src/kdl/lexer

Search:
Group by:
Source   Edit  

Types

Lexer = object
  case isStream*: bool
  of true:
    stream*: Stream
  else:
    source*: string
    current*: int
  multilineStringsNewLines*: seq[tuple[idx, length: int]]
  stack*: seq[Token]
Source   Edit  
Token = object
  lexeme*: string
  start*: int
  kind*: TokenKind
Source   Edit  
TokenKind = enum
  tkEmpty = "empty", tkNull = "null", tkStar = "star", tkPlus = "plus",
  tkBool = "bool", tkTilde = "tilde", tkComma = "comma", tkCaret = "caret",
  tkDollar = "dollar", tkIdent = "identifier", tkSemicolon = "semicolon",
  tkGreater = "greater_than", tkSlashDash = "slash_dash",
  tkDoublePipe = "double_pipe", tkLineCont = "line_continuation",
  tkEqual = "equal", tkNotEqual = "not_equal", tkString = "string",
  tkRawString = "raw_string", tkWhitespace = "whitespace",
  tkNewLine = "new_line", tkOpenPar = "open_parenthesis",
  tkClosePar = "close_parenthesis", tkOpenBra = "open_bracket",
  tkCloseBra = "close_bracket", tkOpenSqu = "open_square_bracket",
  tkCloseSqu = "close_square_bracket", tkNumFloat = "float_number",
  tkNumInt = "integer_number", tkNumHex = "hexadecimal_number",
  tkNumBin = "binary_number", tkNumOct = "octagonal_number"
Source   Edit  

Procs

proc `$`(lexer: Lexer): string {....raises: [IOError, OSError], tags: [],
                                 forbids: [].}
Source   Edit  
proc getPos(lexer: Lexer): int {....raises: [IOError, OSError], tags: [],
                                 forbids: [].}
Source   Edit  
proc scanKdl(lexer: var Lexer) {....raises: [IOError, OSError, KdlLexerError],
                                 tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc scanKdl(source: string; start = 0): Lexer {.
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc scanKdl(stream: sink Stream): Lexer {.
    ...raises: [IOError, OSError, KdlLexerError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Source   Edit  
proc scanKdlFile(path: string): Lexer {....raises: [IOError, OSError, KdlLexerError],
                                        tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc scanKdlFileStream(path: string): Lexer {.
    ...raises: [IOError, OSError, KdlLexerError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Source   Edit  
proc scanKdlStream(source: sink string): Lexer {.
    ...raises: [IOError, OSError, KdlLexerError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Source   Edit  
proc skipWhitespaces(lexer: var Lexer; consume: bool = true;
                     addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenIdent(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError, KdlLexerError],
    tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenLineCont(lexer: var Lexer; consume: bool = true;
                   addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenMultiLineComment(lexer: var Lexer; consume: bool = true;
                           addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenNewLine(lexer: var Lexer; consume: bool = true;
                  addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenNumBin(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError, KdlLexerError],
    tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenNumHex(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError, KdlLexerError],
    tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenNumInt(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenNumOct(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError, KdlLexerError],
    tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenRawString(lexer: var Lexer; consume: bool = true;
                    addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenSingleLineComment(lexer: var Lexer; consume: bool = true;
                            addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenString(lexer: var Lexer; consume: bool = true; addToStack: bool = true): bool {.
    discardable, ...raises: [IOError, OSError, KdlLexerError],
    tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc tokenWhitespace(lexer: var Lexer; consume: bool = true;
                     addToStack: bool = true): bool {.discardable,
    ...raises: [IOError, OSError, KdlLexerError], tags: [ReadIOEffect], forbids: [].}
Source   Edit  
proc validToken(source: sink string; token: proc (lexer: var Lexer;
    consume = true; addToStack = true): bool): bool {.
    ...raises: [Exception, IOError, OSError], tags: [RootEffect], forbids: [].}
Source   Edit