Skip to content

Commit

Permalink
merge UTF-LABEL to LABEL
Browse files Browse the repository at this point in the history
  • Loading branch information
heroicNeZha committed Dec 9, 2021
1 parent 20229b7 commit 2733bc4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static constexpr size_t kCommentLengthLimit = 256;
%token <boolval> BOOL
%token <intval> INTEGER
%token <doubleval> DOUBLE
%token <strval> STRING VARIABLE LABEL IPV4 UTF8_LABEL
%token <strval> STRING VARIABLE LABEL IPV4

%type <strval> name_label unreserved_keyword predicate_name
%type <expr> expression
Expand Down Expand Up @@ -406,7 +406,6 @@ static constexpr size_t kCommentLengthLimit = 256;

name_label
: LABEL { $$ = $1; }
| UTF8_LABEL { $$ = $1; }
| unreserved_keyword { $$ = $1; }
;

Expand Down
14 changes: 1 addition & 13 deletions src/parser/scanner.lex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ IS_NOT_NULL (IS{blanks}NOT{blanks}NULL)
IS_EMPTY (IS{blanks}EMPTY)
IS_NOT_EMPTY (IS{blanks}NOT{blanks}EMPTY)

LABEL ([a-zA-Z][_a-zA-Z0-9]*)
DEC ([0-9])
EXP ([eE][-+]?[0-9]+)
HEX ([0-9a-fA-F])
Expand All @@ -50,7 +49,7 @@ U4 [\xf0-\xf4]
CHINESE {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
CN_EN {CHINESE}|[a-zA-Z]
CN_EN_NUM {CHINESE}|[_a-zA-Z0-9]
UTF8_LABEL {CN_EN}{CN_EN_NUM}+
LABEL {CN_EN}{CN_EN_NUM}*

%%

Expand Down Expand Up @@ -474,17 +473,6 @@ UTF8_LABEL {CN_EN}{CN_EN_NUM}+
// Must match /* */
throw GraphParser::syntax_error(*yylloc, "unterminated comment");
}
\`{UTF8_LABEL}\` {
yylval->strval = new std::string(yytext + 1, yyleng - 2);
if (yylval->strval->size() > MAX_STRING) {
auto error = "Out of range of the LABEL length, "
"the max length of LABEL is " +
std::to_string(MAX_STRING) + ":";
delete yylval->strval;
throw GraphParser::syntax_error(*yylloc, error);
}
return TokenType::UTF8_LABEL;
}
. {
/**
* Any other unmatched byte sequences will get us here,
Expand Down

0 comments on commit 2733bc4

Please sign in to comment.