Lines Matching refs:prog
21 // It is the same as syntax.Prog except for the use of onePassInst.
40 func onePassPrefix(p *syntax.Prog) (prefix string, complete bool, pc uint32) {
70 // OnePassNext selects the next actionable state of the prog, based on the input character.
207 func cleanupOnePass(prog *onePassProg, original *syntax.Prog) {
212 prog.Inst[ix].Next = nil
214 prog.Inst[ix].Next = nil
215 prog.Inst[ix] = onePassInst{Inst: instOriginal}
220 // onePassCopy creates a copy of the original Prog, as we'll be modifying it
221 func onePassCopy(prog *syntax.Prog) *onePassProg {
223 Start: prog.Start,
224 NumCap: prog.NumCap,
225 Inst: make([]onePassInst, len(prog.Inst)),
227 for i, inst := range prog.Inst {
231 // rewrites one or more common Prog constructs that enable some otherwise
294 // makeOnePass creates a onepass Prog, if possible. It is possible if at any alt,
296 // p if it is turned into a onepass Prog. If it isn't possible for this to be a
297 // onepass Prog, the Prog notOnePass is returned. makeOnePass is recursive
298 // to the size of the Prog.
463 // compileOnePass returns a new *syntax.Prog suitable for onePass execution if the original Prog
465 // Prog cannot be converted. For a one pass prog, the fundamental condition that must
467 func compileOnePass(prog *syntax.Prog) (p *onePassProg) {
468 if prog.Start == 0 {
472 if prog.Inst[prog.Start].Op != syntax.InstEmptyWidth ||
473 syntax.EmptyOp(prog.Inst[prog.Start].Arg)&syntax.EmptyBeginText != syntax.EmptyBeginText {
477 for _, inst := range prog.Inst {
478 opOut := prog.Inst[inst.Out].Op
485 if opOut == syntax.InstMatch || prog.Inst[inst.Arg].Op == syntax.InstMatch {
497 // Creates a slightly optimized copy of the original Prog
498 // that cleans up some Prog idioms that block valid onepass programs
499 p = onePassCopy(prog)
501 // checkAmbiguity on InstAlts, build onepass Prog if possible
505 cleanupOnePass(p, prog)