parser

Types

Parser = object
  currInd: int
  firstTok: bool
  hasProgress: bool
  lex*: Lexer
  tok*: Token
  inPragma*: int
  inSemiStmtList*: int
  emptyNode: PNode
  when defined(nimpretty):
      em*: Emitter

  
  Source Edit

Procs

proc getTok(p: var Parser) {...}{.raises: [Exception, ValueError, IOError,
                                      ERecoverableError], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Get the next token from the parser's lexer, and store it in the parser's tok member.   Source Edit
proc openParser(p: var Parser; fileIdx: FileIndex; inputStream: PLLStream;
                cache: IdentCache; config: ConfigRef) {...}{.
    raises: [IOError, Exception, ValueError, ERecoverableError],
    tags: [ReadIOEffect, RootEffect, WriteIOEffect, ReadEnvEffect].}
Open a parser, using the given arguments to set up its internal state.   Source Edit
proc openParser(p: var Parser; filename: AbsoluteFile; inputStream: PLLStream;
                cache: IdentCache; config: ConfigRef) {...}{.
    raises: [IOError, Exception, ValueError, ERecoverableError, KeyError], tags: [
    ReadIOEffect, RootEffect, WriteIOEffect, ReadEnvEffect, ReadDirEffect].}
  Source Edit
proc closeParser(p: var Parser) {...}{.raises: [], tags: [].}
Close a parser, freeing up its resources.   Source Edit
proc parMessage(p: Parser; msg: TMsgKind; arg: string = "") {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Produce and emit the parser message arg to output.   Source Edit
proc skipComment(p: var Parser; node: PNode) {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc skipInd(p: var Parser) {...}{.raises: [Exception, ValueError, IOError,
                                       ERecoverableError], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc optPar(p: var Parser) {...}{.raises: [Exception, ValueError, IOError,
                                      ERecoverableError], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc optInd(p: var Parser; n: PNode) {...}{.raises: [Exception, ValueError, IOError,
    ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect,
                               ReadEnvEffect].}
  Source Edit
proc expectIdentOrKeyw(p: Parser) {...}{.raises: [Exception, ValueError, IOError,
    ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect,
                               ReadEnvEffect].}
  Source Edit
proc expectIdent(p: Parser) {...}{.raises: [Exception, ValueError, IOError,
                                       ERecoverableError], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc eat(p: var Parser; tokType: TokType) {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Move the parser to the next token if the current token is of type tokType, otherwise error.   Source Edit
proc parLineInfo(p: Parser): TLineInfo {...}{.raises: [], tags: [].}
Retrieve the line information associated with the parser's current state.   Source Edit
proc indAndComment(p: var Parser; n: PNode) {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc newNodeP(kind: TNodeKind; p: Parser): PNode {...}{.raises: [], tags: [].}
  Source Edit
proc newIntNodeP(kind: TNodeKind; intVal: BiggestInt; p: Parser): PNode {...}{.
    raises: [], tags: [].}
  Source Edit
proc newFloatNodeP(kind: TNodeKind; floatVal: BiggestFloat; p: Parser): PNode {...}{.
    raises: [], tags: [].}
  Source Edit
proc newStrNodeP(kind: TNodeKind; strVal: string; p: Parser): PNode {...}{.
    raises: [], tags: [].}
  Source Edit
proc newIdentNodeP(ident: PIdent; p: Parser): PNode {...}{.raises: [], tags: [].}
  Source Edit
proc isOperator(tok: Token): bool {...}{.raises: [], tags: [].}
Determines if the given token is an operator type token.   Source Edit
proc parseSymbol(p: var Parser; mode = smNormal): PNode {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source Edit
proc setBaseFlags(n: PNode; base: NumericalBase) {...}{.raises: [], tags: [].}
  Source Edit
proc parseAll(p: var Parser): PNode {...}{.raises: [Exception, ValueError, IOError,
    ERecoverableError], tags: [RootEffect, WriteIOEffect, ReadIOEffect,
                               ReadEnvEffect].}
Parses the rest of the input stream held by the parser into a PNode.   Source Edit
proc parseTopLevelStmt(p: var Parser): PNode {...}{.
    raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Implements an iterator which, when called repeatedly, returns the next top-level statement or emptyNode if end of stream.   Source Edit
proc parseString(s: string; cache: IdentCache; config: ConfigRef;
                 filename: string = ""; line: int = 0;
                 errorHandler: ErrorHandler = nil): PNode {...}{.
    raises: [IOError, Exception, ValueError, ERecoverableError, KeyError], tags: [
    ReadIOEffect, RootEffect, WriteIOEffect, ReadEnvEffect, ReadDirEffect].}
Parses a string into an AST, returning the top node. filename and line, although optional, provide info so that the compiler can generate correct error messages referring to the original source.   Source Edit