winedbg pathname lexing fix.

C. Scott Ananian cscott at cscott.net
Sun Mar 13 08:49:44 CST 2005


Changelog:
  - debug.l: 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.
  - debug.l: add '-' to the set of characters legal in a pathname.
  - dbg.y: add tSTRING to the pathname production, so that you can quote a
    pathname which contains 'odd' characters.

This makes the following statements work:
    dir /
    dir .
    dir wine-0.0.20050211
    dir "/home/cananian/!#%^/wine-cvs"

which previously gave a terse (and confusing) 'syntax error' message.
  --scott
                          ( http://cscott.net/ )

Index: programs/winedbg/dbg.y
===================================================================
RCS file: /home/wine/wine/programs/winedbg/dbg.y,v
retrieving revision 1.22
diff -u -p -r1.22 dbg.y
--- programs/winedbg/dbg.y	3 Mar 2005 14:10:17 -0000	1.22
+++ programs/winedbg/dbg.y	13 Mar 2005 14:30:51 -0000
@@ -154,6 +154,7 @@ command:

  pathname:
        identifier                { $$ = $1; }
+    | tSTRING                   { $$ = $1; }
      | tPATH                     { $$ = $1; }
      ;

Index: programs/winedbg/debug.l
===================================================================
RCS file: /home/wine/wine/programs/winedbg/debug.l,v
retrieving revision 1.11
diff -u -p -r1.11 debug.l
--- programs/winedbg/debug.l	31 Jan 2005 11:34:59 -0000	1.11
+++ programs/winedbg/debug.l	13 Mar 2005 14:30:51 -0000
@@ -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; }
@@ -204,8 +209,6 @@ all

  {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 */




More information about the wine-patches mailing list