npeg/common

Search:
Group by:
Source   Edit  

Types

Assoc = enum
  assocLeft, assocRight
Source   Edit  
CapFrame[S] = object
  cft*: CapFrameType
  name*: string
  si*: int
  ck*: CapKind
  when S is char:
    sPushed*: string
  else:
    sPushed*: S
Source   Edit  
CapFrameType = enum
  cftOpen, cftClose
Source   Edit  
CapKind = enum
  ckVal, ckPushed, ckCodeBlock, ckRef
Source   Edit  
CharSet = set[char]
Source   Edit  
Grammar = ref object
  rules*: Table[string, Rule]
  templates*: Table[string, Template]
Source   Edit  
Inst = object
  case op*: Opcode
  of opChoice, opCommit:
    ipOffset*: int
    siOffset*: int
  of opChr:
    ch*: char
  of opLit:
    lit*: NimNode
  of opCall, opJump:
    callLabel*: string
    callOffset*: int
  of opSet, opSpan:
    cs*: CharSet
  of opCapOpen, opCapClose:
    capKind*: CapKind
    capAction*: NimNode
    capName*: string
    capSiOffset*: int
  of opErr:
    msg*: string
  of opFail, opReturn, opAny, opNop, opPrecPop:
    nil
  of opBackref:
    refName*: string
  of opPrecPush:
    prec*: int
    assoc*: Assoc
  failOffset*: int
  name*: string
  nimNode*: NimNode
  indent*: int
Source   Edit  
NPegException = object of CatchableError
  matchLen*: int
  matchMax*: int
Source   Edit  
NPegParseError = object of NPegException
Source   Edit  
Opcode = enum
  opChr, opLit, opSet, opAny, opNop, opSpan, opChoice, opCommit, opCall, opJump,
  opReturn, opFail, opCapOpen, opCapClose, opBackref, opErr, opPrecPush,
  opPrecPop
Source   Edit  
Patt = seq[Inst]
Source   Edit  
Program = object
  patt*: Patt
  symTab*: SymTab
Source   Edit  
Ref = object
  key*: string
  val*: string
Source   Edit  
Rule = object
  name*: string
  patt*: Patt
  repr*: string
  lineInfo*: LineInfo
Source   Edit  
Symbol = object
  ip*: int
  name*: string
  repr*: string
  lineInfo*: LineInfo
Source   Edit  
SymTab = object
  syms*: seq[Symbol]
Source   Edit  
Template = ref object
  name*: string
  args*: seq[string]
  code*: NimNode
Source   Edit  

Consts

npegBackStackSize {.intdefine.} = 1024
Source   Edit  
npegDebug = false
Source   Edit  
npegExpand = false
Source   Edit  
npegGcsafe = false
Source   Edit  
npegGraph = false
Source   Edit  
npegInlineMaxLen {.intdefine.} = 30
Source   Edit  
npegOptCapShift = true
Source   Edit  
npegOptHeadFail = true
Source   Edit  
npegOptimize {.intdefine.} = 255
Source   Edit  
npegOptSets = true
Source   Edit  
npegPattMaxLen {.intdefine.} = 4096
Source   Edit  
npegRetStackSize {.intdefine.} = 1024
Source   Edit  
npegStacktrace = false
Source   Edit  
npegTrace = false
Source   Edit  

Procs

proc `$`(i: Inst; ip = 0): string {....raises: [KeyError], tags: [], forbids: [].}
Source   Edit  
proc `$`(program: Program): string {....raises: [KeyError], tags: [], forbids: [].}
Source   Edit  
proc `$`(t: Template): string {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc `[]`(s: SymTab; ip: int): Symbol {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc `[]`(s: SymTab; name: string): Symbol {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc add(s: var SymTab; ip: int; name: string; repr: string = "";
         lineInfo: LineInfo = LineInfo()) {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc contains(s: SymTab; ip: int): bool {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc contains(s: SymTab; name: string): bool {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc dumpSet(cs: CharSet): string {....raises: [KeyError], tags: [], forbids: [].}
Source   Edit  
proc dumpSubject[S](s: openArray[S]; o: int = 0; l: int = 1024): string
Source   Edit  
proc escapeChar(c: char): string {....raises: [KeyError], tags: [], forbids: [].}
Source   Edit  
proc flattenChoice(n: NimNode; nChoice: NimNode = nil): NimNode {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc setKrakNode(n: NimNode) {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc slice(s: openArray[char]; iFrom, iTo: int): string {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc slice[S](s: openArray[S]; iFrom, iTo: int): S
Source   Edit  
proc subIStrCmp(s: openArray[char]; slen: int; si: int; s2: string): bool {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc subStrCmp(s: openArray[char]; slen: int; si: int; s2: string): bool {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc truncate(s: string; len: int): string {....raises: [], tags: [], forbids: [].}
Source   Edit  

Templates

template krak(msg: string)
Source   Edit  
template krak(n: NimNode; msg: string)
Source   Edit