diff --git a/grammar.js b/grammar.js index 1a02de8..95602f4 100644 --- a/grammar.js +++ b/grammar.js @@ -336,10 +336,9 @@ module.exports = grammar({ ), constraint_when: ($) => - choice( + seq( kw("deferrable"), - seq(kw("deferrable"), kw("initially"), kw("immediate")), - seq(kw("deferrable"), kw("initially"), kw("deferred")) + optional(seq(kw("initially"), choice(kw("immediate"), kw("deferred")))) ), table_constraint_ty: ($) => diff --git a/src/grammar.json b/src/grammar.json index 97935e4..05a74a3 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -2186,43 +2186,39 @@ ] }, "constraint_when": { - "type": "CHOICE", + "type": "SEQ", "members": [ { "type": "PATTERN", "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" }, { - "type": "SEQ", + "type": "CHOICE", "members": [ { - "type": "PATTERN", - "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" + "type": "SEQ", + "members": [ + { + "type": "PATTERN", + "value": "[iI][nN][iI][tT][iI][aA][lL][lL][yY]" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "PATTERN", + "value": "[iI][mM][mM][eE][dD][iI][aA][tT][eE]" + }, + { + "type": "PATTERN", + "value": "[dD][eE][fF][eE][rR][rR][eE][dD]" + } + ] + } + ] }, { - "type": "PATTERN", - "value": "[iI][nN][iI][tT][iI][aA][lL][lL][yY]" - }, - { - "type": "PATTERN", - "value": "[iI][mM][mM][eE][dD][iI][aA][tT][eE]" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "PATTERN", - "value": "[dD][eE][fF][eE][rR][rR][aA][bB][lL][eE]" - }, - { - "type": "PATTERN", - "value": "[iI][nN][iI][tT][iI][aA][lL][lL][yY]" - }, - { - "type": "PATTERN", - "value": "[dD][eE][fF][eE][rR][rR][eE][dD]" + "type": "BLANK" } ] }