From 61a2e527fc996199e1b6d14f9ed20ff179474a21 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 8 Dec 2021 14:44:51 +0100 Subject: [PATCH] winedbg: Move C++ identifier detection to the lexer. Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- 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 expr lvalue %type expr_lvalue lvalue_addr %type expr_rvalue -%type pathname identifier cpp_identifier +%type pathname identifier %type list_arg %type type_expr %type 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; } {PATHNAME} { dbg_lval.string = lexeme_alloc(yytext); return tPATH; }