Skip to content

Commit

Permalink
count line when escaped identifier is ended by '\n'
Browse files Browse the repository at this point in the history
  • Loading branch information
xtofalex committed Apr 2, 2024
1 parent c6268c2 commit 5c66725
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/VerilogScanner.ll
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ supply1 { return token::SUPPLY1_KW; }
assign { return token::ASSIGN_KW; }

{IDENTIFIER} { yylval->build<std::string>( yytext ); return token::IDENTIFIER_TK; }
{ESCAPED_IDENTIFIER} { yylval->build<std::string>( yytext ); return token::ESCAPED_IDENTIFIER_TK; }
{ESCAPED_IDENTIFIER} {
//if the character ending the escape identifier is '\n'
//we need to update the line number
if (yytext[strlen(yytext)-1] == '\n') {
loc->lines();
}
yylval->build<std::string>( yytext );
return token::ESCAPED_IDENTIFIER_TK;
}
{STRING} { yylval->build<std::string>( yytext ); return token::STRING_TK; }

{UNSIGNED_NUMBER} {
Expand Down

0 comments on commit 5c66725

Please sign in to comment.