diff options
Diffstat (limited to 'core/vm/sqlvm/parser/grammar.go')
-rw-r--r-- | core/vm/sqlvm/parser/grammar.go | 7514 |
1 files changed, 7514 insertions, 0 deletions
diff --git a/core/vm/sqlvm/parser/grammar.go b/core/vm/sqlvm/parser/grammar.go new file mode 100644 index 000000000..7dae2c977 --- /dev/null +++ b/core/vm/sqlvm/parser/grammar.go @@ -0,0 +1,7514 @@ +// Code generated by pigeon; DO NOT EDIT. + +package parser + +import ( + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "math" + "os" + "sort" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/dexon-foundation/dexon/core/vm/sqlvm/ast" +) + +var g = &grammar{ + rules: []*rule{ + { + name: "S", + pos: position{line: 5, col: 1, offset: 20}, + expr: &actionExpr{ + pos: position{line: 6, col: 5, offset: 26}, + run: (*parser).callonS1, + expr: &seqExpr{ + pos: position{line: 6, col: 5, offset: 26}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 6, col: 5, offset: 26}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 6, col: 7, offset: 28}, + label: "x", + expr: &zeroOrOneExpr{ + pos: position{line: 6, col: 9, offset: 30}, + expr: &ruleRefExpr{ + pos: position{line: 6, col: 9, offset: 30}, + name: "Stmt", + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 6, col: 15, offset: 36}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 6, col: 17, offset: 38}, + label: "xs", + expr: &zeroOrMoreExpr{ + pos: position{line: 6, col: 20, offset: 41}, + expr: &actionExpr{ + pos: position{line: 6, col: 22, offset: 43}, + run: (*parser).callonS10, + expr: &seqExpr{ + pos: position{line: 6, col: 22, offset: 43}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 6, col: 22, offset: 43}, + val: ";", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 6, col: 26, offset: 47}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 6, col: 28, offset: 49}, + label: "s", + expr: &zeroOrOneExpr{ + pos: position{line: 6, col: 30, offset: 51}, + expr: &ruleRefExpr{ + pos: position{line: 6, col: 30, offset: 51}, + name: "Stmt", + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 6, col: 36, offset: 57}, + name: "_", + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 6, col: 59, offset: 80}, + name: "EOF", + }, + }, + }, + }, + }, + { + name: "Stmt", + pos: position{line: 10, col: 1, offset: 133}, + expr: &choiceExpr{ + pos: position{line: 11, col: 4, offset: 141}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 11, col: 4, offset: 141}, + name: "SelectStmt", + }, + &ruleRefExpr{ + pos: position{line: 12, col: 4, offset: 155}, + name: "UpdateStmt", + }, + &ruleRefExpr{ + pos: position{line: 13, col: 4, offset: 169}, + name: "DeleteStmt", + }, + &ruleRefExpr{ + pos: position{line: 14, col: 4, offset: 183}, + name: "InsertStmt", + }, + &ruleRefExpr{ + pos: position{line: 15, col: 4, offset: 197}, + name: "CreateTableStmt", + }, + &ruleRefExpr{ + pos: position{line: 16, col: 4, offset: 216}, + name: "CreateIndexStmt", + }, + }, + }, + }, + { + name: "SelectStmt", + pos: position{line: 18, col: 1, offset: 233}, + expr: &actionExpr{ + pos: position{line: 19, col: 4, offset: 247}, + run: (*parser).callonSelectStmt1, + expr: &seqExpr{ + pos: position{line: 19, col: 4, offset: 247}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 19, col: 4, offset: 247}, + name: "SelectToken", + }, + &ruleRefExpr{ + pos: position{line: 20, col: 2, offset: 260}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 20, col: 4, offset: 262}, + label: "f", + expr: &ruleRefExpr{ + pos: position{line: 20, col: 6, offset: 264}, + name: "SelectColumn", + }, + }, + &labeledExpr{ + pos: position{line: 20, col: 19, offset: 277}, + label: "fs", + expr: &zeroOrMoreExpr{ + pos: position{line: 20, col: 22, offset: 280}, + expr: &actionExpr{ + pos: position{line: 20, col: 24, offset: 282}, + run: (*parser).callonSelectStmt9, + expr: &seqExpr{ + pos: position{line: 20, col: 24, offset: 282}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 20, col: 24, offset: 282}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 20, col: 26, offset: 284}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 20, col: 41, offset: 299}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 20, col: 43, offset: 301}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 20, col: 45, offset: 303}, + name: "SelectColumn", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 21, col: 2, offset: 338}, + label: "table", + expr: &zeroOrOneExpr{ + pos: position{line: 21, col: 8, offset: 344}, + expr: &actionExpr{ + pos: position{line: 21, col: 10, offset: 346}, + run: (*parser).callonSelectStmt18, + expr: &seqExpr{ + pos: position{line: 21, col: 10, offset: 346}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 21, col: 10, offset: 346}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 21, col: 12, offset: 348}, + name: "FromToken", + }, + &ruleRefExpr{ + pos: position{line: 21, col: 22, offset: 358}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 21, col: 24, offset: 360}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 21, col: 26, offset: 362}, + name: "Identifier", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 22, col: 2, offset: 395}, + label: "where", + expr: &zeroOrOneExpr{ + pos: position{line: 22, col: 8, offset: 401}, + expr: &actionExpr{ + pos: position{line: 22, col: 10, offset: 403}, + run: (*parser).callonSelectStmt27, + expr: &seqExpr{ + pos: position{line: 22, col: 10, offset: 403}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 22, col: 10, offset: 403}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 22, col: 12, offset: 405}, + label: "w", + expr: &ruleRefExpr{ + pos: position{line: 22, col: 14, offset: 407}, + name: "WhereClause", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 23, col: 2, offset: 441}, + label: "group", + expr: &zeroOrOneExpr{ + pos: position{line: 23, col: 8, offset: 447}, + expr: &actionExpr{ + pos: position{line: 23, col: 10, offset: 449}, + run: (*parser).callonSelectStmt34, + expr: &seqExpr{ + pos: position{line: 23, col: 10, offset: 449}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 23, col: 10, offset: 449}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 23, col: 12, offset: 451}, + label: "g", + expr: &ruleRefExpr{ + pos: position{line: 23, col: 14, offset: 453}, + name: "GroupByClause", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 24, col: 2, offset: 489}, + label: "order", + expr: &zeroOrOneExpr{ + pos: position{line: 24, col: 8, offset: 495}, + expr: &actionExpr{ + pos: position{line: 24, col: 10, offset: 497}, + run: (*parser).callonSelectStmt41, + expr: &seqExpr{ + pos: position{line: 24, col: 10, offset: 497}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 24, col: 10, offset: 497}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 24, col: 12, offset: 499}, + label: "or", + expr: &ruleRefExpr{ + pos: position{line: 24, col: 15, offset: 502}, + name: "OrderByClause", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 25, col: 2, offset: 539}, + label: "limit", + expr: &zeroOrOneExpr{ + pos: position{line: 25, col: 8, offset: 545}, + expr: &actionExpr{ + pos: position{line: 25, col: 10, offset: 547}, + run: (*parser).callonSelectStmt48, + expr: &seqExpr{ + pos: position{line: 25, col: 10, offset: 547}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 25, col: 10, offset: 547}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 25, col: 12, offset: 549}, + label: "l", + expr: &ruleRefExpr{ + pos: position{line: 25, col: 14, offset: 551}, + name: "LimitClause", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 26, col: 2, offset: 585}, + label: "offset", + expr: &zeroOrOneExpr{ + pos: position{line: 26, col: 9, offset: 592}, + expr: &actionExpr{ + pos: position{line: 26, col: 11, offset: 594}, + run: (*parser).callonSelectStmt55, + expr: &seqExpr{ + pos: position{line: 26, col: 11, offset: 594}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 26, col: 11, offset: 594}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 26, col: 13, offset: 596}, + label: "of", + expr: &ruleRefExpr{ + pos: position{line: 26, col: 16, offset: 599}, + name: "OffsetClause", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "SelectColumn", + pos: position{line: 61, col: 1, offset: 1283}, + expr: &choiceExpr{ + pos: position{line: 62, col: 4, offset: 1299}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 62, col: 4, offset: 1299}, + name: "AnyLiteral", + }, + &ruleRefExpr{ + pos: position{line: 63, col: 4, offset: 1313}, + name: "Expr", + }, + }, + }, + }, + { + name: "UpdateStmt", + pos: position{line: 65, col: 1, offset: 1319}, + expr: &actionExpr{ + pos: position{line: 66, col: 4, offset: 1333}, + run: (*parser).callonUpdateStmt1, + expr: &seqExpr{ + pos: position{line: 66, col: 4, offset: 1333}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 66, col: 4, offset: 1333}, + name: "UpdateToken", + }, + &ruleRefExpr{ + pos: position{line: 67, col: 2, offset: 1346}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 67, col: 4, offset: 1348}, + label: "table", + expr: &ruleRefExpr{ + pos: position{line: 67, col: 10, offset: 1354}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 68, col: 2, offset: 1366}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 68, col: 4, offset: 1368}, + name: "SetToken", + }, + &ruleRefExpr{ + pos: position{line: 69, col: 2, offset: 1378}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 69, col: 4, offset: 1380}, + label: "a", + expr: &ruleRefExpr{ + pos: position{line: 69, col: 6, offset: 1382}, + name: "Assignment", + }, + }, + &labeledExpr{ + pos: position{line: 69, col: 17, offset: 1393}, + label: "as", + expr: &zeroOrMoreExpr{ + pos: position{line: 69, col: 20, offset: 1396}, + expr: &actionExpr{ + pos: position{line: 69, col: 22, offset: 1398}, + run: (*parser).callonUpdateStmt14, + expr: &seqExpr{ + pos: position{line: 69, col: 22, offset: 1398}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 69, col: 22, offset: 1398}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 69, col: 24, offset: 1400}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 69, col: 39, offset: 1415}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 69, col: 41, offset: 1417}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 69, col: 43, offset: 1419}, + name: "Assignment", + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 70, col: 2, offset: 1452}, + label: "where", + expr: &zeroOrOneExpr{ + pos: position{line: 70, col: 8, offset: 1458}, + expr: &actionExpr{ + pos: position{line: 70, col: 10, offset: 1460}, + run: (*parser).callonUpdateStmt23, + expr: &seqExpr{ + pos: position{line: 70, col: 10, offset: 1460}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 70, col: 10, offset: 1460}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 70, col: 12, offset: 1462}, + label: "w", + expr: &ruleRefExpr{ + pos: position{line: 70, col: 14, offset: 1464}, + name: "WhereClause", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "DeleteStmt", + pos: position{line: 86, col: 1, offset: 1752}, + expr: &actionExpr{ + pos: position{line: 87, col: 4, offset: 1766}, + run: (*parser).callonDeleteStmt1, + expr: &seqExpr{ + pos: position{line: 87, col: 4, offset: 1766}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 87, col: 4, offset: 1766}, + name: "DeleteToken", + }, + &ruleRefExpr{ + pos: position{line: 88, col: 2, offset: 1779}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 88, col: 4, offset: 1781}, + name: "FromToken", + }, + &ruleRefExpr{ + pos: position{line: 89, col: 2, offset: 1792}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 89, col: 4, offset: 1794}, + label: "table", + expr: &ruleRefExpr{ + pos: position{line: 89, col: 10, offset: 1800}, + name: "Identifier", + }, + }, + &labeledExpr{ + pos: position{line: 90, col: 2, offset: 1812}, + label: "where", + expr: &zeroOrOneExpr{ + pos: position{line: 90, col: 8, offset: 1818}, + expr: &actionExpr{ + pos: position{line: 90, col: 10, offset: 1820}, + run: (*parser).callonDeleteStmt11, + expr: &seqExpr{ + pos: position{line: 90, col: 10, offset: 1820}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 90, col: 10, offset: 1820}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 90, col: 12, offset: 1822}, + label: "w", + expr: &ruleRefExpr{ + pos: position{line: 90, col: 14, offset: 1824}, + name: "WhereClause", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "InsertStmt", + pos: position{line: 105, col: 1, offset: 2072}, + expr: &actionExpr{ + pos: position{line: 106, col: 4, offset: 2086}, + run: (*parser).callonInsertStmt1, + expr: &seqExpr{ + pos: position{line: 106, col: 4, offset: 2086}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 106, col: 4, offset: 2086}, + name: "InsertToken", + }, + &ruleRefExpr{ + pos: position{line: 107, col: 2, offset: 2099}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 107, col: 4, offset: 2101}, + name: "IntoToken", + }, + &ruleRefExpr{ + pos: position{line: 108, col: 2, offset: 2112}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 108, col: 4, offset: 2114}, + label: "table", + expr: &ruleRefExpr{ + pos: position{line: 108, col: 10, offset: 2120}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 109, col: 2, offset: 2132}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 109, col: 4, offset: 2134}, + label: "insert", + expr: &choiceExpr{ + pos: position{line: 109, col: 13, offset: 2143}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 109, col: 13, offset: 2143}, + name: "InsertWithColumnClause", + }, + &ruleRefExpr{ + pos: position{line: 109, col: 38, offset: 2168}, + name: "InsertWithDefaultClause", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "InsertValue", + pos: position{line: 117, col: 1, offset: 2291}, + expr: &actionExpr{ + pos: position{line: 118, col: 4, offset: 2306}, + run: (*parser).callonInsertValue1, + expr: &seqExpr{ + pos: position{line: 118, col: 4, offset: 2306}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 118, col: 4, offset: 2306}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 118, col: 8, offset: 2310}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 118, col: 10, offset: 2312}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 118, col: 12, offset: 2314}, + name: "MultiExprWithDefault", + }, + }, + &ruleRefExpr{ + pos: position{line: 118, col: 33, offset: 2335}, + name: "_", + }, + &litMatcher{ + pos: position{line: 118, col: 35, offset: 2337}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "CreateTableStmt", + pos: position{line: 121, col: 1, offset: 2360}, + expr: &actionExpr{ + pos: position{line: 122, col: 4, offset: 2379}, + run: (*parser).callonCreateTableStmt1, + expr: &seqExpr{ + pos: position{line: 122, col: 4, offset: 2379}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 122, col: 4, offset: 2379}, + name: "CreateToken", + }, + &ruleRefExpr{ + pos: position{line: 123, col: 2, offset: 2392}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 123, col: 4, offset: 2394}, + name: "TableToken", + }, + &ruleRefExpr{ + pos: position{line: 124, col: 2, offset: 2406}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 124, col: 4, offset: 2408}, + label: "table", + expr: &ruleRefExpr{ + pos: position{line: 124, col: 10, offset: 2414}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 125, col: 2, offset: 2426}, + name: "_", + }, + &litMatcher{ + pos: position{line: 125, col: 4, offset: 2428}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 126, col: 2, offset: 2433}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 126, col: 4, offset: 2435}, + label: "column", + expr: &zeroOrOneExpr{ + pos: position{line: 126, col: 11, offset: 2442}, + expr: &actionExpr{ + pos: position{line: 127, col: 3, offset: 2446}, + run: (*parser).callonCreateTableStmt14, + expr: &seqExpr{ + pos: position{line: 127, col: 3, offset: 2446}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 127, col: 3, offset: 2446}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 127, col: 5, offset: 2448}, + name: "ColumnSchema", + }, + }, + &labeledExpr{ + pos: position{line: 128, col: 3, offset: 2463}, + label: "ss", + expr: &zeroOrMoreExpr{ + pos: position{line: 128, col: 6, offset: 2466}, + expr: &actionExpr{ + pos: position{line: 128, col: 8, offset: 2468}, + run: (*parser).callonCreateTableStmt20, + expr: &seqExpr{ + pos: position{line: 128, col: 8, offset: 2468}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 128, col: 8, offset: 2468}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 128, col: 10, offset: 2470}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 128, col: 25, offset: 2485}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 128, col: 27, offset: 2487}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 128, col: 29, offset: 2489}, + name: "ColumnSchema", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 131, col: 2, offset: 2561}, + name: "_", + }, + &litMatcher{ + pos: position{line: 131, col: 4, offset: 2563}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "ColumnSchema", + pos: position{line: 139, col: 1, offset: 2678}, + expr: &actionExpr{ + pos: position{line: 140, col: 4, offset: 2694}, + run: (*parser).callonColumnSchema1, + expr: &seqExpr{ + pos: position{line: 140, col: 4, offset: 2694}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 140, col: 4, offset: 2694}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 140, col: 6, offset: 2696}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 141, col: 2, offset: 2708}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 141, col: 4, offset: 2710}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 141, col: 6, offset: 2712}, + name: "DataType", + }, + }, + &labeledExpr{ + pos: position{line: 142, col: 2, offset: 2722}, + label: "cs", + expr: &zeroOrMoreExpr{ + pos: position{line: 142, col: 5, offset: 2725}, + expr: &actionExpr{ + pos: position{line: 142, col: 7, offset: 2727}, + run: (*parser).callonColumnSchema10, + expr: &seqExpr{ + pos: position{line: 142, col: 7, offset: 2727}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 142, col: 7, offset: 2727}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 142, col: 9, offset: 2729}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 142, col: 11, offset: 2731}, + name: "ColumnConstraint", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "ColumnConstraint", + pos: position{line: 151, col: 1, offset: 2894}, + expr: &choiceExpr{ + pos: position{line: 152, col: 4, offset: 2914}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 152, col: 4, offset: 2914}, + name: "PrimaryKeyClause", + }, + &ruleRefExpr{ + pos: position{line: 153, col: 4, offset: 2934}, + name: "NotNullClause", + }, + &ruleRefExpr{ + pos: position{line: 154, col: 4, offset: 2951}, + name: "UniqueClause", + }, + &ruleRefExpr{ + pos: position{line: 155, col: 4, offset: 2967}, + name: "DefaultClause", + }, + &ruleRefExpr{ + pos: position{line: 156, col: 4, offset: 2984}, + name: "ForeignClause", + }, + &ruleRefExpr{ + pos: position{line: 157, col: 4, offset: 3001}, + name: "AutoincrementClause", + }, + }, + }, + }, + { + name: "CreateIndexStmt", + pos: position{line: 159, col: 1, offset: 3022}, + expr: &actionExpr{ + pos: position{line: 160, col: 4, offset: 3041}, + run: (*parser).callonCreateIndexStmt1, + expr: &seqExpr{ + pos: position{line: 160, col: 4, offset: 3041}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 160, col: 4, offset: 3041}, + name: "CreateToken", + }, + &labeledExpr{ + pos: position{line: 161, col: 2, offset: 3054}, + label: "unique", + expr: &zeroOrOneExpr{ + pos: position{line: 161, col: 9, offset: 3061}, + expr: &actionExpr{ + pos: position{line: 161, col: 11, offset: 3063}, + run: (*parser).callonCreateIndexStmt6, + expr: &seqExpr{ + pos: position{line: 161, col: 11, offset: 3063}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 161, col: 11, offset: 3063}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 161, col: 13, offset: 3065}, + label: "u", + expr: &ruleRefExpr{ + pos: position{line: 161, col: 15, offset: 3067}, + name: "UniqueClause", + }, + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 162, col: 2, offset: 3102}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 162, col: 4, offset: 3104}, + name: "IndexToken", + }, + &ruleRefExpr{ + pos: position{line: 163, col: 2, offset: 3116}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 163, col: 4, offset: 3118}, + label: "index", + expr: &ruleRefExpr{ + pos: position{line: 163, col: 10, offset: 3124}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 164, col: 2, offset: 3136}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 164, col: 4, offset: 3138}, + name: "OnToken", + }, + &ruleRefExpr{ + pos: position{line: 165, col: 2, offset: 3147}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 165, col: 4, offset: 3149}, + label: "table", + expr: &ruleRefExpr{ + pos: position{line: 165, col: 10, offset: 3155}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 166, col: 2, offset: 3167}, + name: "_", + }, + &litMatcher{ + pos: position{line: 166, col: 4, offset: 3169}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 166, col: 8, offset: 3173}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 166, col: 10, offset: 3175}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 166, col: 12, offset: 3177}, + name: "Identifier", + }, + }, + &labeledExpr{ + pos: position{line: 166, col: 23, offset: 3188}, + label: "is", + expr: &zeroOrMoreExpr{ + pos: position{line: 166, col: 26, offset: 3191}, + expr: &actionExpr{ + pos: position{line: 166, col: 28, offset: 3193}, + run: (*parser).callonCreateIndexStmt28, + expr: &seqExpr{ + pos: position{line: 166, col: 28, offset: 3193}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 166, col: 28, offset: 3193}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 166, col: 30, offset: 3195}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 166, col: 45, offset: 3210}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 166, col: 47, offset: 3212}, + label: "x", + expr: &ruleRefExpr{ + pos: position{line: 166, col: 49, offset: 3214}, + name: "Identifier", + }, + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 166, col: 81, offset: 3246}, + name: "_", + }, + &litMatcher{ + pos: position{line: 166, col: 83, offset: 3248}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "WhereClause", + pos: position{line: 184, col: 1, offset: 3559}, + expr: &actionExpr{ + pos: position{line: 185, col: 4, offset: 3574}, + run: (*parser).callonWhereClause1, + expr: &seqExpr{ + pos: position{line: 185, col: 4, offset: 3574}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 185, col: 4, offset: 3574}, + name: "WhereToken", + }, + &ruleRefExpr{ + pos: position{line: 185, col: 15, offset: 3585}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 185, col: 17, offset: 3587}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 185, col: 19, offset: 3589}, + name: "Expr", + }, + }, + }, + }, + }, + }, + { + name: "OrderByClause", + pos: position{line: 188, col: 1, offset: 3645}, + expr: &actionExpr{ + pos: position{line: 189, col: 4, offset: 3662}, + run: (*parser).callonOrderByClause1, + expr: &seqExpr{ + pos: position{line: 189, col: 4, offset: 3662}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 189, col: 4, offset: 3662}, + name: "OrderToken", + }, + &ruleRefExpr{ + pos: position{line: 190, col: 2, offset: 3674}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 190, col: 4, offset: 3676}, + name: "ByToken", + }, + &ruleRefExpr{ + pos: position{line: 191, col: 2, offset: 3685}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 191, col: 4, offset: 3687}, + label: "f", + expr: &ruleRefExpr{ + pos: position{line: 191, col: 6, offset: 3689}, + name: "OrderColumn", + }, + }, + &labeledExpr{ + pos: position{line: 192, col: 2, offset: 3702}, + label: "fs", + expr: &zeroOrMoreExpr{ + pos: position{line: 192, col: 5, offset: 3705}, + expr: &actionExpr{ + pos: position{line: 192, col: 7, offset: 3707}, + run: (*parser).callonOrderByClause11, + expr: &seqExpr{ + pos: position{line: 192, col: 7, offset: 3707}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 192, col: 7, offset: 3707}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 192, col: 9, offset: 3709}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 192, col: 24, offset: 3724}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 192, col: 26, offset: 3726}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 192, col: 28, offset: 3728}, + name: "OrderColumn", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "OrderColumn", + pos: position{line: 195, col: 1, offset: 3793}, + expr: &actionExpr{ + pos: position{line: 196, col: 4, offset: 3808}, + run: (*parser).callonOrderColumn1, + expr: &seqExpr{ + pos: position{line: 196, col: 4, offset: 3808}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 196, col: 4, offset: 3808}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 196, col: 6, offset: 3810}, + name: "Expr", + }, + }, + &labeledExpr{ + pos: position{line: 197, col: 2, offset: 3816}, + label: "s", + expr: &zeroOrOneExpr{ + pos: position{line: 197, col: 4, offset: 3818}, + expr: &actionExpr{ + pos: position{line: 197, col: 6, offset: 3820}, + run: (*parser).callonOrderColumn7, + expr: &seqExpr{ + pos: position{line: 197, col: 6, offset: 3820}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 197, col: 6, offset: 3820}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 197, col: 8, offset: 3822}, + label: "t", + expr: &choiceExpr{ + pos: position{line: 197, col: 12, offset: 3826}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 197, col: 12, offset: 3826}, + name: "AscToken", + }, + &ruleRefExpr{ + pos: position{line: 197, col: 23, offset: 3837}, + name: "DescToken", + }, + }, + }, + }, + }, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 198, col: 2, offset: 3871}, + label: "n", + expr: &zeroOrOneExpr{ + pos: position{line: 198, col: 4, offset: 3873}, + expr: &actionExpr{ + pos: position{line: 198, col: 6, offset: 3875}, + run: (*parser).callonOrderColumn16, + expr: &seqExpr{ + pos: position{line: 198, col: 6, offset: 3875}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 198, col: 6, offset: 3875}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 198, col: 8, offset: 3877}, + name: "NullsToken", + }, + &ruleRefExpr{ + pos: position{line: 198, col: 19, offset: 3888}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 198, col: 21, offset: 3890}, + label: "l", + expr: &choiceExpr{ + pos: position{line: 198, col: 25, offset: 3894}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 198, col: 25, offset: 3894}, + name: "LastToken", + }, + &ruleRefExpr{ + pos: position{line: 198, col: 37, offset: 3906}, + name: "FirstToken", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "GroupByClause", + pos: position{line: 207, col: 1, offset: 4112}, + expr: &actionExpr{ + pos: position{line: 208, col: 4, offset: 4129}, + run: (*parser).callonGroupByClause1, + expr: &seqExpr{ + pos: position{line: 208, col: 4, offset: 4129}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 208, col: 4, offset: 4129}, + name: "GroupToken", + }, + &ruleRefExpr{ + pos: position{line: 209, col: 2, offset: 4141}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 209, col: 4, offset: 4143}, + name: "ByToken", + }, + &ruleRefExpr{ + pos: position{line: 210, col: 2, offset: 4152}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 210, col: 4, offset: 4154}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 210, col: 6, offset: 4156}, + name: "Expr", + }, + }, + &labeledExpr{ + pos: position{line: 211, col: 2, offset: 4162}, + label: "is", + expr: &zeroOrMoreExpr{ + pos: position{line: 211, col: 5, offset: 4165}, + expr: &actionExpr{ + pos: position{line: 211, col: 7, offset: 4167}, + run: (*parser).callonGroupByClause11, + expr: &seqExpr{ + pos: position{line: 211, col: 7, offset: 4167}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 211, col: 7, offset: 4167}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 211, col: 9, offset: 4169}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 211, col: 24, offset: 4184}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 211, col: 26, offset: 4186}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 211, col: 28, offset: 4188}, + name: "Expr", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "OffsetClause", + pos: position{line: 214, col: 1, offset: 4300}, + expr: &actionExpr{ + pos: position{line: 215, col: 4, offset: 4316}, + run: (*parser).callonOffsetClause1, + expr: &seqExpr{ + pos: position{line: 215, col: 4, offset: 4316}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 215, col: 4, offset: 4316}, + name: "OffsetToken", + }, + &ruleRefExpr{ + pos: position{line: 215, col: 16, offset: 4328}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 215, col: 18, offset: 4330}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 215, col: 20, offset: 4332}, + name: "Integer", + }, + }, + }, + }, + }, + }, + { + name: "LimitClause", + pos: position{line: 218, col: 1, offset: 4411}, + expr: &actionExpr{ + pos: position{line: 219, col: 4, offset: 4426}, + run: (*parser).callonLimitClause1, + expr: &seqExpr{ + pos: position{line: 219, col: 4, offset: 4426}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 219, col: 4, offset: 4426}, + name: "LimitToken", + }, + &ruleRefExpr{ + pos: position{line: 219, col: 15, offset: 4437}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 219, col: 17, offset: 4439}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 219, col: 19, offset: 4441}, + name: "Integer", + }, + }, + }, + }, + }, + }, + { + name: "InsertWithColumnClause", + pos: position{line: 222, col: 1, offset: 4519}, + expr: &actionExpr{ + pos: position{line: 223, col: 4, offset: 4545}, + run: (*parser).callonInsertWithColumnClause1, + expr: &seqExpr{ + pos: position{line: 223, col: 4, offset: 4545}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 223, col: 4, offset: 4545}, + label: "cs", + expr: &zeroOrOneExpr{ + pos: position{line: 223, col: 7, offset: 4548}, + expr: &actionExpr{ + pos: position{line: 223, col: 9, offset: 4550}, + run: (*parser).callonInsertWithColumnClause5, + expr: &seqExpr{ + pos: position{line: 223, col: 9, offset: 4550}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 223, col: 9, offset: 4550}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 224, col: 4, offset: 4557}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 224, col: 6, offset: 4559}, + label: "f", + expr: &ruleRefExpr{ + pos: position{line: 224, col: 8, offset: 4561}, + name: "Identifier", + }, + }, + &labeledExpr{ + pos: position{line: 225, col: 4, offset: 4575}, + label: "fs", + expr: &zeroOrMoreExpr{ + pos: position{line: 225, col: 7, offset: 4578}, + expr: &actionExpr{ + pos: position{line: 225, col: 9, offset: 4580}, + run: (*parser).callonInsertWithColumnClause13, + expr: &seqExpr{ + pos: position{line: 225, col: 9, offset: 4580}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 225, col: 9, offset: 4580}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 225, col: 11, offset: 4582}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 225, col: 26, offset: 4597}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 225, col: 28, offset: 4599}, + label: "x", + expr: &ruleRefExpr{ + pos: position{line: 225, col: 30, offset: 4601}, + name: "Identifier", + }, + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 226, col: 4, offset: 4636}, + name: "_", + }, + &litMatcher{ + pos: position{line: 226, col: 6, offset: 4638}, + val: ")", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 227, col: 4, offset: 4645}, + name: "_", + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 229, col: 3, offset: 4685}, + name: "ValuesToken", + }, + &ruleRefExpr{ + pos: position{line: 230, col: 2, offset: 4698}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 230, col: 4, offset: 4700}, + label: "v", + expr: &ruleRefExpr{ + pos: position{line: 230, col: 6, offset: 4702}, + name: "InsertValue", + }, + }, + &labeledExpr{ + pos: position{line: 231, col: 2, offset: 4715}, + label: "vs", + expr: &zeroOrMoreExpr{ + pos: position{line: 231, col: 5, offset: 4718}, + expr: &actionExpr{ + pos: position{line: 231, col: 7, offset: 4720}, + run: (*parser).callonInsertWithColumnClause29, + expr: &seqExpr{ + pos: position{line: 231, col: 7, offset: 4720}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 231, col: 7, offset: 4720}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 231, col: 9, offset: 4722}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 231, col: 24, offset: 4737}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 231, col: 26, offset: 4739}, + label: "y", + expr: &ruleRefExpr{ + pos: position{line: 231, col: 28, offset: 4741}, + name: "InsertValue", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "InsertWithDefaultClause", + pos: position{line: 239, col: 1, offset: 4876}, + expr: &actionExpr{ + pos: position{line: 240, col: 4, offset: 4903}, + run: (*parser).callonInsertWithDefaultClause1, + expr: &seqExpr{ + pos: position{line: 240, col: 4, offset: 4903}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 240, col: 4, offset: 4903}, + name: "DefaultToken", + }, + &ruleRefExpr{ + pos: position{line: 240, col: 17, offset: 4916}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 240, col: 19, offset: 4918}, + name: "ValuesToken", + }, + }, + }, + }, + }, + { + name: "PrimaryKeyClause", + pos: position{line: 243, col: 1, offset: 4981}, + expr: &actionExpr{ + pos: position{line: 244, col: 4, offset: 5001}, + run: (*parser).callonPrimaryKeyClause1, + expr: &seqExpr{ + pos: position{line: 244, col: 4, offset: 5001}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 244, col: 4, offset: 5001}, + name: "PrimaryToken", + }, + &ruleRefExpr{ + pos: position{line: 244, col: 17, offset: 5014}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 244, col: 19, offset: 5016}, + name: "KeyToken", + }, + }, + }, + }, + }, + { + name: "NotNullClause", + pos: position{line: 247, col: 1, offset: 5066}, + expr: &actionExpr{ + pos: position{line: 248, col: 4, offset: 5083}, + run: (*parser).callonNotNullClause1, + expr: &seqExpr{ + pos: position{line: 248, col: 4, offset: 5083}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 248, col: 4, offset: 5083}, + name: "NotToken", + }, + &ruleRefExpr{ + pos: position{line: 248, col: 13, offset: 5092}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 248, col: 15, offset: 5094}, + name: "NullToken", + }, + }, + }, + }, + }, + { + name: "UniqueClause", + pos: position{line: 251, col: 1, offset: 5145}, + expr: &actionExpr{ + pos: position{line: 252, col: 4, offset: 5161}, + run: (*parser).callonUniqueClause1, + expr: &ruleRefExpr{ + pos: position{line: 252, col: 4, offset: 5161}, + name: "UniqueToken", + }, + }, + }, + { + name: "DefaultClause", + pos: position{line: 255, col: 1, offset: 5213}, + expr: &actionExpr{ + pos: position{line: 256, col: 4, offset: 5230}, + run: (*parser).callonDefaultClause1, + expr: &seqExpr{ + pos: position{line: 256, col: 4, offset: 5230}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 256, col: 4, offset: 5230}, + name: "DefaultToken", + }, + &ruleRefExpr{ + pos: position{line: 256, col: 17, offset: 5243}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 256, col: 19, offset: 5245}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 256, col: 21, offset: 5247}, + name: "Expr", + }, + }, + }, + }, + }, + }, + { + name: "ForeignClause", + pos: position{line: 259, col: 1, offset: 5301}, + expr: &actionExpr{ + pos: position{line: 260, col: 4, offset: 5318}, + run: (*parser).callonForeignClause1, + expr: &seqExpr{ + pos: position{line: 260, col: 4, offset: 5318}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 260, col: 4, offset: 5318}, + name: "ReferencesToken", + }, + &ruleRefExpr{ + pos: position{line: 260, col: 20, offset: 5334}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 260, col: 22, offset: 5336}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 260, col: 24, offset: 5338}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 260, col: 35, offset: 5349}, + name: "_", + }, + &litMatcher{ + pos: position{line: 260, col: 37, offset: 5351}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 260, col: 41, offset: 5355}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 260, col: 43, offset: 5357}, + label: "f", + expr: &ruleRefExpr{ + pos: position{line: 260, col: 45, offset: 5359}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 260, col: 56, offset: 5370}, + name: "_", + }, + &litMatcher{ + pos: position{line: 260, col: 58, offset: 5372}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "AutoincrementClause", + pos: position{line: 268, col: 1, offset: 5488}, + expr: &actionExpr{ + pos: position{line: 269, col: 4, offset: 5511}, + run: (*parser).callonAutoincrementClause1, + expr: &ruleRefExpr{ + pos: position{line: 269, col: 4, offset: 5511}, + name: "AutoincrementToken", + }, + }, + }, + { + name: "Expr", + pos: position{line: 273, col: 1, offset: 5595}, + expr: &ruleRefExpr{ + pos: position{line: 274, col: 4, offset: 5603}, + name: "LogicExpr", + }, + }, + { + name: "ExprWithDefault", + pos: position{line: 276, col: 1, offset: 5614}, + expr: &choiceExpr{ + pos: position{line: 277, col: 4, offset: 5633}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 277, col: 4, offset: 5633}, + run: (*parser).callonExprWithDefault2, + expr: &seqExpr{ + pos: position{line: 277, col: 4, offset: 5633}, + exprs: []interface{}{ + &andExpr{ + pos: position{line: 277, col: 4, offset: 5633}, + expr: &ruleRefExpr{ + pos: position{line: 277, col: 6, offset: 5635}, + name: "DefaultLiteral", + }, + }, + &labeledExpr{ + pos: position{line: 277, col: 22, offset: 5651}, + label: "d", + expr: &ruleRefExpr{ + pos: position{line: 277, col: 24, offset: 5653}, + name: "DefaultLiteral", + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 278, col: 4, offset: 5689}, + name: "Expr", + }, + }, + }, + }, + { + name: "LogicExpr", + pos: position{line: 280, col: 1, offset: 5695}, + expr: &ruleRefExpr{ + pos: position{line: 281, col: 4, offset: 5708}, + name: "LogicExpr4", + }, + }, + { + name: "LogicExpr4", + pos: position{line: 283, col: 1, offset: 5720}, + expr: &actionExpr{ + pos: position{line: 284, col: 4, offset: 5734}, + run: (*parser).callonLogicExpr41, + expr: &seqExpr{ + pos: position{line: 284, col: 4, offset: 5734}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 284, col: 4, offset: 5734}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 284, col: 6, offset: 5736}, + name: "LogicExpr3", + }, + }, + &labeledExpr{ + pos: position{line: 285, col: 3, offset: 5749}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 285, col: 6, offset: 5752}, + expr: &actionExpr{ + pos: position{line: 285, col: 8, offset: 5754}, + run: (*parser).callonLogicExpr47, + expr: &seqExpr{ + pos: position{line: 285, col: 8, offset: 5754}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 285, col: 8, offset: 5754}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 285, col: 10, offset: 5756}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 285, col: 13, offset: 5759}, + name: "OrOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 285, col: 24, offset: 5770}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 285, col: 26, offset: 5772}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 285, col: 28, offset: 5774}, + name: "LogicExpr3", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "LogicExpr3", + pos: position{line: 288, col: 1, offset: 5867}, + expr: &actionExpr{ + pos: position{line: 289, col: 4, offset: 5881}, + run: (*parser).callonLogicExpr31, + expr: &seqExpr{ + pos: position{line: 289, col: 4, offset: 5881}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 289, col: 4, offset: 5881}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 289, col: 6, offset: 5883}, + name: "LogicExpr2", + }, + }, + &labeledExpr{ + pos: position{line: 290, col: 3, offset: 5896}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 290, col: 6, offset: 5899}, + expr: &actionExpr{ + pos: position{line: 290, col: 8, offset: 5901}, + run: (*parser).callonLogicExpr37, + expr: &seqExpr{ + pos: position{line: 290, col: 8, offset: 5901}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 290, col: 8, offset: 5901}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 290, col: 10, offset: 5903}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 290, col: 13, offset: 5906}, + name: "AndOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 290, col: 25, offset: 5918}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 290, col: 27, offset: 5920}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 290, col: 29, offset: 5922}, + name: "LogicExpr2", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "LogicExpr2", + pos: position{line: 293, col: 1, offset: 6015}, + expr: &choiceExpr{ + pos: position{line: 294, col: 4, offset: 6029}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 294, col: 4, offset: 6029}, + run: (*parser).callonLogicExpr22, + expr: &seqExpr{ + pos: position{line: 294, col: 4, offset: 6029}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 294, col: 4, offset: 6029}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 294, col: 7, offset: 6032}, + name: "NotOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 294, col: 19, offset: 6044}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 294, col: 21, offset: 6046}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 294, col: 23, offset: 6048}, + name: "LogicExpr2", + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 296, col: 4, offset: 6098}, + name: "LogicExpr1", + }, + }, + }, + }, + { + name: "LogicExpr1", + pos: position{line: 298, col: 1, offset: 6110}, + expr: &actionExpr{ + pos: position{line: 299, col: 4, offset: 6124}, + run: (*parser).callonLogicExpr11, + expr: &seqExpr{ + pos: position{line: 299, col: 4, offset: 6124}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 299, col: 4, offset: 6124}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 299, col: 6, offset: 6126}, + name: "ArithmeticExpr", + }, + }, + &labeledExpr{ + pos: position{line: 299, col: 21, offset: 6141}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 299, col: 24, offset: 6144}, + expr: &actionExpr{ + pos: position{line: 299, col: 26, offset: 6146}, + run: (*parser).callonLogicExpr17, + expr: &seqExpr{ + pos: position{line: 299, col: 26, offset: 6146}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 299, col: 26, offset: 6146}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 299, col: 28, offset: 6148}, + label: "l", + expr: &ruleRefExpr{ + pos: position{line: 299, col: 30, offset: 6150}, + name: "LogicExpr1Op", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "LogicExpr1Op", + pos: position{line: 302, col: 1, offset: 6227}, + expr: &choiceExpr{ + pos: position{line: 303, col: 4, offset: 6243}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 303, col: 4, offset: 6243}, + name: "LogicExpr1In", + }, + &ruleRefExpr{ + pos: position{line: 304, col: 4, offset: 6259}, + name: "LogicExpr1Null", + }, + &ruleRefExpr{ + pos: position{line: 305, col: 4, offset: 6277}, + name: "LogicExpr1Like", + }, + &ruleRefExpr{ + pos: position{line: 306, col: 4, offset: 6295}, + name: "LogicExpr1Cmp", + }, + }, + }, + }, + { + name: "LogicExpr1In", + pos: position{line: 308, col: 1, offset: 6310}, + expr: &actionExpr{ + pos: position{line: 309, col: 4, offset: 6326}, + run: (*parser).callonLogicExpr1In1, + expr: &seqExpr{ + pos: position{line: 309, col: 4, offset: 6326}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 309, col: 4, offset: 6326}, + label: "n", + expr: &zeroOrOneExpr{ + pos: position{line: 309, col: 6, offset: 6328}, + expr: &actionExpr{ + pos: position{line: 309, col: 8, offset: 6330}, + run: (*parser).callonLogicExpr1In5, + expr: &seqExpr{ + pos: position{line: 309, col: 8, offset: 6330}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 309, col: 8, offset: 6330}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 309, col: 10, offset: 6332}, + name: "NotOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 309, col: 22, offset: 6344}, + name: "_", + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 309, col: 45, offset: 6367}, + name: "InToken", + }, + &ruleRefExpr{ + pos: position{line: 309, col: 53, offset: 6375}, + name: "_", + }, + &litMatcher{ + pos: position{line: 309, col: 55, offset: 6377}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 309, col: 59, offset: 6381}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 309, col: 61, offset: 6383}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 309, col: 63, offset: 6385}, + name: "MultiExpr", + }, + }, + &ruleRefExpr{ + pos: position{line: 309, col: 73, offset: 6395}, + name: "_", + }, + &litMatcher{ + pos: position{line: 309, col: 75, offset: 6397}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "LogicExpr1Null", + pos: position{line: 318, col: 1, offset: 6519}, + expr: &actionExpr{ + pos: position{line: 319, col: 4, offset: 6537}, + run: (*parser).callonLogicExpr1Null1, + expr: &seqExpr{ + pos: position{line: 319, col: 4, offset: 6537}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 319, col: 4, offset: 6537}, + name: "IsToken", + }, + &labeledExpr{ + pos: position{line: 319, col: 12, offset: 6545}, + label: "n", + expr: &zeroOrOneExpr{ + pos: position{line: 319, col: 14, offset: 6547}, + expr: &actionExpr{ + pos: position{line: 319, col: 16, offset: 6549}, + run: (*parser).callonLogicExpr1Null6, + expr: &seqExpr{ + pos: position{line: 319, col: 16, offset: 6549}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 319, col: 16, offset: 6549}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 319, col: 18, offset: 6551}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 319, col: 20, offset: 6553}, + name: "NotOperator", + }, + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 319, col: 53, offset: 6586}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 319, col: 55, offset: 6588}, + name: "NullToken", + }, + }, + }, + }, + }, + { + name: "LogicExpr1Like", + pos: position{line: 328, col: 1, offset: 6734}, + expr: &actionExpr{ + pos: position{line: 329, col: 4, offset: 6752}, + run: (*parser).callonLogicExpr1Like1, + expr: &seqExpr{ + pos: position{line: 329, col: 4, offset: 6752}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 329, col: 4, offset: 6752}, + label: "n", + expr: &zeroOrOneExpr{ + pos: position{line: 329, col: 6, offset: 6754}, + expr: &actionExpr{ + pos: position{line: 329, col: 8, offset: 6756}, + run: (*parser).callonLogicExpr1Like5, + expr: &seqExpr{ + pos: position{line: 329, col: 8, offset: 6756}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 329, col: 8, offset: 6756}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 329, col: 10, offset: 6758}, + name: "NotOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 329, col: 22, offset: 6770}, + name: "_", + }, + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 329, col: 45, offset: 6793}, + name: "LikeToken", + }, + &ruleRefExpr{ + pos: position{line: 329, col: 55, offset: 6803}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 329, col: 57, offset: 6805}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 329, col: 59, offset: 6807}, + name: "Expr", + }, + }, + }, + }, + }, + }, + { + name: "LogicExpr1Cmp", + pos: position{line: 338, col: 1, offset: 6932}, + expr: &actionExpr{ + pos: position{line: 339, col: 4, offset: 6949}, + run: (*parser).callonLogicExpr1Cmp1, + expr: &seqExpr{ + pos: position{line: 339, col: 4, offset: 6949}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 339, col: 4, offset: 6949}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 339, col: 7, offset: 6952}, + name: "CmpOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 339, col: 19, offset: 6964}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 339, col: 21, offset: 6966}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 339, col: 23, offset: 6968}, + name: "ArithmeticExpr", + }, + }, + }, + }, + }, + }, + { + name: "ArithmeticExpr", + pos: position{line: 342, col: 1, offset: 7020}, + expr: &ruleRefExpr{ + pos: position{line: 343, col: 4, offset: 7038}, + name: "ArithmeticExpr3", + }, + }, + { + name: "ArithmeticExpr3", + pos: position{line: 345, col: 1, offset: 7055}, + expr: &actionExpr{ + pos: position{line: 346, col: 4, offset: 7074}, + run: (*parser).callonArithmeticExpr31, + expr: &seqExpr{ + pos: position{line: 346, col: 4, offset: 7074}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 346, col: 4, offset: 7074}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 346, col: 6, offset: 7076}, + name: "ArithmeticExpr2", + }, + }, + &labeledExpr{ + pos: position{line: 346, col: 22, offset: 7092}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 346, col: 25, offset: 7095}, + expr: &actionExpr{ + pos: position{line: 346, col: 27, offset: 7097}, + run: (*parser).callonArithmeticExpr37, + expr: &seqExpr{ + pos: position{line: 346, col: 27, offset: 7097}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 346, col: 27, offset: 7097}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 346, col: 29, offset: 7099}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 346, col: 32, offset: 7102}, + name: "ConcatOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 346, col: 47, offset: 7117}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 346, col: 49, offset: 7119}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 346, col: 51, offset: 7121}, + name: "ArithmeticExpr2", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "ArithmeticExpr2", + pos: position{line: 349, col: 1, offset: 7219}, + expr: &actionExpr{ + pos: position{line: 350, col: 4, offset: 7238}, + run: (*parser).callonArithmeticExpr21, + expr: &seqExpr{ + pos: position{line: 350, col: 4, offset: 7238}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 350, col: 4, offset: 7238}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 350, col: 6, offset: 7240}, + name: "ArithmeticExpr1", + }, + }, + &labeledExpr{ + pos: position{line: 350, col: 22, offset: 7256}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 350, col: 25, offset: 7259}, + expr: &actionExpr{ + pos: position{line: 350, col: 27, offset: 7261}, + run: (*parser).callonArithmeticExpr27, + expr: &seqExpr{ + pos: position{line: 350, col: 27, offset: 7261}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 350, col: 27, offset: 7261}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 350, col: 29, offset: 7263}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 350, col: 32, offset: 7266}, + name: "AddSubOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 350, col: 47, offset: 7281}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 350, col: 49, offset: 7283}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 350, col: 51, offset: 7285}, + name: "ArithmeticExpr1", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "ArithmeticExpr1", + pos: position{line: 353, col: 1, offset: 7383}, + expr: &actionExpr{ + pos: position{line: 354, col: 4, offset: 7402}, + run: (*parser).callonArithmeticExpr11, + expr: &seqExpr{ + pos: position{line: 354, col: 4, offset: 7402}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 354, col: 4, offset: 7402}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 354, col: 6, offset: 7404}, + name: "Operand", + }, + }, + &labeledExpr{ + pos: position{line: 354, col: 14, offset: 7412}, + label: "os", + expr: &zeroOrMoreExpr{ + pos: position{line: 354, col: 17, offset: 7415}, + expr: &actionExpr{ + pos: position{line: 354, col: 19, offset: 7417}, + run: (*parser).callonArithmeticExpr17, + expr: &seqExpr{ + pos: position{line: 354, col: 19, offset: 7417}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 354, col: 19, offset: 7417}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 354, col: 21, offset: 7419}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 354, col: 24, offset: 7422}, + name: "MulDivModOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 354, col: 42, offset: 7440}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 354, col: 44, offset: 7442}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 354, col: 46, offset: 7444}, + name: "Operand", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "MultiExpr", + pos: position{line: 357, col: 1, offset: 7534}, + expr: &actionExpr{ + pos: position{line: 358, col: 4, offset: 7547}, + run: (*parser).callonMultiExpr1, + expr: &seqExpr{ + pos: position{line: 358, col: 4, offset: 7547}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 358, col: 4, offset: 7547}, + label: "x", + expr: &ruleRefExpr{ + pos: position{line: 358, col: 6, offset: 7549}, + name: "Expr", + }, + }, + &labeledExpr{ + pos: position{line: 358, col: 11, offset: 7554}, + label: "xs", + expr: &zeroOrMoreExpr{ + pos: position{line: 358, col: 14, offset: 7557}, + expr: &actionExpr{ + pos: position{line: 358, col: 16, offset: 7559}, + run: (*parser).callonMultiExpr7, + expr: &seqExpr{ + pos: position{line: 358, col: 16, offset: 7559}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 358, col: 16, offset: 7559}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 358, col: 18, offset: 7561}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 358, col: 33, offset: 7576}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 358, col: 35, offset: 7578}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 358, col: 37, offset: 7580}, + name: "Expr", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "MultiExprWithDefault", + pos: position{line: 361, col: 1, offset: 7638}, + expr: &actionExpr{ + pos: position{line: 362, col: 4, offset: 7662}, + run: (*parser).callonMultiExprWithDefault1, + expr: &seqExpr{ + pos: position{line: 362, col: 4, offset: 7662}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 362, col: 4, offset: 7662}, + label: "x", + expr: &ruleRefExpr{ + pos: position{line: 362, col: 6, offset: 7664}, + name: "ExprWithDefault", + }, + }, + &labeledExpr{ + pos: position{line: 362, col: 22, offset: 7680}, + label: "xs", + expr: &zeroOrMoreExpr{ + pos: position{line: 362, col: 25, offset: 7683}, + expr: &actionExpr{ + pos: position{line: 362, col: 27, offset: 7685}, + run: (*parser).callonMultiExprWithDefault7, + expr: &seqExpr{ + pos: position{line: 362, col: 27, offset: 7685}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 362, col: 27, offset: 7685}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 362, col: 29, offset: 7687}, + name: "SeparatorToken", + }, + &ruleRefExpr{ + pos: position{line: 362, col: 44, offset: 7702}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 362, col: 46, offset: 7704}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 362, col: 48, offset: 7706}, + name: "ExprWithDefault", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "Operand", + pos: position{line: 365, col: 1, offset: 7775}, + expr: &choiceExpr{ + pos: position{line: 366, col: 4, offset: 7786}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 366, col: 4, offset: 7786}, + run: (*parser).callonOperand2, + expr: &seqExpr{ + pos: position{line: 366, col: 4, offset: 7786}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 366, col: 4, offset: 7786}, + label: "op", + expr: &ruleRefExpr{ + pos: position{line: 366, col: 7, offset: 7789}, + name: "UnaryOperator", + }, + }, + &ruleRefExpr{ + pos: position{line: 366, col: 21, offset: 7803}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 366, col: 23, offset: 7805}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 366, col: 25, offset: 7807}, + name: "Operand", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 367, col: 4, offset: 7853}, + run: (*parser).callonOperand9, + expr: &seqExpr{ + pos: position{line: 367, col: 4, offset: 7853}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 367, col: 4, offset: 7853}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 367, col: 8, offset: 7857}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 367, col: 10, offset: 7859}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 367, col: 12, offset: 7861}, + name: "Expr", + }, + }, + &ruleRefExpr{ + pos: position{line: 367, col: 17, offset: 7866}, + name: "_", + }, + &litMatcher{ + pos: position{line: 367, col: 19, offset: 7868}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 368, col: 4, offset: 7893}, + run: (*parser).callonOperand17, + expr: &seqExpr{ + pos: position{line: 368, col: 4, offset: 7893}, + exprs: []interface{}{ + &andExpr{ + pos: position{line: 368, col: 4, offset: 7893}, + expr: &ruleRefExpr{ + pos: position{line: 368, col: 6, offset: 7895}, + name: "CastToken", + }, + }, + &labeledExpr{ + pos: position{line: 368, col: 17, offset: 7906}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 368, col: 19, offset: 7908}, + name: "TypeCast", + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 369, col: 4, offset: 7938}, + name: "FunctionCall", + }, + &ruleRefExpr{ + pos: position{line: 370, col: 4, offset: 7954}, + name: "Value", + }, + &ruleRefExpr{ + pos: position{line: 371, col: 4, offset: 7963}, + name: "Identifier", + }, + }, + }, + }, + { + name: "TypeCast", + pos: position{line: 373, col: 1, offset: 7975}, + expr: &actionExpr{ + pos: position{line: 374, col: 4, offset: 7987}, + run: (*parser).callonTypeCast1, + expr: &seqExpr{ + pos: position{line: 374, col: 4, offset: 7987}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 374, col: 4, offset: 7987}, + name: "CastToken", + }, + &ruleRefExpr{ + pos: position{line: 374, col: 14, offset: 7997}, + name: "_", + }, + &litMatcher{ + pos: position{line: 374, col: 16, offset: 7999}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 374, col: 20, offset: 8003}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 374, col: 22, offset: 8005}, + label: "o", + expr: &ruleRefExpr{ + pos: position{line: 374, col: 24, offset: 8007}, + name: "Expr", + }, + }, + &ruleRefExpr{ + pos: position{line: 374, col: 29, offset: 8012}, + name: "_", + }, + &ruleRefExpr{ + pos: position{line: 374, col: 31, offset: 8014}, + name: "AsToken", + }, + &ruleRefExpr{ + pos: position{line: 374, col: 39, offset: 8022}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 374, col: 41, offset: 8024}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 374, col: 43, offset: 8026}, + name: "DataType", + }, + }, + &ruleRefExpr{ + pos: position{line: 374, col: 52, offset: 8035}, + name: "_", + }, + &litMatcher{ + pos: position{line: 374, col: 54, offset: 8037}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "FunctionCall", + pos: position{line: 377, col: 1, offset: 8115}, + expr: &actionExpr{ + pos: position{line: 378, col: 4, offset: 8131}, + run: (*parser).callonFunctionCall1, + expr: &seqExpr{ + pos: position{line: 378, col: 4, offset: 8131}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 378, col: 4, offset: 8131}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 378, col: 6, offset: 8133}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 378, col: 17, offset: 8144}, + name: "_", + }, + &litMatcher{ + pos: position{line: 378, col: 19, offset: 8146}, + val: "(", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 378, col: 23, offset: 8150}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 378, col: 25, offset: 8152}, + label: "r", + expr: &zeroOrOneExpr{ + pos: position{line: 378, col: 27, offset: 8154}, + expr: &ruleRefExpr{ + pos: position{line: 378, col: 27, offset: 8154}, + name: "FunctionArgs", + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 378, col: 41, offset: 8168}, + name: "_", + }, + &litMatcher{ + pos: position{line: 378, col: 43, offset: 8170}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "FunctionArgs", + pos: position{line: 381, col: 1, offset: 8252}, + expr: &choiceExpr{ + pos: position{line: 382, col: 4, offset: 8268}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 382, col: 4, offset: 8268}, + run: (*parser).callonFunctionArgs2, + expr: &labeledExpr{ + pos: position{line: 382, col: 4, offset: 8268}, + label: "a", + expr: &ruleRefExpr{ + pos: position{line: 382, col: 6, offset: 8270}, + name: "AnyLiteral", + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 383, col: 4, offset: 8317}, + name: "MultiExpr", + }, + }, + }, + }, + { + name: "Assignment", + pos: position{line: 385, col: 1, offset: 8328}, + expr: &actionExpr{ + pos: position{line: 386, col: 4, offset: 8342}, + run: (*parser).callonAssignment1, + expr: &seqExpr{ + pos: position{line: 386, col: 4, offset: 8342}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 386, col: 4, offset: 8342}, + label: "i", + expr: &ruleRefExpr{ + pos: position{line: 386, col: 6, offset: 8344}, + name: "Identifier", + }, + }, + &ruleRefExpr{ + pos: position{line: 386, col: 17, offset: 8355}, + name: "_", + }, + &litMatcher{ + pos: position{line: 386, col: 19, offset: 8357}, + val: "=", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 386, col: 23, offset: 8361}, + name: "_", + }, + &labeledExpr{ + pos: position{line: 386, col: 25, offset: 8363}, + label: "e", + expr: &ruleRefExpr{ + pos: position{line: 386, col: 27, offset: 8365}, + name: "ExprWithDefault", + }, + }, + }, + }, + }, + }, + { + name: "UnaryOperator", + pos: position{line: 390, col: 1, offset: 8473}, + expr: &ruleRefExpr{ + pos: position{line: 391, col: 4, offset: 8490}, + name: "SignOperator", + }, + }, + { + name: "SignOperator", + pos: position{line: 393, col: 1, offset: 8504}, + expr: &actionExpr{ + pos: position{line: 394, col: 4, offset: 8520}, + run: (*parser).callonSignOperator1, + expr: &ruleRefExpr{ + pos: position{line: 394, col: 4, offset: 8520}, + name: "Sign", + }, + }, + }, + { + name: "NotOperator", + pos: position{line: 405, col: 1, offset: 8694}, + expr: &actionExpr{ + pos: position{line: 406, col: 4, offset: 8709}, + run: (*parser).callonNotOperator1, + expr: &ruleRefExpr{ + pos: position{line: 406, col: 4, offset: 8709}, + name: "NotToken", + }, + }, + }, + { + name: "AndOperator", + pos: position{line: 409, col: 1, offset: 8758}, + expr: &actionExpr{ + pos: position{line: 410, col: 4, offset: 8773}, + run: (*parser).callonAndOperator1, + expr: &ruleRefExpr{ + pos: position{line: 410, col: 4, offset: 8773}, + name: "AndToken", + }, + }, + }, + { + name: "OrOperator", + pos: position{line: 413, col: 1, offset: 8822}, + expr: &actionExpr{ + pos: position{line: 414, col: 4, offset: 8836}, + run: (*parser).callonOrOperator1, + expr: &ruleRefExpr{ + pos: position{line: 414, col: 4, offset: 8836}, + name: "OrToken", + }, + }, + }, + { + name: "CmpOperator", + pos: position{line: 417, col: 1, offset: 8883}, + expr: &actionExpr{ + pos: position{line: 418, col: 4, offset: 8898}, + run: (*parser).callonCmpOperator1, + expr: &choiceExpr{ + pos: position{line: 418, col: 6, offset: 8900}, + alternatives: []interface{}{ + &litMatcher{ + pos: position{line: 418, col: 6, offset: 8900}, + val: "<=", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 418, col: 13, offset: 8907}, + val: ">=", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 418, col: 20, offset: 8914}, + val: "<>", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 418, col: 27, offset: 8921}, + val: "!=", + ignoreCase: false, + }, + &charClassMatcher{ + pos: position{line: 418, col: 34, offset: 8928}, + val: "[<>=]", + chars: []rune{'<', '>', '='}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + }, + { + name: "ConcatOperator", + pos: position{line: 439, col: 1, offset: 9384}, + expr: &actionExpr{ + pos: position{line: 440, col: 4, offset: 9402}, + run: (*parser).callonConcatOperator1, + expr: &litMatcher{ + pos: position{line: 440, col: 4, offset: 9402}, + val: "||", + ignoreCase: false, + }, + }, + }, + { + name: "AddSubOperator", + pos: position{line: 443, col: 1, offset: 9450}, + expr: &actionExpr{ + pos: position{line: 444, col: 4, offset: 9468}, + run: (*parser).callonAddSubOperator1, + expr: &charClassMatcher{ + pos: position{line: 444, col: 4, offset: 9468}, + val: "[+-]", + chars: []rune{'+', '-'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + { + name: "MulDivModOperator", + pos: position{line: 455, col: 1, offset: 9645}, + expr: &actionExpr{ + pos: position{line: 456, col: 4, offset: 9666}, + run: (*parser).callonMulDivModOperator1, + expr: &charClassMatcher{ + pos: position{line: 456, col: 4, offset: 9666}, + val: "[*/%]", + chars: []rune{'*', '/', '%'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + { + name: "DataType", + pos: position{line: 470, col: 1, offset: 9908}, + expr: &choiceExpr{ + pos: position{line: 471, col: 4, offset: 9920}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 471, col: 4, offset: 9920}, + name: "UIntType", + }, + &ruleRefExpr{ + pos: position{line: 472, col: 4, offset: 9932}, + name: "IntType", + }, + &ruleRefExpr{ + pos: position{line: 473, col: 4, offset: 9943}, + name: "UFixedType", + }, + &ruleRefExpr{ + pos: position{line: 474, col: 4, offset: 9957}, + name: "FixedType", + }, + &ruleRefExpr{ + pos: position{line: 475, col: 4, offset: 9970}, + name: "FixedBytesType", + }, + &ruleRefExpr{ + pos: position{line: 476, col: 4, offset: 9988}, + name: "DynamicBytesType", + }, + &ruleRefExpr{ + pos: position{line: 477, col: 4, offset: 10008}, + name: "BoolType", + }, + &ruleRefExpr{ + pos: position{line: 478, col: 4, offset: 10020}, + name: "AddressType", + }, + }, + }, + }, + { + name: "UIntType", + pos: position{line: 480, col: 1, offset: 10033}, + expr: &actionExpr{ + pos: position{line: 481, col: 4, offset: 10045}, + run: (*parser).callonUIntType1, + expr: &seqExpr{ + pos: position{line: 481, col: 4, offset: 10045}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 481, col: 4, offset: 10045}, + val: "uint", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 481, col: 12, offset: 10053}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 481, col: 14, offset: 10055}, + name: "NonZeroLeadingInteger", + }, + }, + ¬Expr{ + pos: position{line: 481, col: 36, offset: 10077}, + expr: &ruleRefExpr{ + pos: position{line: 481, col: 37, offset: 10078}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "IntType", + pos: position{line: 489, col: 1, offset: 10187}, + expr: &actionExpr{ + pos: position{line: 490, col: 4, offset: 10198}, + run: (*parser).callonIntType1, + expr: &seqExpr{ + pos: position{line: 490, col: 4, offset: 10198}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 490, col: 4, offset: 10198}, + val: "int", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 490, col: 11, offset: 10205}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 490, col: 13, offset: 10207}, + name: "NonZeroLeadingInteger", + }, + }, + ¬Expr{ + pos: position{line: 490, col: 35, offset: 10229}, + expr: &ruleRefExpr{ + pos: position{line: 490, col: 36, offset: 10230}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "UFixedType", + pos: position{line: 498, col: 1, offset: 10340}, + expr: &actionExpr{ + pos: position{line: 499, col: 4, offset: 10354}, + run: (*parser).callonUFixedType1, + expr: &seqExpr{ + pos: position{line: 499, col: 4, offset: 10354}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 499, col: 4, offset: 10354}, + val: "ufixed", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 499, col: 14, offset: 10364}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 499, col: 16, offset: 10366}, + name: "NonZeroLeadingInteger", + }, + }, + &litMatcher{ + pos: position{line: 499, col: 38, offset: 10388}, + val: "x", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 499, col: 43, offset: 10393}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 499, col: 45, offset: 10395}, + name: "NonZeroLeadingInteger", + }, + }, + ¬Expr{ + pos: position{line: 499, col: 67, offset: 10417}, + expr: &ruleRefExpr{ + pos: position{line: 499, col: 68, offset: 10418}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "FixedType", + pos: position{line: 508, col: 1, offset: 10585}, + expr: &actionExpr{ + pos: position{line: 509, col: 4, offset: 10598}, + run: (*parser).callonFixedType1, + expr: &seqExpr{ + pos: position{line: 509, col: 4, offset: 10598}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 509, col: 4, offset: 10598}, + val: "fixed", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 509, col: 13, offset: 10607}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 509, col: 15, offset: 10609}, + name: "NonZeroLeadingInteger", + }, + }, + &litMatcher{ + pos: position{line: 509, col: 37, offset: 10631}, + val: "x", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 509, col: 42, offset: 10636}, + label: "t", + expr: &ruleRefExpr{ + pos: position{line: 509, col: 44, offset: 10638}, + name: "NonZeroLeadingInteger", + }, + }, + ¬Expr{ + pos: position{line: 509, col: 66, offset: 10660}, + expr: &ruleRefExpr{ + pos: position{line: 509, col: 67, offset: 10661}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "FixedBytesType", + pos: position{line: 518, col: 1, offset: 10829}, + expr: &choiceExpr{ + pos: position{line: 519, col: 4, offset: 10847}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 519, col: 4, offset: 10847}, + run: (*parser).callonFixedBytesType2, + expr: &seqExpr{ + pos: position{line: 519, col: 4, offset: 10847}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 519, col: 4, offset: 10847}, + val: "bytes", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 519, col: 13, offset: 10856}, + label: "s", + expr: &ruleRefExpr{ + pos: position{line: 519, col: 15, offset: 10858}, + name: "NonZeroLeadingInteger", + }, + }, + ¬Expr{ + pos: position{line: 519, col: 37, offset: 10880}, + expr: &ruleRefExpr{ + pos: position{line: 519, col: 38, offset: 10881}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 521, col: 4, offset: 10970}, + run: (*parser).callonFixedBytesType9, + expr: &seqExpr{ + pos: position{line: 521, col: 4, offset: 10970}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 521, col: 4, offset: 10970}, + val: "byte", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 521, col: 12, offset: 10978}, + expr: &ruleRefExpr{ + pos: position{line: 521, col: 13, offset: 10979}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "DynamicBytesType", + pos: position{line: 524, col: 1, offset: 11049}, + expr: &actionExpr{ + pos: position{line: 525, col: 4, offset: 11069}, + run: (*parser).callonDynamicBytesType1, + expr: &choiceExpr{ + pos: position{line: 525, col: 6, offset: 11071}, + alternatives: []interface{}{ + &seqExpr{ + pos: position{line: 525, col: 6, offset: 11071}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 525, col: 6, offset: 11071}, + val: "bytes", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 525, col: 15, offset: 11080}, + expr: &ruleRefExpr{ + pos: position{line: 525, col: 16, offset: 11081}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + &seqExpr{ + pos: position{line: 526, col: 5, offset: 11106}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 526, col: 5, offset: 11106}, + val: "string", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 526, col: 15, offset: 11116}, + expr: &ruleRefExpr{ + pos: position{line: 526, col: 16, offset: 11117}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + &seqExpr{ + pos: position{line: 527, col: 5, offset: 11142}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 527, col: 5, offset: 11142}, + val: "text", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 527, col: 13, offset: 11150}, + expr: &ruleRefExpr{ + pos: position{line: 527, col: 14, offset: 11151}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "AddressType", + pos: position{line: 531, col: 1, offset: 11219}, + expr: &actionExpr{ + pos: position{line: 532, col: 4, offset: 11234}, + run: (*parser).callonAddressType1, + expr: &seqExpr{ + pos: position{line: 532, col: 4, offset: 11234}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 532, col: 4, offset: 11234}, + val: "address", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 532, col: 15, offset: 11245}, + expr: &ruleRefExpr{ + pos: position{line: 532, col: 16, offset: 11246}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "BoolType", + pos: position{line: 535, col: 1, offset: 11306}, + expr: &actionExpr{ + pos: position{line: 536, col: 4, offset: 11318}, + run: (*parser).callonBoolType1, + expr: &choiceExpr{ + pos: position{line: 536, col: 6, offset: 11320}, + alternatives: []interface{}{ + &seqExpr{ + pos: position{line: 536, col: 6, offset: 11320}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 536, col: 6, offset: 11320}, + val: "bool", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 536, col: 14, offset: 11328}, + expr: &ruleRefExpr{ + pos: position{line: 536, col: 15, offset: 11329}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + &seqExpr{ + pos: position{line: 537, col: 5, offset: 11354}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 537, col: 5, offset: 11354}, + val: "boolean", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 537, col: 16, offset: 11365}, + expr: &ruleRefExpr{ + pos: position{line: 537, col: 17, offset: 11366}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "Value", + pos: position{line: 542, col: 1, offset: 11439}, + expr: &choiceExpr{ + pos: position{line: 543, col: 4, offset: 11448}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 543, col: 4, offset: 11448}, + name: "NumberLiteral", + }, + &ruleRefExpr{ + pos: position{line: 544, col: 4, offset: 11465}, + name: "StringLiteral", + }, + &ruleRefExpr{ + pos: position{line: 545, col: 4, offset: 11482}, + name: "BoolLiteral", + }, + &ruleRefExpr{ + pos: position{line: 546, col: 4, offset: 11497}, + name: "NullLiteral", + }, + }, + }, + }, + { + name: "AnyLiteral", + pos: position{line: 548, col: 1, offset: 11510}, + expr: &actionExpr{ + pos: position{line: 549, col: 4, offset: 11524}, + run: (*parser).callonAnyLiteral1, + expr: &ruleRefExpr{ + pos: position{line: 549, col: 4, offset: 11524}, + name: "AnyToken", + }, + }, + }, + { + name: "DefaultLiteral", + pos: position{line: 552, col: 1, offset: 11569}, + expr: &actionExpr{ + pos: position{line: 553, col: 4, offset: 11587}, + run: (*parser).callonDefaultLiteral1, + expr: &ruleRefExpr{ + pos: position{line: 553, col: 4, offset: 11587}, + name: "DefaultToken", + }, + }, + }, + { + name: "BoolLiteral", + pos: position{line: 556, col: 1, offset: 11640}, + expr: &actionExpr{ + pos: position{line: 557, col: 4, offset: 11655}, + run: (*parser).callonBoolLiteral1, + expr: &labeledExpr{ + pos: position{line: 557, col: 4, offset: 11655}, + label: "b", + expr: &choiceExpr{ + pos: position{line: 557, col: 8, offset: 11659}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 557, col: 8, offset: 11659}, + name: "TrueToken", + }, + &ruleRefExpr{ + pos: position{line: 557, col: 20, offset: 11671}, + name: "FalseToken", + }, + }, + }, + }, + }, + }, + { + name: "NullLiteral", + pos: position{line: 560, col: 1, offset: 11752}, + expr: &actionExpr{ + pos: position{line: 561, col: 4, offset: 11767}, + run: (*parser).callonNullLiteral1, + expr: &ruleRefExpr{ + pos: position{line: 561, col: 4, offset: 11767}, + name: "NullToken", + }, + }, + }, + { + name: "NumberLiteral", + pos: position{line: 564, col: 1, offset: 11814}, + expr: &choiceExpr{ + pos: position{line: 565, col: 4, offset: 11831}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 565, col: 4, offset: 11831}, + run: (*parser).callonNumberLiteral2, + expr: &seqExpr{ + pos: position{line: 565, col: 4, offset: 11831}, + exprs: []interface{}{ + &andExpr{ + pos: position{line: 565, col: 4, offset: 11831}, + expr: &seqExpr{ + pos: position{line: 565, col: 6, offset: 11833}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 565, col: 6, offset: 11833}, + val: "0", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 565, col: 10, offset: 11837}, + val: "x", + ignoreCase: true, + }, + }, + }, + }, + &labeledExpr{ + pos: position{line: 565, col: 16, offset: 11843}, + label: "h", + expr: &ruleRefExpr{ + pos: position{line: 565, col: 18, offset: 11845}, + name: "Hex", + }, + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 566, col: 4, offset: 11870}, + name: "Decimal", + }, + }, + }, + }, + { + name: "Sign", + pos: position{line: 568, col: 1, offset: 11879}, + expr: &charClassMatcher{ + pos: position{line: 569, col: 4, offset: 11887}, + val: "[-+]", + chars: []rune{'-', '+'}, + ignoreCase: false, + inverted: false, + }, + }, + { + name: "Integer", + pos: position{line: 571, col: 1, offset: 11893}, + expr: &actionExpr{ + pos: position{line: 572, col: 4, offset: 11904}, + run: (*parser).callonInteger1, + expr: &oneOrMoreExpr{ + pos: position{line: 572, col: 4, offset: 11904}, + expr: &charClassMatcher{ + pos: position{line: 572, col: 4, offset: 11904}, + val: "[0-9]", + ranges: []rune{'0', '9'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + { + name: "NonZeroLeadingInteger", + pos: position{line: 575, col: 1, offset: 11971}, + expr: &actionExpr{ + pos: position{line: 576, col: 4, offset: 11996}, + run: (*parser).callonNonZeroLeadingInteger1, + expr: &choiceExpr{ + pos: position{line: 576, col: 6, offset: 11998}, + alternatives: []interface{}{ + &litMatcher{ + pos: position{line: 576, col: 6, offset: 11998}, + val: "0", + ignoreCase: false, + }, + &seqExpr{ + pos: position{line: 576, col: 12, offset: 12004}, + exprs: []interface{}{ + &charClassMatcher{ + pos: position{line: 576, col: 12, offset: 12004}, + val: "[1-9]", + ranges: []rune{'1', '9'}, + ignoreCase: false, + inverted: false, + }, + &zeroOrMoreExpr{ + pos: position{line: 576, col: 17, offset: 12009}, + expr: &charClassMatcher{ + pos: position{line: 576, col: 17, offset: 12009}, + val: "[0-9]", + ranges: []rune{'0', '9'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "Fixnum", + pos: position{line: 579, col: 1, offset: 12042}, + expr: &choiceExpr{ + pos: position{line: 580, col: 4, offset: 12052}, + alternatives: []interface{}{ + &seqExpr{ + pos: position{line: 580, col: 4, offset: 12052}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 580, col: 4, offset: 12052}, + name: "Integer", + }, + &litMatcher{ + pos: position{line: 580, col: 12, offset: 12060}, + val: ".", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 580, col: 16, offset: 12064}, + name: "Integer", + }, + }, + }, + &seqExpr{ + pos: position{line: 581, col: 4, offset: 12075}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 581, col: 4, offset: 12075}, + name: "Integer", + }, + &zeroOrOneExpr{ + pos: position{line: 581, col: 12, offset: 12083}, + expr: &litMatcher{ + pos: position{line: 581, col: 12, offset: 12083}, + val: ".", + ignoreCase: false, + }, + }, + }, + }, + &seqExpr{ + pos: position{line: 582, col: 4, offset: 12091}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 582, col: 4, offset: 12091}, + val: ".", + ignoreCase: false, + }, + &ruleRefExpr{ + pos: position{line: 582, col: 8, offset: 12095}, + name: "Integer", + }, + }, + }, + }, + }, + }, + { + name: "Decimal", + pos: position{line: 584, col: 1, offset: 12104}, + expr: &actionExpr{ + pos: position{line: 585, col: 4, offset: 12115}, + run: (*parser).callonDecimal1, + expr: &seqExpr{ + pos: position{line: 585, col: 4, offset: 12115}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 585, col: 4, offset: 12115}, + name: "Fixnum", + }, + &zeroOrOneExpr{ + pos: position{line: 585, col: 11, offset: 12122}, + expr: &seqExpr{ + pos: position{line: 585, col: 13, offset: 12124}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 585, col: 13, offset: 12124}, + val: "e", + ignoreCase: true, + }, + &zeroOrOneExpr{ + pos: position{line: 585, col: 18, offset: 12129}, + expr: &ruleRefExpr{ + pos: position{line: 585, col: 18, offset: 12129}, + name: "Sign", + }, + }, + &ruleRefExpr{ + pos: position{line: 585, col: 24, offset: 12135}, + name: "Integer", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "Hex", + pos: position{line: 588, col: 1, offset: 12206}, + expr: &actionExpr{ + pos: position{line: 589, col: 4, offset: 12213}, + run: (*parser).callonHex1, + expr: &seqExpr{ + pos: position{line: 589, col: 4, offset: 12213}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 589, col: 4, offset: 12213}, + val: "0", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 589, col: 8, offset: 12217}, + val: "x", + ignoreCase: true, + }, + &labeledExpr{ + pos: position{line: 589, col: 13, offset: 12222}, + label: "s", + expr: &oneOrMoreExpr{ + pos: position{line: 589, col: 15, offset: 12224}, + expr: &charClassMatcher{ + pos: position{line: 589, col: 17, offset: 12226}, + val: "[0-9A-Fa-f]", + ranges: []rune{'0', '9', 'A', 'F', 'a', 'f'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + ¬Expr{ + pos: position{line: 589, col: 32, offset: 12241}, + expr: &ruleRefExpr{ + pos: position{line: 589, col: 33, offset: 12242}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "StringLiteral", + pos: position{line: 592, col: 1, offset: 12307}, + expr: &choiceExpr{ + pos: position{line: 593, col: 4, offset: 12324}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 593, col: 4, offset: 12324}, + name: "HexString", + }, + &ruleRefExpr{ + pos: position{line: 594, col: 4, offset: 12337}, + name: "NormalString", + }, + }, + }, + }, + { + name: "HexString", + pos: position{line: 596, col: 1, offset: 12351}, + expr: &actionExpr{ + pos: position{line: 597, col: 4, offset: 12364}, + run: (*parser).callonHexString1, + expr: &seqExpr{ + pos: position{line: 597, col: 4, offset: 12364}, + exprs: []interface{}{ + &choiceExpr{ + pos: position{line: 597, col: 6, offset: 12366}, + alternatives: []interface{}{ + &litMatcher{ + pos: position{line: 597, col: 6, offset: 12366}, + val: "hex", + ignoreCase: true, + }, + &litMatcher{ + pos: position{line: 597, col: 15, offset: 12375}, + val: "x", + ignoreCase: true, + }, + }, + }, + &litMatcher{ + pos: position{line: 597, col: 22, offset: 12382}, + val: "'", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 597, col: 26, offset: 12386}, + label: "s", + expr: &zeroOrMoreExpr{ + pos: position{line: 597, col: 28, offset: 12388}, + expr: &actionExpr{ + pos: position{line: 597, col: 29, offset: 12389}, + run: (*parser).callonHexString9, + expr: &seqExpr{ + pos: position{line: 597, col: 29, offset: 12389}, + exprs: []interface{}{ + &charClassMatcher{ + pos: position{line: 597, col: 29, offset: 12389}, + val: "[0-9a-fA-F]", + ranges: []rune{'0', '9', 'a', 'f', 'A', 'F'}, + ignoreCase: false, + inverted: false, + }, + &charClassMatcher{ + pos: position{line: 597, col: 40, offset: 12400}, + val: "[0-9a-fA-F]", + ranges: []rune{'0', '9', 'a', 'f', 'A', 'F'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 597, col: 78, offset: 12438}, + val: "'", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "NormalString", + pos: position{line: 600, col: 1, offset: 12507}, + expr: &actionExpr{ + pos: position{line: 601, col: 4, offset: 12523}, + run: (*parser).callonNormalString1, + expr: &seqExpr{ + pos: position{line: 601, col: 4, offset: 12523}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 601, col: 4, offset: 12523}, + val: "'", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 601, col: 8, offset: 12527}, + label: "s", + expr: &zeroOrMoreExpr{ + pos: position{line: 601, col: 10, offset: 12529}, + expr: &actionExpr{ + pos: position{line: 601, col: 12, offset: 12531}, + run: (*parser).callonNormalString6, + expr: &choiceExpr{ + pos: position{line: 601, col: 14, offset: 12533}, + alternatives: []interface{}{ + &charClassMatcher{ + pos: position{line: 601, col: 14, offset: 12533}, + val: "[^'\\r\\n\\\\]", + chars: []rune{'\'', '\r', '\n', '\\'}, + ignoreCase: false, + inverted: true, + }, + &seqExpr{ + pos: position{line: 601, col: 27, offset: 12546}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 601, col: 27, offset: 12546}, + val: "\\", + ignoreCase: false, + }, + &anyMatcher{ + line: 601, col: 32, offset: 12551, + }, + }, + }, + }, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 601, col: 62, offset: 12581}, + val: "'", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "SelectToken", + pos: position{line: 605, col: 1, offset: 12666}, + expr: &seqExpr{ + pos: position{line: 606, col: 4, offset: 12681}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 606, col: 4, offset: 12681}, + val: "select", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 606, col: 14, offset: 12691}, + expr: &ruleRefExpr{ + pos: position{line: 606, col: 15, offset: 12692}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "FromToken", + pos: position{line: 608, col: 1, offset: 12714}, + expr: &seqExpr{ + pos: position{line: 609, col: 4, offset: 12727}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 609, col: 4, offset: 12727}, + val: "from", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 609, col: 12, offset: 12735}, + expr: &ruleRefExpr{ + pos: position{line: 609, col: 13, offset: 12736}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "WhereToken", + pos: position{line: 611, col: 1, offset: 12758}, + expr: &seqExpr{ + pos: position{line: 612, col: 4, offset: 12772}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 612, col: 4, offset: 12772}, + val: "where", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 612, col: 13, offset: 12781}, + expr: &ruleRefExpr{ + pos: position{line: 612, col: 14, offset: 12782}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "OrderToken", + pos: position{line: 614, col: 1, offset: 12804}, + expr: &seqExpr{ + pos: position{line: 615, col: 4, offset: 12818}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 615, col: 4, offset: 12818}, + val: "order", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 615, col: 13, offset: 12827}, + expr: &ruleRefExpr{ + pos: position{line: 615, col: 14, offset: 12828}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "ByToken", + pos: position{line: 617, col: 1, offset: 12850}, + expr: &seqExpr{ + pos: position{line: 618, col: 4, offset: 12861}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 618, col: 4, offset: 12861}, + val: "by", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 618, col: 10, offset: 12867}, + expr: &ruleRefExpr{ + pos: position{line: 618, col: 11, offset: 12868}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "GroupToken", + pos: position{line: 620, col: 1, offset: 12890}, + expr: &seqExpr{ + pos: position{line: 621, col: 4, offset: 12904}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 621, col: 4, offset: 12904}, + val: "group", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 621, col: 13, offset: 12913}, + expr: &ruleRefExpr{ + pos: position{line: 621, col: 14, offset: 12914}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "LimitToken", + pos: position{line: 623, col: 1, offset: 12936}, + expr: &seqExpr{ + pos: position{line: 624, col: 4, offset: 12950}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 624, col: 4, offset: 12950}, + val: "limit", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 624, col: 13, offset: 12959}, + expr: &ruleRefExpr{ + pos: position{line: 624, col: 14, offset: 12960}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "OffsetToken", + pos: position{line: 626, col: 1, offset: 12982}, + expr: &seqExpr{ + pos: position{line: 627, col: 4, offset: 12997}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 627, col: 4, offset: 12997}, + val: "offset", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 627, col: 14, offset: 13007}, + expr: &ruleRefExpr{ + pos: position{line: 627, col: 15, offset: 13008}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "UpdateToken", + pos: position{line: 629, col: 1, offset: 13030}, + expr: &seqExpr{ + pos: position{line: 630, col: 4, offset: 13045}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 630, col: 4, offset: 13045}, + val: "update", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 630, col: 14, offset: 13055}, + expr: &ruleRefExpr{ + pos: position{line: 630, col: 15, offset: 13056}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "SetToken", + pos: position{line: 632, col: 1, offset: 13078}, + expr: &seqExpr{ + pos: position{line: 633, col: 4, offset: 13090}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 633, col: 4, offset: 13090}, + val: "set", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 633, col: 11, offset: 13097}, + expr: &ruleRefExpr{ + pos: position{line: 633, col: 12, offset: 13098}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "DeleteToken", + pos: position{line: 635, col: 1, offset: 13120}, + expr: &seqExpr{ + pos: position{line: 636, col: 4, offset: 13135}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 636, col: 4, offset: 13135}, + val: "delete", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 636, col: 14, offset: 13145}, + expr: &ruleRefExpr{ + pos: position{line: 636, col: 15, offset: 13146}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "InsertToken", + pos: position{line: 638, col: 1, offset: 13168}, + expr: &seqExpr{ + pos: position{line: 639, col: 4, offset: 13183}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 639, col: 4, offset: 13183}, + val: "insert", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 639, col: 14, offset: 13193}, + expr: &ruleRefExpr{ + pos: position{line: 639, col: 15, offset: 13194}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "IntoToken", + pos: position{line: 641, col: 1, offset: 13216}, + expr: &seqExpr{ + pos: position{line: 642, col: 4, offset: 13229}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 642, col: 4, offset: 13229}, + val: "into", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 642, col: 12, offset: 13237}, + expr: &ruleRefExpr{ + pos: position{line: 642, col: 13, offset: 13238}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "ValuesToken", + pos: position{line: 644, col: 1, offset: 13260}, + expr: &seqExpr{ + pos: position{line: 645, col: 4, offset: 13275}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 645, col: 4, offset: 13275}, + val: "values", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 645, col: 14, offset: 13285}, + expr: &ruleRefExpr{ + pos: position{line: 645, col: 15, offset: 13286}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "CreateToken", + pos: position{line: 647, col: 1, offset: 13308}, + expr: &seqExpr{ + pos: position{line: 648, col: 4, offset: 13323}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 648, col: 4, offset: 13323}, + val: "create", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 648, col: 14, offset: 13333}, + expr: &ruleRefExpr{ + pos: position{line: 648, col: 15, offset: 13334}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "TableToken", + pos: position{line: 650, col: 1, offset: 13356}, + expr: &seqExpr{ + pos: position{line: 651, col: 4, offset: 13370}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 651, col: 4, offset: 13370}, + val: "table", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 651, col: 13, offset: 13379}, + expr: &ruleRefExpr{ + pos: position{line: 651, col: 14, offset: 13380}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "IndexToken", + pos: position{line: 653, col: 1, offset: 13402}, + expr: &seqExpr{ + pos: position{line: 654, col: 4, offset: 13416}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 654, col: 4, offset: 13416}, + val: "index", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 654, col: 13, offset: 13425}, + expr: &ruleRefExpr{ + pos: position{line: 654, col: 14, offset: 13426}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "UniqueToken", + pos: position{line: 656, col: 1, offset: 13448}, + expr: &seqExpr{ + pos: position{line: 657, col: 4, offset: 13463}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 657, col: 4, offset: 13463}, + val: "unique", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 657, col: 14, offset: 13473}, + expr: &ruleRefExpr{ + pos: position{line: 657, col: 15, offset: 13474}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "DefaultToken", + pos: position{line: 659, col: 1, offset: 13496}, + expr: &seqExpr{ + pos: position{line: 660, col: 4, offset: 13512}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 660, col: 4, offset: 13512}, + val: "default", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 660, col: 15, offset: 13523}, + expr: &ruleRefExpr{ + pos: position{line: 660, col: 16, offset: 13524}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "PrimaryToken", + pos: position{line: 662, col: 1, offset: 13546}, + expr: &seqExpr{ + pos: position{line: 663, col: 4, offset: 13562}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 663, col: 4, offset: 13562}, + val: "primary", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 663, col: 15, offset: 13573}, + expr: &ruleRefExpr{ + pos: position{line: 663, col: 16, offset: 13574}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "KeyToken", + pos: position{line: 665, col: 1, offset: 13596}, + expr: &seqExpr{ + pos: position{line: 666, col: 4, offset: 13608}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 666, col: 4, offset: 13608}, + val: "key", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 666, col: 11, offset: 13615}, + expr: &ruleRefExpr{ + pos: position{line: 666, col: 12, offset: 13616}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "ReferencesToken", + pos: position{line: 668, col: 1, offset: 13638}, + expr: &seqExpr{ + pos: position{line: 669, col: 4, offset: 13657}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 669, col: 4, offset: 13657}, + val: "references", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 669, col: 18, offset: 13671}, + expr: &ruleRefExpr{ + pos: position{line: 669, col: 19, offset: 13672}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "AutoincrementToken", + pos: position{line: 671, col: 1, offset: 13694}, + expr: &seqExpr{ + pos: position{line: 672, col: 4, offset: 13716}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 672, col: 4, offset: 13716}, + val: "autoincrement", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 672, col: 21, offset: 13733}, + expr: &ruleRefExpr{ + pos: position{line: 672, col: 22, offset: 13734}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "OnToken", + pos: position{line: 674, col: 1, offset: 13756}, + expr: &seqExpr{ + pos: position{line: 675, col: 4, offset: 13767}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 675, col: 4, offset: 13767}, + val: "on", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 675, col: 10, offset: 13773}, + expr: &ruleRefExpr{ + pos: position{line: 675, col: 11, offset: 13774}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "TrueToken", + pos: position{line: 677, col: 1, offset: 13796}, + expr: &actionExpr{ + pos: position{line: 678, col: 4, offset: 13809}, + run: (*parser).callonTrueToken1, + expr: &seqExpr{ + pos: position{line: 678, col: 4, offset: 13809}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 678, col: 4, offset: 13809}, + val: "true", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 678, col: 12, offset: 13817}, + expr: &ruleRefExpr{ + pos: position{line: 678, col: 13, offset: 13818}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "FalseToken", + pos: position{line: 681, col: 1, offset: 13872}, + expr: &actionExpr{ + pos: position{line: 682, col: 4, offset: 13886}, + run: (*parser).callonFalseToken1, + expr: &seqExpr{ + pos: position{line: 682, col: 4, offset: 13886}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 682, col: 4, offset: 13886}, + val: "false", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 682, col: 13, offset: 13895}, + expr: &ruleRefExpr{ + pos: position{line: 682, col: 14, offset: 13896}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "NullToken", + pos: position{line: 685, col: 1, offset: 13950}, + expr: &seqExpr{ + pos: position{line: 686, col: 4, offset: 13963}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 686, col: 4, offset: 13963}, + val: "null", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 686, col: 12, offset: 13971}, + expr: &ruleRefExpr{ + pos: position{line: 686, col: 13, offset: 13972}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "IsToken", + pos: position{line: 688, col: 1, offset: 13994}, + expr: &seqExpr{ + pos: position{line: 689, col: 4, offset: 14005}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 689, col: 4, offset: 14005}, + val: "is", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 689, col: 10, offset: 14011}, + expr: &ruleRefExpr{ + pos: position{line: 689, col: 11, offset: 14012}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "NullsToken", + pos: position{line: 691, col: 1, offset: 14034}, + expr: &seqExpr{ + pos: position{line: 692, col: 4, offset: 14048}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 692, col: 4, offset: 14048}, + val: "nulls", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 692, col: 13, offset: 14057}, + expr: &ruleRefExpr{ + pos: position{line: 692, col: 14, offset: 14058}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "LastToken", + pos: position{line: 694, col: 1, offset: 14080}, + expr: &actionExpr{ + pos: position{line: 695, col: 4, offset: 14093}, + run: (*parser).callonLastToken1, + expr: &seqExpr{ + pos: position{line: 695, col: 4, offset: 14093}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 695, col: 4, offset: 14093}, + val: "last", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 695, col: 12, offset: 14101}, + expr: &ruleRefExpr{ + pos: position{line: 695, col: 13, offset: 14102}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "FirstToken", + pos: position{line: 698, col: 1, offset: 14156}, + expr: &actionExpr{ + pos: position{line: 699, col: 4, offset: 14170}, + run: (*parser).callonFirstToken1, + expr: &seqExpr{ + pos: position{line: 699, col: 4, offset: 14170}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 699, col: 4, offset: 14170}, + val: "first", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 699, col: 13, offset: 14179}, + expr: &ruleRefExpr{ + pos: position{line: 699, col: 14, offset: 14180}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "AndToken", + pos: position{line: 702, col: 1, offset: 14234}, + expr: &seqExpr{ + pos: position{line: 703, col: 4, offset: 14246}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 703, col: 4, offset: 14246}, + val: "and", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 703, col: 11, offset: 14253}, + expr: &ruleRefExpr{ + pos: position{line: 703, col: 12, offset: 14254}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "OrToken", + pos: position{line: 705, col: 1, offset: 14276}, + expr: &seqExpr{ + pos: position{line: 706, col: 4, offset: 14287}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 706, col: 4, offset: 14287}, + val: "or", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 706, col: 10, offset: 14293}, + expr: &ruleRefExpr{ + pos: position{line: 706, col: 11, offset: 14294}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "NotToken", + pos: position{line: 708, col: 1, offset: 14316}, + expr: &seqExpr{ + pos: position{line: 709, col: 4, offset: 14328}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 709, col: 4, offset: 14328}, + val: "not", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 709, col: 11, offset: 14335}, + expr: &ruleRefExpr{ + pos: position{line: 709, col: 12, offset: 14336}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "InToken", + pos: position{line: 711, col: 1, offset: 14358}, + expr: &seqExpr{ + pos: position{line: 712, col: 4, offset: 14369}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 712, col: 4, offset: 14369}, + val: "in", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 712, col: 10, offset: 14375}, + expr: &ruleRefExpr{ + pos: position{line: 712, col: 11, offset: 14376}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "LikeToken", + pos: position{line: 714, col: 1, offset: 14398}, + expr: &seqExpr{ + pos: position{line: 715, col: 4, offset: 14411}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 715, col: 4, offset: 14411}, + val: "like", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 715, col: 12, offset: 14419}, + expr: &ruleRefExpr{ + pos: position{line: 715, col: 13, offset: 14420}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "AscToken", + pos: position{line: 717, col: 1, offset: 14442}, + expr: &actionExpr{ + pos: position{line: 718, col: 4, offset: 14454}, + run: (*parser).callonAscToken1, + expr: &seqExpr{ + pos: position{line: 718, col: 4, offset: 14454}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 718, col: 4, offset: 14454}, + val: "asc", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 718, col: 11, offset: 14461}, + expr: &ruleRefExpr{ + pos: position{line: 718, col: 12, offset: 14462}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "DescToken", + pos: position{line: 721, col: 1, offset: 14516}, + expr: &actionExpr{ + pos: position{line: 722, col: 4, offset: 14529}, + run: (*parser).callonDescToken1, + expr: &seqExpr{ + pos: position{line: 722, col: 4, offset: 14529}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 722, col: 4, offset: 14529}, + val: "desc", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 722, col: 12, offset: 14537}, + expr: &ruleRefExpr{ + pos: position{line: 722, col: 13, offset: 14538}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "CastToken", + pos: position{line: 725, col: 1, offset: 14592}, + expr: &seqExpr{ + pos: position{line: 726, col: 4, offset: 14605}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 726, col: 4, offset: 14605}, + val: "cast", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 726, col: 12, offset: 14613}, + expr: &ruleRefExpr{ + pos: position{line: 726, col: 13, offset: 14614}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "AsToken", + pos: position{line: 728, col: 1, offset: 14636}, + expr: &seqExpr{ + pos: position{line: 729, col: 4, offset: 14647}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 729, col: 4, offset: 14647}, + val: "as", + ignoreCase: true, + }, + ¬Expr{ + pos: position{line: 729, col: 10, offset: 14653}, + expr: &ruleRefExpr{ + pos: position{line: 729, col: 11, offset: 14654}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + { + name: "SeparatorToken", + pos: position{line: 731, col: 1, offset: 14676}, + expr: &litMatcher{ + pos: position{line: 732, col: 4, offset: 14694}, + val: ",", + ignoreCase: false, + }, + }, + { + name: "AnyToken", + pos: position{line: 734, col: 1, offset: 14699}, + expr: &litMatcher{ + pos: position{line: 735, col: 4, offset: 14711}, + val: "*", + ignoreCase: false, + }, + }, + { + name: "Identifier", + pos: position{line: 738, col: 1, offset: 14734}, + expr: &choiceExpr{ + pos: position{line: 739, col: 4, offset: 14748}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 739, col: 4, offset: 14748}, + name: "NormalIdentifier", + }, + &ruleRefExpr{ + pos: position{line: 740, col: 4, offset: 14768}, + name: "StringIdentifier", + }, + }, + }, + }, + { + name: "NormalIdentifier", + pos: position{line: 742, col: 1, offset: 14786}, + expr: &actionExpr{ + pos: position{line: 743, col: 4, offset: 14806}, + run: (*parser).callonNormalIdentifier1, + expr: &seqExpr{ + pos: position{line: 743, col: 4, offset: 14806}, + exprs: []interface{}{ + &ruleRefExpr{ + pos: position{line: 743, col: 4, offset: 14806}, + name: "NormalIdentifierStart", + }, + &zeroOrMoreExpr{ + pos: position{line: 743, col: 26, offset: 14828}, + expr: &ruleRefExpr{ + pos: position{line: 743, col: 26, offset: 14828}, + name: "NormalIdentifierRest", + }, + }, + }, + }, + }, + }, + { + name: "NormalIdentifierStart", + pos: position{line: 746, col: 1, offset: 14900}, + expr: &charClassMatcher{ + pos: position{line: 747, col: 4, offset: 14925}, + val: "[a-zA-Z@#_\\u0080-\\uffff]", + chars: []rune{'@', '#', '_'}, + ranges: []rune{'a', 'z', 'A', 'Z', '\u0080', '\uffff'}, + ignoreCase: false, + inverted: false, + }, + }, + { + name: "NormalIdentifierRest", + pos: position{line: 749, col: 1, offset: 14951}, + expr: &charClassMatcher{ + pos: position{line: 750, col: 4, offset: 14975}, + val: "[a-zA-Z0-9@#$_\\u0080-\\uffff]", + chars: []rune{'@', '#', '$', '_'}, + ranges: []rune{'a', 'z', 'A', 'Z', '0', '9', '\u0080', '\uffff'}, + ignoreCase: false, + inverted: false, + }, + }, + { + name: "StringIdentifier", + pos: position{line: 752, col: 1, offset: 15005}, + expr: &actionExpr{ + pos: position{line: 753, col: 4, offset: 15025}, + run: (*parser).callonStringIdentifier1, + expr: &seqExpr{ + pos: position{line: 753, col: 4, offset: 15025}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 753, col: 4, offset: 15025}, + val: "\"", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 753, col: 9, offset: 15030}, + label: "s", + expr: &zeroOrMoreExpr{ + pos: position{line: 753, col: 11, offset: 15032}, + expr: &actionExpr{ + pos: position{line: 753, col: 13, offset: 15034}, + run: (*parser).callonStringIdentifier6, + expr: &choiceExpr{ + pos: position{line: 753, col: 15, offset: 15036}, + alternatives: []interface{}{ + &charClassMatcher{ + pos: position{line: 753, col: 15, offset: 15036}, + val: "[^\"\\r\\n\\\\]", + chars: []rune{'"', '\r', '\n', '\\'}, + ignoreCase: false, + inverted: true, + }, + &seqExpr{ + pos: position{line: 753, col: 28, offset: 15049}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 753, col: 28, offset: 15049}, + val: "\\", + ignoreCase: false, + }, + &anyMatcher{ + line: 753, col: 33, offset: 15054, + }, + }, + }, + }, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 753, col: 63, offset: 15084}, + val: "\"", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "_", + pos: position{line: 759, col: 1, offset: 15172}, + expr: &zeroOrMoreExpr{ + pos: position{line: 760, col: 4, offset: 15177}, + expr: &choiceExpr{ + pos: position{line: 760, col: 6, offset: 15179}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 760, col: 6, offset: 15179}, + name: "Whitespace", + }, + &ruleRefExpr{ + pos: position{line: 760, col: 19, offset: 15192}, + name: "Newline", + }, + }, + }, + }, + }, + { + name: "Newline", + pos: position{line: 762, col: 1, offset: 15204}, + expr: &choiceExpr{ + pos: position{line: 763, col: 4, offset: 15215}, + alternatives: []interface{}{ + &litMatcher{ + pos: position{line: 763, col: 4, offset: 15215}, + val: "\r\n", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 764, col: 4, offset: 15225}, + val: "\r", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 765, col: 4, offset: 15233}, + val: "\n", + ignoreCase: false, + }, + }, + }, + }, + { + name: "Whitespace", + pos: position{line: 767, col: 1, offset: 15239}, + expr: &choiceExpr{ + pos: position{line: 768, col: 4, offset: 15253}, + alternatives: []interface{}{ + &litMatcher{ + pos: position{line: 768, col: 4, offset: 15253}, + val: " ", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 769, col: 4, offset: 15260}, + val: "\t", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 770, col: 4, offset: 15268}, + val: "\v", + ignoreCase: false, + }, + &litMatcher{ + pos: position{line: 771, col: 4, offset: 15276}, + val: "\f", + ignoreCase: false, + }, + }, + }, + }, + { + name: "EOF", + pos: position{line: 773, col: 1, offset: 15282}, + expr: ¬Expr{ + pos: position{line: 774, col: 4, offset: 15289}, + expr: &anyMatcher{ + line: 774, col: 5, offset: 15290, + }, + }, + }, + }, +} + +func (c *current) onS10(s interface{}) (interface{}, error) { + return s, nil +} + +func (p *parser) callonS10() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onS10(stack["s"]) +} + +func (c *current) onS1(x, xs interface{}) (interface{}, error) { + return prepend(x, xs), nil +} + +func (p *parser) callonS1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onS1(stack["x"], stack["xs"]) +} + +func (c *current) onSelectStmt9(s interface{}) (interface{}, error) { + return s, nil +} + +func (p *parser) callonSelectStmt9() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt9(stack["s"]) +} + +func (c *current) onSelectStmt18(i interface{}) (interface{}, error) { + return i, nil +} + +func (p *parser) callonSelectStmt18() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt18(stack["i"]) +} + +func (c *current) onSelectStmt27(w interface{}) (interface{}, error) { + return w, nil +} + +func (p *parser) callonSelectStmt27() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt27(stack["w"]) +} + +func (c *current) onSelectStmt34(g interface{}) (interface{}, error) { + return g, nil +} + +func (p *parser) callonSelectStmt34() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt34(stack["g"]) +} + +func (c *current) onSelectStmt41(or interface{}) (interface{}, error) { + return or, nil +} + +func (p *parser) callonSelectStmt41() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt41(stack["or"]) +} + +func (c *current) onSelectStmt48(l interface{}) (interface{}, error) { + return l, nil +} + +func (p *parser) callonSelectStmt48() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt48(stack["l"]) +} + +func (c *current) onSelectStmt55(of interface{}) (interface{}, error) { + return of, nil +} + +func (p *parser) callonSelectStmt55() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt55(stack["of"]) +} + +func (c *current) onSelectStmt1(f, fs, table, where, group, order, limit, offset interface{}) (interface{}, error) { + var ( + tableNode *ast.IdentifierNode + whereNode *ast.WhereOptionNode + limitNode *ast.LimitOptionNode + offsetNode *ast.OffsetOptionNode + ) + if table != nil { + t := table.(ast.IdentifierNode) + tableNode = &t + } + if where != nil { + w := where.(ast.WhereOptionNode) + whereNode = &w + } + if limit != nil { + l := limit.(ast.LimitOptionNode) + limitNode = &l + } + if offset != nil { + o := offset.(ast.OffsetOptionNode) + offsetNode = &o + } + return ast.SelectStmtNode{ + Column: prepend(f, fs), + Table: tableNode, + Where: whereNode, + Group: toSlice(group), + Order: toSlice(order), + Limit: limitNode, + Offset: offsetNode, + }, nil +} + +func (p *parser) callonSelectStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSelectStmt1(stack["f"], stack["fs"], stack["table"], stack["where"], stack["group"], stack["order"], stack["limit"], stack["offset"]) +} + +func (c *current) onUpdateStmt14(s interface{}) (interface{}, error) { + return s, nil +} + +func (p *parser) callonUpdateStmt14() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUpdateStmt14(stack["s"]) +} + +func (c *current) onUpdateStmt23(w interface{}) (interface{}, error) { + return w, nil +} + +func (p *parser) callonUpdateStmt23() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUpdateStmt23(stack["w"]) +} + +func (c *current) onUpdateStmt1(table, a, as, where interface{}) (interface{}, error) { + var ( + whereNode *ast.WhereOptionNode + ) + if where != nil { + w := where.(ast.WhereOptionNode) + whereNode = &w + } + return ast.UpdateStmtNode{ + Table: table.(ast.IdentifierNode), + Assignment: prepend(a, as), + Where: whereNode, + }, nil +} + +func (p *parser) callonUpdateStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUpdateStmt1(stack["table"], stack["a"], stack["as"], stack["where"]) +} + +func (c *current) onDeleteStmt11(w interface{}) (interface{}, error) { + return w, nil +} + +func (p *parser) callonDeleteStmt11() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDeleteStmt11(stack["w"]) +} + +func (c *current) onDeleteStmt1(table, where interface{}) (interface{}, error) { + var ( + whereNode *ast.WhereOptionNode + ) + if where != nil { + w := where.(ast.WhereOptionNode) + whereNode = &w + } + return ast.DeleteStmtNode{ + Table: table.(ast.IdentifierNode), + Where: whereNode, + }, nil +} + +func (p *parser) callonDeleteStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDeleteStmt1(stack["table"], stack["where"]) +} + +func (c *current) onInsertStmt1(table, insert interface{}) (interface{}, error) { + return ast.InsertStmtNode{ + Table: table.(ast.IdentifierNode), + Insert: insert, + }, nil +} + +func (p *parser) callonInsertStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertStmt1(stack["table"], stack["insert"]) +} + +func (c *current) onInsertValue1(e interface{}) (interface{}, error) { + return e, nil +} + +func (p *parser) callonInsertValue1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertValue1(stack["e"]) +} + +func (c *current) onCreateTableStmt20(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonCreateTableStmt20() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateTableStmt20(stack["t"]) +} + +func (c *current) onCreateTableStmt14(s, ss interface{}) (interface{}, error) { + return prepend(s, ss), nil +} + +func (p *parser) callonCreateTableStmt14() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateTableStmt14(stack["s"], stack["ss"]) +} + +func (c *current) onCreateTableStmt1(table, column interface{}) (interface{}, error) { + return ast.CreateTableStmtNode{ + Table: table.(ast.IdentifierNode), + Column: toSlice(column), + }, nil +} + +func (p *parser) callonCreateTableStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateTableStmt1(stack["table"], stack["column"]) +} + +func (c *current) onColumnSchema10(s interface{}) (interface{}, error) { + return s, nil +} + +func (p *parser) callonColumnSchema10() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onColumnSchema10(stack["s"]) +} + +func (c *current) onColumnSchema1(i, t, cs interface{}) (interface{}, error) { + return ast.ColumnSchemaNode{ + Column: i.(ast.IdentifierNode), + DataType: t, + Constraint: toSlice(cs), + }, nil +} + +func (p *parser) callonColumnSchema1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onColumnSchema1(stack["i"], stack["t"], stack["cs"]) +} + +func (c *current) onCreateIndexStmt6(u interface{}) (interface{}, error) { + return u, nil +} + +func (p *parser) callonCreateIndexStmt6() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateIndexStmt6(stack["u"]) +} + +func (c *current) onCreateIndexStmt28(x interface{}) (interface{}, error) { + return x, nil +} + +func (p *parser) callonCreateIndexStmt28() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateIndexStmt28(stack["x"]) +} + +func (c *current) onCreateIndexStmt1(unique, index, table, i, is interface{}) (interface{}, error) { + var ( + uniqueNode *ast.UniqueOptionNode + ) + if unique != nil { + u := unique.(ast.UniqueOptionNode) + uniqueNode = &u + } + return ast.CreateIndexStmtNode{ + Index: index.(ast.IdentifierNode), + Table: table.(ast.IdentifierNode), + Column: prepend(i, is), + Unique: uniqueNode, + }, nil +} + +func (p *parser) callonCreateIndexStmt1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCreateIndexStmt1(stack["unique"], stack["index"], stack["table"], stack["i"], stack["is"]) +} + +func (c *current) onWhereClause1(e interface{}) (interface{}, error) { + return ast.WhereOptionNode{Condition: e}, nil +} + +func (p *parser) callonWhereClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onWhereClause1(stack["e"]) +} + +func (c *current) onOrderByClause11(s interface{}) (interface{}, error) { + return s, nil +} + +func (p *parser) callonOrderByClause11() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderByClause11(stack["s"]) +} + +func (c *current) onOrderByClause1(f, fs interface{}) (interface{}, error) { + return prepend(f, fs), nil +} + +func (p *parser) callonOrderByClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderByClause1(stack["f"], stack["fs"]) +} + +func (c *current) onOrderColumn7(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonOrderColumn7() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderColumn7(stack["t"]) +} + +func (c *current) onOrderColumn16(l interface{}) (interface{}, error) { + return l, nil +} + +func (p *parser) callonOrderColumn16() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderColumn16(stack["l"]) +} + +func (c *current) onOrderColumn1(i, s, n interface{}) (interface{}, error) { + return ast.OrderOptionNode{ + Expr: i, + Desc: s != nil && string(s.([]byte)) == "desc", + NullsFirst: n != nil && string(n.([]byte)) == "first", + }, nil +} + +func (p *parser) callonOrderColumn1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderColumn1(stack["i"], stack["s"], stack["n"]) +} + +func (c *current) onGroupByClause11(s interface{}) (interface{}, error) { + return ast.GroupOptionNode{Expr: s}, nil +} + +func (p *parser) callonGroupByClause11() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onGroupByClause11(stack["s"]) +} + +func (c *current) onGroupByClause1(i, is interface{}) (interface{}, error) { + return prepend(ast.GroupOptionNode{Expr: i}, is), nil +} + +func (p *parser) callonGroupByClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onGroupByClause1(stack["i"], stack["is"]) +} + +func (c *current) onOffsetClause1(i interface{}) (interface{}, error) { + return ast.OffsetOptionNode{Value: i.(ast.IntegerValueNode)}, nil +} + +func (p *parser) callonOffsetClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOffsetClause1(stack["i"]) +} + +func (c *current) onLimitClause1(i interface{}) (interface{}, error) { + return ast.LimitOptionNode{Value: i.(ast.IntegerValueNode)}, nil +} + +func (p *parser) callonLimitClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLimitClause1(stack["i"]) +} + +func (c *current) onInsertWithColumnClause13(x interface{}) (interface{}, error) { + return x, nil +} + +func (p *parser) callonInsertWithColumnClause13() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertWithColumnClause13(stack["x"]) +} + +func (c *current) onInsertWithColumnClause5(f, fs interface{}) (interface{}, error) { + return prepend(f, fs), nil +} + +func (p *parser) callonInsertWithColumnClause5() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertWithColumnClause5(stack["f"], stack["fs"]) +} + +func (c *current) onInsertWithColumnClause29(y interface{}) (interface{}, error) { + return y, nil +} + +func (p *parser) callonInsertWithColumnClause29() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertWithColumnClause29(stack["y"]) +} + +func (c *current) onInsertWithColumnClause1(cs, v, vs interface{}) (interface{}, error) { + return ast.InsertWithColumnOptionNode{ + Column: toSlice(cs), + Value: prepend(v, vs), + }, nil +} + +func (p *parser) callonInsertWithColumnClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertWithColumnClause1(stack["cs"], stack["v"], stack["vs"]) +} + +func (c *current) onInsertWithDefaultClause1() (interface{}, error) { + return ast.InsertWithDefaultOptionNode{}, nil +} + +func (p *parser) callonInsertWithDefaultClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInsertWithDefaultClause1() +} + +func (c *current) onPrimaryKeyClause1() (interface{}, error) { + return ast.PrimaryOptionNode{}, nil +} + +func (p *parser) callonPrimaryKeyClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onPrimaryKeyClause1() +} + +func (c *current) onNotNullClause1() (interface{}, error) { + return ast.NotNullOptionNode{}, nil +} + +func (p *parser) callonNotNullClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNotNullClause1() +} + +func (c *current) onUniqueClause1() (interface{}, error) { + return ast.UniqueOptionNode{}, nil +} + +func (p *parser) callonUniqueClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUniqueClause1() +} + +func (c *current) onDefaultClause1(e interface{}) (interface{}, error) { + return ast.DefaultOptionNode{Value: e}, nil +} + +func (p *parser) callonDefaultClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDefaultClause1(stack["e"]) +} + +func (c *current) onForeignClause1(t, f interface{}) (interface{}, error) { + return ast.ForeignOptionNode{ + Table: t.(ast.IdentifierNode), + Column: f.(ast.IdentifierNode), + }, nil +} + +func (p *parser) callonForeignClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onForeignClause1(stack["t"], stack["f"]) +} + +func (c *current) onAutoincrementClause1() (interface{}, error) { + return ast.AutoIncrementOptionNode{}, nil +} + +func (p *parser) callonAutoincrementClause1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAutoincrementClause1() +} + +func (c *current) onExprWithDefault2(d interface{}) (interface{}, error) { + return d, nil +} + +func (p *parser) callonExprWithDefault2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onExprWithDefault2(stack["d"]) +} + +func (c *current) onLogicExpr47(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonLogicExpr47() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr47(stack["op"], stack["s"]) +} + +func (c *current) onLogicExpr41(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonLogicExpr41() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr41(stack["o"], stack["os"]) +} + +func (c *current) onLogicExpr37(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonLogicExpr37() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr37(stack["op"], stack["s"]) +} + +func (c *current) onLogicExpr31(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonLogicExpr31() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr31(stack["o"], stack["os"]) +} + +func (c *current) onLogicExpr22(op, s interface{}) (interface{}, error) { + return opSetTarget(op, s), nil +} + +func (p *parser) callonLogicExpr22() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr22(stack["op"], stack["s"]) +} + +func (c *current) onLogicExpr17(l interface{}) (interface{}, error) { + return l, nil +} + +func (p *parser) callonLogicExpr17() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr17(stack["l"]) +} + +func (c *current) onLogicExpr11(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonLogicExpr11() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr11(stack["o"], stack["os"]) +} + +func (c *current) onLogicExpr1In5(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonLogicExpr1In5() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1In5(stack["t"]) +} + +func (c *current) onLogicExpr1In1(n, s interface{}) (interface{}, error) { + op := opSetSubject(&ast.InOperatorNode{}, s) + if n != nil { + return opSetTarget(n, op), nil + } + return op, nil +} + +func (p *parser) callonLogicExpr1In1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1In1(stack["n"], stack["s"]) +} + +func (c *current) onLogicExpr1Null6(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonLogicExpr1Null6() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1Null6(stack["t"]) +} + +func (c *current) onLogicExpr1Null1(n interface{}) (interface{}, error) { + op := opSetSubject(&ast.IsOperatorNode{}, ast.NullValueNode{}) + if n != nil { + return opSetTarget(n, op), nil + } + return op, nil +} + +func (p *parser) callonLogicExpr1Null1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1Null1(stack["n"]) +} + +func (c *current) onLogicExpr1Like5(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonLogicExpr1Like5() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1Like5(stack["t"]) +} + +func (c *current) onLogicExpr1Like1(n, s interface{}) (interface{}, error) { + op := opSetSubject(&ast.LikeOperatorNode{}, s) + if n != nil { + return opSetTarget(n, op), nil + } + return op, nil +} + +func (p *parser) callonLogicExpr1Like1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1Like1(stack["n"], stack["s"]) +} + +func (c *current) onLogicExpr1Cmp1(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonLogicExpr1Cmp1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLogicExpr1Cmp1(stack["op"], stack["s"]) +} + +func (c *current) onArithmeticExpr37(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonArithmeticExpr37() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr37(stack["op"], stack["s"]) +} + +func (c *current) onArithmeticExpr31(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonArithmeticExpr31() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr31(stack["o"], stack["os"]) +} + +func (c *current) onArithmeticExpr27(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonArithmeticExpr27() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr27(stack["op"], stack["s"]) +} + +func (c *current) onArithmeticExpr21(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonArithmeticExpr21() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr21(stack["o"], stack["os"]) +} + +func (c *current) onArithmeticExpr17(op, s interface{}) (interface{}, error) { + return opSetSubject(op, s), nil +} + +func (p *parser) callonArithmeticExpr17() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr17(stack["op"], stack["s"]) +} + +func (c *current) onArithmeticExpr11(o, os interface{}) (interface{}, error) { + return rightJoinOperators(o, os), nil +} + +func (p *parser) callonArithmeticExpr11() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onArithmeticExpr11(stack["o"], stack["os"]) +} + +func (c *current) onMultiExpr7(e interface{}) (interface{}, error) { + return e, nil +} + +func (p *parser) callonMultiExpr7() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onMultiExpr7(stack["e"]) +} + +func (c *current) onMultiExpr1(x, xs interface{}) (interface{}, error) { + return prepend(x, xs), nil +} + +func (p *parser) callonMultiExpr1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onMultiExpr1(stack["x"], stack["xs"]) +} + +func (c *current) onMultiExprWithDefault7(e interface{}) (interface{}, error) { + return e, nil +} + +func (p *parser) callonMultiExprWithDefault7() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onMultiExprWithDefault7(stack["e"]) +} + +func (c *current) onMultiExprWithDefault1(x, xs interface{}) (interface{}, error) { + return prepend(x, xs), nil +} + +func (p *parser) callonMultiExprWithDefault1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onMultiExprWithDefault1(stack["x"], stack["xs"]) +} + +func (c *current) onOperand2(op, s interface{}) (interface{}, error) { + return opSetTarget(op, s), nil +} + +func (p *parser) callonOperand2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOperand2(stack["op"], stack["s"]) +} + +func (c *current) onOperand9(e interface{}) (interface{}, error) { + return e, nil +} + +func (p *parser) callonOperand9() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOperand9(stack["e"]) +} + +func (c *current) onOperand17(t interface{}) (interface{}, error) { + return t, nil +} + +func (p *parser) callonOperand17() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOperand17(stack["t"]) +} + +func (c *current) onTypeCast1(o, s interface{}) (interface{}, error) { + return opSetSubject(opSetObject(&ast.CastOperatorNode{}, o), s), nil +} + +func (p *parser) callonTypeCast1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onTypeCast1(stack["o"], stack["s"]) +} + +func (c *current) onFunctionCall1(i, r interface{}) (interface{}, error) { + return opSetSubject(opSetObject(&ast.FunctionOperatorNode{}, i), r), nil +} + +func (p *parser) callonFunctionCall1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFunctionCall1(stack["i"], stack["r"]) +} + +func (c *current) onFunctionArgs2(a interface{}) (interface{}, error) { + return []interface{}{a}, nil +} + +func (p *parser) callonFunctionArgs2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFunctionArgs2(stack["a"]) +} + +func (c *current) onAssignment1(i, e interface{}) (interface{}, error) { + return opSetSubject(opSetObject(&ast.AssignOperatorNode{}, i), e), nil +} + +func (p *parser) callonAssignment1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAssignment1(stack["i"], stack["e"]) +} + +func (c *current) onSignOperator1() (interface{}, error) { + switch string(c.text) { + case "+": + return &ast.PosOperatorNode{}, nil + case "-": + return &ast.NegOperatorNode{}, nil + } + return nil, errors.New("unknown sign") +} + +func (p *parser) callonSignOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onSignOperator1() +} + +func (c *current) onNotOperator1() (interface{}, error) { + return &ast.NotOperatorNode{}, nil +} + +func (p *parser) callonNotOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNotOperator1() +} + +func (c *current) onAndOperator1() (interface{}, error) { + return &ast.AndOperatorNode{}, nil +} + +func (p *parser) callonAndOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAndOperator1() +} + +func (c *current) onOrOperator1() (interface{}, error) { + return &ast.OrOperatorNode{}, nil +} + +func (p *parser) callonOrOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrOperator1() +} + +func (c *current) onCmpOperator1() (interface{}, error) { + switch string(c.text) { + case "<=": + return &ast.LessOrEqualOperatorNode{}, nil + case ">=": + return &ast.GreaterOrEqualOperatorNode{}, nil + case "<>": + return &ast.NotEqualOperatorNode{}, nil + case "!=": + return &ast.NotEqualOperatorNode{}, nil + case "<": + return &ast.LessOperatorNode{}, nil + case ">": + return &ast.GreaterOperatorNode{}, nil + case "=": + return &ast.EqualOperatorNode{}, nil + } + return nil, errors.New("unknown cmp") +} + +func (p *parser) callonCmpOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onCmpOperator1() +} + +func (c *current) onConcatOperator1() (interface{}, error) { + return &ast.ConcatOperatorNode{}, nil +} + +func (p *parser) callonConcatOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onConcatOperator1() +} + +func (c *current) onAddSubOperator1() (interface{}, error) { + switch string(c.text) { + case "+": + return &ast.AddOperatorNode{}, nil + case "-": + return &ast.SubOperatorNode{}, nil + } + return nil, errors.New("unknown add sub") +} + +func (p *parser) callonAddSubOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAddSubOperator1() +} + +func (c *current) onMulDivModOperator1() (interface{}, error) { + switch string(c.text) { + case "*": + return &ast.MulOperatorNode{}, nil + case "/": + return &ast.DivOperatorNode{}, nil + case "%": + return &ast.ModOperatorNode{}, nil + } + return nil, errors.New("unknown mul div mod") +} + +func (p *parser) callonMulDivModOperator1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onMulDivModOperator1() +} + +func (c *current) onUIntType1(s interface{}) (interface{}, error) { + return ast.IntTypeNode{ + Unsigned: true, + Size: toUint(s.([]byte)), + }, nil +} + +func (p *parser) callonUIntType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUIntType1(stack["s"]) +} + +func (c *current) onIntType1(s interface{}) (interface{}, error) { + return ast.IntTypeNode{ + Unsigned: false, + Size: toUint(s.([]byte)), + }, nil +} + +func (p *parser) callonIntType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onIntType1(stack["s"]) +} + +func (c *current) onUFixedType1(s, t interface{}) (interface{}, error) { + return ast.FixedTypeNode{ + Unsigned: true, + Size: toUint(s.([]byte)), + FractionalDigits: toUint(t.([]byte)), + }, nil +} + +func (p *parser) callonUFixedType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUFixedType1(stack["s"], stack["t"]) +} + +func (c *current) onFixedType1(s, t interface{}) (interface{}, error) { + return ast.FixedTypeNode{ + Unsigned: false, + Size: toUint(s.([]byte)), + FractionalDigits: toUint(t.([]byte)), + }, nil +} + +func (p *parser) callonFixedType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFixedType1(stack["s"], stack["t"]) +} + +func (c *current) onFixedBytesType2(s interface{}) (interface{}, error) { + return ast.FixedBytesTypeNode{Size: toUint(s.([]byte))}, nil +} + +func (p *parser) callonFixedBytesType2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFixedBytesType2(stack["s"]) +} + +func (c *current) onFixedBytesType9() (interface{}, error) { + return ast.FixedBytesTypeNode{Size: 1}, nil +} + +func (p *parser) callonFixedBytesType9() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFixedBytesType9() +} + +func (c *current) onDynamicBytesType1() (interface{}, error) { + return ast.DynamicBytesTypeNode{}, nil +} + +func (p *parser) callonDynamicBytesType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDynamicBytesType1() +} + +func (c *current) onAddressType1() (interface{}, error) { + return ast.AddressTypeNode{}, nil +} + +func (p *parser) callonAddressType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAddressType1() +} + +func (c *current) onBoolType1() (interface{}, error) { + return ast.BoolTypeNode{}, nil +} + +func (p *parser) callonBoolType1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onBoolType1() +} + +func (c *current) onAnyLiteral1() (interface{}, error) { + return ast.AnyValueNode{}, nil +} + +func (p *parser) callonAnyLiteral1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAnyLiteral1() +} + +func (c *current) onDefaultLiteral1() (interface{}, error) { + return ast.DefaultValueNode{}, nil +} + +func (p *parser) callonDefaultLiteral1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDefaultLiteral1() +} + +func (c *current) onBoolLiteral1(b interface{}) (interface{}, error) { + return ast.BoolValueNode{V: string(b.([]byte)) == "true"}, nil +} + +func (p *parser) callonBoolLiteral1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onBoolLiteral1(stack["b"]) +} + +func (c *current) onNullLiteral1() (interface{}, error) { + return ast.NullValueNode{}, nil +} + +func (p *parser) callonNullLiteral1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNullLiteral1() +} + +func (c *current) onNumberLiteral2(h interface{}) (interface{}, error) { + return h, nil +} + +func (p *parser) callonNumberLiteral2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNumberLiteral2(stack["h"]) +} + +func (c *current) onInteger1() (interface{}, error) { + return ast.IntegerValueNode{V: toDecimal(c.text)}, nil +} + +func (p *parser) callonInteger1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onInteger1() +} + +func (c *current) onNonZeroLeadingInteger1() (interface{}, error) { + return c.text, nil +} + +func (p *parser) callonNonZeroLeadingInteger1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNonZeroLeadingInteger1() +} + +func (c *current) onDecimal1() (interface{}, error) { + return ast.DecimalValueNode{V: toDecimal(c.text)}, nil +} + +func (p *parser) callonDecimal1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDecimal1() +} + +func (c *current) onHex1(s interface{}) (interface{}, error) { + return hexToInteger(joinBytes(s)), nil +} + +func (p *parser) callonHex1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onHex1(stack["s"]) +} + +func (c *current) onHexString9() (interface{}, error) { + return c.text, nil +} + +func (p *parser) callonHexString9() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onHexString9() +} + +func (c *current) onHexString1(s interface{}) (interface{}, error) { + return ast.BytesValueNode{V: hexToBytes(joinBytes(s))}, nil +} + +func (p *parser) callonHexString1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onHexString1(stack["s"]) +} + +func (c *current) onNormalString6() (interface{}, error) { + return c.text, nil +} + +func (p *parser) callonNormalString6() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNormalString6() +} + +func (c *current) onNormalString1(s interface{}) (interface{}, error) { + return ast.BytesValueNode{V: resolveString(joinBytes(s))}, nil +} + +func (p *parser) callonNormalString1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNormalString1(stack["s"]) +} + +func (c *current) onTrueToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonTrueToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onTrueToken1() +} + +func (c *current) onFalseToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonFalseToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFalseToken1() +} + +func (c *current) onLastToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonLastToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onLastToken1() +} + +func (c *current) onFirstToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonFirstToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onFirstToken1() +} + +func (c *current) onAscToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonAscToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAscToken1() +} + +func (c *current) onDescToken1() (interface{}, error) { + return toLower(c.text), nil +} + +func (p *parser) callonDescToken1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onDescToken1() +} + +func (c *current) onNormalIdentifier1() (interface{}, error) { + return ast.IdentifierNode{Name: c.text}, nil +} + +func (p *parser) callonNormalIdentifier1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onNormalIdentifier1() +} + +func (c *current) onStringIdentifier6() (interface{}, error) { + return c.text, nil +} + +func (p *parser) callonStringIdentifier6() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onStringIdentifier6() +} + +func (c *current) onStringIdentifier1(s interface{}) (interface{}, error) { + return ast.IdentifierNode{Name: resolveString(joinBytes(s))}, nil +} + +func (p *parser) callonStringIdentifier1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onStringIdentifier1(stack["s"]) +} + +var ( + // errNoRule is returned when the grammar to parse has no rule. + errNoRule = errors.New("grammar has no rule") + + // errInvalidEntrypoint is returned when the specified entrypoint rule + // does not exit. + errInvalidEntrypoint = errors.New("invalid entrypoint") + + // errInvalidEncoding is returned when the source is not properly + // utf8-encoded. + errInvalidEncoding = errors.New("invalid encoding") + + // errMaxExprCnt is used to signal that the maximum number of + // expressions have been parsed. + errMaxExprCnt = errors.New("max number of expresssions parsed") +) + +// Option is a function that can set an option on the parser. It returns +// the previous setting as an Option. +type Option func(*parser) Option + +// MaxExpressions creates an Option to stop parsing after the provided +// number of expressions have been parsed, if the value is 0 then the parser will +// parse for as many steps as needed (possibly an infinite number). +// +// The default for maxExprCnt is 0. +func MaxExpressions(maxExprCnt uint64) Option { + return func(p *parser) Option { + oldMaxExprCnt := p.maxExprCnt + p.maxExprCnt = maxExprCnt + return MaxExpressions(oldMaxExprCnt) + } +} + +// Entrypoint creates an Option to set the rule name to use as entrypoint. +// The rule name must have been specified in the -alternate-entrypoints +// if generating the parser with the -optimize-grammar flag, otherwise +// it may have been optimized out. Passing an empty string sets the +// entrypoint to the first rule in the grammar. +// +// The default is to start parsing at the first rule in the grammar. +func Entrypoint(ruleName string) Option { + return func(p *parser) Option { + oldEntrypoint := p.entrypoint + p.entrypoint = ruleName + if ruleName == "" { + p.entrypoint = g.rules[0].name + } + return Entrypoint(oldEntrypoint) + } +} + +// Statistics adds a user provided Stats struct to the parser to allow +// the user to process the results after the parsing has finished. +// Also the key for the "no match" counter is set. +// +// Example usage: +// +// input := "input" +// stats := Stats{} +// _, err := Parse("input-file", []byte(input), Statistics(&stats, "no match")) +// if err != nil { +// log.Panicln(err) +// } +// b, err := json.MarshalIndent(stats.ChoiceAltCnt, "", " ") +// if err != nil { +// log.Panicln(err) +// } +// fmt.Println(string(b)) +// +func Statistics(stats *Stats, choiceNoMatch string) Option { + return func(p *parser) Option { + oldStats := p.Stats + p.Stats = stats + oldChoiceNoMatch := p.choiceNoMatch + p.choiceNoMatch = choiceNoMatch + if p.Stats.ChoiceAltCnt == nil { + p.Stats.ChoiceAltCnt = make(map[string]map[string]int) + } + return Statistics(oldStats, oldChoiceNoMatch) + } +} + +// Debug creates an Option to set the debug flag to b. When set to true, +// debugging information is printed to stdout while parsing. +// +// The default is false. +func Debug(b bool) Option { + return func(p *parser) Option { + old := p.debug + p.debug = b + return Debug(old) + } +} + +// Memoize creates an Option to set the memoize flag to b. When set to true, +// the parser will cache all results so each expression is evaluated only +// once. This guarantees linear parsing time even for pathological cases, +// at the expense of more memory and slower times for typical cases. +// +// The default is false. +func Memoize(b bool) Option { + return func(p *parser) Option { + old := p.memoize + p.memoize = b + return Memoize(old) + } +} + +// AllowInvalidUTF8 creates an Option to allow invalid UTF-8 bytes. +// Every invalid UTF-8 byte is treated as a utf8.RuneError (U+FFFD) +// by character class matchers and is matched by the any matcher. +// The returned matched value, c.text and c.offset are NOT affected. +// +// The default is false. +func AllowInvalidUTF8(b bool) Option { + return func(p *parser) Option { + old := p.allowInvalidUTF8 + p.allowInvalidUTF8 = b + return AllowInvalidUTF8(old) + } +} + +// Recover creates an Option to set the recover flag to b. When set to +// true, this causes the parser to recover from panics and convert it +// to an error. Setting it to false can be useful while debugging to +// access the full stack trace. +// +// The default is true. +func Recover(b bool) Option { + return func(p *parser) Option { + old := p.recover + p.recover = b + return Recover(old) + } +} + +// GlobalStore creates an Option to set a key to a certain value in +// the globalStore. +func GlobalStore(key string, value interface{}) Option { + return func(p *parser) Option { + old := p.cur.globalStore[key] + p.cur.globalStore[key] = value + return GlobalStore(key, old) + } +} + +// InitState creates an Option to set a key to a certain value in +// the global "state" store. +func InitState(key string, value interface{}) Option { + return func(p *parser) Option { + old := p.cur.state[key] + p.cur.state[key] = value + return InitState(key, old) + } +} + +// ParseFile parses the file identified by filename. +func ParseFile(filename string, opts ...Option) (i interface{}, err error) { + f, err := os.Open(filename) + if err != nil { + return nil, err + } + defer func() { + if closeErr := f.Close(); closeErr != nil { + err = closeErr + } + }() + return ParseReader(filename, f, opts...) +} + +// ParseReader parses the data from r using filename as information in the +// error messages. +func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + + return Parse(filename, b, opts...) +} + +// Parse parses the data from b using filename as information in the +// error messages. +func Parse(filename string, b []byte, opts ...Option) (interface{}, error) { + return newParser(filename, b, opts...).parse(g) +} + +// position records a position in the text. +type position struct { + line, col, offset int +} + +func (p position) String() string { + return fmt.Sprintf("%d:%d [%d]", p.line, p.col, p.offset) +} + +// savepoint stores all state required to go back to this point in the +// parser. +type savepoint struct { + position + rn rune + w int +} + +type current struct { + pos position // start position of the match + text []byte // raw text of the match + + // state is a store for arbitrary key,value pairs that the user wants to be + // tied to the backtracking of the parser. + // This is always rolled back if a parsing rule fails. + state storeDict + + // globalStore is a general store for the user to store arbitrary key-value + // pairs that they need to manage and that they do not want tied to the + // backtracking of the parser. This is only modified by the user and never + // rolled back by the parser. It is always up to the user to keep this in a + // consistent state. + globalStore storeDict +} + +type storeDict map[string]interface{} + +// the AST types... + +type grammar struct { + pos position + rules []*rule +} + +type rule struct { + pos position + name string + displayName string + expr interface{} +} + +type choiceExpr struct { + pos position + alternatives []interface{} +} + +type actionExpr struct { + pos position + expr interface{} + run func(*parser) (interface{}, error) +} + +type recoveryExpr struct { + pos position + expr interface{} + recoverExpr interface{} + failureLabel []string +} + +type seqExpr struct { + pos position + exprs []interface{} +} + +type throwExpr struct { + pos position + label string +} + +type labeledExpr struct { + pos position + label string + expr interface{} +} + +type expr struct { + pos position + expr interface{} +} + +type andExpr expr +type notExpr expr +type zeroOrOneExpr expr +type zeroOrMoreExpr expr +type oneOrMoreExpr expr + +type ruleRefExpr struct { + pos position + name string +} + +type stateCodeExpr struct { + pos position + run func(*parser) error +} + +type andCodeExpr struct { + pos position + run func(*parser) (bool, error) +} + +type notCodeExpr struct { + pos position + run func(*parser) (bool, error) +} + +type litMatcher struct { + pos position + val string + ignoreCase bool +} + +type charClassMatcher struct { + pos position + val string + basicLatinChars [128]bool + chars []rune + ranges []rune + classes []*unicode.RangeTable + ignoreCase bool + inverted bool +} + +type anyMatcher position + +// errList cumulates the errors found by the parser. +type errList []error + +func (e *errList) add(err error) { + *e = append(*e, err) +} + +func (e errList) err() error { + if len(e) == 0 { + return nil + } + e.dedupe() + return e +} + +func (e *errList) dedupe() { + var cleaned []error + set := make(map[string]bool) + for _, err := range *e { + if msg := err.Error(); !set[msg] { + set[msg] = true + cleaned = append(cleaned, err) + } + } + *e = cleaned +} + +func (e errList) Error() string { + switch len(e) { + case 0: + return "" + case 1: + return e[0].Error() + default: + var buf bytes.Buffer + + for i, err := range e { + if i > 0 { + buf.WriteRune('\n') + } + buf.WriteString(err.Error()) + } + return buf.String() + } +} + +// parserError wraps an error with a prefix indicating the rule in which +// the error occurred. The original error is stored in the Inner field. +type parserError struct { + Inner error + pos position + prefix string + expected []string +} + +// Error returns the error message. +func (p *parserError) Error() string { + return p.prefix + ": " + p.Inner.Error() +} + +// newParser creates a parser with the specified input source and options. +func newParser(filename string, b []byte, opts ...Option) *parser { + stats := Stats{ + ChoiceAltCnt: make(map[string]map[string]int), + } + + p := &parser{ + filename: filename, + errs: new(errList), + data: b, + pt: savepoint{position: position{line: 1}}, + recover: true, + cur: current{ + state: make(storeDict), + globalStore: make(storeDict), + }, + maxFailPos: position{col: 1, line: 1}, + maxFailExpected: make([]string, 0, 20), + Stats: &stats, + // start rule is rule [0] unless an alternate entrypoint is specified + entrypoint: g.rules[0].name, + } + p.setOptions(opts) + + if p.maxExprCnt == 0 { + p.maxExprCnt = math.MaxUint64 + } + + return p +} + +// setOptions applies the options to the parser. +func (p *parser) setOptions(opts []Option) { + for _, opt := range opts { + opt(p) + } +} + +type resultTuple struct { + v interface{} + b bool + end savepoint +} + +const choiceNoMatch = -1 + +// Stats stores some statistics, gathered during parsing +type Stats struct { + // ExprCnt counts the number of expressions processed during parsing + // This value is compared to the maximum number of expressions allowed + // (set by the MaxExpressions option). + ExprCnt uint64 + + // ChoiceAltCnt is used to count for each ordered choice expression, + // which alternative is used how may times. + // These numbers allow to optimize the order of the ordered choice expression + // to increase the performance of the parser + // + // The outer key of ChoiceAltCnt is composed of the name of the rule as well + // as the line and the column of the ordered choice. + // The inner key of ChoiceAltCnt is the number (one-based) of the matching alternative. + // For each alternative the number of matches are counted. If an ordered choice does not + // match, a special counter is incremented. The name of this counter is set with + // the parser option Statistics. + // For an alternative to be included in ChoiceAltCnt, it has to match at least once. + ChoiceAltCnt map[string]map[string]int +} + +type parser struct { + filename string + pt savepoint + cur current + + data []byte + errs *errList + + depth int + recover bool + debug bool + + memoize bool + // memoization table for the packrat algorithm: + // map[offset in source] map[expression or rule] {value, match} + memo map[int]map[interface{}]resultTuple + + // rules table, maps the rule identifier to the rule node + rules map[string]*rule + // variables stack, map of label to value + vstack []map[string]interface{} + // rule stack, allows identification of the current rule in errors + rstack []*rule + + // parse fail + maxFailPos position + maxFailExpected []string + maxFailInvertExpected bool + + // max number of expressions to be parsed + maxExprCnt uint64 + // entrypoint for the parser + entrypoint string + + allowInvalidUTF8 bool + + *Stats + + choiceNoMatch string + // recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse + recoveryStack []map[string]interface{} +} + +// push a variable set on the vstack. +func (p *parser) pushV() { + if cap(p.vstack) == len(p.vstack) { + // create new empty slot in the stack + p.vstack = append(p.vstack, nil) + } else { + // slice to 1 more + p.vstack = p.vstack[:len(p.vstack)+1] + } + + // get the last args set + m := p.vstack[len(p.vstack)-1] + if m != nil && len(m) == 0 { + // empty map, all good + return + } + + m = make(map[string]interface{}) + p.vstack[len(p.vstack)-1] = m +} + +// pop a variable set from the vstack. +func (p *parser) popV() { + // if the map is not empty, clear it + m := p.vstack[len(p.vstack)-1] + if len(m) > 0 { + // GC that map + p.vstack[len(p.vstack)-1] = nil + } + p.vstack = p.vstack[:len(p.vstack)-1] +} + +// push a recovery expression with its labels to the recoveryStack +func (p *parser) pushRecovery(labels []string, expr interface{}) { + if cap(p.recoveryStack) == len(p.recoveryStack) { + // create new empty slot in the stack + p.recoveryStack = append(p.recoveryStack, nil) + } else { + // slice to 1 more + p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)+1] + } + + m := make(map[string]interface{}, len(labels)) + for _, fl := range labels { + m[fl] = expr + } + p.recoveryStack[len(p.recoveryStack)-1] = m +} + +// pop a recovery expression from the recoveryStack +func (p *parser) popRecovery() { + // GC that map + p.recoveryStack[len(p.recoveryStack)-1] = nil + + p.recoveryStack = p.recoveryStack[:len(p.recoveryStack)-1] +} + +func (p *parser) print(prefix, s string) string { + if !p.debug { + return s + } + + fmt.Printf("%s %d:%d:%d: %s [%#U]\n", + prefix, p.pt.line, p.pt.col, p.pt.offset, s, p.pt.rn) + return s +} + +func (p *parser) in(s string) string { + p.depth++ + return p.print(strings.Repeat(" ", p.depth)+">", s) +} + +func (p *parser) out(s string) string { + p.depth-- + return p.print(strings.Repeat(" ", p.depth)+"<", s) +} + +func (p *parser) addErr(err error) { + p.addErrAt(err, p.pt.position, []string{}) +} + +func (p *parser) addErrAt(err error, pos position, expected []string) { + var buf bytes.Buffer + if p.filename != "" { + buf.WriteString(p.filename) + } + if buf.Len() > 0 { + buf.WriteString(":") + } + buf.WriteString(fmt.Sprintf("%d:%d (%d)", pos.line, pos.col, pos.offset)) + if len(p.rstack) > 0 { + if buf.Len() > 0 { + buf.WriteString(": ") + } + rule := p.rstack[len(p.rstack)-1] + if rule.displayName != "" { + buf.WriteString("rule " + rule.displayName) + } else { + buf.WriteString("rule " + rule.name) + } + } + pe := &parserError{Inner: err, pos: pos, prefix: buf.String(), expected: expected} + p.errs.add(pe) +} + +func (p *parser) failAt(fail bool, pos position, want string) { + // process fail if parsing fails and not inverted or parsing succeeds and invert is set + if fail == p.maxFailInvertExpected { + if pos.offset < p.maxFailPos.offset { + return + } + + if pos.offset > p.maxFailPos.offset { + p.maxFailPos = pos + p.maxFailExpected = p.maxFailExpected[:0] + } + + if p.maxFailInvertExpected { + want = "!" + want + } + p.maxFailExpected = append(p.maxFailExpected, want) + } +} + +// read advances the parser to the next rune. +func (p *parser) read() { + p.pt.offset += p.pt.w + rn, n := utf8.DecodeRune(p.data[p.pt.offset:]) + p.pt.rn = rn + p.pt.w = n + p.pt.col++ + if rn == '\n' { + p.pt.line++ + p.pt.col = 0 + } + + if rn == utf8.RuneError && n == 1 { // see utf8.DecodeRune + if !p.allowInvalidUTF8 { + p.addErr(errInvalidEncoding) + } + } +} + +// restore parser position to the savepoint pt. +func (p *parser) restore(pt savepoint) { + if p.debug { + defer p.out(p.in("restore")) + } + if pt.offset == p.pt.offset { + return + } + p.pt = pt +} + +// Cloner is implemented by any value that has a Clone method, which returns a +// copy of the value. This is mainly used for types which are not passed by +// value (e.g map, slice, chan) or structs that contain such types. +// +// This is used in conjunction with the global state feature to create proper +// copies of the state to allow the parser to properly restore the state in +// the case of backtracking. +type Cloner interface { + Clone() interface{} +} + +// clone and return parser current state. +func (p *parser) cloneState() storeDict { + if p.debug { + defer p.out(p.in("cloneState")) + } + + state := make(storeDict, len(p.cur.state)) + for k, v := range p.cur.state { + if c, ok := v.(Cloner); ok { + state[k] = c.Clone() + } else { + state[k] = v + } + } + return state +} + +// restore parser current state to the state storeDict. +// every restoreState should applied only one time for every cloned state +func (p *parser) restoreState(state storeDict) { + if p.debug { + defer p.out(p.in("restoreState")) + } + p.cur.state = state +} + +// get the slice of bytes from the savepoint start to the current position. +func (p *parser) sliceFrom(start savepoint) []byte { + return p.data[start.position.offset:p.pt.position.offset] +} + +func (p *parser) getMemoized(node interface{}) (resultTuple, bool) { + if len(p.memo) == 0 { + return resultTuple{}, false + } + m := p.memo[p.pt.offset] + if len(m) == 0 { + return resultTuple{}, false + } + res, ok := m[node] + return res, ok +} + +func (p *parser) setMemoized(pt savepoint, node interface{}, tuple resultTuple) { + if p.memo == nil { + p.memo = make(map[int]map[interface{}]resultTuple) + } + m := p.memo[pt.offset] + if m == nil { + m = make(map[interface{}]resultTuple) + p.memo[pt.offset] = m + } + m[node] = tuple +} + +func (p *parser) buildRulesTable(g *grammar) { + p.rules = make(map[string]*rule, len(g.rules)) + for _, r := range g.rules { + p.rules[r.name] = r + } +} + +func (p *parser) parse(g *grammar) (val interface{}, err error) { + if len(g.rules) == 0 { + p.addErr(errNoRule) + return nil, p.errs.err() + } + + // TODO : not super critical but this could be generated + p.buildRulesTable(g) + + if p.recover { + // panic can be used in action code to stop parsing immediately + // and return the panic as an error. + defer func() { + if e := recover(); e != nil { + if p.debug { + defer p.out(p.in("panic handler")) + } + val = nil + switch e := e.(type) { + case error: + p.addErr(e) + default: + p.addErr(fmt.Errorf("%v", e)) + } + err = p.errs.err() + } + }() + } + + startRule, ok := p.rules[p.entrypoint] + if !ok { + p.addErr(errInvalidEntrypoint) + return nil, p.errs.err() + } + + p.read() // advance to first rune + val, ok = p.parseRule(startRule) + if !ok { + if len(*p.errs) == 0 { + // If parsing fails, but no errors have been recorded, the expected values + // for the farthest parser position are returned as error. + maxFailExpectedMap := make(map[string]struct{}, len(p.maxFailExpected)) + for _, v := range p.maxFailExpected { + maxFailExpectedMap[v] = struct{}{} + } + expected := make([]string, 0, len(maxFailExpectedMap)) + eof := false + if _, ok := maxFailExpectedMap["!."]; ok { + delete(maxFailExpectedMap, "!.") + eof = true + } + for k := range maxFailExpectedMap { + expected = append(expected, k) + } + sort.Strings(expected) + if eof { + expected = append(expected, "EOF") + } + p.addErrAt(errors.New("no match found, expected: "+listJoin(expected, ", ", "or")), p.maxFailPos, expected) + } + + return nil, p.errs.err() + } + return val, p.errs.err() +} + +func listJoin(list []string, sep string, lastSep string) string { + switch len(list) { + case 0: + return "" + case 1: + return list[0] + default: + return fmt.Sprintf("%s %s %s", strings.Join(list[:len(list)-1], sep), lastSep, list[len(list)-1]) + } +} + +func (p *parser) parseRule(rule *rule) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseRule " + rule.name)) + } + + if p.memoize { + res, ok := p.getMemoized(rule) + if ok { + p.restore(res.end) + return res.v, res.b + } + } + + start := p.pt + p.rstack = append(p.rstack, rule) + p.pushV() + val, ok := p.parseExpr(rule.expr) + p.popV() + p.rstack = p.rstack[:len(p.rstack)-1] + if ok && p.debug { + p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start))) + } + + if p.memoize { + p.setMemoized(start, rule, resultTuple{val, ok, p.pt}) + } + return val, ok +} + +func (p *parser) parseExpr(expr interface{}) (interface{}, bool) { + var pt savepoint + + if p.memoize { + res, ok := p.getMemoized(expr) + if ok { + p.restore(res.end) + return res.v, res.b + } + pt = p.pt + } + + p.ExprCnt++ + if p.ExprCnt > p.maxExprCnt { + panic(errMaxExprCnt) + } + + var val interface{} + var ok bool + switch expr := expr.(type) { + case *actionExpr: + val, ok = p.parseActionExpr(expr) + case *andCodeExpr: + val, ok = p.parseAndCodeExpr(expr) + case *andExpr: + val, ok = p.parseAndExpr(expr) + case *anyMatcher: + val, ok = p.parseAnyMatcher(expr) + case *charClassMatcher: + val, ok = p.parseCharClassMatcher(expr) + case *choiceExpr: + val, ok = p.parseChoiceExpr(expr) + case *labeledExpr: + val, ok = p.parseLabeledExpr(expr) + case *litMatcher: + val, ok = p.parseLitMatcher(expr) + case *notCodeExpr: + val, ok = p.parseNotCodeExpr(expr) + case *notExpr: + val, ok = p.parseNotExpr(expr) + case *oneOrMoreExpr: + val, ok = p.parseOneOrMoreExpr(expr) + case *recoveryExpr: + val, ok = p.parseRecoveryExpr(expr) + case *ruleRefExpr: + val, ok = p.parseRuleRefExpr(expr) + case *seqExpr: + val, ok = p.parseSeqExpr(expr) + case *stateCodeExpr: + val, ok = p.parseStateCodeExpr(expr) + case *throwExpr: + val, ok = p.parseThrowExpr(expr) + case *zeroOrMoreExpr: + val, ok = p.parseZeroOrMoreExpr(expr) + case *zeroOrOneExpr: + val, ok = p.parseZeroOrOneExpr(expr) + default: + panic(fmt.Sprintf("unknown expression type %T", expr)) + } + if p.memoize { + p.setMemoized(pt, expr, resultTuple{val, ok, p.pt}) + } + return val, ok +} + +func (p *parser) parseActionExpr(act *actionExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseActionExpr")) + } + + start := p.pt + val, ok := p.parseExpr(act.expr) + if ok { + p.cur.pos = start.position + p.cur.text = p.sliceFrom(start) + state := p.cloneState() + actVal, err := act.run(p) + if err != nil { + p.addErrAt(err, start.position, []string{}) + } + p.restoreState(state) + + val = actVal + } + if ok && p.debug { + p.print(strings.Repeat(" ", p.depth)+"MATCH", string(p.sliceFrom(start))) + } + return val, ok +} + +func (p *parser) parseAndCodeExpr(and *andCodeExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseAndCodeExpr")) + } + + state := p.cloneState() + + ok, err := and.run(p) + if err != nil { + p.addErr(err) + } + p.restoreState(state) + + return nil, ok +} + +func (p *parser) parseAndExpr(and *andExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseAndExpr")) + } + + pt := p.pt + state := p.cloneState() + p.pushV() + _, ok := p.parseExpr(and.expr) + p.popV() + p.restoreState(state) + p.restore(pt) + + return nil, ok +} + +func (p *parser) parseAnyMatcher(any *anyMatcher) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseAnyMatcher")) + } + + if p.pt.rn == utf8.RuneError && p.pt.w == 0 { + // EOF - see utf8.DecodeRune + p.failAt(false, p.pt.position, ".") + return nil, false + } + start := p.pt + p.read() + p.failAt(true, start.position, ".") + return p.sliceFrom(start), true +} + +func (p *parser) parseCharClassMatcher(chr *charClassMatcher) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseCharClassMatcher")) + } + + cur := p.pt.rn + start := p.pt + + // can't match EOF + if cur == utf8.RuneError && p.pt.w == 0 { // see utf8.DecodeRune + p.failAt(false, start.position, chr.val) + return nil, false + } + + if chr.ignoreCase { + cur = unicode.ToLower(cur) + } + + // try to match in the list of available chars + for _, rn := range chr.chars { + if rn == cur { + if chr.inverted { + p.failAt(false, start.position, chr.val) + return nil, false + } + p.read() + p.failAt(true, start.position, chr.val) + return p.sliceFrom(start), true + } + } + + // try to match in the list of ranges + for i := 0; i < len(chr.ranges); i += 2 { + if cur >= chr.ranges[i] && cur <= chr.ranges[i+1] { + if chr.inverted { + p.failAt(false, start.position, chr.val) + return nil, false + } + p.read() + p.failAt(true, start.position, chr.val) + return p.sliceFrom(start), true + } + } + + // try to match in the list of Unicode classes + for _, cl := range chr.classes { + if unicode.Is(cl, cur) { + if chr.inverted { + p.failAt(false, start.position, chr.val) + return nil, false + } + p.read() + p.failAt(true, start.position, chr.val) + return p.sliceFrom(start), true + } + } + + if chr.inverted { + p.read() + p.failAt(true, start.position, chr.val) + return p.sliceFrom(start), true + } + p.failAt(false, start.position, chr.val) + return nil, false +} + +func (p *parser) incChoiceAltCnt(ch *choiceExpr, altI int) { + choiceIdent := fmt.Sprintf("%s %d:%d", p.rstack[len(p.rstack)-1].name, ch.pos.line, ch.pos.col) + m := p.ChoiceAltCnt[choiceIdent] + if m == nil { + m = make(map[string]int) + p.ChoiceAltCnt[choiceIdent] = m + } + // We increment altI by 1, so the keys do not start at 0 + alt := strconv.Itoa(altI + 1) + if altI == choiceNoMatch { + alt = p.choiceNoMatch + } + m[alt]++ +} + +func (p *parser) parseChoiceExpr(ch *choiceExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseChoiceExpr")) + } + + for altI, alt := range ch.alternatives { + // dummy assignment to prevent compile error if optimized + _ = altI + + state := p.cloneState() + + p.pushV() + val, ok := p.parseExpr(alt) + p.popV() + if ok { + p.incChoiceAltCnt(ch, altI) + return val, ok + } + p.restoreState(state) + } + p.incChoiceAltCnt(ch, choiceNoMatch) + return nil, false +} + +func (p *parser) parseLabeledExpr(lab *labeledExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseLabeledExpr")) + } + + p.pushV() + val, ok := p.parseExpr(lab.expr) + p.popV() + if ok && lab.label != "" { + m := p.vstack[len(p.vstack)-1] + m[lab.label] = val + } + return val, ok +} + +func (p *parser) parseLitMatcher(lit *litMatcher) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseLitMatcher")) + } + + ignoreCase := "" + if lit.ignoreCase { + ignoreCase = "i" + } + val := fmt.Sprintf("%q%s", lit.val, ignoreCase) + start := p.pt + for _, want := range lit.val { + cur := p.pt.rn + if lit.ignoreCase { + cur = unicode.ToLower(cur) + } + if cur != want { + p.failAt(false, start.position, val) + p.restore(start) + return nil, false + } + p.read() + } + p.failAt(true, start.position, val) + return p.sliceFrom(start), true +} + +func (p *parser) parseNotCodeExpr(not *notCodeExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseNotCodeExpr")) + } + + state := p.cloneState() + + ok, err := not.run(p) + if err != nil { + p.addErr(err) + } + p.restoreState(state) + + return nil, !ok +} + +func (p *parser) parseNotExpr(not *notExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseNotExpr")) + } + + pt := p.pt + state := p.cloneState() + p.pushV() + p.maxFailInvertExpected = !p.maxFailInvertExpected + _, ok := p.parseExpr(not.expr) + p.maxFailInvertExpected = !p.maxFailInvertExpected + p.popV() + p.restoreState(state) + p.restore(pt) + + return nil, !ok +} + +func (p *parser) parseOneOrMoreExpr(expr *oneOrMoreExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseOneOrMoreExpr")) + } + + var vals []interface{} + + for { + p.pushV() + val, ok := p.parseExpr(expr.expr) + p.popV() + if !ok { + if len(vals) == 0 { + // did not match once, no match + return nil, false + } + return vals, true + } + vals = append(vals, val) + } +} + +func (p *parser) parseRecoveryExpr(recover *recoveryExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseRecoveryExpr (" + strings.Join(recover.failureLabel, ",") + ")")) + } + + p.pushRecovery(recover.failureLabel, recover.recoverExpr) + val, ok := p.parseExpr(recover.expr) + p.popRecovery() + + return val, ok +} + +func (p *parser) parseRuleRefExpr(ref *ruleRefExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseRuleRefExpr " + ref.name)) + } + + if ref.name == "" { + panic(fmt.Sprintf("%s: invalid rule: missing name", ref.pos)) + } + + rule := p.rules[ref.name] + if rule == nil { + p.addErr(fmt.Errorf("undefined rule: %s", ref.name)) + return nil, false + } + return p.parseRule(rule) +} + +func (p *parser) parseSeqExpr(seq *seqExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseSeqExpr")) + } + + vals := make([]interface{}, 0, len(seq.exprs)) + + pt := p.pt + state := p.cloneState() + for _, expr := range seq.exprs { + val, ok := p.parseExpr(expr) + if !ok { + p.restoreState(state) + p.restore(pt) + return nil, false + } + vals = append(vals, val) + } + return vals, true +} + +func (p *parser) parseStateCodeExpr(state *stateCodeExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseStateCodeExpr")) + } + + err := state.run(p) + if err != nil { + p.addErr(err) + } + return nil, true +} + +func (p *parser) parseThrowExpr(expr *throwExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseThrowExpr")) + } + + for i := len(p.recoveryStack) - 1; i >= 0; i-- { + if recoverExpr, ok := p.recoveryStack[i][expr.label]; ok { + if val, ok := p.parseExpr(recoverExpr); ok { + return val, ok + } + } + } + + return nil, false +} + +func (p *parser) parseZeroOrMoreExpr(expr *zeroOrMoreExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseZeroOrMoreExpr")) + } + + var vals []interface{} + + for { + p.pushV() + val, ok := p.parseExpr(expr.expr) + p.popV() + if !ok { + return vals, true + } + vals = append(vals, val) + } +} + +func (p *parser) parseZeroOrOneExpr(expr *zeroOrOneExpr) (interface{}, bool) { + if p.debug { + defer p.out(p.in("parseZeroOrOneExpr")) + } + + p.pushV() + val, _ := p.parseExpr(expr.expr) + p.popV() + // whether it matched or not, consider it a match + return val, true +} |