diff --git a/util/fipstools/delocate/delocate.peg.go b/util/fipstools/delocate/delocate.peg.go index 62114546c0..fe3ae401e5 100644 --- a/util/fipstools/delocate/delocate.peg.go +++ b/util/fipstools/delocate/delocate.peg.go @@ -1,14 +1,14 @@ -package main +// Code generated by /home/dpitt/src/peg/peg delocate.peg. DO NOT EDIT. -// Code generated by /Users/justsmth/go/bin/peg delocate.peg DO NOT EDIT. +package main import ( + "bytes" "fmt" "io" "os" "sort" "strconv" - "strings" ) const endSymbol rune = 1114112 @@ -248,12 +248,13 @@ func (t *tokens32) Tokens() []token32 { } type Asm struct { - Buffer string - buffer []rune - rules [58]func() bool - parse func(rule ...int) error - reset func() - Pretty bool + Buffer string + buffer []rune + rules [58]func() bool + parse func(rule ...int) error + reset func() + Pretty bool + disableMemoize bool tokens32 } @@ -338,9 +339,9 @@ func (p *Asm) WriteSyntaxTree(w io.Writer) { } func (p *Asm) SprintSyntaxTree() string { - var bldr strings.Builder - p.WriteSyntaxTree(&bldr) - return bldr.String() + var b bytes.Buffer + p.WriteSyntaxTree(&b) + return b.String() } func Pretty(pretty bool) func(*Asm) error { @@ -356,11 +357,30 @@ func Size(size int) func(*Asm) error { return nil } } + +func DisableMemoize() func(*Asm) error { + return func(p *Asm) error { + p.disableMemoize = true + return nil + } +} + +type memo struct { + Matched bool + Partial []token32 +} + +type memoKey struct { + Rule uint32 + Position uint32 +} + func (p *Asm) Init(options ...func(*Asm) error) error { var ( max token32 position, tokenIndex uint32 buffer []rune + memoization map[memoKey]memo ) for _, option := range options { err := option(p) @@ -371,7 +391,7 @@ func (p *Asm) Init(options ...func(*Asm) error) error { p.reset = func() { max = token32{} position, tokenIndex = 0, 0 - + memoization = make(map[memoKey]memo) p.buffer = []rune(p.Buffer) if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol { p.buffer = append(p.buffer, endSymbol) @@ -404,6 +424,34 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } } + memoize := func(rule uint32, begin uint32, tokenIndexStart uint32, matched bool) { + if p.disableMemoize { + return + } + key := memoKey{rule, begin} + if !matched { + memoization[key] = memo{Matched: false} + } else { + t := tree.tree[tokenIndexStart:tokenIndex] + tokenCopy := make([]token32, len(t)) + copy(tokenCopy, t) + memoization[key] = memo{Matched: true, Partial: tokenCopy} + } + } + + memoizedResult := func(m memo) bool { + if !m.Matched { + return false + } + tree.tree = append(tree.tree[:tokenIndex], m.Partial...) + tokenIndex += uint32(len(m.Partial)) + position = m.Partial[len(m.Partial)-1].end + if tree.tree[tokenIndex-1].begin != position && position > max.end { + max = tree.tree[tokenIndex-1] + } + return true + } + matchDot := func() bool { if buffer[position] != endSymbol { position++ @@ -432,6 +480,9 @@ func (p *Asm) Init(options ...func(*Asm) error) error { nil, /* 0 AsmFile <- <(Statement* !.)> */ func() bool { + if memoized, ok := memoization[memoKey{0, position}]; ok { + return memoizedResult(memoized) + } position0, tokenIndex0 := position, tokenIndex { position1 := position @@ -456,13 +507,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleAsmFile, position1) } + memoize(0, position0, tokenIndex0, true) return true l0: + memoize(0, position0, tokenIndex0, false) position, tokenIndex = position0, tokenIndex0 return false }, /* 1 Statement <- <(WS? (Label / ((GlobalDirective / LocationDirective / LabelContainingDirective / Instruction / Directive / Comment / ) WS? ((Comment? '\n') / ';'))))> */ func() bool { + if memoized, ok := memoization[memoKey{1, position}]; ok { + return memoizedResult(memoized) + } position5, tokenIndex5 := position, tokenIndex { position6 := position @@ -563,13 +619,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l9: add(ruleStatement, position6) } + memoize(1, position5, tokenIndex5, true) return true l5: + memoize(1, position5, tokenIndex5, false) position, tokenIndex = position5, tokenIndex5 return false }, /* 2 GlobalDirective <- <((('.' ('g' / 'G') ('l' / 'L') ('o' / 'O') ('b' / 'B') ('a' / 'A') ('l' / 'L')) / ('.' ('g' / 'G') ('l' / 'L') ('o' / 'O') ('b' / 'B') ('l' / 'L'))) WS SymbolName)> */ func() bool { + if memoized, ok := memoization[memoKey{2, position}]; ok { + return memoizedResult(memoized) + } position24, tokenIndex24 := position, tokenIndex { position25 := position @@ -761,13 +822,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleGlobalDirective, position25) } + memoize(2, position24, tokenIndex24, true) return true l24: + memoize(2, position24, tokenIndex24, false) position, tokenIndex = position24, tokenIndex24 return false }, /* 3 Directive <- <('.' DirectiveName (WS Args)?)> */ func() bool { + if memoized, ok := memoization[memoKey{3, position}]; ok { + return memoizedResult(memoized) + } position50, tokenIndex50 := position, tokenIndex { position51 := position @@ -793,13 +859,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l53: add(ruleDirective, position51) } + memoize(3, position50, tokenIndex50, true) return true l50: + memoize(3, position50, tokenIndex50, false) position, tokenIndex = position50, tokenIndex50 return false }, /* 4 DirectiveName <- <([a-z] / [A-Z] / ([0-9] / [0-9]) / '_')+> */ func() bool { + if memoized, ok := memoization[memoKey{4, position}]; ok { + return memoizedResult(memoized) + } position54, tokenIndex54 := position, tokenIndex { position55 := position @@ -892,13 +963,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleDirectiveName, position55) } + memoize(4, position54, tokenIndex54, true) return true l54: + memoize(4, position54, tokenIndex54, false) position, tokenIndex = position54, tokenIndex54 return false }, /* 5 LocationDirective <- <(FileDirective / LocDirective)> */ func() bool { + if memoized, ok := memoization[memoKey{5, position}]; ok { + return memoizedResult(memoized) + } position70, tokenIndex70 := position, tokenIndex { position71 := position @@ -917,13 +993,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l72: add(ruleLocationDirective, position71) } + memoize(5, position70, tokenIndex70, true) return true l70: + memoize(5, position70, tokenIndex70, false) position, tokenIndex = position70, tokenIndex70 return false }, /* 6 FileDirective <- <('.' ('f' / 'F') ('i' / 'I') ('l' / 'L') ('e' / 'E') WS (!('#' / '\n') .)+)> */ func() bool { + if memoized, ok := memoization[memoKey{6, position}]; ok { + return memoizedResult(memoized) + } position74, tokenIndex74 := position, tokenIndex { position75 := position @@ -1051,13 +1132,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleFileDirective, position75) } + memoize(6, position74, tokenIndex74, true) return true l74: + memoize(6, position74, tokenIndex74, false) position, tokenIndex = position74, tokenIndex74 return false }, /* 7 LocDirective <- <('.' ('l' / 'L') ('o' / 'O') ('c' / 'C') WS (!('#' / '/' / '\n') .)+)> */ func() bool { + if memoized, ok := memoization[memoKey{7, position}]; ok { + return memoizedResult(memoized) + } position92, tokenIndex92 := position, tokenIndex { position93 := position @@ -1184,13 +1270,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleLocDirective, position93) } + memoize(7, position92, tokenIndex92, true) return true l92: + memoize(7, position92, tokenIndex92, false) position, tokenIndex = position92, tokenIndex92 return false }, /* 8 Args <- <(Arg (WS? ',' WS? Arg)*)> */ func() bool { + if memoized, ok := memoization[memoKey{8, position}]; ok { + return memoizedResult(memoized) + } position110, tokenIndex110 := position, tokenIndex { position111 := position @@ -1233,13 +1324,19 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleArgs, position111) } + memoize(8, position110, tokenIndex110, true) return true l110: + memoize(8, position110, tokenIndex110, false) position, tokenIndex = position110, tokenIndex110 return false }, /* 9 Arg <- <(QuotedArg / ([0-9] / [0-9] / ([a-z] / [A-Z]) / '%' / '+' / '-' / '*' / '_' / '@' / '.')*)> */ func() bool { + if memoized, ok := memoization[memoKey{9, position}]; ok { + return memoizedResult(memoized) + } + position118, tokenIndex118 := position, tokenIndex { position119 := position { @@ -1343,10 +1440,14 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l120: add(ruleArg, position119) } + memoize(9, position118, tokenIndex118, true) return true }, /* 10 QuotedArg <- <('"' QuotedText '"')> */ func() bool { + if memoized, ok := memoization[memoKey{10, position}]; ok { + return memoizedResult(memoized) + } position136, tokenIndex136 := position, tokenIndex { position137 := position @@ -1363,13 +1464,19 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleQuotedArg, position137) } + memoize(10, position136, tokenIndex136, true) return true l136: + memoize(10, position136, tokenIndex136, false) position, tokenIndex = position136, tokenIndex136 return false }, /* 11 QuotedText <- <(EscapedChar / (!'"' .))*> */ func() bool { + if memoized, ok := memoization[memoKey{11, position}]; ok { + return memoizedResult(memoized) + } + position138, tokenIndex138 := position, tokenIndex { position139 := position l140: @@ -1404,10 +1511,14 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleQuotedText, position139) } + memoize(11, position138, tokenIndex138, true) return true }, /* 12 LabelContainingDirective <- <(LabelContainingDirectiveName WS SymbolArgs)> */ func() bool { + if memoized, ok := memoization[memoKey{12, position}]; ok { + return memoizedResult(memoized) + } position145, tokenIndex145 := position, tokenIndex { position146 := position @@ -1422,13 +1533,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleLabelContainingDirective, position146) } + memoize(12, position145, tokenIndex145, true) return true l145: + memoize(12, position145, tokenIndex145, false) position, tokenIndex = position145, tokenIndex145 return false }, /* 13 LabelContainingDirectiveName <- <(('.' ('x' / 'X') ('w' / 'W') ('o' / 'O') ('r' / 'R') ('d' / 'D')) / ('.' ('w' / 'W') ('o' / 'O') ('r' / 'R') ('d' / 'D')) / ('.' ('h' / 'H') ('w' / 'W') ('o' / 'O') ('r' / 'R') ('d' / 'D')) / ('.' ('l' / 'L') ('o' / 'O') ('n' / 'N') ('g' / 'G')) / ('.' ('s' / 'S') ('e' / 'E') ('t' / 'T')) / ('.' ('b' / 'B') ('y' / 'Y') ('t' / 'T') ('e' / 'E')) / ('.' '8' ('b' / 'B') ('y' / 'Y') ('t' / 'T') ('e' / 'E')) / ('.' '4' ('b' / 'B') ('y' / 'Y') ('t' / 'T') ('e' / 'E')) / ('.' ('q' / 'Q') ('u' / 'U') ('a' / 'A') ('d' / 'D')) / ('.' ('t' / 'T') ('c' / 'C')) / ('.' ('l' / 'L') ('o' / 'O') ('c' / 'C') ('a' / 'A') ('l' / 'L') ('e' / 'E') ('n' / 'N') ('t' / 'T') ('r' / 'R') ('y' / 'Y')) / ('.' ('s' / 'S') ('i' / 'I') ('z' / 'Z') ('e' / 'E')) / ('.' ('t' / 'T') ('y' / 'Y') ('p' / 'P') ('e' / 'E')) / ('.' ('u' / 'U') ('l' / 'L') ('e' / 'E') ('b' / 'B') '1' '2' '8') / ('.' ('s' / 'S') ('l' / 'L') ('e' / 'E') ('b' / 'B') '1' '2' '8'))> */ func() bool { + if memoized, ok := memoization[memoKey{13, position}]; ok { + return memoizedResult(memoized) + } position147, tokenIndex147 := position, tokenIndex { position148 := position @@ -2547,13 +2663,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l149: add(ruleLabelContainingDirectiveName, position148) } + memoize(13, position147, tokenIndex147, true) return true l147: + memoize(13, position147, tokenIndex147, false) position, tokenIndex = position147, tokenIndex147 return false }, /* 14 SymbolArgs <- <(SymbolArg (WS? ',' WS? SymbolArg)*)> */ func() bool { + if memoized, ok := memoization[memoKey{14, position}]; ok { + return memoizedResult(memoized) + } position294, tokenIndex294 := position, tokenIndex { position295 := position @@ -2596,13 +2717,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleSymbolArgs, position295) } + memoize(14, position294, tokenIndex294, true) return true l294: + memoize(14, position294, tokenIndex294, false) position, tokenIndex = position294, tokenIndex294 return false }, /* 15 SymbolArg <- */ func() bool { + if memoized, ok := memoization[memoKey{15, position}]; ok { + return memoizedResult(memoized) + } position302, tokenIndex302 := position, tokenIndex { position303 := position @@ -2611,13 +2737,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleSymbolArg, position303) } + memoize(15, position302, tokenIndex302, true) return true l302: + memoize(15, position302, tokenIndex302, false) position, tokenIndex = position302, tokenIndex302 return false }, /* 16 SymbolExpr <- <(SymbolAtom (WS? SymbolOperator WS? SymbolExpr)?)> */ func() bool { + if memoized, ok := memoization[memoKey{16, position}]; ok { + return memoizedResult(memoized) + } position304, tokenIndex304 := position, tokenIndex { position305 := position @@ -2659,13 +2790,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l307: add(ruleSymbolExpr, position305) } + memoize(16, position304, tokenIndex304, true) return true l304: + memoize(16, position304, tokenIndex304, false) position, tokenIndex = position304, tokenIndex304 return false }, /* 17 SymbolAtom <- <(Offset / SymbolType / LocalLabelRef / (LocalSymbol TCMarker?) / (SymbolName Offset) / (SymbolName TCMarker?) / Dot / (OpenParen WS? SymbolExpr WS? CloseParen))> */ func() bool { + if memoized, ok := memoization[memoKey{17, position}]; ok { + return memoizedResult(memoized) + } position312, tokenIndex312 := position, tokenIndex { position313 := position @@ -2769,13 +2905,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l314: add(ruleSymbolAtom, position313) } + memoize(17, position312, tokenIndex312, true) return true l312: + memoize(17, position312, tokenIndex312, false) position, tokenIndex = position312, tokenIndex312 return false }, /* 18 SymbolOperator <- <('+' / '-' / '|' / ('<' '<') / ('>' '>'))> */ func() bool { + if memoized, ok := memoization[memoKey{18, position}]; ok { + return memoizedResult(memoized) + } position330, tokenIndex330 := position, tokenIndex { position331 := position @@ -2825,13 +2966,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l332: add(ruleSymbolOperator, position331) } + memoize(18, position330, tokenIndex330, true) return true l330: + memoize(18, position330, tokenIndex330, false) position, tokenIndex = position330, tokenIndex330 return false }, /* 19 OpenParen <- <'('> */ func() bool { + if memoized, ok := memoization[memoKey{19, position}]; ok { + return memoizedResult(memoized) + } position337, tokenIndex337 := position, tokenIndex { position338 := position @@ -2841,13 +2987,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleOpenParen, position338) } + memoize(19, position337, tokenIndex337, true) return true l337: + memoize(19, position337, tokenIndex337, false) position, tokenIndex = position337, tokenIndex337 return false }, /* 20 CloseParen <- <')'> */ func() bool { + if memoized, ok := memoization[memoKey{20, position}]; ok { + return memoizedResult(memoized) + } position339, tokenIndex339 := position, tokenIndex { position340 := position @@ -2857,13 +3008,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleCloseParen, position340) } + memoize(20, position339, tokenIndex339, true) return true l339: + memoize(20, position339, tokenIndex339, false) position, tokenIndex = position339, tokenIndex339 return false }, /* 21 SymbolType <- <(('@' / '%') (('f' 'u' 'n' 'c' 't' 'i' 'o' 'n') / ('o' 'b' 'j' 'e' 'c' 't')))> */ func() bool { + if memoized, ok := memoization[memoKey{21, position}]; ok { + return memoizedResult(memoized) + } position341, tokenIndex341 := position, tokenIndex { position342 := position @@ -2947,13 +3103,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l345: add(ruleSymbolType, position342) } + memoize(21, position341, tokenIndex341, true) return true l341: + memoize(21, position341, tokenIndex341, false) position, tokenIndex = position341, tokenIndex341 return false }, /* 22 Dot <- <'.'> */ func() bool { + if memoized, ok := memoization[memoKey{22, position}]; ok { + return memoizedResult(memoized) + } position347, tokenIndex347 := position, tokenIndex { position348 := position @@ -2963,13 +3124,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleDot, position348) } + memoize(22, position347, tokenIndex347, true) return true l347: + memoize(22, position347, tokenIndex347, false) position, tokenIndex = position347, tokenIndex347 return false }, /* 23 TCMarker <- <('[' 'T' 'C' ']')> */ func() bool { + if memoized, ok := memoization[memoKey{23, position}]; ok { + return memoizedResult(memoized) + } position349, tokenIndex349 := position, tokenIndex { position350 := position @@ -2991,13 +3157,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleTCMarker, position350) } + memoize(23, position349, tokenIndex349, true) return true l349: + memoize(23, position349, tokenIndex349, false) position, tokenIndex = position349, tokenIndex349 return false }, /* 24 EscapedChar <- <('\\' .)> */ func() bool { + if memoized, ok := memoization[memoKey{24, position}]; ok { + return memoizedResult(memoized) + } position351, tokenIndex351 := position, tokenIndex { position352 := position @@ -3010,13 +3181,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleEscapedChar, position352) } + memoize(24, position351, tokenIndex351, true) return true l351: + memoize(24, position351, tokenIndex351, false) position, tokenIndex = position351, tokenIndex351 return false }, /* 25 WS <- <(' ' / '\t')+> */ func() bool { + if memoized, ok := memoization[memoKey{25, position}]; ok { + return memoizedResult(memoized) + } position353, tokenIndex353 := position, tokenIndex { position354 := position @@ -3059,13 +3235,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleWS, position354) } + memoize(25, position353, tokenIndex353, true) return true l353: + memoize(25, position353, tokenIndex353, false) position, tokenIndex = position353, tokenIndex353 return false }, /* 26 Comment <- <((('/' '/') / '#') (!'\n' .)*)> */ func() bool { + if memoized, ok := memoization[memoKey{26, position}]; ok { + return memoizedResult(memoized) + } position361, tokenIndex361 := position, tokenIndex { position362 := position @@ -3110,13 +3291,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleComment, position362) } + memoize(26, position361, tokenIndex361, true) return true l361: + memoize(26, position361, tokenIndex361, false) position, tokenIndex = position361, tokenIndex361 return false }, /* 27 Label <- <((LocalSymbol / LocalLabel / SymbolName) ':')> */ func() bool { + if memoized, ok := memoization[memoKey{27, position}]; ok { + return memoizedResult(memoized) + } position368, tokenIndex368 := position, tokenIndex { position369 := position @@ -3145,13 +3331,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleLabel, position369) } + memoize(27, position368, tokenIndex368, true) return true l368: + memoize(27, position368, tokenIndex368, false) position, tokenIndex = position368, tokenIndex368 return false }, /* 28 SymbolName <- <(([a-z] / [A-Z] / '.' / '_') ([a-z] / [A-Z] / '.' / ([0-9] / [0-9]) / '$' / '_')*)> */ func() bool { + if memoized, ok := memoization[memoKey{28, position}]; ok { + return memoizedResult(memoized) + } position373, tokenIndex373 := position, tokenIndex { position374 := position @@ -3247,13 +3438,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleSymbolName, position374) } + memoize(28, position373, tokenIndex373, true) return true l373: + memoize(28, position373, tokenIndex373, false) position, tokenIndex = position373, tokenIndex373 return false }, /* 29 LocalSymbol <- <('.' 'L' ([a-z] / [A-Z] / ([a-z] / [A-Z]) / '.' / ([0-9] / [0-9]) / '$' / '_')+)> */ func() bool { + if memoized, ok := memoization[memoKey{29, position}]; ok { + return memoizedResult(memoized) + } position389, tokenIndex389 := position, tokenIndex { position390 := position @@ -3418,13 +3614,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleLocalSymbol, position390) } + memoize(29, position389, tokenIndex389, true) return true l389: + memoize(29, position389, tokenIndex389, false) position, tokenIndex = position389, tokenIndex389 return false }, /* 30 LocalLabel <- <([0-9] ([0-9] / '$')*)> */ func() bool { + if memoized, ok := memoization[memoKey{30, position}]; ok { + return memoizedResult(memoized) + } position415, tokenIndex415 := position, tokenIndex { position416 := position @@ -3456,13 +3657,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleLocalLabel, position416) } + memoize(30, position415, tokenIndex415, true) return true l415: + memoize(30, position415, tokenIndex415, false) position, tokenIndex = position415, tokenIndex415 return false }, /* 31 LocalLabelRef <- <([0-9] ([0-9] / '$')* ('b' / 'f'))> */ func() bool { + if memoized, ok := memoization[memoKey{31, position}]; ok { + return memoizedResult(memoized) + } position421, tokenIndex421 := position, tokenIndex { position422 := position @@ -3509,13 +3715,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l427: add(ruleLocalLabelRef, position422) } + memoize(31, position421, tokenIndex421, true) return true l421: + memoize(31, position421, tokenIndex421, false) position, tokenIndex = position421, tokenIndex421 return false }, /* 32 Instruction <- <(InstructionName (WS InstructionArg (WS? ','? WS? InstructionArg)*)?)> */ func() bool { + if memoized, ok := memoization[memoKey{32, position}]; ok { + return memoizedResult(memoized) + } position429, tokenIndex429 := position, tokenIndex { position430 := position @@ -3578,13 +3789,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l432: add(ruleInstruction, position430) } + memoize(32, position429, tokenIndex429, true) return true l429: + memoize(32, position429, tokenIndex429, false) position, tokenIndex = position429, tokenIndex429 return false }, /* 33 InstructionName <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / '.' / ([0-9] / [0-9]))* ('.' / '+' / '-')?)> */ func() bool { + if memoized, ok := memoization[memoKey{33, position}]; ok { + return memoizedResult(memoized) + } position441, tokenIndex441 := position, tokenIndex { position442 := position @@ -3681,13 +3897,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l454: add(ruleInstructionName, position442) } + memoize(33, position441, tokenIndex441, true) return true l441: + memoize(33, position441, tokenIndex441, false) position, tokenIndex = position441, tokenIndex441 return false }, /* 34 InstructionArg <- <(IndirectionIndicator? (ARMConstantTweak / RegisterOrConstant / LocalLabelRef / TOCRefHigh / TOCRefLow / GOTLocation / GOTSymbolOffset / MemoryRef) AVX512Token*)> */ func() bool { + if memoized, ok := memoization[memoKey{34, position}]; ok { + return memoizedResult(memoized) + } position458, tokenIndex458 := position, tokenIndex { position459 := position @@ -3762,13 +3983,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleInstructionArg, position459) } + memoize(34, position458, tokenIndex458, true) return true l458: + memoize(34, position458, tokenIndex458, false) position, tokenIndex = position458, tokenIndex458 return false }, /* 35 GOTLocation <- <('$' '_' 'G' 'L' 'O' 'B' 'A' 'L' '_' 'O' 'F' 'F' 'S' 'E' 'T' '_' 'T' 'A' 'B' 'L' 'E' '_' '-' LocalSymbol)> */ func() bool { + if memoized, ok := memoization[memoKey{35, position}]; ok { + return memoizedResult(memoized) + } position472, tokenIndex472 := position, tokenIndex { position473 := position @@ -3869,13 +4095,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleGOTLocation, position473) } + memoize(35, position472, tokenIndex472, true) return true l472: + memoize(35, position472, tokenIndex472, false) position, tokenIndex = position472, tokenIndex472 return false }, /* 36 GOTSymbolOffset <- <(('$' SymbolName ('@' 'G' 'O' 'T') ('O' 'F' 'F')?) / (':' ('g' / 'G') ('o' / 'O') ('t' / 'T') ':' SymbolName))> */ func() bool { + if memoized, ok := memoization[memoKey{36, position}]; ok { + return memoizedResult(memoized) + } position474, tokenIndex474 := position, tokenIndex { position475 := position @@ -3986,13 +4217,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l476: add(ruleGOTSymbolOffset, position475) } + memoize(36, position474, tokenIndex474, true) return true l474: + memoize(36, position474, tokenIndex474, false) position, tokenIndex = position474, tokenIndex474 return false }, /* 37 AVX512Token <- <(WS? '{' '%'? ([0-9] / [a-z])* '}')> */ func() bool { + if memoized, ok := memoization[memoKey{37, position}]; ok { + return memoizedResult(memoized) + } position486, tokenIndex486 := position, tokenIndex { position487 := position @@ -4049,13 +4285,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleAVX512Token, position487) } + memoize(37, position486, tokenIndex486, true) return true l486: + memoize(37, position486, tokenIndex486, false) position, tokenIndex = position486, tokenIndex486 return false }, /* 38 TOCRefHigh <- <('.' 'T' 'O' 'C' '.' '-' (('0' 'b') / ('.' 'L' ([a-z] / [A-Z] / '_' / [0-9])+)) ('@' ('h' / 'H') ('a' / 'A')))> */ func() bool { + if memoized, ok := memoization[memoKey{38, position}]; ok { + return memoizedResult(memoized) + } position496, tokenIndex496 := position, tokenIndex { position497 := position @@ -4207,13 +4448,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l512: add(ruleTOCRefHigh, position497) } + memoize(38, position496, tokenIndex496, true) return true l496: + memoize(38, position496, tokenIndex496, false) position, tokenIndex = position496, tokenIndex496 return false }, /* 39 TOCRefLow <- <('.' 'T' 'O' 'C' '.' '-' (('0' 'b') / ('.' 'L' ([a-z] / [A-Z] / '_' / [0-9])+)) ('@' ('l' / 'L')))> */ func() bool { + if memoized, ok := memoization[memoKey{39, position}]; ok { + return memoizedResult(memoized) + } position514, tokenIndex514 := position, tokenIndex { position515 := position @@ -4350,13 +4596,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l528: add(ruleTOCRefLow, position515) } + memoize(39, position514, tokenIndex514, true) return true l514: + memoize(39, position514, tokenIndex514, false) position, tokenIndex = position514, tokenIndex514 return false }, /* 40 IndirectionIndicator <- <'*'> */ func() bool { + if memoized, ok := memoization[memoKey{40, position}]; ok { + return memoizedResult(memoized) + } position530, tokenIndex530 := position, tokenIndex { position531 := position @@ -4366,13 +4617,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleIndirectionIndicator, position531) } + memoize(40, position530, tokenIndex530, true) return true l530: + memoize(40, position530, tokenIndex530, false) position, tokenIndex = position530, tokenIndex530 return false }, /* 41 RegisterOrConstant <- <((('%' ([a-z] / [A-Z]) ([a-z] / [A-Z] / ([0-9] / [0-9]))*) / ('$' [0-9]+ WS? '*' WS? '(' [0-9]+ WS? '-' WS? [0-9]+ ')') / ('$'? ((Offset Offset) / Offset)) / ('#' Offset ('*' [0-9]+ ('-' [0-9] [0-9]*)?)?) / ('#' '~'? '(' [0-9] WS? ('<' '<') WS? [0-9] [0-9]? ')') / (('#' / '$') '~'? ('0' 'x')? ([0-9] / [0-9] / ([a-f] / [A-F]))+) / ('$' '(' '-' [0-9]+ ')') / ARMRegister) !('f' / 'b' / ':' / '(' / '+' / '-'))> */ func() bool { + if memoized, ok := memoization[memoKey{41, position}]; ok { + return memoizedResult(memoized) + } position532, tokenIndex532 := position, tokenIndex { position533 := position @@ -4920,13 +5176,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleRegisterOrConstant, position533) } + memoize(41, position532, tokenIndex532, true) return true l532: + memoize(41, position532, tokenIndex532, false) position, tokenIndex = position532, tokenIndex532 return false }, /* 42 ARMConstantTweak <- <(((('u' / 's') (('x' / 'X') ('t' / 'T')) ('x' / 'w' / 'h' / 'b')) / (('l' / 'L') ('s' / 'S') ('l' / 'L')) / (('l' / 'L') ('s' / 'S') ('r' / 'R')) / (('r' / 'R') ('o' / 'O') ('r' / 'R')) / (('a' / 'A') ('s' / 'S') ('r' / 'R'))) (WS '#'? Offset)?)> */ func() bool { + if memoized, ok := memoization[memoKey{42, position}]; ok { + return memoizedResult(memoized) + } position612, tokenIndex612 := position, tokenIndex { position613 := position @@ -5226,13 +5487,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l654: add(ruleARMConstantTweak, position613) } + memoize(42, position612, tokenIndex612, true) return true l612: + memoize(42, position612, tokenIndex612, false) position, tokenIndex = position612, tokenIndex612 return false }, /* 43 ARMRegister <- <((('s' / 'S') ('p' / 'P')) / (('x' / 'w' / 'd' / 'q' / 's' / 'h' / 'b') [0-9] [0-9]?) / (('x' / 'X') ('z' / 'Z') ('r' / 'R')) / (('w' / 'W') ('z' / 'Z') ('r' / 'R')) / (('n' / 'N') ('z' / 'Z') ('c' / 'C') ('v' / 'V')) / ARMVectorRegister / ('{' WS? ARMVectorRegister WS? ((',' / '-') WS? ARMVectorRegister)* WS? '}' ('[' [0-9] [0-9]? ']')?))> */ func() bool { + if memoized, ok := memoization[memoKey{43, position}]; ok { + return memoizedResult(memoized) + } position657, tokenIndex657 := position, tokenIndex { position658 := position @@ -5614,13 +5880,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l659: add(ruleARMRegister, position658) } + memoize(43, position657, tokenIndex657, true) return true l657: + memoize(43, position657, tokenIndex657, false) position, tokenIndex = position657, tokenIndex657 return false }, /* 44 ARMVectorRegister <- <(('v' / 'V') [0-9] [0-9]? ('.' [0-9]* ('b' / 's' / 'd' / 'h' / 'q') ('[' [0-9] [0-9]? ']')?)?)> */ func() bool { + if memoized, ok := memoization[memoKey{44, position}]; ok { + return memoizedResult(memoized) + } position715, tokenIndex715 := position, tokenIndex { position716 := position @@ -5744,13 +6015,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l722: add(ruleARMVectorRegister, position716) } + memoize(44, position715, tokenIndex715, true) return true l715: + memoize(44, position715, tokenIndex715, false) position, tokenIndex = position715, tokenIndex715 return false }, /* 45 MemoryRef <- <((SymbolRef BaseIndexScale) / SymbolRef / Low12BitsSymbolRef / (Offset* BaseIndexScale) / (SegmentRegister Offset BaseIndexScale) / (SegmentRegister BaseIndexScale) / (SegmentRegister Offset) / ARMBaseIndexScale / BaseIndexScale)> */ func() bool { + if memoized, ok := memoization[memoKey{45, position}]; ok { + return memoizedResult(memoized) + } position734, tokenIndex734 := position, tokenIndex { position735 := position @@ -5836,13 +6112,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l736: add(ruleMemoryRef, position735) } + memoize(45, position734, tokenIndex734, true) return true l734: + memoize(45, position734, tokenIndex734, false) position, tokenIndex = position734, tokenIndex734 return false }, /* 46 SymbolRef <- <((Offset* '+')? (LocalSymbol / SymbolName) Offset* ('@' Section Offset*)?)> */ func() bool { + if memoized, ok := memoization[memoKey{46, position}]; ok { + return memoizedResult(memoized) + } position747, tokenIndex747 := position, tokenIndex { position748 := position @@ -5916,13 +6197,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l758: add(ruleSymbolRef, position748) } + memoize(46, position747, tokenIndex747, true) return true l747: + memoize(46, position747, tokenIndex747, false) position, tokenIndex = position747, tokenIndex747 return false }, /* 47 Low12BitsSymbolRef <- <(':' ('l' / 'L') ('o' / 'O') '1' '2' ':' (LocalSymbol / SymbolName) Offset?)> */ func() bool { + if memoized, ok := memoization[memoKey{47, position}]; ok { + return memoizedResult(memoized) + } position761, tokenIndex761 := position, tokenIndex { position762 := position @@ -5997,13 +6283,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l770: add(ruleLow12BitsSymbolRef, position762) } + memoize(47, position761, tokenIndex761, true) return true l761: + memoize(47, position761, tokenIndex761, false) position, tokenIndex = position761, tokenIndex761 return false }, /* 48 ARMBaseIndexScale <- <('[' ARMRegister (',' WS? (('#'? Offset (('*' [0-9]+) / ('*' '(' [0-9]+ Operator [0-9]+ ')') / ('+' [0-9]+)*)?) / ('#'? ARMGOTLow12) / ('#'? Low12BitsSymbolRef) / ARMRegister) (',' WS? ARMConstantTweak)?)? ']' ARMPostincrement?)> */ func() bool { + if memoized, ok := memoization[memoKey{48, position}]; ok { + return memoizedResult(memoized) + } position771, tokenIndex771 := position, tokenIndex { position772 := position @@ -6240,13 +6531,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l807: add(ruleARMBaseIndexScale, position772) } + memoize(48, position771, tokenIndex771, true) return true l771: + memoize(48, position771, tokenIndex771, false) position, tokenIndex = position771, tokenIndex771 return false }, /* 49 ARMGOTLow12 <- <(':' ('g' / 'G') ('o' / 'O') ('t' / 'T') '_' ('l' / 'L') ('o' / 'O') '1' '2' ':' SymbolName)> */ func() bool { + if memoized, ok := memoization[memoKey{49, position}]; ok { + return memoizedResult(memoized) + } position808, tokenIndex808 := position, tokenIndex { position809 := position @@ -6350,13 +6646,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } add(ruleARMGOTLow12, position809) } + memoize(49, position808, tokenIndex808, true) return true l808: + memoize(49, position808, tokenIndex808, false) position, tokenIndex = position808, tokenIndex808 return false }, /* 50 ARMPostincrement <- <'!'> */ func() bool { + if memoized, ok := memoization[memoKey{50, position}]; ok { + return memoizedResult(memoized) + } position820, tokenIndex820 := position, tokenIndex { position821 := position @@ -6366,13 +6667,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleARMPostincrement, position821) } + memoize(50, position820, tokenIndex820, true) return true l820: + memoize(50, position820, tokenIndex820, false) position, tokenIndex = position820, tokenIndex820 return false }, /* 51 BaseIndexScale <- <('(' RegisterOrConstant? WS? (',' WS? RegisterOrConstant WS? (',' [0-9]+)?)? ')')> */ func() bool { + if memoized, ok := memoization[memoKey{51, position}]; ok { + return memoizedResult(memoized) + } position822, tokenIndex822 := position, tokenIndex { position823 := position @@ -6466,13 +6772,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position++ add(ruleBaseIndexScale, position823) } + memoize(51, position822, tokenIndex822, true) return true l822: + memoize(51, position822, tokenIndex822, false) position, tokenIndex = position822, tokenIndex822 return false }, /* 52 Operator <- <('+' / '-')> */ func() bool { + if memoized, ok := memoization[memoKey{52, position}]; ok { + return memoizedResult(memoized) + } position838, tokenIndex838 := position, tokenIndex { position839 := position @@ -6493,13 +6804,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l840: add(ruleOperator, position839) } + memoize(52, position838, tokenIndex838, true) return true l838: + memoize(52, position838, tokenIndex838, false) position, tokenIndex = position838, tokenIndex838 return false }, /* 53 OffsetOperator <- <('+' / '-' / '*')> */ func() bool { + if memoized, ok := memoization[memoKey{53, position}]; ok { + return memoizedResult(memoized) + } position842, tokenIndex842 := position, tokenIndex { position843 := position @@ -6527,13 +6843,18 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l844: add(ruleOffsetOperator, position843) } + memoize(53, position842, tokenIndex842, true) return true l842: + memoize(53, position842, tokenIndex842, false) position, tokenIndex = position842, tokenIndex842 return false }, - /* 54 Offset <- <('+'? '-'? (('0' ('b' / 'B') ('0' / '1')+) / ('0' ('x' / 'X') ([0-9] / [0-9] / ([a-f] / [A-F]))+) / ((([0-9]+ WS OffsetOperator [0-9]+) / ([0-9]+ (OffsetOperator '(' [0-9]+ OffsetOperator [0-9]+ ')')?) / ([0-9]+ (OffsetOperator [0-9]+ OffsetOperator [0-9]+)?) / ([0-9]+ (OffsetOperator [0-9]+)?) / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')' OffsetOperator [0-9]+ OffsetOperator [0-9]+) / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')' OffsetOperator [0-9]+ !'x') / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')') / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ WS? OffsetOperator WS? [0-9]+ ')')) !([a-z] / [A-Z]))))> */ + /* 54 Offset <- <('+'? '-'? (('0' ('b' / 'B') ('0' / '1')+) / ('0' ('x' / 'X') ([0-9] / [0-9] / ([a-f] / [A-F]))+) / ((([0-9]+ WS OffsetOperator WS? [0-9]+) / ([0-9]+ (OffsetOperator '(' [0-9]+ OffsetOperator [0-9]+ ')')?) / ([0-9]+ (OffsetOperator [0-9]+ OffsetOperator [0-9]+)?) / ([0-9]+ (OffsetOperator [0-9]+)?) / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')' OffsetOperator [0-9]+ OffsetOperator [0-9]+) / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')' OffsetOperator [0-9]+ !'x') / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ ')') / ('(' [0-9]+ WS? OffsetOperator WS? [0-9]+ WS? OffsetOperator WS? [0-9]+ ')')) !([a-z] / [A-Z]))))> */ func() bool { + if memoized, ok := memoization[memoKey{54, position}]; ok { + return memoizedResult(memoized) + } position847, tokenIndex847 := position, tokenIndex { position848 := position @@ -6738,228 +7059,225 @@ func (p *Asm) Init(options ...func(*Asm) error) error { if !_rules[ruleOffsetOperator]() { goto l879 } + { + position882, tokenIndex882 := position, tokenIndex + if !_rules[ruleWS]() { + goto l882 + } + goto l883 + l882: + position, tokenIndex = position882, tokenIndex882 + } + l883: if c := buffer[position]; c < rune('0') || c > rune('9') { goto l879 } position++ - l882: + l884: { - position883, tokenIndex883 := position, tokenIndex + position885, tokenIndex885 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l883 + goto l885 } position++ - goto l882 - l883: - position, tokenIndex = position883, tokenIndex883 + goto l884 + l885: + position, tokenIndex = position885, tokenIndex885 } goto l878 l879: position, tokenIndex = position878, tokenIndex878 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l884 + goto l886 } position++ - l885: + l887: { - position886, tokenIndex886 := position, tokenIndex + position888, tokenIndex888 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l886 + goto l888 } position++ - goto l885 - l886: - position, tokenIndex = position886, tokenIndex886 + goto l887 + l888: + position, tokenIndex = position888, tokenIndex888 } { - position887, tokenIndex887 := position, tokenIndex + position889, tokenIndex889 := position, tokenIndex if !_rules[ruleOffsetOperator]() { - goto l887 + goto l889 } if buffer[position] != rune('(') { - goto l887 + goto l889 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l887 + goto l889 } position++ - l889: + l891: { - position890, tokenIndex890 := position, tokenIndex + position892, tokenIndex892 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l890 + goto l892 } position++ - goto l889 - l890: - position, tokenIndex = position890, tokenIndex890 + goto l891 + l892: + position, tokenIndex = position892, tokenIndex892 } if !_rules[ruleOffsetOperator]() { - goto l887 + goto l889 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l887 + goto l889 } position++ - l891: + l893: { - position892, tokenIndex892 := position, tokenIndex + position894, tokenIndex894 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l892 + goto l894 } position++ - goto l891 - l892: - position, tokenIndex = position892, tokenIndex892 + goto l893 + l894: + position, tokenIndex = position894, tokenIndex894 } if buffer[position] != rune(')') { - goto l887 + goto l889 } position++ - goto l888 - l887: - position, tokenIndex = position887, tokenIndex887 + goto l890 + l889: + position, tokenIndex = position889, tokenIndex889 } - l888: + l890: goto l878 - l884: + l886: position, tokenIndex = position878, tokenIndex878 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l893 + goto l895 } position++ - l894: + l896: { - position895, tokenIndex895 := position, tokenIndex + position897, tokenIndex897 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l895 + goto l897 } position++ - goto l894 - l895: - position, tokenIndex = position895, tokenIndex895 + goto l896 + l897: + position, tokenIndex = position897, tokenIndex897 } { - position896, tokenIndex896 := position, tokenIndex + position898, tokenIndex898 := position, tokenIndex if !_rules[ruleOffsetOperator]() { - goto l896 + goto l898 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l896 + goto l898 } position++ - l898: + l900: { - position899, tokenIndex899 := position, tokenIndex + position901, tokenIndex901 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l899 + goto l901 } position++ - goto l898 - l899: - position, tokenIndex = position899, tokenIndex899 + goto l900 + l901: + position, tokenIndex = position901, tokenIndex901 } if !_rules[ruleOffsetOperator]() { - goto l896 + goto l898 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l896 + goto l898 } position++ - l900: + l902: { - position901, tokenIndex901 := position, tokenIndex + position903, tokenIndex903 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l901 + goto l903 } position++ - goto l900 - l901: - position, tokenIndex = position901, tokenIndex901 + goto l902 + l903: + position, tokenIndex = position903, tokenIndex903 } - goto l897 - l896: - position, tokenIndex = position896, tokenIndex896 + goto l899 + l898: + position, tokenIndex = position898, tokenIndex898 } - l897: + l899: goto l878 - l893: + l895: position, tokenIndex = position878, tokenIndex878 if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l902 + goto l904 } position++ - l903: + l905: { - position904, tokenIndex904 := position, tokenIndex + position906, tokenIndex906 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l904 + goto l906 } position++ - goto l903 - l904: - position, tokenIndex = position904, tokenIndex904 + goto l905 + l906: + position, tokenIndex = position906, tokenIndex906 } { - position905, tokenIndex905 := position, tokenIndex + position907, tokenIndex907 := position, tokenIndex if !_rules[ruleOffsetOperator]() { - goto l905 + goto l907 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l905 + goto l907 } position++ - l907: + l909: { - position908, tokenIndex908 := position, tokenIndex + position910, tokenIndex910 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l908 + goto l910 } position++ - goto l907 - l908: - position, tokenIndex = position908, tokenIndex908 + goto l909 + l910: + position, tokenIndex = position910, tokenIndex910 } - goto l906 - l905: - position, tokenIndex = position905, tokenIndex905 + goto l908 + l907: + position, tokenIndex = position907, tokenIndex907 } - l906: + l908: goto l878 - l902: + l904: position, tokenIndex = position878, tokenIndex878 if buffer[position] != rune('(') { - goto l909 + goto l911 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l909 + goto l911 } position++ - l910: + l912: { - position911, tokenIndex911 := position, tokenIndex + position913, tokenIndex913 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l911 + goto l913 } position++ - goto l910 - l911: - position, tokenIndex = position911, tokenIndex911 - } - { - position912, tokenIndex912 := position, tokenIndex - if !_rules[ruleWS]() { - goto l912 - } - goto l913 - l912: - position, tokenIndex = position912, tokenIndex912 - } - l913: - if !_rules[ruleOffsetOperator]() { - goto l909 + goto l912 + l913: + position, tokenIndex = position913, tokenIndex913 } { position914, tokenIndex914 := position, tokenIndex @@ -6971,30 +7289,21 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position, tokenIndex = position914, tokenIndex914 } l915: - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l909 + if !_rules[ruleOffsetOperator]() { + goto l911 } - position++ - l916: { - position917, tokenIndex917 := position, tokenIndex - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l917 + position916, tokenIndex916 := position, tokenIndex + if !_rules[ruleWS]() { + goto l916 } - position++ - goto l916 - l917: - position, tokenIndex = position917, tokenIndex917 - } - if buffer[position] != rune(')') { - goto l909 - } - position++ - if !_rules[ruleOffsetOperator]() { - goto l909 + goto l917 + l916: + position, tokenIndex = position916, tokenIndex916 } + l917: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l909 + goto l911 } position++ l918: @@ -7008,11 +7317,15 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l919: position, tokenIndex = position919, tokenIndex919 } + if buffer[position] != rune(')') { + goto l911 + } + position++ if !_rules[ruleOffsetOperator]() { - goto l909 + goto l911 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l909 + goto l911 } position++ l920: @@ -7026,40 +7339,45 @@ func (p *Asm) Init(options ...func(*Asm) error) error { l921: position, tokenIndex = position921, tokenIndex921 } + if !_rules[ruleOffsetOperator]() { + goto l911 + } + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l911 + } + position++ + l922: + { + position923, tokenIndex923 := position, tokenIndex + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l923 + } + position++ + goto l922 + l923: + position, tokenIndex = position923, tokenIndex923 + } goto l878 - l909: + l911: position, tokenIndex = position878, tokenIndex878 if buffer[position] != rune('(') { - goto l922 + goto l924 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l922 + goto l924 } position++ - l923: + l925: { - position924, tokenIndex924 := position, tokenIndex + position926, tokenIndex926 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l924 + goto l926 } position++ - goto l923 - l924: - position, tokenIndex = position924, tokenIndex924 - } - { - position925, tokenIndex925 := position, tokenIndex - if !_rules[ruleWS]() { - goto l925 - } - goto l926 - l925: - position, tokenIndex = position925, tokenIndex925 - } - l926: - if !_rules[ruleOffsetOperator]() { - goto l922 + goto l925 + l926: + position, tokenIndex = position926, tokenIndex926 } { position927, tokenIndex927 := position, tokenIndex @@ -7071,87 +7389,87 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position, tokenIndex = position927, tokenIndex927 } l928: + if !_rules[ruleOffsetOperator]() { + goto l924 + } + { + position929, tokenIndex929 := position, tokenIndex + if !_rules[ruleWS]() { + goto l929 + } + goto l930 + l929: + position, tokenIndex = position929, tokenIndex929 + } + l930: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l922 + goto l924 } position++ - l929: + l931: { - position930, tokenIndex930 := position, tokenIndex + position932, tokenIndex932 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l930 + goto l932 } position++ - goto l929 - l930: - position, tokenIndex = position930, tokenIndex930 + goto l931 + l932: + position, tokenIndex = position932, tokenIndex932 } if buffer[position] != rune(')') { - goto l922 + goto l924 } position++ if !_rules[ruleOffsetOperator]() { - goto l922 + goto l924 } if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l922 + goto l924 } position++ - l931: + l933: { - position932, tokenIndex932 := position, tokenIndex + position934, tokenIndex934 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l932 + goto l934 } position++ - goto l931 - l932: - position, tokenIndex = position932, tokenIndex932 + goto l933 + l934: + position, tokenIndex = position934, tokenIndex934 } { - position933, tokenIndex933 := position, tokenIndex + position935, tokenIndex935 := position, tokenIndex if buffer[position] != rune('x') { - goto l933 + goto l935 } position++ - goto l922 - l933: - position, tokenIndex = position933, tokenIndex933 + goto l924 + l935: + position, tokenIndex = position935, tokenIndex935 } goto l878 - l922: + l924: position, tokenIndex = position878, tokenIndex878 if buffer[position] != rune('(') { - goto l934 + goto l936 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l934 + goto l936 } position++ - l935: + l937: { - position936, tokenIndex936 := position, tokenIndex + position938, tokenIndex938 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l936 + goto l938 } position++ - goto l935 - l936: - position, tokenIndex = position936, tokenIndex936 - } - { - position937, tokenIndex937 := position, tokenIndex - if !_rules[ruleWS]() { - goto l937 - } - goto l938 - l937: - position, tokenIndex = position937, tokenIndex937 - } - l938: - if !_rules[ruleOffsetOperator]() { - goto l934 + goto l937 + l938: + position, tokenIndex = position938, tokenIndex938 } { position939, tokenIndex939 := position, tokenIndex @@ -7163,27 +7481,40 @@ func (p *Asm) Init(options ...func(*Asm) error) error { position, tokenIndex = position939, tokenIndex939 } l940: + if !_rules[ruleOffsetOperator]() { + goto l936 + } + { + position941, tokenIndex941 := position, tokenIndex + if !_rules[ruleWS]() { + goto l941 + } + goto l942 + l941: + position, tokenIndex = position941, tokenIndex941 + } + l942: if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l934 + goto l936 } position++ - l941: + l943: { - position942, tokenIndex942 := position, tokenIndex + position944, tokenIndex944 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l942 + goto l944 } position++ - goto l941 - l942: - position, tokenIndex = position942, tokenIndex942 + goto l943 + l944: + position, tokenIndex = position944, tokenIndex944 } if buffer[position] != rune(')') { - goto l934 + goto l936 } position++ goto l878 - l934: + l936: position, tokenIndex = position878, tokenIndex878 if buffer[position] != rune('(') { goto l847 @@ -7193,92 +7524,92 @@ func (p *Asm) Init(options ...func(*Asm) error) error { goto l847 } position++ - l943: + l945: { - position944, tokenIndex944 := position, tokenIndex + position946, tokenIndex946 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l944 + goto l946 } position++ - goto l943 - l944: - position, tokenIndex = position944, tokenIndex944 + goto l945 + l946: + position, tokenIndex = position946, tokenIndex946 } { - position945, tokenIndex945 := position, tokenIndex + position947, tokenIndex947 := position, tokenIndex if !_rules[ruleWS]() { - goto l945 + goto l947 } - goto l946 - l945: - position, tokenIndex = position945, tokenIndex945 + goto l948 + l947: + position, tokenIndex = position947, tokenIndex947 } - l946: + l948: if !_rules[ruleOffsetOperator]() { goto l847 } { - position947, tokenIndex947 := position, tokenIndex + position949, tokenIndex949 := position, tokenIndex if !_rules[ruleWS]() { - goto l947 + goto l949 } - goto l948 - l947: - position, tokenIndex = position947, tokenIndex947 + goto l950 + l949: + position, tokenIndex = position949, tokenIndex949 } - l948: + l950: if c := buffer[position]; c < rune('0') || c > rune('9') { goto l847 } position++ - l949: + l951: { - position950, tokenIndex950 := position, tokenIndex + position952, tokenIndex952 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l950 + goto l952 } position++ - goto l949 - l950: - position, tokenIndex = position950, tokenIndex950 + goto l951 + l952: + position, tokenIndex = position952, tokenIndex952 } { - position951, tokenIndex951 := position, tokenIndex + position953, tokenIndex953 := position, tokenIndex if !_rules[ruleWS]() { - goto l951 + goto l953 } - goto l952 - l951: - position, tokenIndex = position951, tokenIndex951 + goto l954 + l953: + position, tokenIndex = position953, tokenIndex953 } - l952: + l954: if !_rules[ruleOffsetOperator]() { goto l847 } { - position953, tokenIndex953 := position, tokenIndex + position955, tokenIndex955 := position, tokenIndex if !_rules[ruleWS]() { - goto l953 + goto l955 } - goto l954 - l953: - position, tokenIndex = position953, tokenIndex953 + goto l956 + l955: + position, tokenIndex = position955, tokenIndex955 } - l954: + l956: if c := buffer[position]; c < rune('0') || c > rune('9') { goto l847 } position++ - l955: + l957: { - position956, tokenIndex956 := position, tokenIndex + position958, tokenIndex958 := position, tokenIndex if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l956 + goto l958 } position++ - goto l955 - l956: - position, tokenIndex = position956, tokenIndex956 + goto l957 + l958: + position, tokenIndex = position958, tokenIndex958 } if buffer[position] != rune(')') { goto l847 @@ -7287,135 +7618,147 @@ func (p *Asm) Init(options ...func(*Asm) error) error { } l878: { - position957, tokenIndex957 := position, tokenIndex + position959, tokenIndex959 := position, tokenIndex { - position958, tokenIndex958 := position, tokenIndex + position960, tokenIndex960 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l959 + goto l961 } position++ - goto l958 - l959: - position, tokenIndex = position958, tokenIndex958 + goto l960 + l961: + position, tokenIndex = position960, tokenIndex960 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l957 + goto l959 } position++ } - l958: + l960: goto l847 - l957: - position, tokenIndex = position957, tokenIndex957 + l959: + position, tokenIndex = position959, tokenIndex959 } } l853: add(ruleOffset, position848) } + memoize(54, position847, tokenIndex847, true) return true l847: + memoize(54, position847, tokenIndex847, false) position, tokenIndex = position847, tokenIndex847 return false }, /* 55 Section <- <([a-z] / [A-Z] / '@')+> */ func() bool { - position960, tokenIndex960 := position, tokenIndex + if memoized, ok := memoization[memoKey{55, position}]; ok { + return memoizedResult(memoized) + } + position962, tokenIndex962 := position, tokenIndex { - position961 := position + position963 := position { - position964, tokenIndex964 := position, tokenIndex + position966, tokenIndex966 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l965 + goto l967 } position++ - goto l964 - l965: - position, tokenIndex = position964, tokenIndex964 + goto l966 + l967: + position, tokenIndex = position966, tokenIndex966 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l966 + goto l968 } position++ - goto l964 - l966: - position, tokenIndex = position964, tokenIndex964 + goto l966 + l968: + position, tokenIndex = position966, tokenIndex966 if buffer[position] != rune('@') { - goto l960 + goto l962 } position++ } + l966: l964: - l962: { - position963, tokenIndex963 := position, tokenIndex + position965, tokenIndex965 := position, tokenIndex { - position967, tokenIndex967 := position, tokenIndex + position969, tokenIndex969 := position, tokenIndex if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l968 + goto l970 } position++ - goto l967 - l968: - position, tokenIndex = position967, tokenIndex967 + goto l969 + l970: + position, tokenIndex = position969, tokenIndex969 if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l969 + goto l971 } position++ - goto l967 - l969: - position, tokenIndex = position967, tokenIndex967 + goto l969 + l971: + position, tokenIndex = position969, tokenIndex969 if buffer[position] != rune('@') { - goto l963 + goto l965 } position++ } - l967: - goto l962 - l963: - position, tokenIndex = position963, tokenIndex963 + l969: + goto l964 + l965: + position, tokenIndex = position965, tokenIndex965 } - add(ruleSection, position961) + add(ruleSection, position963) } + memoize(55, position962, tokenIndex962, true) return true - l960: - position, tokenIndex = position960, tokenIndex960 + l962: + memoize(55, position962, tokenIndex962, false) + position, tokenIndex = position962, tokenIndex962 return false }, /* 56 SegmentRegister <- <('%' ([c-g] / 's') ('s' ':'))> */ func() bool { - position970, tokenIndex970 := position, tokenIndex + if memoized, ok := memoization[memoKey{56, position}]; ok { + return memoizedResult(memoized) + } + position972, tokenIndex972 := position, tokenIndex { - position971 := position + position973 := position if buffer[position] != rune('%') { - goto l970 + goto l972 } position++ { - position972, tokenIndex972 := position, tokenIndex + position974, tokenIndex974 := position, tokenIndex if c := buffer[position]; c < rune('c') || c > rune('g') { - goto l973 + goto l975 } position++ - goto l972 - l973: - position, tokenIndex = position972, tokenIndex972 + goto l974 + l975: + position, tokenIndex = position974, tokenIndex974 if buffer[position] != rune('s') { - goto l970 + goto l972 } position++ } - l972: + l974: if buffer[position] != rune('s') { - goto l970 + goto l972 } position++ if buffer[position] != rune(':') { - goto l970 + goto l972 } position++ - add(ruleSegmentRegister, position971) + add(ruleSegmentRegister, position973) } + memoize(56, position972, tokenIndex972, true) return true - l970: - position, tokenIndex = position970, tokenIndex970 + l972: + memoize(56, position972, tokenIndex972, false) + position, tokenIndex = position972, tokenIndex972 return false }, }