| 1 | package parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/ |
| 2 | |
| 3 | import ( |
| 4 | "slicesscip-go gomod github.com/golang/go/src go1.25 slices/" |
| 5 | |
| 6 | "github.com/tomwright/dasel/v3/selector/astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/" |
| 7 | "github.com/tomwright/dasel/v3/selector/lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/" |
| 8 | ) |
| 9 | |
| 10 | type Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser# struct { |
| 11 | tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens. lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens# |
| 12 | iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i. int |
| 13 | } |
| 14 | |
| 15 | func NewParserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/NewParser().(tokens lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens#) *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser# { |
| 16 | return &Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#{ |
| 17 | tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.: tokens, |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) parseExpressionsAsSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpressionsAsSlice().( |
| 22 | breakOn []lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#, |
| 23 | splitOn []lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#, |
| 24 | requireExpressions bool, |
| 25 | bp bindingPowerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bindingPower#, |
| 26 | advanceOnBreak bool, |
| 27 | ) (astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Expressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expressions#, error) { |
| 28 | var finalExpr astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Expressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expressions# |
| 29 | var current astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Expressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expressions# |
| 30 | for p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() { |
| 31 | if p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(breakOn...) { |
| 32 | if advanceOnBreak { |
| 33 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 34 | } |
| 35 | break |
| 36 | } |
| 37 | if p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(splitOn...) { |
| 38 | if requireExpressions && len(current) == 0 { |
| 39 | return nil, &UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#{Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#Token.: p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().()} |
| 40 | } |
| 41 | finalExpr = append(finalExpr, astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainExprsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainExprs().(current...)) |
| 42 | current = nil |
| 43 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 44 | continue |
| 45 | } |
| 46 | expr, err := p.parseExpressionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpression().(bp) |
| 47 | if err != nil { |
| 48 | return nil, err |
| 49 | } |
| 50 | current = append(current, expr) |
| 51 | } |
| 52 | |
| 53 | if len(current) > 0 { |
| 54 | finalExpr = append(finalExpr, astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainExprsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainExprs().(current...)) |
| 55 | } |
| 56 | |
| 57 | if len(finalExpr) == 0 { |
| 58 | return nil, nil |
| 59 | } |
| 60 | |
| 61 | return finalExpr, nil |
| 62 | } |
| 63 | |
| 64 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) parseExpressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpressions().( |
| 65 | breakOn []lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#, |
| 66 | splitOn []lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#, |
| 67 | requireExpressions bool, |
| 68 | bp bindingPowerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bindingPower#, |
| 69 | advanceOnBreak bool, |
| 70 | ) (astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Exprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expr#, error) { |
| 71 | expressions, err := p.parseExpressionsAsSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpressionsAsSlice().(breakOn, splitOn, requireExpressions, bp, advanceOnBreak) |
| 72 | if err != nil { |
| 73 | return nil, err |
| 74 | } |
| 75 | switch len(expressions) { |
| 76 | case 0: |
| 77 | return nil, nil |
| 78 | default: |
| 79 | return astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainExprsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainExprs().(expressions...), nil |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) Parsescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#Parse().() (astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Exprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expr#, error) { |
| 84 | return p.parseExpressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpressions().([]lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#{lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.EOFscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/EOF.}, []lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#{lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Semicolonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Semicolon.}, true, bpDefaultscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bpDefault., true) |
| 85 | } |
| 86 | |
| 87 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) parseExpressionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpression().(bp bindingPowerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bindingPower#) (left astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Exprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expr#, err error) { |
| 88 | if p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() && slicesscip-go gomod github.com/golang/go/src go1.25 slices/.Containsscip-go gomod github.com/golang/go/src go1.25 slices/Contains().(rightDenotationTokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/rightDenotationTokens., p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.) { |
| 89 | unary := astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.UnaryExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#{ |
| 90 | Operatorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#Operator.: p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().(), |
| 91 | Rightscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#Right.: nil, |
| 92 | } |
| 93 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 94 | expr, err := p.parseExpressionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpression().(getTokenBindingPowerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/getTokenBindingPower().(unary.Operatorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#Operator..Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.)) |
| 95 | if err != nil { |
| 96 | return nil, err |
| 97 | } |
| 98 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 99 | unary.Rightscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#Right. = expr |
| 100 | left = unary |
| 101 | } |
| 102 | |
| 103 | if !p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() { |
| 104 | return |
| 105 | } |
| 106 | |
| 107 | switch p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind. { |
| 108 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/String.: |
| 109 | left, err = parseStringLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseStringLiteral().(p) |
| 110 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Numberscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Number.: |
| 111 | left, err = parseNumberLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseNumberLiteral().(p) |
| 112 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Dashscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dash.: |
| 113 | if p.peekscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#peek().().Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind. == lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Numberscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Number. { |
| 114 | left, err = parseNumberLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseNumberLiteral().(p) |
| 115 | } else { |
| 116 | return nil, &UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#{ |
| 117 | Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#Token.: p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().(), |
| 118 | } |
| 119 | } |
| 120 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Symbolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Symbol.: |
| 121 | left, err = parseSymbolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseSymbol().(p, true, true) |
| 122 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.OpenBracketscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenBracket.: |
| 123 | left, err = parseArrayscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseArray().(p) |
| 124 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.OpenCurlyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenCurly.: |
| 125 | left, err = parseObjectscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseObject().(p) |
| 126 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Boolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Bool.: |
| 127 | left, err = parseBoolLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseBoolLiteral().(p) |
| 128 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Spreadscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Spread.: |
| 129 | left, err = parseSpreadscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseSpread().(p) |
| 130 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Variablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Variable.: |
| 131 | left, err = parseVariablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseVariable().(p) |
| 132 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.OpenParenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenParen.: |
| 133 | left, err = parseGroupscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseGroup().(p) |
| 134 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Ifscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/If.: |
| 135 | left, err = parseIfscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseIf().(p) |
| 136 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Branchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Branch.: |
| 137 | left, err = parseBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseBranch().(p) |
| 138 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Mapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Map.: |
| 139 | left, err = parseMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseMap().(p) |
| 140 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Eachscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Each.: |
| 141 | left, err = parseEachscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseEach().(p) |
| 142 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Filterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Filter.: |
| 143 | left, err = parseFilterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseFilter().(p) |
| 144 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Searchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Search.: |
| 145 | left, err = parseSearchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseSearch().(p) |
| 146 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.RecursiveDescentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/RecursiveDescent.: |
| 147 | left, err = parseRecursiveDescentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseRecursiveDescent().(p) |
| 148 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.RegexPatternscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/RegexPattern.: |
| 149 | left, err = parseRegexPatternscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseRegexPattern().(p) |
| 150 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.SortByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/SortBy.: |
| 151 | left, err = parseSortByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseSortBy().(p) |
| 152 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.GroupByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/GroupBy.: |
| 153 | left, err = parseGroupByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseGroupBy().(p) |
| 154 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Reducescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Reduce.: |
| 155 | left, err = parseReducescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseReduce().(p) |
| 156 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.MapValuesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/MapValues.: |
| 157 | left, err = parseMapValuesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseMapValues().(p) |
| 158 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Anyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Any.: |
| 159 | left, err = parseAnyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseAny().(p) |
| 160 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Allscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/All.: |
| 161 | left, err = parseAllscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseAll().(p) |
| 162 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Countscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Count.: |
| 163 | left, err = parseCountscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseCount().(p) |
| 164 | case lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Nullscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Null.: |
| 165 | left = astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.NullExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/NullExpr#{} |
| 166 | err = nil |
| 167 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 168 | default: |
| 169 | return nil, &UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#{ |
| 170 | Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#Token.: p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().(), |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if err != nil { |
| 175 | return |
| 176 | } |
| 177 | |
| 178 | toChain := astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Expressionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expressions#{left} |
| 179 | // Ensure dot separated chains are parsed as a sequence of expressions |
| 180 | if p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() && p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Dotscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dot.) { |
| 181 | for p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() && p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Dotscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dot.) { |
| 182 | p.advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() |
| 183 | expr, err := p.parseExpressionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpression().(bpUnaryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bpUnary.) |
| 184 | if err != nil { |
| 185 | return nil, err |
| 186 | } |
| 187 | toChain = append(toChain, expr) |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | // Handle spread |
| 192 | if p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() && p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Spreadscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Spread.) { |
| 193 | expr, err := p.parseExpressionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#parseExpression().(bpLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/bpLiteral.) |
| 194 | if err != nil { |
| 195 | return nil, err |
| 196 | } |
| 197 | toChain = append(toChain, expr) |
| 198 | } |
| 199 | |
| 200 | if len(toChain) > 1 { |
| 201 | left = astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainExprsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainExprs().(toChain...) |
| 202 | } |
| 203 | |
| 204 | // Handle binding powers |
| 205 | for p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() && slicesscip-go gomod github.com/golang/go/src go1.25 slices/.Containsscip-go gomod github.com/golang/go/src go1.25 slices/Contains().(leftDenotationTokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/leftDenotationTokens., p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.) && getTokenBindingPowerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/getTokenBindingPower().(p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.) > bp { |
| 206 | if p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.QuestionMarkscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/QuestionMark.) { |
| 207 | left, err = parseTernaryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseTernary().(p, left) |
| 208 | } else { |
| 209 | left, err = parseBinaryscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/parseBinary().(p, left) |
| 210 | } |
| 211 | if err != nil { |
| 212 | return |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | return |
| 217 | } |
| 218 | |
| 219 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() bool { |
| 220 | return p.hasTokenNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasTokenN().(0) |
| 221 | } |
| 222 | |
| 223 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) hasTokenNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasTokenN().(n int) bool { |
| 224 | return p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i.+n < len(p.tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.) && !p.tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.[p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i.+n].IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.EOFscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/EOF.) |
| 225 | } |
| 226 | |
| 227 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().() lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# { |
| 228 | if p.hasTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#hasToken().() { |
| 229 | return p.tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.[p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i.] |
| 230 | } |
| 231 | return lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#{Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.: lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.EOFscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/EOF.} |
| 232 | } |
| 233 | |
| 234 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) advancescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advance().() lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# { |
| 235 | return p.advanceNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advanceN().(1) |
| 236 | } |
| 237 | |
| 238 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) advanceNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#advanceN().(n int) lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# { |
| 239 | p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i. += n |
| 240 | return p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().() |
| 241 | } |
| 242 | |
| 243 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) peekscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#peek().() lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# { |
| 244 | return p.peekNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#peekN().(1) |
| 245 | } |
| 246 | |
| 247 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) peekNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#peekN().(n int) lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# { |
| 248 | if p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i.+n >= len(p.tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.) { |
| 249 | return lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#{Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.: lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.EOFscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/EOF.} |
| 250 | } |
| 251 | return p.tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#tokens.[p.iscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#i.+n] |
| 252 | } |
| 253 | |
| 254 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) expectscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#expect().(kind ...lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#) error { |
| 255 | t := p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().() |
| 256 | if p.currentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#current().().IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(kind...) { |
| 257 | return nil |
| 258 | } |
| 259 | return &UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#{ |
| 260 | Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#Token.: t, |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func (p *Parserscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#) expectNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#expectN().(n int, kind ...lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/.TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#) error { |
| 265 | t := p.peekNscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/Parser#peekN().(n) |
| 266 | if t.IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(kind...) { |
| 267 | return nil |
| 268 | } |
| 269 | return &UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#{ |
| 270 | Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/parser`/UnexpectedTokenError#Token.: t, |
| 271 | } |
| 272 | } |