This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b8a491565f5 [opt](parser) optimize parser perfermance of
STRING_LITERAL (#53644)
b8a491565f5 is described below
commit b8a491565f5d8fb6d4821dbcf94c69fa9d45470e
Author: morrySnow <[email protected]>
AuthorDate: Tue Jul 22 10:15:42 2025 +0800
[opt](parser) optimize parser perfermance of STRING_LITERAL (#53644)
### What problem does this PR solve?
Related PR: #53449
Problem Summary:
reduce conflict of reduce to speed up string literal parsing
---
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4 | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
index 17d0d5b37f5..8dc3fb75b85 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
@@ -618,10 +618,8 @@ ATSIGN: '@';
DOUBLEATSIGN: '@@';
STRING_LITERAL
- : {!isNoBackslashEscapes}? '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\''
- | {isNoBackslashEscapes}? '\'' ('\'\'' | ~('\''))* '\''
- | {!isNoBackslashEscapes}?'"' ( '\\'. | '""' | ~('"'| '\\'))* '"'
- | {isNoBackslashEscapes}?'"' ('""' | ~('"'))* '"'
+ : '\'' ( {!isNoBackslashEscapes}? '\\'. | '\'\'' |
{!isNoBackslashEscapes}? ~('\'' | '\\') | {isNoBackslashEscapes}? ~('\''))* '\''
+ | '"' ( {!isNoBackslashEscapes}? '\\'. | '""' | {!isNoBackslashEscapes}?
~('"'| '\\') | {isNoBackslashEscapes}? ~('"'))* '"'
;
LEADING_STRING
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]