mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 22:29:59 -05:00
3674 lines
98 KiB
Go
3674 lines
98 KiB
Go
// Code generated by pigeon; DO NOT EDIT.
|
|
|
|
package kql
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"fmt"
|
|
"io"
|
|
"math"
|
|
"os"
|
|
"sort"
|
|
"strconv"
|
|
"strings"
|
|
"unicode"
|
|
"unicode/utf8"
|
|
)
|
|
|
|
var g = &grammar{
|
|
rules: []*rule{
|
|
{
|
|
name: "AST",
|
|
pos: position{line: 9, col: 1, offset: 143},
|
|
expr: &actionExpr{
|
|
pos: position{line: 10, col: 5, offset: 154},
|
|
run: (*parser).callonAST1,
|
|
expr: &labeledExpr{
|
|
pos: position{line: 10, col: 5, offset: 154},
|
|
label: "n",
|
|
expr: &ruleRefExpr{
|
|
pos: position{line: 10, col: 7, offset: 156},
|
|
name: "Nodes",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "Nodes",
|
|
pos: position{line: 18, col: 1, offset: 337},
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 19, col: 5, offset: 350},
|
|
expr: &seqExpr{
|
|
pos: position{line: 19, col: 6, offset: 351},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
run: (*parser).callonNodes3,
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
val: "[ \\t]",
|
|
chars: []rune{' ', '\t'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
&ruleRefExpr{
|
|
pos: position{line: 19, col: 8, offset: 353},
|
|
name: "Node",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "Node",
|
|
pos: position{line: 21, col: 1, offset: 361},
|
|
expr: &choiceExpr{
|
|
pos: position{line: 22, col: 5, offset: 373},
|
|
alternatives: []any{
|
|
&ruleRefExpr{
|
|
pos: position{line: 22, col: 5, offset: 373},
|
|
name: "GroupNode",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 46, col: 5, offset: 1042},
|
|
run: (*parser).callonNode3,
|
|
expr: &seqExpr{
|
|
pos: position{line: 46, col: 5, offset: 1042},
|
|
exprs: []any{
|
|
&labeledExpr{
|
|
pos: position{line: 46, col: 5, offset: 1042},
|
|
label: "k",
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 46, col: 7, offset: 1044},
|
|
expr: &actionExpr{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
run: (*parser).callonNode7,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
val: "[A-Za-z]",
|
|
ranges: []rune{'A', 'Z', 'a', 'z'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&choiceExpr{
|
|
pos: position{line: 46, col: 14, offset: 1051},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode10,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
run: (*parser).callonNode12,
|
|
expr: &litMatcher{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
val: "=",
|
|
ignoreCase: false,
|
|
want: "\"=\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 46, col: 53, offset: 1090},
|
|
label: "v",
|
|
expr: &choiceExpr{
|
|
pos: position{line: 46, col: 56, offset: 1093},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 46, col: 56, offset: 1093},
|
|
val: "true",
|
|
ignoreCase: false,
|
|
want: "\"true\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 46, col: 65, offset: 1102},
|
|
val: "false",
|
|
ignoreCase: false,
|
|
want: "\"false\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 51, col: 5, offset: 1203},
|
|
run: (*parser).callonNode18,
|
|
expr: &seqExpr{
|
|
pos: position{line: 51, col: 5, offset: 1203},
|
|
exprs: []any{
|
|
&labeledExpr{
|
|
pos: position{line: 51, col: 5, offset: 1203},
|
|
label: "k",
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 51, col: 7, offset: 1205},
|
|
expr: &actionExpr{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
run: (*parser).callonNode22,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
val: "[A-Za-z]",
|
|
ranges: []rune{'A', 'Z', 'a', 'z'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 51, col: 13, offset: 1211},
|
|
label: "o",
|
|
expr: &choiceExpr{
|
|
pos: position{line: 52, col: 9, offset: 1223},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 145, col: 5, offset: 3358},
|
|
run: (*parser).callonNode26,
|
|
expr: &litMatcher{
|
|
pos: position{line: 145, col: 5, offset: 3358},
|
|
val: ">=",
|
|
ignoreCase: false,
|
|
want: "\">=\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 135, col: 5, offset: 3174},
|
|
run: (*parser).callonNode28,
|
|
expr: &litMatcher{
|
|
pos: position{line: 135, col: 5, offset: 3174},
|
|
val: "<=",
|
|
ignoreCase: false,
|
|
want: "\"<=\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 140, col: 5, offset: 3263},
|
|
run: (*parser).callonNode30,
|
|
expr: &litMatcher{
|
|
pos: position{line: 140, col: 5, offset: 3263},
|
|
val: ">",
|
|
ignoreCase: false,
|
|
want: "\">\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 130, col: 5, offset: 3082},
|
|
run: (*parser).callonNode32,
|
|
expr: &litMatcher{
|
|
pos: position{line: 130, col: 5, offset: 3082},
|
|
val: "<",
|
|
ignoreCase: false,
|
|
want: "\"<\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
run: (*parser).callonNode34,
|
|
expr: &litMatcher{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
val: "=",
|
|
ignoreCase: false,
|
|
want: "\"=\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode36,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 58, col: 7, offset: 1403},
|
|
expr: &litMatcher{
|
|
pos: position{line: 58, col: 7, offset: 1403},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 58, col: 12, offset: 1408},
|
|
label: "v",
|
|
expr: &choiceExpr{
|
|
pos: position{line: 59, col: 9, offset: 1420},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 195, col: 5, offset: 4197},
|
|
run: (*parser).callonNode42,
|
|
expr: &seqExpr{
|
|
pos: position{line: 195, col: 5, offset: 4197},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 185, col: 5, offset: 3960},
|
|
run: (*parser).callonNode44,
|
|
expr: &seqExpr{
|
|
pos: position{line: 185, col: 5, offset: 3960},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 155, col: 5, offset: 3560},
|
|
run: (*parser).callonNode46,
|
|
expr: &seqExpr{
|
|
pos: position{line: 155, col: 5, offset: 3560},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode48,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode50,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode52,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode54,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 185, col: 14, offset: 3969},
|
|
val: "-",
|
|
ignoreCase: false,
|
|
want: "\"-\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 160, col: 5, offset: 3637},
|
|
run: (*parser).callonNode57,
|
|
expr: &seqExpr{
|
|
pos: position{line: 160, col: 5, offset: 3637},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode59,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode61,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 185, col: 28, offset: 3983},
|
|
val: "-",
|
|
ignoreCase: false,
|
|
want: "\"-\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 165, col: 5, offset: 3700},
|
|
run: (*parser).callonNode64,
|
|
expr: &seqExpr{
|
|
pos: position{line: 165, col: 5, offset: 3700},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode66,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode68,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 195, col: 14, offset: 4206},
|
|
val: "T",
|
|
ignoreCase: false,
|
|
want: "\"T\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 190, col: 5, offset: 4047},
|
|
run: (*parser).callonNode71,
|
|
expr: &seqExpr{
|
|
pos: position{line: 190, col: 5, offset: 4047},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
run: (*parser).callonNode73,
|
|
expr: &seqExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode75,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode77,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 14, offset: 4056},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
run: (*parser).callonNode80,
|
|
expr: &seqExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode82,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode84,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 29, offset: 4071},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 180, col: 5, offset: 3896},
|
|
run: (*parser).callonNode87,
|
|
expr: &seqExpr{
|
|
pos: position{line: 180, col: 5, offset: 3896},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode89,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode91,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 190, col: 44, offset: 4086},
|
|
expr: &seqExpr{
|
|
pos: position{line: 190, col: 45, offset: 4087},
|
|
exprs: []any{
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 45, offset: 4087},
|
|
val: ".",
|
|
ignoreCase: false,
|
|
want: "\".\"",
|
|
},
|
|
&oneOrMoreExpr{
|
|
pos: position{line: 190, col: 49, offset: 4091},
|
|
expr: &actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode97,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&choiceExpr{
|
|
pos: position{line: 190, col: 59, offset: 4101},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 59, offset: 4101},
|
|
val: "Z",
|
|
ignoreCase: false,
|
|
want: "\"Z\"",
|
|
},
|
|
&seqExpr{
|
|
pos: position{line: 190, col: 65, offset: 4107},
|
|
exprs: []any{
|
|
&charClassMatcher{
|
|
pos: position{line: 190, col: 66, offset: 4108},
|
|
val: "[+-]",
|
|
chars: []rune{'+', '-'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
run: (*parser).callonNode103,
|
|
expr: &seqExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode105,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode107,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 86, offset: 4128},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
run: (*parser).callonNode110,
|
|
expr: &seqExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode112,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode114,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 185, col: 5, offset: 3960},
|
|
run: (*parser).callonNode116,
|
|
expr: &seqExpr{
|
|
pos: position{line: 185, col: 5, offset: 3960},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 155, col: 5, offset: 3560},
|
|
run: (*parser).callonNode118,
|
|
expr: &seqExpr{
|
|
pos: position{line: 155, col: 5, offset: 3560},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode120,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode122,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode124,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode126,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 185, col: 14, offset: 3969},
|
|
val: "-",
|
|
ignoreCase: false,
|
|
want: "\"-\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 160, col: 5, offset: 3637},
|
|
run: (*parser).callonNode129,
|
|
expr: &seqExpr{
|
|
pos: position{line: 160, col: 5, offset: 3637},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode131,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode133,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 185, col: 28, offset: 3983},
|
|
val: "-",
|
|
ignoreCase: false,
|
|
want: "\"-\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 165, col: 5, offset: 3700},
|
|
run: (*parser).callonNode136,
|
|
expr: &seqExpr{
|
|
pos: position{line: 165, col: 5, offset: 3700},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode138,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode140,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 190, col: 5, offset: 4047},
|
|
run: (*parser).callonNode142,
|
|
expr: &seqExpr{
|
|
pos: position{line: 190, col: 5, offset: 4047},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
run: (*parser).callonNode144,
|
|
expr: &seqExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode146,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode148,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 14, offset: 4056},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
run: (*parser).callonNode151,
|
|
expr: &seqExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode153,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode155,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 29, offset: 4071},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 180, col: 5, offset: 3896},
|
|
run: (*parser).callonNode158,
|
|
expr: &seqExpr{
|
|
pos: position{line: 180, col: 5, offset: 3896},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode160,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode162,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 190, col: 44, offset: 4086},
|
|
expr: &seqExpr{
|
|
pos: position{line: 190, col: 45, offset: 4087},
|
|
exprs: []any{
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 45, offset: 4087},
|
|
val: ".",
|
|
ignoreCase: false,
|
|
want: "\".\"",
|
|
},
|
|
&oneOrMoreExpr{
|
|
pos: position{line: 190, col: 49, offset: 4091},
|
|
expr: &actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode168,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&choiceExpr{
|
|
pos: position{line: 190, col: 59, offset: 4101},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 59, offset: 4101},
|
|
val: "Z",
|
|
ignoreCase: false,
|
|
want: "\"Z\"",
|
|
},
|
|
&seqExpr{
|
|
pos: position{line: 190, col: 65, offset: 4107},
|
|
exprs: []any{
|
|
&charClassMatcher{
|
|
pos: position{line: 190, col: 66, offset: 4108},
|
|
val: "[+-]",
|
|
chars: []rune{'+', '-'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
run: (*parser).callonNode174,
|
|
expr: &seqExpr{
|
|
pos: position{line: 170, col: 5, offset: 3764},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode176,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode178,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 190, col: 86, offset: 4128},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
run: (*parser).callonNode181,
|
|
expr: &seqExpr{
|
|
pos: position{line: 175, col: 5, offset: 3830},
|
|
exprs: []any{
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode183,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
run: (*parser).callonNode185,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 228, col: 5, offset: 4753},
|
|
val: "[0-9]",
|
|
ranges: []rune{'0', '9'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 62, col: 7, offset: 1473},
|
|
expr: &litMatcher{
|
|
pos: position{line: 62, col: 7, offset: 1473},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 65, col: 5, offset: 1549},
|
|
run: (*parser).callonNode189,
|
|
expr: &seqExpr{
|
|
pos: position{line: 65, col: 5, offset: 1549},
|
|
exprs: []any{
|
|
&labeledExpr{
|
|
pos: position{line: 65, col: 5, offset: 1549},
|
|
label: "k",
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 65, col: 7, offset: 1551},
|
|
expr: &actionExpr{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
run: (*parser).callonNode193,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
val: "[A-Za-z]",
|
|
ranges: []rune{'A', 'Z', 'a', 'z'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&choiceExpr{
|
|
pos: position{line: 66, col: 9, offset: 1567},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
run: (*parser).callonNode196,
|
|
expr: &litMatcher{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
val: "=",
|
|
ignoreCase: false,
|
|
want: "\"=\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode198,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 68, col: 7, offset: 1619},
|
|
expr: &litMatcher{
|
|
pos: position{line: 68, col: 7, offset: 1619},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 68, col: 12, offset: 1624},
|
|
label: "v",
|
|
expr: &choiceExpr{
|
|
pos: position{line: 200, col: 5, offset: 4285},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 200, col: 5, offset: 4285},
|
|
val: "today",
|
|
ignoreCase: false,
|
|
want: "\"today\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 201, col: 5, offset: 4299},
|
|
val: "yesterday",
|
|
ignoreCase: false,
|
|
want: "\"yesterday\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 202, col: 5, offset: 4317},
|
|
val: "this week",
|
|
ignoreCase: false,
|
|
want: "\"this week\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 203, col: 5, offset: 4335},
|
|
val: "last week",
|
|
ignoreCase: false,
|
|
want: "\"last week\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 204, col: 5, offset: 4353},
|
|
val: "last 7 days",
|
|
ignoreCase: false,
|
|
want: "\"last 7 days\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 205, col: 5, offset: 4373},
|
|
val: "this month",
|
|
ignoreCase: false,
|
|
want: "\"this month\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 206, col: 5, offset: 4392},
|
|
val: "last month",
|
|
ignoreCase: false,
|
|
want: "\"last month\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 207, col: 5, offset: 4411},
|
|
val: "last 30 days",
|
|
ignoreCase: false,
|
|
want: "\"last 30 days\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 208, col: 5, offset: 4432},
|
|
val: "this year",
|
|
ignoreCase: false,
|
|
want: "\"this year\"",
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 209, col: 5, offset: 4450},
|
|
run: (*parser).callonNode213,
|
|
expr: &litMatcher{
|
|
pos: position{line: 209, col: 5, offset: 4450},
|
|
val: "last year",
|
|
ignoreCase: false,
|
|
want: "\"last year\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 68, col: 38, offset: 1650},
|
|
expr: &litMatcher{
|
|
pos: position{line: 68, col: 38, offset: 1650},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 73, col: 5, offset: 1769},
|
|
run: (*parser).callonNode217,
|
|
expr: &seqExpr{
|
|
pos: position{line: 73, col: 5, offset: 1769},
|
|
exprs: []any{
|
|
&labeledExpr{
|
|
pos: position{line: 73, col: 5, offset: 1769},
|
|
label: "k",
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 73, col: 7, offset: 1771},
|
|
expr: &actionExpr{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
run: (*parser).callonNode221,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
val: "[A-Za-z]",
|
|
ranges: []rune{'A', 'Z', 'a', 'z'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&choiceExpr{
|
|
pos: position{line: 73, col: 14, offset: 1778},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode224,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
run: (*parser).callonNode226,
|
|
expr: &litMatcher{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
val: "=",
|
|
ignoreCase: false,
|
|
want: "\"=\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 73, col: 53, offset: 1817},
|
|
label: "v",
|
|
expr: &choiceExpr{
|
|
pos: position{line: 73, col: 56, offset: 1820},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
run: (*parser).callonNode230,
|
|
expr: &seqExpr{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
exprs: []any{
|
|
&litMatcher{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 223, col: 9, offset: 4697},
|
|
label: "v",
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 223, col: 11, offset: 4699},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 223, col: 11, offset: 4699},
|
|
val: "[^\"]",
|
|
chars: []rune{'"'},
|
|
ignoreCase: false,
|
|
inverted: true,
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 223, col: 17, offset: 4705},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&oneOrMoreExpr{
|
|
pos: position{line: 73, col: 65, offset: 1829},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 73, col: 65, offset: 1829},
|
|
val: "[^ ()]",
|
|
chars: []rune{' ', '(', ')'},
|
|
ignoreCase: false,
|
|
inverted: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 105, col: 5, offset: 2621},
|
|
run: (*parser).callonNode239,
|
|
expr: &choiceExpr{
|
|
pos: position{line: 105, col: 6, offset: 2622},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 105, col: 6, offset: 2622},
|
|
val: "AND",
|
|
ignoreCase: false,
|
|
want: "\"AND\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 105, col: 14, offset: 2630},
|
|
val: "+",
|
|
ignoreCase: false,
|
|
want: "\"+\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 110, col: 5, offset: 2722},
|
|
run: (*parser).callonNode243,
|
|
expr: &choiceExpr{
|
|
pos: position{line: 110, col: 6, offset: 2723},
|
|
alternatives: []any{
|
|
&litMatcher{
|
|
pos: position{line: 110, col: 6, offset: 2723},
|
|
val: "NOT",
|
|
ignoreCase: false,
|
|
want: "\"NOT\"",
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 110, col: 14, offset: 2731},
|
|
val: "-",
|
|
ignoreCase: false,
|
|
want: "\"-\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 115, col: 5, offset: 2822},
|
|
run: (*parser).callonNode247,
|
|
expr: &litMatcher{
|
|
pos: position{line: 115, col: 6, offset: 2823},
|
|
val: "OR",
|
|
ignoreCase: false,
|
|
want: "\"OR\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 86, col: 6, offset: 2109},
|
|
run: (*parser).callonNode249,
|
|
expr: &seqExpr{
|
|
pos: position{line: 86, col: 6, offset: 2109},
|
|
exprs: []any{
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 86, col: 6, offset: 2109},
|
|
expr: &actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode252,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
run: (*parser).callonNode254,
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
val: "[ \\t]",
|
|
chars: []rune{' ', '\t'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 86, col: 27, offset: 2130},
|
|
label: "v",
|
|
expr: &actionExpr{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
run: (*parser).callonNode258,
|
|
expr: &seqExpr{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
exprs: []any{
|
|
&litMatcher{
|
|
pos: position{line: 223, col: 5, offset: 4693},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 223, col: 9, offset: 4697},
|
|
label: "v",
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 223, col: 11, offset: 4699},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 223, col: 11, offset: 4699},
|
|
val: "[^\"]",
|
|
chars: []rune{'"'},
|
|
ignoreCase: false,
|
|
inverted: true,
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 223, col: 17, offset: 4705},
|
|
val: "\"",
|
|
ignoreCase: false,
|
|
want: "\"\\\"\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
run: (*parser).callonNode265,
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
val: "[ \\t]",
|
|
chars: []rune{' ', '\t'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 86, col: 38, offset: 2141},
|
|
expr: &actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode269,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 91, col: 6, offset: 2239},
|
|
run: (*parser).callonNode271,
|
|
expr: &seqExpr{
|
|
pos: position{line: 91, col: 6, offset: 2239},
|
|
exprs: []any{
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 91, col: 6, offset: 2239},
|
|
expr: &actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode274,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
run: (*parser).callonNode276,
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
val: "[ \\t]",
|
|
chars: []rune{' ', '\t'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 91, col: 27, offset: 2260},
|
|
label: "v",
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 91, col: 29, offset: 2262},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 91, col: 29, offset: 2262},
|
|
val: "[^ :()]",
|
|
chars: []rune{' ', ':', '(', ')'},
|
|
ignoreCase: false,
|
|
inverted: true,
|
|
},
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
run: (*parser).callonNode282,
|
|
expr: &zeroOrMoreExpr{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 233, col: 5, offset: 4804},
|
|
val: "[ \\t]",
|
|
chars: []rune{' ', '\t'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 91, col: 40, offset: 2273},
|
|
expr: &actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonNode286,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "GroupNode",
|
|
pos: position{line: 31, col: 1, offset: 595},
|
|
expr: &actionExpr{
|
|
pos: position{line: 32, col: 5, offset: 612},
|
|
run: (*parser).callonGroupNode1,
|
|
expr: &seqExpr{
|
|
pos: position{line: 32, col: 5, offset: 612},
|
|
exprs: []any{
|
|
&labeledExpr{
|
|
pos: position{line: 32, col: 5, offset: 612},
|
|
label: "k",
|
|
expr: &zeroOrOneExpr{
|
|
pos: position{line: 32, col: 7, offset: 614},
|
|
expr: &oneOrMoreExpr{
|
|
pos: position{line: 32, col: 8, offset: 615},
|
|
expr: &actionExpr{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
run: (*parser).callonGroupNode6,
|
|
expr: &charClassMatcher{
|
|
pos: position{line: 218, col: 5, offset: 4634},
|
|
val: "[A-Za-z]",
|
|
ranges: []rune{'A', 'Z', 'a', 'z'},
|
|
ignoreCase: false,
|
|
inverted: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&zeroOrOneExpr{
|
|
pos: position{line: 32, col: 16, offset: 623},
|
|
expr: &choiceExpr{
|
|
pos: position{line: 32, col: 17, offset: 624},
|
|
alternatives: []any{
|
|
&actionExpr{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
run: (*parser).callonGroupNode10,
|
|
expr: &litMatcher{
|
|
pos: position{line: 120, col: 5, offset: 2911},
|
|
val: ":",
|
|
ignoreCase: false,
|
|
want: "\":\"",
|
|
},
|
|
},
|
|
&actionExpr{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
run: (*parser).callonGroupNode12,
|
|
expr: &litMatcher{
|
|
pos: position{line: 125, col: 5, offset: 2997},
|
|
val: "=",
|
|
ignoreCase: false,
|
|
want: "\"=\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 32, col: 57, offset: 664},
|
|
val: "(",
|
|
ignoreCase: false,
|
|
want: "\"(\"",
|
|
},
|
|
&labeledExpr{
|
|
pos: position{line: 32, col: 61, offset: 668},
|
|
label: "v",
|
|
expr: &ruleRefExpr{
|
|
pos: position{line: 32, col: 63, offset: 670},
|
|
name: "Nodes",
|
|
},
|
|
},
|
|
&litMatcher{
|
|
pos: position{line: 32, col: 69, offset: 676},
|
|
val: ")",
|
|
ignoreCase: false,
|
|
want: "\")\"",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
func (c *current) onAST1(n any) (any, error) {
|
|
return buildAST(n, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonAST1() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onAST1(stack["n"])
|
|
}
|
|
|
|
func (c *current) onNodes3() (any, error) {
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNodes3() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNodes3()
|
|
}
|
|
|
|
func (c *current) onNode7() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode7() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode7()
|
|
}
|
|
|
|
func (c *current) onNode10() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode10() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode10()
|
|
}
|
|
|
|
func (c *current) onNode12() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode12() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode12()
|
|
}
|
|
|
|
func (c *current) onNode3(k, v any) (any, error) {
|
|
return buildBooleanNode(k, v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode3() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode3(stack["k"], stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode22() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode22() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode22()
|
|
}
|
|
|
|
func (c *current) onNode26() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode26() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode26()
|
|
}
|
|
|
|
func (c *current) onNode28() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode28() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode28()
|
|
}
|
|
|
|
func (c *current) onNode30() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode30() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode30()
|
|
}
|
|
|
|
func (c *current) onNode32() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode32() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode32()
|
|
}
|
|
|
|
func (c *current) onNode34() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode34() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode34()
|
|
}
|
|
|
|
func (c *current) onNode36() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode36() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode36()
|
|
}
|
|
|
|
func (c *current) onNode48() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode48() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode48()
|
|
}
|
|
|
|
func (c *current) onNode50() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode50() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode50()
|
|
}
|
|
|
|
func (c *current) onNode52() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode52() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode52()
|
|
}
|
|
|
|
func (c *current) onNode54() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode54() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode54()
|
|
}
|
|
|
|
func (c *current) onNode46() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode46() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode46()
|
|
}
|
|
|
|
func (c *current) onNode59() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode59() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode59()
|
|
}
|
|
|
|
func (c *current) onNode61() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode61() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode61()
|
|
}
|
|
|
|
func (c *current) onNode57() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode57() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode57()
|
|
}
|
|
|
|
func (c *current) onNode66() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode66() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode66()
|
|
}
|
|
|
|
func (c *current) onNode68() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode68() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode68()
|
|
}
|
|
|
|
func (c *current) onNode64() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode64() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode64()
|
|
}
|
|
|
|
func (c *current) onNode44() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode44() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode44()
|
|
}
|
|
|
|
func (c *current) onNode75() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode75() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode75()
|
|
}
|
|
|
|
func (c *current) onNode77() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode77() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode77()
|
|
}
|
|
|
|
func (c *current) onNode73() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode73() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode73()
|
|
}
|
|
|
|
func (c *current) onNode82() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode82() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode82()
|
|
}
|
|
|
|
func (c *current) onNode84() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode84() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode84()
|
|
}
|
|
|
|
func (c *current) onNode80() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode80() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode80()
|
|
}
|
|
|
|
func (c *current) onNode89() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode89() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode89()
|
|
}
|
|
|
|
func (c *current) onNode91() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode91() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode91()
|
|
}
|
|
|
|
func (c *current) onNode87() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode87() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode87()
|
|
}
|
|
|
|
func (c *current) onNode97() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode97() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode97()
|
|
}
|
|
|
|
func (c *current) onNode105() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode105() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode105()
|
|
}
|
|
|
|
func (c *current) onNode107() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode107() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode107()
|
|
}
|
|
|
|
func (c *current) onNode103() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode103() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode103()
|
|
}
|
|
|
|
func (c *current) onNode112() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode112() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode112()
|
|
}
|
|
|
|
func (c *current) onNode114() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode114() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode114()
|
|
}
|
|
|
|
func (c *current) onNode110() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode110() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode110()
|
|
}
|
|
|
|
func (c *current) onNode71() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode71() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode71()
|
|
}
|
|
|
|
func (c *current) onNode42() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode42() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode42()
|
|
}
|
|
|
|
func (c *current) onNode120() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode120() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode120()
|
|
}
|
|
|
|
func (c *current) onNode122() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode122() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode122()
|
|
}
|
|
|
|
func (c *current) onNode124() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode124() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode124()
|
|
}
|
|
|
|
func (c *current) onNode126() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode126() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode126()
|
|
}
|
|
|
|
func (c *current) onNode118() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode118() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode118()
|
|
}
|
|
|
|
func (c *current) onNode131() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode131() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode131()
|
|
}
|
|
|
|
func (c *current) onNode133() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode133() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode133()
|
|
}
|
|
|
|
func (c *current) onNode129() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode129() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode129()
|
|
}
|
|
|
|
func (c *current) onNode138() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode138() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode138()
|
|
}
|
|
|
|
func (c *current) onNode140() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode140() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode140()
|
|
}
|
|
|
|
func (c *current) onNode136() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode136() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode136()
|
|
}
|
|
|
|
func (c *current) onNode116() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode116() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode116()
|
|
}
|
|
|
|
func (c *current) onNode146() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode146() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode146()
|
|
}
|
|
|
|
func (c *current) onNode148() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode148() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode148()
|
|
}
|
|
|
|
func (c *current) onNode144() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode144() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode144()
|
|
}
|
|
|
|
func (c *current) onNode153() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode153() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode153()
|
|
}
|
|
|
|
func (c *current) onNode155() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode155() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode155()
|
|
}
|
|
|
|
func (c *current) onNode151() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode151() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode151()
|
|
}
|
|
|
|
func (c *current) onNode160() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode160() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode160()
|
|
}
|
|
|
|
func (c *current) onNode162() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode162() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode162()
|
|
}
|
|
|
|
func (c *current) onNode158() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode158() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode158()
|
|
}
|
|
|
|
func (c *current) onNode168() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode168() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode168()
|
|
}
|
|
|
|
func (c *current) onNode176() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode176() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode176()
|
|
}
|
|
|
|
func (c *current) onNode178() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode178() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode178()
|
|
}
|
|
|
|
func (c *current) onNode174() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode174() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode174()
|
|
}
|
|
|
|
func (c *current) onNode183() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode183() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode183()
|
|
}
|
|
|
|
func (c *current) onNode185() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode185() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode185()
|
|
}
|
|
|
|
func (c *current) onNode181() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode181() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode181()
|
|
}
|
|
|
|
func (c *current) onNode142() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode142() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode142()
|
|
}
|
|
|
|
func (c *current) onNode18(k, o, v any) (any, error) {
|
|
return buildDateTimeNode(k, o, v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode18() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode18(stack["k"], stack["o"], stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode193() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode193() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode193()
|
|
}
|
|
|
|
func (c *current) onNode196() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode196() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode196()
|
|
}
|
|
|
|
func (c *current) onNode198() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode198() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode198()
|
|
}
|
|
|
|
func (c *current) onNode213() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode213() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode213()
|
|
}
|
|
|
|
func (c *current) onNode189(k, v any) (any, error) {
|
|
return buildNaturalLanguageDateTimeNodes(k, v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode189() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode189(stack["k"], stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode221() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode221() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode221()
|
|
}
|
|
|
|
func (c *current) onNode224() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode224() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode224()
|
|
}
|
|
|
|
func (c *current) onNode226() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode226() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode226()
|
|
}
|
|
|
|
func (c *current) onNode230(v any) (any, error) {
|
|
return v, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode230() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode230(stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode217(k, v any) (any, error) {
|
|
return buildStringNode(k, v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode217() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode217(stack["k"], stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode239() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode239() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode239()
|
|
}
|
|
|
|
func (c *current) onNode243() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode243() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode243()
|
|
}
|
|
|
|
func (c *current) onNode247() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode247() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode247()
|
|
}
|
|
|
|
func (c *current) onNode252() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode252() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode252()
|
|
}
|
|
|
|
func (c *current) onNode254() (any, error) {
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode254() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode254()
|
|
}
|
|
|
|
func (c *current) onNode258(v any) (any, error) {
|
|
return v, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode258() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode258(stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode265(v any) (any, error) {
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode265() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode265(stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode269() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode269() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode269()
|
|
}
|
|
|
|
func (c *current) onNode249(v any) (any, error) {
|
|
return buildStringNode("", v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode249() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode249(stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode274() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode274() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode274()
|
|
}
|
|
|
|
func (c *current) onNode276() (any, error) {
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode276() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode276()
|
|
}
|
|
|
|
func (c *current) onNode282(v any) (any, error) {
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode282() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode282(stack["v"])
|
|
}
|
|
|
|
func (c *current) onNode286() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode286() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode286()
|
|
}
|
|
|
|
func (c *current) onNode271(v any) (any, error) {
|
|
return buildStringNode("", v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonNode271() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onNode271(stack["v"])
|
|
}
|
|
|
|
func (c *current) onGroupNode6() (any, error) {
|
|
return c.text, nil
|
|
|
|
}
|
|
|
|
func (p *parser) callonGroupNode6() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onGroupNode6()
|
|
}
|
|
|
|
func (c *current) onGroupNode10() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonGroupNode10() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onGroupNode10()
|
|
}
|
|
|
|
func (c *current) onGroupNode12() (any, error) {
|
|
return buildOperatorNode(c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonGroupNode12() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onGroupNode12()
|
|
}
|
|
|
|
func (c *current) onGroupNode1(k, v any) (any, error) {
|
|
return buildGroupNode(k, v, c.text, c.pos)
|
|
|
|
}
|
|
|
|
func (p *parser) callonGroupNode1() (any, error) {
|
|
stack := p.vstack[len(p.vstack)-1]
|
|
_ = stack
|
|
return p.cur.onGroupNode1(stack["k"], stack["v"])
|
|
}
|
|
|
|
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 expressions 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)
|
|
}
|
|
}
|
|
|
|
// 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 any) Option {
|
|
return func(p *parser) Option {
|
|
old := p.cur.globalStore[key]
|
|
p.cur.globalStore[key] = value
|
|
return GlobalStore(key, old)
|
|
}
|
|
}
|
|
|
|
// ParseFile parses the file identified by filename.
|
|
func ParseFile(filename string, opts ...Option) (i any, 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) (any, error) {
|
|
b, err := io.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) (any, 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 strconv.Itoa(p.line) + ":" + strconv.Itoa(p.col) + " [" + strconv.Itoa(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
|
|
|
|
// 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]any
|
|
|
|
// the AST types...
|
|
|
|
type grammar struct {
|
|
pos position
|
|
rules []*rule
|
|
}
|
|
|
|
type rule struct {
|
|
pos position
|
|
name string
|
|
displayName string
|
|
expr any
|
|
}
|
|
|
|
type choiceExpr struct {
|
|
pos position
|
|
alternatives []any
|
|
}
|
|
|
|
type actionExpr struct {
|
|
pos position
|
|
expr any
|
|
run func(*parser) (any, error)
|
|
}
|
|
|
|
type recoveryExpr struct {
|
|
pos position
|
|
expr any
|
|
recoverExpr any
|
|
failureLabel []string
|
|
}
|
|
|
|
type seqExpr struct {
|
|
pos position
|
|
exprs []any
|
|
}
|
|
|
|
type throwExpr struct {
|
|
pos position
|
|
label string
|
|
}
|
|
|
|
type labeledExpr struct {
|
|
pos position
|
|
label string
|
|
expr any
|
|
}
|
|
|
|
type expr struct {
|
|
pos position
|
|
expr any
|
|
}
|
|
|
|
type (
|
|
andExpr expr
|
|
notExpr expr
|
|
zeroOrOneExpr expr
|
|
zeroOrMoreExpr expr
|
|
oneOrMoreExpr expr
|
|
)
|
|
|
|
type ruleRefExpr struct {
|
|
pos position
|
|
name string
|
|
}
|
|
|
|
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
|
|
want string
|
|
}
|
|
|
|
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{
|
|
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 any
|
|
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
|
|
|
|
// rules table, maps the rule identifier to the rule node
|
|
rules map[string]*rule
|
|
// variables stack, map of label to value
|
|
vstack []map[string]any
|
|
// 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]any
|
|
}
|
|
|
|
// 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]any)
|
|
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 any) {
|
|
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]any, 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) 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 pt.offset == p.pt.offset {
|
|
return
|
|
}
|
|
p.pt = pt
|
|
}
|
|
|
|
// 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) 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 any, 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 {
|
|
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.parseRuleWrap(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 strings.Join(list[:len(list)-1], sep) + " " + lastSep + " " + list[len(list)-1]
|
|
}
|
|
}
|
|
|
|
func (p *parser) parseRuleWrap(rule *rule) (any, bool) {
|
|
var (
|
|
val any
|
|
ok bool
|
|
)
|
|
|
|
val, ok = p.parseRule(rule)
|
|
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseRule(rule *rule) (any, bool) {
|
|
p.rstack = append(p.rstack, rule)
|
|
p.pushV()
|
|
val, ok := p.parseExprWrap(rule.expr)
|
|
p.popV()
|
|
p.rstack = p.rstack[:len(p.rstack)-1]
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseExprWrap(expr any) (any, bool) {
|
|
val, ok := p.parseExpr(expr)
|
|
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseExpr(expr any) (any, bool) {
|
|
p.ExprCnt++
|
|
if p.ExprCnt > p.maxExprCnt {
|
|
panic(errMaxExprCnt)
|
|
}
|
|
|
|
var val any
|
|
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 *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))
|
|
}
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseActionExpr(act *actionExpr) (any, bool) {
|
|
start := p.pt
|
|
val, ok := p.parseExprWrap(act.expr)
|
|
if ok {
|
|
p.cur.pos = start.position
|
|
p.cur.text = p.sliceFrom(start)
|
|
actVal, err := act.run(p)
|
|
if err != nil {
|
|
p.addErrAt(err, start.position, []string{})
|
|
}
|
|
|
|
val = actVal
|
|
}
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseAndCodeExpr(and *andCodeExpr) (any, bool) {
|
|
|
|
ok, err := and.run(p)
|
|
if err != nil {
|
|
p.addErr(err)
|
|
}
|
|
|
|
return nil, ok
|
|
}
|
|
|
|
func (p *parser) parseAndExpr(and *andExpr) (any, bool) {
|
|
pt := p.pt
|
|
p.pushV()
|
|
_, ok := p.parseExprWrap(and.expr)
|
|
p.popV()
|
|
p.restore(pt)
|
|
|
|
return nil, ok
|
|
}
|
|
|
|
func (p *parser) parseAnyMatcher(any *anyMatcher) (any, bool) {
|
|
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) (any, bool) {
|
|
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) parseChoiceExpr(ch *choiceExpr) (any, bool) {
|
|
|
|
for altI, alt := range ch.alternatives {
|
|
// dummy assignment to prevent compile error if optimized
|
|
_ = altI
|
|
|
|
p.pushV()
|
|
val, ok := p.parseExprWrap(alt)
|
|
p.popV()
|
|
if ok {
|
|
return val, ok
|
|
}
|
|
}
|
|
return nil, false
|
|
}
|
|
|
|
func (p *parser) parseLabeledExpr(lab *labeledExpr) (any, bool) {
|
|
p.pushV()
|
|
val, ok := p.parseExprWrap(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) (any, bool) {
|
|
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, lit.want)
|
|
p.restore(start)
|
|
return nil, false
|
|
}
|
|
p.read()
|
|
}
|
|
p.failAt(true, start.position, lit.want)
|
|
return p.sliceFrom(start), true
|
|
}
|
|
|
|
func (p *parser) parseNotCodeExpr(not *notCodeExpr) (any, bool) {
|
|
ok, err := not.run(p)
|
|
if err != nil {
|
|
p.addErr(err)
|
|
}
|
|
|
|
return nil, !ok
|
|
}
|
|
|
|
func (p *parser) parseNotExpr(not *notExpr) (any, bool) {
|
|
pt := p.pt
|
|
p.pushV()
|
|
p.maxFailInvertExpected = !p.maxFailInvertExpected
|
|
_, ok := p.parseExprWrap(not.expr)
|
|
p.maxFailInvertExpected = !p.maxFailInvertExpected
|
|
p.popV()
|
|
p.restore(pt)
|
|
|
|
return nil, !ok
|
|
}
|
|
|
|
func (p *parser) parseOneOrMoreExpr(expr *oneOrMoreExpr) (any, bool) {
|
|
var vals []any
|
|
|
|
for {
|
|
p.pushV()
|
|
val, ok := p.parseExprWrap(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) (any, bool) {
|
|
|
|
p.pushRecovery(recover.failureLabel, recover.recoverExpr)
|
|
val, ok := p.parseExprWrap(recover.expr)
|
|
p.popRecovery()
|
|
|
|
return val, ok
|
|
}
|
|
|
|
func (p *parser) parseRuleRefExpr(ref *ruleRefExpr) (any, bool) {
|
|
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.parseRuleWrap(rule)
|
|
}
|
|
|
|
func (p *parser) parseSeqExpr(seq *seqExpr) (any, bool) {
|
|
vals := make([]any, 0, len(seq.exprs))
|
|
|
|
pt := p.pt
|
|
for _, expr := range seq.exprs {
|
|
val, ok := p.parseExprWrap(expr)
|
|
if !ok {
|
|
p.restore(pt)
|
|
return nil, false
|
|
}
|
|
vals = append(vals, val)
|
|
}
|
|
return vals, true
|
|
}
|
|
|
|
func (p *parser) parseThrowExpr(expr *throwExpr) (any, bool) {
|
|
|
|
for i := len(p.recoveryStack) - 1; i >= 0; i-- {
|
|
if recoverExpr, ok := p.recoveryStack[i][expr.label]; ok {
|
|
if val, ok := p.parseExprWrap(recoverExpr); ok {
|
|
return val, ok
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil, false
|
|
}
|
|
|
|
func (p *parser) parseZeroOrMoreExpr(expr *zeroOrMoreExpr) (any, bool) {
|
|
var vals []any
|
|
|
|
for {
|
|
p.pushV()
|
|
val, ok := p.parseExprWrap(expr.expr)
|
|
p.popV()
|
|
if !ok {
|
|
return vals, true
|
|
}
|
|
vals = append(vals, val)
|
|
}
|
|
}
|
|
|
|
func (p *parser) parseZeroOrOneExpr(expr *zeroOrOneExpr) (any, bool) {
|
|
p.pushV()
|
|
val, _ := p.parseExprWrap(expr.expr)
|
|
p.popV()
|
|
// whether it matched or not, consider it a match
|
|
return val, true
|
|
}
|