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

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-12-08 14:44:51 +01:00 committed by Alexandre Julliard
parent 05c5a12f87
commit 61a2e527fc
2 changed files with 6 additions and 12 deletions

View File

@ -77,13 +77,13 @@ static void parser(const char*);
%left '+' '-'
%left '*' '/' '%'
%left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */
%left '.' '[' OP_DRF OP_SCOPE
%left '.' '[' OP_DRF
%nonassoc ':'
%type <expression> expr lvalue
%type <lvalue> expr_lvalue lvalue_addr
%type <integer> expr_rvalue
%type <string> pathname identifier cpp_identifier
%type <string> pathname identifier
%type <listing> list_arg
%type <type> type_expr
%type <strings> list_of_words
@ -162,15 +162,9 @@ pathname:
| 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:
cpp_identifier { $$ = $1; }
| tIDENTIFIER '!' cpp_identifier { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1);
tIDENTIFIER { $$ = $1; }
| tIDENTIFIER '!' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1);
sprintf($$, "%s!%s", $1, $3); }
;

View File

@ -99,6 +99,7 @@ DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
FORMAT [ubcdgiswxa]
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\.~@]*
STRING \"(\\[^\n]|[^\\"\n])*\"
@ -135,7 +136,6 @@ STRING \"(\\[^\n]|[^\\"\n])*\"
"<<" { return OP_SHL; }
">>" { return OP_SHR; }
"->" { return OP_DRF; }
"::" { return OP_SCOPE; }
"[" { return *yytext; }
"]" { return *yytext; }
@ -243,7 +243,7 @@ union { return tUNION; }
enum { return tENUM; }
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; }
<PATH_EXPECTED,PATH_ACCEPTED>{PATHNAME} { dbg_lval.string = lexeme_alloc(yytext); return tPATH; }