npeg/codegen

Source   Edit  

Types

MatchResult[S] = object
  ok*: bool
  matchLen*: int
  matchMax*: int
  cs*: Captures[S]
Source   Edit  
MatchState[S] = object
  ip*: int
  si*: int
  simax*: int
  refs*: Table[string, string]
  retStack*: Stack[RetFrame]
  capStack*: Stack[CapFrame[S]]
  backStack*: Stack[BackFrame]
  precStack*: Stack[PrecFrame]
Source   Edit  
Parser[S; T] = object
  fn_init*: proc (): MatchState[S]
  when npegGcsafe:
    fn_run*: proc (ms: var MatchState[S]; s: openArray[S]; u: var T): MatchResult[
        S] {....gcsafe.}
  else:
    fn_run*: proc (ms: var MatchState[S]; s: openArray[S]; u: var T): MatchResult[
        S]
Source   Edit  

Procs

proc genCasesCode(program: Program; sType, uType, uId: NimNode;
                  ms, s, si, simax, ip: NimNode): NimNode {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
proc genCode(program: Program; sType, uType, uId: NimNode): NimNode {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc genTraceCode(program: Program;
                  sType, uType, uId, ms, s, si, simax, ip: NimNode): NimNode {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit