Skip to content

Commit

Permalink
feat(grammar): Support COVERAGE pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
felipebz committed Sep 18, 2024
1 parent 7149f96 commit 4161080
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
9,
13
],
"lnpls/COVERAGE-pragma-3.sql" : [
15,
17
],
"lnpls/DEPRECATE-pragma-27.sql" : [
12
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@
"lnpls/COVERAGE-pragma-1.sql" : [
2
],
"lnpls/COVERAGE-pragma-3.sql" : [
10
],
"lnpls/CREATE-FUNCTION-statement-0.sql" : [
2
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ enum class PlSqlGrammar : GrammarRuleKey {
UDF_PRAGMA,
DEPRECATE_PRAGMA,
SUPPRESSES_WARNING_6009_PRAGMA,
COVERAGE_PRAGMA,
PRAGMA_DECLARATION,
HOST_AND_INDICATOR_VARIABLE,
JAVA_DECLARATION,
Expand Down Expand Up @@ -682,7 +683,8 @@ enum class PlSqlGrammar : GrammarRuleKey {
CASE_STATEMENT,
SET_TRANSACTION_STATEMENT,
MERGE_STATEMENT,
INLINE_PRAGMA_STATEMENT))
INLINE_PRAGMA_STATEMENT,
COVERAGE_PRAGMA))

b.rule(STATEMENTS, Statements::class).define(b.oneOrMore(STATEMENT))
}
Expand Down Expand Up @@ -1014,6 +1016,9 @@ enum class PlSqlGrammar : GrammarRuleKey {
b.rule(SUPPRESSES_WARNING_6009_PRAGMA)
.define(PRAGMA, SUPPRESSES_WARNING_6009, LPARENTHESIS, IDENTIFIER_NAME, RPARENTHESIS)

b.rule(COVERAGE_PRAGMA)
.define(PRAGMA, COVERAGE, LPARENTHESIS, STRING_LITERAL, RPARENTHESIS, SEMICOLON)

b.rule(PRAGMA_DECLARATION).define(
b.firstOf(
EXCEPTION_INIT_PRAGMA,
Expand All @@ -1023,7 +1028,8 @@ enum class PlSqlGrammar : GrammarRuleKey {
RESTRICT_REFERENCES_PRAGMA,
UDF_PRAGMA,
b.sequence(DEPRECATE_PRAGMA, SEMICOLON),
b.sequence(SUPPRESSES_WARNING_6009_PRAGMA, SEMICOLON)
b.sequence(SUPPRESSES_WARNING_6009_PRAGMA, SEMICOLON),
COVERAGE_PRAGMA
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ enum class PlSqlKeyword(override val value: String, val isReserved: Boolean = fa
CONVERSION("conversion"),
COPY("copy"),
COUNT("count"),
COVERAGE("coverage"),
CRASH("crash"),
CROSS("cross"),
CROSSEDITION("crossedition"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class PragmaDeclarationTest : RuleTest() {
}

@Test
fun matchesSuppressWarning6009Pragma() {
assertThat(p).matches("pragma suppresses_warning_6009(pcd);")
fun matchesCoveragePragma() {
assertThat(p).matches("pragma coverage('NOT_FEASIBLE_START');")
}

}

0 comments on commit 4161080

Please sign in to comment.