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

View file

@ -74,7 +74,7 @@ DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
FORMAT [ubcdgiswx]
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"]+\"
%s FORMAT_EXPECTED
@ -98,6 +98,11 @@ STRING \"[^\n"]+\"
<*>\n { BEGIN(INITIAL); syntax_error = 0; return tEOL; }
/* 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_LAND; }
"==" { return OP_EQ; }
@ -205,8 +210,6 @@ all { return tALL; }
{IDENTIFIER} { yylval.string = lexeme_alloc(yytext); return tIDENTIFIER; }
"$"{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 */
<NOPROCESS>. { BEGIN(ASTRING_EXPECTED); yyless(0); return tNOPROCESS;}