Types
Lexer = object of TBaseLexer fileIdx*: FileIndex indentAhead*: int currLineIndent*: int errorHandler*: ErrorHandler cache*: IdentCache when defined(nimsuggest): tokenEnd*: TLineInfo previousTokenEnd*: TLineInfo config*: ConfigRef
- Source Edit
NumericalBase = enum base10, base2, base8, base16
- Source Edit
Token = object tokType*: TokType base*: NumericalBase spacing*: set[TokenSpacing] indent*: int ident*: PIdent iNumber*: BiggestInt fNumber*: BiggestFloat literal*: string line*, col*: int when defined(nimpretty): offsetA*, offsetB*: int commentOffsetA*, commentOffsetB*: int
- Source Edit
TokenSpacing = enum tsLeading, tsTrailing, tsEof
- Source Edit
TokType = enum tkInvalid = "tkInvalid", tkEof = "[EOF]", tkSymbol = "tkSymbol", tkAddr = "addr", tkAnd = "and", tkAs = "as", tkAsm = "asm", tkBind = "bind", tkBlock = "block", tkBreak = "break", tkCase = "case", tkCast = "cast", tkConcept = "concept", tkConst = "const", tkContinue = "continue", tkConverter = "converter", tkDefer = "defer", tkDiscard = "discard", tkDistinct = "distinct", tkDiv = "div", tkDo = "do", tkElif = "elif", tkElse = "else", tkEnd = "end", tkEnum = "enum", tkExcept = "except", tkExport = "export", tkFinally = "finally", tkFor = "for", tkFrom = "from", tkFunc = "func", tkIf = "if", tkImport = "import", tkIn = "in", tkInclude = "include", tkInterface = "interface", tkIs = "is", tkIsnot = "isnot", tkIterator = "iterator", tkLet = "let", tkMacro = "macro", tkMethod = "method", tkMixin = "mixin", tkMod = "mod", tkNil = "nil", tkNot = "not", tkNotin = "notin", tkObject = "object", tkOf = "of", tkOr = "or", tkOut = "out", tkProc = "proc", tkPtr = "ptr", tkRaise = "raise", tkRef = "ref", tkReturn = "return", tkShl = "shl", tkShr = "shr", tkStatic = "static", tkTemplate = "template", tkTry = "try", tkTuple = "tuple", tkType = "type", tkUsing = "using", tkVar = "var", tkWhen = "when", tkWhile = "while", tkXor = "xor", tkYield = "yield", tkIntLit = "tkIntLit", tkInt8Lit = "tkInt8Lit", tkInt16Lit = "tkInt16Lit", tkInt32Lit = "tkInt32Lit", tkInt64Lit = "tkInt64Lit", tkUIntLit = "tkUIntLit", tkUInt8Lit = "tkUInt8Lit", tkUInt16Lit = "tkUInt16Lit", tkUInt32Lit = "tkUInt32Lit", tkUInt64Lit = "tkUInt64Lit", tkFloatLit = "tkFloatLit", tkFloat32Lit = "tkFloat32Lit", tkFloat64Lit = "tkFloat64Lit", tkFloat128Lit = "tkFloat128Lit", tkStrLit = "tkStrLit", tkRStrLit = "tkRStrLit", tkTripleStrLit = "tkTripleStrLit", tkGStrLit = "tkGStrLit", tkGTripleStrLit = "tkGTripleStrLit", tkCharLit = "tkCharLit", tkCustomLit = "tkCustomLit", tkParLe = "(", tkParRi = ")", tkBracketLe = "[", tkBracketRi = "]", tkCurlyLe = "{", tkCurlyRi = "}", tkBracketDotLe = "[.", tkBracketDotRi = ".]", tkCurlyDotLe = "{.", tkCurlyDotRi = ".}", tkParDotLe = "(.", tkParDotRi = ".)", tkComma = ",", tkSemiColon = ";", tkColon = ":", tkColonColon = "::", tkEquals = "=", tkDot = ".", tkDotDot = "..", tkBracketLeColon = "[:", tkOpr, tkComment, tkAccent = "`", tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr, tkHideableStart, tkHideableEnd
- Source Edit
Consts
OpChars: set[char] = {'+', '-', '*', '/', '\\', '<', '>', '!', '?', '^', '.', '|', '=', '%', '&', '$', '@', '~', ':'}
- Source Edit
SymStartChars: set[char] = {'a'..'z', 'A'..'Z', '\x80'..'\xFF'}
- Source Edit
tokKeywordHigh = tkYield
- Source Edit
tokKeywordLow = tkAddr
- Source Edit
Procs
proc closeLexer(lex: var Lexer) {....raises: [IOError], tags: [], forbids: [].}
- Source Edit
proc getIndentWidth(fileIdx: FileIndex; inputstream: PLLStream; cache: IdentCache; config: ConfigRef): int {. ...raises: [IOError, Exception, ValueError, KeyError, ERecoverableError], tags: [ ReadIOEffect, RootEffect, ReadDirEffect, WriteIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc getPrecedence(ident: PIdent): int {....raises: [], tags: [], forbids: [].}
- assumes ident is binary operator already Source Edit
proc getPrecedence(tok: Token): int {....raises: [], tags: [], forbids: [].}
- Calculates the precedence of the given token. Source Edit
proc isNimIdentifier(s: string): bool {....raises: [], tags: [], forbids: [].}
- Source Edit
proc lexMessage(L: Lexer; msg: TMsgKind; arg = "") {. ...raises: [Exception, ValueError, KeyError, IOError, ERecoverableError], tags: [ RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}
- Source Edit
proc openLexer(lex: var Lexer; fileIdx: FileIndex; inputstream: PLLStream; cache: IdentCache; config: ConfigRef) {. ...raises: [IOError, Exception], tags: [ReadIOEffect, RootEffect], forbids: [].}
- Source Edit
proc openLexer(lex: var Lexer; filename: AbsoluteFile; inputstream: PLLStream; cache: IdentCache; config: ConfigRef) {. ...raises: [IOError, Exception, KeyError], tags: [ReadIOEffect, RootEffect, ReadDirEffect], forbids: [].}
- Source Edit