Rob Shearman : wpp: Fix expansion of macro bodies following the parsing of a numerical digit.

Alexandre Julliard julliard at winehq.org
Tue Jan 19 11:53:42 CST 2010


Module: wine
Branch: master
Commit: 3fecf9ddcd5dd8ac8d3b48106e8eab7e3e303371
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3fecf9ddcd5dd8ac8d3b48106e8eab7e3e303371

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Mon Jan 18 22:15:09 2010 +0000

wpp: Fix expansion of macro bodies following the parsing of a numerical digit.

The current regular expression causes all letters and spaces (among
other characters) following the appearance of a digit to be classed as
a literal, including C identifiers which may need to be expanded.

The expression was intended to catch the remaining characters that
were not covered by the first two rules ([^a-zA-Z0-9'"#/\\\n]+ and
{cident}), but the [^'"#/\\\n] expression caught {cident} as well.
While one solution would have been just to catch the expression that
match [a-zA-Z0-9]* that don't match {cident}, i.e. [0-9][a-zA-Z0-9]*,
in the interests of avoiding unnecessary multiple LITERALs being
generated and then combined during parsing the expression also
includes the first expression, making it
[0-9][a-zA-Z0-9]*[^a-zA-Z0-9'"#/\\\n]*.

---

 libs/wpp/ppl.l |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index 1ce98fb..06a4f18 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -527,7 +527,7 @@ void pp_writestring(const char *format, ...)
 <pp_mbody>{cident}		ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
 <pp_mbody>\#\#			return tCONCAT;
 <pp_mbody>\#			return tSTRINGIZE;
-<pp_mbody>[0-9][^'"#/\\\n]*	ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
+<pp_mbody>[0-9][a-zA-Z0-9]*[^a-zA-Z0-9'"#/\\\n]*	ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
 <pp_mbody>(\\\r?)|(\/[^/*'"#\\\n]*)	ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
 <pp_mbody>\\\r?\n{ws}+		newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL;
 <pp_mbody>\\\r?\n		newline(0);




More information about the wine-cvs mailing list