Skip to content

Commit 2567575

Browse files
committed
Intermediate changes
commit_hash:6768768ea3a3962231d3fabdffb2ce0db44e9347
1 parent 2ec9241 commit 2567575

File tree

9 files changed

+38
-14
lines changed

9 files changed

+38
-14
lines changed

yql/essentials/parser/common/ya.make

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ SRCS(
99
)
1010

1111
END()
12+
13+
RECURSE(
14+
antlr4
15+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
LIBRARY()
22

33
END()
4+
5+
RECURSE(
6+
fallback
7+
static
8+
)

yql/essentials/sql/v1/complete/ya.make

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ PEERDIR(
2020

2121
END()
2222

23+
RECURSE(
24+
antlr4
25+
name
26+
syntax
27+
text
28+
)
29+
2330
RECURSE_FOR_TESTS(
2431
ut
2532
)

yql/essentials/sql/v1/lexer/regex/lexer_ut.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ Y_UNIT_TEST_SUITE(RegexLexerTests) {
197197

198198
TString expected =
199199
"SELECT WS(\n) "
200-
"WS( ) WS( ) INTEGER_VALUE(123467) COMMA(,) WS(\n) "
200+
"WS( ) WS( ) DIGITS(123467) COMMA(,) WS(\n) "
201201
"WS( ) WS( ) STRING_VALUE(\"Hello, {name}!\") COMMA(,) WS(\n) "
202-
"WS( ) WS( ) LPAREN(() INTEGER_VALUE(1) WS( ) PLUS(+) WS( ) LPAREN(() INTEGER_VALUE(5) WS( ) "
203-
"ASTERISK(*) WS( ) INTEGER_VALUE(1) WS( ) SLASH(/) WS( ) INTEGER_VALUE(0) RPAREN()) "
202+
"WS( ) WS( ) LPAREN(() DIGITS(1) WS( ) PLUS(+) WS( ) LPAREN(() DIGITS(5) WS( ) "
203+
"ASTERISK(*) WS( ) DIGITS(1) WS( ) SLASH(/) WS( ) DIGITS(0) RPAREN()) "
204204
"RPAREN()) COMMA(,) WS(\n) "
205205
"WS( ) WS( ) ID_PLAIN(MIN) LPAREN(() ID_PLAIN(identifier) RPAREN()) COMMA(,) WS(\n) "
206206
"WS( ) WS( ) ID_PLAIN(Bool) LPAREN(() ID_PLAIN(field) RPAREN()) COMMA(,) WS(\n) "
@@ -216,4 +216,4 @@ Y_UNIT_TEST_SUITE(RegexLexerTests) {
216216
Check("\" SELECT", "[INVALID] WS( ) SELECT EOF");
217217
}
218218

219-
} // Y_UNIT_TEST_SUITE(RegexLexerTests)
219+
} // Y_UNIT_TEST_SUITE(RegexLexerTests)

yql/essentials/sql/v1/lexer/regex/regex_ut.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ using namespace NSQLTranslationV1;
88

99
namespace {
1010
auto grammar = NSQLReflect::LoadLexerGrammar();
11-
auto defaultRegexes = MakeRegexByOtherNameMap(grammar, /* ansi = */ false);
12-
auto ansiRegexes = MakeRegexByOtherNameMap(grammar, /* ansi = */ true);
11+
auto defaultRegexes = MakeRegexByOtherName(grammar, /* ansi = */ false);
12+
auto ansiRegexes = MakeRegexByOtherName(grammar, /* ansi = */ true);
13+
14+
TString Get(const TVector<std::tuple<TString, TString>>& regexes, const TStringBuf name) {
15+
return std::get<1>(*FindIf(regexes, [&](const auto& pair) {
16+
return std::get<0>(pair) == name;
17+
}));
18+
}
1319

1420
void CheckRegex(bool ansi, const TStringBuf name, const TStringBuf expected) {
1521
const auto& regexes = ansi ? ansiRegexes : defaultRegexes;
16-
const TString regex = regexes.at(name);
22+
const TString regex = Get(regexes, name);
1723

1824
const RE2 re2(regex);
1925
Y_ENSURE(re2.ok(), re2.error());
@@ -83,8 +89,8 @@ Y_UNIT_TEST_SUITE(SqlRegexTests) {
8389
Y_UNIT_TEST(AnsiCommentSameAsDefault) {
8490
// Because of recursive definition
8591
UNIT_ASSERT_VALUES_EQUAL(
86-
ansiRegexes.at("COMMENT"),
87-
defaultRegexes.at("COMMENT"));
92+
Get(ansiRegexes, "COMMENT"),
93+
Get(defaultRegexes, "COMMENT"));
8894
}
8995

90-
} // Y_UNIT_TEST_SUITE(SqlRegexTests)
96+
} // Y_UNIT_TEST_SUITE(SqlRegexTests)

yql/essentials/sql/v1/lexer/regex/ut/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ SRCS(
1010
regex_ut.cpp
1111
)
1212

13-
END()
13+
END()

yql/essentials/sql/v1/lexer/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ RECURSE(
2222
antlr4_ansi
2323
antlr4_pure
2424
antlr4_pure_ansi
25+
regex
2526
)
2627

2728
RECURSE_FOR_TESTS(

yql/essentials/sql/v1/reflect/sql_reflect_ut.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Y_UNIT_TEST_SUITE(SqlReflectTests) {
2828
}
2929

3030
Y_UNIT_TEST(Other) {
31-
UNIT_ASSERT_VALUES_EQUAL(grammar.OtherNames.contains("REAL"), true);
32-
UNIT_ASSERT_VALUES_EQUAL(grammar.OtherNames.contains("STRING_VALUE"), true);
33-
UNIT_ASSERT_VALUES_EQUAL(grammar.OtherNames.contains("STRING_MULTILINE"), false);
31+
UNIT_ASSERT_VALUES_EQUAL(Count(grammar.OtherNames, "REAL"), 1);
32+
UNIT_ASSERT_VALUES_EQUAL(Count(grammar.OtherNames, "STRING_VALUE"), 1);
33+
UNIT_ASSERT_VALUES_EQUAL(Count(grammar.OtherNames, "STRING_MULTILINE"), 0);
3434

3535
UNIT_ASSERT_VALUES_EQUAL(
3636
grammar.BlockByName.at("FLOAT_EXP"),

yql/essentials/sql/v1/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RECURSE(
6161
lexer
6262
perf
6363
proto_parser
64+
reflect
6465
)
6566

6667
RECURSE_FOR_TESTS(

0 commit comments

Comments
 (0)