Macros can be expanded in quoted strings.
This commit is contained in:
parent
a45803f00f
commit
d188e5cd2e
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: lexor.lex,v 1.37 2003/02/02 23:54:35 steve Exp $"
|
#ident "$Id: lexor.lex,v 1.38 2003/02/03 00:28:12 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -116,20 +116,25 @@ W [ \t\b\f]+
|
||||||
<CCOMMENT>"*/" { BEGIN(comment_enter); ECHO; }
|
<CCOMMENT>"*/" { BEGIN(comment_enter); ECHO; }
|
||||||
|
|
||||||
/* Detect and pass multiline pragma comments. As with C-style
|
/* Detect and pass multiline pragma comments. As with C-style
|
||||||
comments, pragma comments are passed through, and CPP directives
|
comments, pragma comments are passed through, and preprocessor
|
||||||
contained within are ignored. */
|
directives contained within are ignored. Contains macros are
|
||||||
|
expanded, however. */
|
||||||
|
|
||||||
"(*" { comment_enter = YY_START; BEGIN(PCOMENT); ECHO; }
|
"(*" { comment_enter = YY_START; BEGIN(PCOMENT); ECHO; }
|
||||||
<PCOMENT>. { ECHO; }
|
<PCOMENT>. { ECHO; }
|
||||||
<PCOMENT>\n { istack->lineno += 1; ECHO; }
|
<PCOMENT>\n { istack->lineno += 1; ECHO; }
|
||||||
<PCOMENT>"*)" { BEGIN(comment_enter); ECHO; }
|
<PCOMENT>"*)" { BEGIN(comment_enter); ECHO; }
|
||||||
|
<PCOMENT>`[a-zA-Z][a-zA-Z0-9_$]* { def_match(); }
|
||||||
|
|
||||||
/* Strings do not contain macros or preprocessor directives. */
|
/* Strings do not contain preprocessor directives, but can expand
|
||||||
|
macros. If that happens, they get expanded in the context of the
|
||||||
|
string. */
|
||||||
\" { comment_enter = YY_START; BEGIN(CSTRING); ECHO; }
|
\" { comment_enter = YY_START; BEGIN(CSTRING); ECHO; }
|
||||||
<CSTRING>\\\" { yymore(); }
|
<CSTRING>\\\" { ECHO; }
|
||||||
<CSTRING>\n { yymore(); }
|
<CSTRING>\n { ECHO; }
|
||||||
<CSTRING>\" { BEGIN(comment_enter); ECHO; }
|
<CSTRING>\" { BEGIN(comment_enter); ECHO; }
|
||||||
<CSTRING>. { yymore(); }
|
<CSTRING>. { ECHO; }
|
||||||
|
<CSTRING>`[a-zA-Z][a-zA-Z0-9_$]* { def_match(); }
|
||||||
|
|
||||||
/* This set of patterns matches the include directive and the name
|
/* This set of patterns matches the include directive and the name
|
||||||
that follows it. when the directive ends, the do_include function
|
that follows it. when the directive ends, the do_include function
|
||||||
|
|
@ -306,7 +311,6 @@ static int is_defined(const char*name)
|
||||||
static void def_match()
|
static void def_match()
|
||||||
{
|
{
|
||||||
struct define_t*cur = def_lookup(yytext+1);
|
struct define_t*cur = def_lookup(yytext+1);
|
||||||
|
|
||||||
if (cur) {
|
if (cur) {
|
||||||
struct include_stack_t*isp;
|
struct include_stack_t*isp;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue