bropkg/engine/parser

Types

Parser = object
  lex: Lexer
  prev, curr, next: TokenTuple
  program: Program
  memtable: Memtable
  when compileOption("app", "console"):
      error: seq[Row]
      logger*: Logger

  else:
      error: string

  hasErrors*: bool
  warnings*: seq[Warning]
  currentSelector: Node
  imports: Imports
  memparser: Memparser
  case ptype: ParserType
  of Main:
      projectDirectory: string

  else:
    nil
  filePath: string
Warning = tuple[msg: string, line, col: int]

Procs

proc getError(p: Parser): seq[Row] {....raises: [ValueError], tags: [].}
proc getMemtable(p: Parser): Memtable {....raises: [], tags: [].}
Return data stored in memory as Memtable
proc getProgram(p: Parser): Program {....raises: [], tags: [].}
Return current AST as Program
proc hasError(p: Parser): bool {....raises: [], tags: [].}
proc hasWarnings(p: Parser): bool {....raises: [], tags: [].}
proc parseProgram(fpath: string): Parser {.
    ...raises: [IOError, OSError, Exception, ValueError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect].}
Parse program and return Parser instance