From 138ff5e7fd220688f10cf93c5657fbf7487cc4cc Mon Sep 17 00:00:00 2001 From: Felipe Zorzo Date: Fri, 14 Jun 2024 22:38:16 -0300 Subject: [PATCH] fix(grammar): Support the usage of the keyword AS in table aliases --- .../main/kotlin/org/sonar/plugins/plsqlopen/api/DmlGrammar.kt | 1 + .../plugins/plsqlopen/api/sql/DmlTableExpressionClauseTest.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/DmlGrammar.kt b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/DmlGrammar.kt index e44335d1..44059b6f 100644 --- a/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/DmlGrammar.kt +++ b/zpa-core/src/main/kotlin/org/sonar/plugins/plsqlopen/api/DmlGrammar.kt @@ -185,6 +185,7 @@ enum class DmlGrammar : GrammarRuleKey { OBJECT_REFERENCE ), b.optional(b.nextNot(b.firstOf(PARTITION, CROSS, USING, FULL, NATURAL, INNER, LEFT, RIGHT, OUTER, JOIN, RETURN, RETURNING, LOG, EXCEPT)), + b.optional(AS), ALIAS ) ), diff --git a/zpa-core/src/test/kotlin/org/sonar/plugins/plsqlopen/api/sql/DmlTableExpressionClauseTest.kt b/zpa-core/src/test/kotlin/org/sonar/plugins/plsqlopen/api/sql/DmlTableExpressionClauseTest.kt index a510c367..f86f95c4 100644 --- a/zpa-core/src/test/kotlin/org/sonar/plugins/plsqlopen/api/sql/DmlTableExpressionClauseTest.kt +++ b/zpa-core/src/test/kotlin/org/sonar/plugins/plsqlopen/api/sql/DmlTableExpressionClauseTest.kt @@ -51,6 +51,7 @@ class DmlTableExpressionClauseTest : RuleTest() { @Test fun matchesTableWithAlias() { assertThat(p).matches("tab alias") + assertThat(p).matches("tab as alias") } @Test