Skip to content

Commit

Permalink
Sanitize escape char in Transformer::transformSymbolicName
Browse files Browse the repository at this point in the history
Escaped symbol name from parser will be of
form "`Some.Value`". Therefore, we need to sanitize
it such that we don't store the symbol with
escape character.
  • Loading branch information
gaurav8297 committed Jun 7, 2023
1 parent e733a17 commit eeaef34
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser/transformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,10 @@ std::string Transformer::transformSymbolicName(CypherParser::OC_SymbolicNameCont
if (ctx.UnescapedSymbolicName()) {
return ctx.UnescapedSymbolicName()->getText();
} else if (ctx.EscapedSymbolicName()) {
return ctx.EscapedSymbolicName()->getText();
std::string escapedSymbolName = ctx.EscapedSymbolicName()->getText();

Check warning on line 917 in src/parser/transformer.cpp

View check run for this annotation

Codecov / codecov/patch

src/parser/transformer.cpp#L917

Added line #L917 was not covered by tests
// escapedSymbolName symbol will be of form "`Some.Value`". Therefore, we need to sanitize
// it such that we don't store the symbol with escape character.
return escapedSymbolName.substr(1, escapedSymbolName.size() - 2);

Check warning on line 920 in src/parser/transformer.cpp

View check run for this annotation

Codecov / codecov/patch

src/parser/transformer.cpp#L920

Added line #L920 was not covered by tests
} else {
assert(ctx.HexLetter());
return ctx.HexLetter()->getText();
Expand Down

0 comments on commit eeaef34

Please sign in to comment.