Skip to content

Commit

Permalink
Add lexer of array predicate
Browse files Browse the repository at this point in the history
Signed-off-by: Kunlin Yu <[email protected]>
  • Loading branch information
kunlinyu committed Dec 31, 2024
1 parent ae1252f commit 4a1804e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/cql2_lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ IN {
return Cql2ParserBase::token::ID;
}

A_EQUALS|A_CONTAINS|A_CONTAINEDBY|A_OVERLAPS {
print("ARRAY", yytext);
yylval_->emplace<std::string>(yytext);
return Cql2ParserBase::token::arrayFunction;
}

"+" { print("OP", yytext); return Cql2ParserBase::token::PLUS; }
"-" { print("OP", yytext); return Cql2ParserBase::token::MINUS;}
"*" { print("OP", yytext); return Cql2ParserBase::token::MULT; }
Expand Down
2 changes: 1 addition & 1 deletion src/cql2_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ arrayElement:
| numericLiteral
// | temporalInstance
| spatialInstance
| array // shift/reduce conflict
// | array // shift/reduce conflict
// | arithmeticExpression
| booleanExpression
| propertyName
Expand Down
1 change: 1 addition & 0 deletions test/indoorjson/array.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A_CONTAINS(array_field, ('value_1', 'value_2'))
1 change: 1 addition & 0 deletions test/test_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ TEST_F(ParseTest, binary ) { EXPECT_TRUE(Parse(case_name_)); }
TEST_F(ParseTest, is_in_list ) { EXPECT_TRUE(Parse(case_name_)); }
TEST_F(ParseTest, is_not_in_list) { EXPECT_TRUE(Parse(case_name_)); }
TEST_F(ParseTest, localization ) { EXPECT_TRUE(Parse(case_name_)); }
TEST_F(ParseTest, array ) { EXPECT_TRUE(Parse(case_name_)); }
// TEST_F(ParseTest, binlocations ) { EXPECT_TRUE(Parse(case_name_)); } // function
// TEST_F(ParseTest, labels ) { EXPECT_TRUE(Parse(case_name_)); }
// clang-format on

0 comments on commit 4a1804e

Please sign in to comment.