# parser

Theme:

- Index

Search:
Group by:
Source Edit

# Imports

llstream, lexer, idents, msgs, options, lineinfos, pathutils, ast

# Types

    Parser = object
      lex*: Lexer
      tok*: Token
      lineStartPrevious*: int
      lineNumberPrevious*: int
      bufposPrevious*: int
      inPragma*: int
      inSemiStmtList*: int
      when not defined(nimCustomAst):
      when defined(nimpretty):
        em*: Emitter

  Source Edit

# Procs

    proc checkFirstLineIndentation(p: var Parser) {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc closeParser(p: var Parser) {....raises: [IOError], tags: [], forbids: [].}

  Close a parser, freeing up its resources. Source Edit

    proc eat(p: var Parser; tokType: TokType) {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc expectIdent(p: Parser) {....raises: [Exception, ValueError, OSError, KeyError,
                                           IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
                                  forbids: [].}

  Source Edit

    proc expectIdentOrKeyw(p: Parser) {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc getTok(p: var Parser) {....raises: [Exception, ValueError, OSError, KeyError,
                                          IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
                                 forbids: [].}

  Source Edit

    proc indAndComment(p: var Parser; n: PNode; maybeMissEquals = false) {....raises: [
        KeyError, Exception, ValueError, OSError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc isOperator(tok: Token): bool {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc newFloatNodeP(kind: TNodeKind; floatVal: BiggestFloat; p: Parser): PNode {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc newIdentNodeP(ident: PIdent; p: Parser): PNode {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc newIntNodeP(kind: TNodeKind; intVal: BiggestInt; p: Parser): PNode {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc newNodeP(kind: TNodeKind; p: Parser): PNode {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc newStrNodeP(kind: TNodeKind; strVal: sink string; p: Parser): PNode {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc openParser(p: var Parser; fileIdx: FileIndex; inputStream: PLLStream;
                    cache: IdentCache; config: ConfigRef) {....raises: [IOError,
        Exception, ValueError, OSError, KeyError, ERecoverableError], tags: [
        ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect],
        forbids: [].}

  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, OSError, KeyError, ERecoverableError], tags: [
        ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc optInd(p: var Parser; n: PNode) {....raises: [KeyError, Exception, ValueError,
        OSError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc optPar(p: var Parser) {....raises: [Exception, ValueError, OSError, KeyError,
                                          IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
                                 forbids: [].}

  Source Edit

    proc parLineInfo(p: Parser): TLineInfo {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc parMessage(p: Parser; msg: TMsgKind; arg: string = "") {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc parseAll(p: var Parser): PNode {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Parses the rest of the input stream held by the parser into a PNode. Source Edit

    proc parseString(s: string; cache: IdentCache; config: ConfigRef;
                     filename: string = ""; line: int = 0;
                     errorHandler: ErrorHandler = nil): PNode {....raises: [IOError,
        Exception, ValueError, OSError, KeyError, ERecoverableError], tags: [
        ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect],
        forbids: [].}

  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

    proc parseSymbol(p: var Parser; mode = smNormal): PNode {....raises: [Exception,
        ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Source Edit

    proc parseTopLevelStmt(p: var Parser): PNode {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Implements an iterator which, when called repeatedly, returns the next top-level statement or emptyNode if end of stream. Source Edit

    proc setBaseFlags(n: PNode; base: NumericalBase) {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc skipComment(p: var Parser; node: PNode) {....raises: [KeyError, Exception,
        ValueError, OSError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc skipInd(p: var Parser) {....raises: [Exception, ValueError, OSError, KeyError,
                                           IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
                                  forbids: [].}

  Source Edit