[PATCH 12/19] programs/winedbg: move C++ identifier detection in the lexer
Eric Pouech
eric.pouech at gmail.com
Wed Dec 8 07:44:51 CST 2021
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
---
programs/winedbg/dbg.y | 14 ++++----------
programs/winedbg/debug.l | 4 ++--
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y
index 46a643bfb47..79877b2c644 100644
--- a/programs/winedbg/dbg.y
+++ b/programs/winedbg/dbg.y
@@ -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); }
;
diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l
index 5c87f05abe5..a587a13fb70 100644
--- a/programs/winedbg/debug.l
+++ b/programs/winedbg/debug.l
@@ -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; }
More information about the wine-devel
mailing list