Skip to content

Commit

Permalink
feat(grammar): Accept "?" as a binding expression
Browse files Browse the repository at this point in the history
  • Loading branch information
felipebz committed Jun 19, 2024
1 parent 4e7970d commit 2f72915
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
2,
3
],
"examples/union07.sql" : [
23,
37
],
"examples/union09.sql" : [
13,
19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,6 @@
"examples/unified.sql" : [
1
],
"examples/union07.sql" : [
24
],
"examples/validate_conversion.sql" : [
3
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@
24,
28
],
"examples/union07.sql" : [
5,
6,
8,
11
],
"examples/union08.sql" : [
1
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
"examples/select_all_some_any.sql" : [
6
],
"examples/union07.sql" : [
36,
21
],
"examples/xmltable03.sql" : [
6
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,17 @@ enum class PlSqlGrammar : GrammarRuleKey {
}

private fun createStatements(b: PlSqlGrammarBuilder) {
b.rule(HOST_AND_INDICATOR_VARIABLE).define(COLON, b.firstOf(
b.sequence(IDENTIFIER_NAME, b.optional(INDICATOR), b.optional(COLON, IDENTIFIER_NAME)),
INTEGER_LITERAL))
b.rule(HOST_AND_INDICATOR_VARIABLE).define(
b.firstOf(
b.sequence(
COLON, b.firstOf(
b.sequence(IDENTIFIER_NAME, b.optional(INDICATOR), b.optional(COLON, IDENTIFIER_NAME)),
INTEGER_LITERAL
)
),
QUESTION_MARK
)
)

b.rule(NULL_STATEMENT, NullStatement::class).define(NULL, SEMICOLON)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ enum class PlSqlPunctuator(override val value: String) : TokenType {
TILDE("~"),
CARET("^"),
LBRACKET("["),
RBRACKET("]"),;
RBRACKET("]"),
QUESTION_MARK("?");

override fun hasToBeSkippedFromAst(node: AstNode?) = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ class HostAndIndicatorVariableTest : RuleTest() {
assertThat(p).matches(":var indicator :ind")
}

@Test
fun matchesQuestionMarkBinding() {
assertThat(p).matches("?")
}

}

0 comments on commit 2f72915

Please sign in to comment.