Commit 61a2e527 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Move C++ identifier detection to the lexer.

parent 05c5a12f
...@@ -77,13 +77,13 @@ static void parser(const char*); ...@@ -77,13 +77,13 @@ static void parser(const char*);
%left '+' '-' %left '+' '-'
%left '*' '/' '%' %left '*' '/' '%'
%left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */ %left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */
%left '.' '[' OP_DRF OP_SCOPE %left '.' '[' OP_DRF
%nonassoc ':' %nonassoc ':'
%type <expression> expr lvalue %type <expression> expr lvalue
%type <lvalue> expr_lvalue lvalue_addr %type <lvalue> expr_lvalue lvalue_addr
%type <integer> expr_rvalue %type <integer> expr_rvalue
%type <string> pathname identifier cpp_identifier %type <string> pathname identifier
%type <listing> list_arg %type <listing> list_arg
%type <type> type_expr %type <type> type_expr
%type <strings> list_of_words %type <strings> list_of_words
...@@ -162,15 +162,9 @@ pathname: ...@@ -162,15 +162,9 @@ pathname:
| tPATH { $$ = $1; } | tPATH { $$ = $1; }
; ;
cpp_identifier:
tIDENTIFIER { $$ = $1; }
| identifier OP_SCOPE tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 2 + strlen($3) + 1);
sprintf($$, "%s::%s", $1, $3); }
;
identifier: identifier:
cpp_identifier { $$ = $1; } tIDENTIFIER { $$ = $1; }
| tIDENTIFIER '!' cpp_identifier { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1); | tIDENTIFIER '!' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1);
sprintf($$, "%s!%s", $1, $3); } sprintf($$, "%s!%s", $1, $3); }
; ;
......
...@@ -99,6 +99,7 @@ DIGIT [0-9] ...@@ -99,6 +99,7 @@ DIGIT [0-9]
HEXDIGIT [0-9a-fA-F] HEXDIGIT [0-9a-fA-F]
FORMAT [ubcdgiswxa] FORMAT [ubcdgiswxa]
IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]* IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]*
SCOPED_IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]*"::"
PATHNAME [\\/_a-zA-Z0-9\.~@][\\/\-_a-zA-Z0-9\.~@]* PATHNAME [\\/_a-zA-Z0-9\.~@][\\/\-_a-zA-Z0-9\.~@]*
STRING \"(\\[^\n]|[^\\"\n])*\" STRING \"(\\[^\n]|[^\\"\n])*\"
...@@ -135,7 +136,6 @@ STRING \"(\\[^\n]|[^\\"\n])*\" ...@@ -135,7 +136,6 @@ STRING \"(\\[^\n]|[^\\"\n])*\"
"<<" { return OP_SHL; } "<<" { return OP_SHL; }
">>" { return OP_SHR; } ">>" { return OP_SHR; }
"->" { return OP_DRF; } "->" { return OP_DRF; }
"::" { return OP_SCOPE; }
"[" { return *yytext; } "[" { return *yytext; }
"]" { return *yytext; } "]" { return *yytext; }
...@@ -243,7 +243,7 @@ union { return tUNION; } ...@@ -243,7 +243,7 @@ union { return tUNION; }
enum { return tENUM; } enum { return tENUM; }
all { return tALL; } all { return tALL; }
{IDENTIFIER} { dbg_lval.string = lexeme_alloc(yytext); return tIDENTIFIER; } {SCOPED_IDENTIFIER}*{IDENTIFIER} { dbg_lval.string = lexeme_alloc(yytext); return tIDENTIFIER; }
"$"{IDENTIFIER} { dbg_lval.string = lexeme_alloc(yytext+1); return tINTVAR; } "$"{IDENTIFIER} { dbg_lval.string = lexeme_alloc(yytext+1); return tINTVAR; }
<PATH_EXPECTED,PATH_ACCEPTED>{PATHNAME} { dbg_lval.string = lexeme_alloc(yytext); return tPATH; } <PATH_EXPECTED,PATH_ACCEPTED>{PATHNAME} { dbg_lval.string = lexeme_alloc(yytext); return tPATH; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment