Move definition of 'tPATH' token up, so that '/', '.' and '0xA' (etc)

are lexed as paths (in the appropriate contexts) instead of as
operator or number tokens.
Add '-' to the set of characters legal in a pathname.
This commit is contained in:
C. Scott Ananian 2005-03-14 10:48:08 +00:00 committed by Alexandre Julliard
parent 940d857547
commit 28c2b5494f
1 changed files with 6 additions and 3 deletions

View File

@ -74,7 +74,7 @@ DIGIT [0-9]
HEXDIGIT [0-9a-fA-F] HEXDIGIT [0-9a-fA-F]
FORMAT [ubcdgiswx] FORMAT [ubcdgiswx]
IDENTIFIER [_a-zA-Z~][_a-zA-Z0-9~@]* IDENTIFIER [_a-zA-Z~][_a-zA-Z0-9~@]*
PATHNAME [/_a-zA-Z\.~][/_a-zA-Z0-9\.~@]* PATHNAME [-/_a-zA-Z\.~][-/_a-zA-Z0-9\.~@]*
STRING \"[^\n"]+\" STRING \"[^\n"]+\"
%s FORMAT_EXPECTED %s FORMAT_EXPECTED
@ -98,6 +98,11 @@ STRING \"[^\n"]+\"
<*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; } <*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; }
/* Indicates end of command. Reset state. */ /* Indicates end of command. Reset state. */
/* This rule must precede the ones below, */
/* otherwise paths like '/' or '0x9' would */
/* get parsed as an operator or tNUM */
<PATH_EXPECTED>{PATHNAME} { yylval.string = lexeme_alloc(yytext); return tPATH; }
"||" { return OP_LOR; } "||" { return OP_LOR; }
"&&" { return OP_LAND; } "&&" { return OP_LAND; }
"==" { return OP_EQ; } "==" { return OP_EQ; }
@ -205,8 +210,6 @@ all { return tALL; }
{IDENTIFIER} { yylval.string = lexeme_alloc(yytext); return tIDENTIFIER; } {IDENTIFIER} { yylval.string = lexeme_alloc(yytext); return tIDENTIFIER; }
"$"{IDENTIFIER} { yylval.string = lexeme_alloc(yytext+1); return tINTVAR; } "$"{IDENTIFIER} { yylval.string = lexeme_alloc(yytext+1); return tINTVAR; }
<PATH_EXPECTED>{PATHNAME} { yylval.string = lexeme_alloc(yytext); return tPATH; }
<*>[ \t\r]+ /* Eat up whitespace and DOS LF */ <*>[ \t\r]+ /* Eat up whitespace and DOS LF */
<NOPROCESS>. { BEGIN(ASTRING_EXPECTED); yyless(0); return tNOPROCESS;} <NOPROCESS>. { BEGIN(ASTRING_EXPECTED); yyless(0); return tNOPROCESS;}