bropkg/engine/tokens

Types

Lexer = object of BaseLexer
  kind: TokenKind
  token: string
  error: string
  startPos: int
  wsno: int
  multiLineStr: bool
LexerException = object of CatchableError
TokenKind {.pure.} = enum
  tkUnknown, tkInteger, tkFloat, tkString, tkIdentifier, tkEOF, tkA = "a",
  tkAbbr = "abbr", tkAcronym = "acronym", tkAddress = "address",
  tkApplet = "applet", tkArea = "area", tkArticle = "article",
  tkAside = "aside", tkAudio = "audio", tkBold = "b", tkBase = "base",
  tkBasefont = "basefont", tkBdi = "bdi", tkBdo = "bdo", tkBig = "big",
  tkBlockquote = "blockquote", tkBody = "body", tkBr = "br",
  tkButton = "button", tkCanvas = "canvas", tkCaption = "caption",
  tkCenter = "center", tkCite = "cite", tkCode = "code", tkCol = "col",
  tkColgroup = "colgroup", tkData = "data", tkDatalist = "datalist",
  tkDD = "dd", tkDel = "del", tkDetails = "details", tkDFN = "dfn",
  tkDialog = "dialog", tkDir = "dir", tkDiv = "div", tkDoctype = "doctype",
  tkDL = "dl", tkDT = "dt", tkEM = "em", tkEmbed = "embed",
  tkFieldset = "fieldset", tkFigcaption = "figcaption", tkFigure = "figure",
  tkFont = "font", tkFooter = "footer", tkForm = "form", tkFrame = "frame",
  tkFrameset = "frameset", tkH1 = "h1", tkH2 = "h2", tkH3 = "h3", tkH4 = "h4",
  tkH5 = "h5", tkH6 = "h6", tkHead = "head", tkHeader = "header", tkHr = "hr",
  tkHtml = "html", tkItalic = "i", tkIframe = "iframe", tkImg = "img",
  tkInput = "input", tkIns = "ins", tkKbd = "kbd", tkLabel = "label",
  tkLegend = "legend", tkLi = "li", tkLink = "link", tkMain = "main",
  tkMap = "map", tkMark = "mark", tkMeta = "meta", tkMeter = "meter",
  tkNav = "nav", tkNoframes = "noframes", tkNoscript = "noscript",
  tkObject = "object", tkOl = "ol", tkOptgroup = "optgroup",
  tkOption = "option", tkOutput = "output", tkParagraph = "p",
  tkParam = "param", tkPre = "pre", tkProgress = "progress", tkQuotation = "q",
  tkRP = "rp", tkRT = "rt", tkRuby = "ruby", tkStrike = "s", tkSamp = "samp",
  tkScript = "script", tkSection = "section", tkSelect = "select",
  tkSmall = "small", tkSource = "source", tkSpan = "span",
  tkStrike_Long = "strike", tkStrong = "strong", tkStyle = "style",
  tkSub = "sub", tkSummary = "summary", tkSup = "sup", tkSVG = "svg",
  tkTable = "table", tkTbody = "tbody", tkTD = "td", tkTemplate = "template",
  tkTextarea = "textarea", tkTfoot = "tfoot", tkTH = "th", tkThead = "thead",
  tkTime = "time", tkTitle = "title", tkTR = "tr", tkTrack = "track",
  tkTT = "tt", tkUnderline = "u", tkUL = "ul", tkVideo = "video", tkWBR = "wbr",
  tkRoot = "root", tkCase = "case", tkOf = "of", tkAltAnd = "and",
  tkAltOr = "or", tkColon = ":", tkComma = ",", tkAnd, tkAndAnd, tkPseudoClass,
  tkOR, tkPipe, tkMulti = "*", tkMinus = "-", tkPlus = "+", tkEQ, tkAssign,
  tkNE, tkGTE, tkGT, tkLTE, tkLT, tkQMark = "?", tkLPar = "(", tkRPar = ")",
  tkLB = "[", tkRB = "]", tkVarConcat, tkLC, tkRC = "}", tkExcRule, tkHash,
  tkVar, tkVarCall, tkVarCallAccessor, tkClass, tkComment, tkDivide, tkImport,
  tkExtend, tkUse, tkMixin, tkJSON, tkAtRule, tkEcho = "echo",
  tkCSSCalc = "calc", tkCSSAttr = "attr", tkCSSConicGradient = "conic-gradient",
  tkCSSCounter = "counter", tkCSSCubicBezier = "cubic-bezier", tkCSSHSL = "hsl",
  tkCSSHSLA = "hsla", tkCSSLinearGradient = "linear-gradient", tkCSSMax = "max",
  tkCSSmin = "min", tkCSSRadialGradient = "radial-gradient",
  tkCSSRepeatingConicGradient = "repeating-conic-gradient",
  tkCSSRepeatingLinearGradient = "repeating-linear-gradient",
  tkCSSRepeatingRadialGradient = "repeating-radial-gradient", tkCSSRGB = "rgb",
  tkCSSRGBA = "rgba", tkCSSVar = "var", tkColorAliceblue = "aliceblue",
  tkColorAntiquewhite = "antiquewhite", tkColorAqua = "aqua",
  tkColorAquamarine = "aquamarine", tkColorAzure = "azure",
  tkColorBeige = "beige", tkColorBisque = "bisque", tkColorBlack = "black",
  tkColorBlanchedalmond = "blanchedalmond", tkColorBlue = "blue",
  tkColorBlueviolet = "blueviolet", tkColorBrown = "brown",
  tkColorBurlywood = "burlywood", tkColorCadetblue = "cadetblue",
  tkColorChartreuse = "chartreuse", tkColorChocolate = "chocolate",
  tkColorCoral = "coral", tkColorCornflowerblue = "cornflowerblue",
  tkColorCornsilk = "cornsilk", tkColorCrimson = "crimson",
  tkColorCyan = "cyan", tkColorDarkblue = "darkblue",
  tkColorDarkcyan = "darkcyan", tkColorDarkgoldenrod = "darkgoldenrod",
  tkColorDarkgray = "darkgray", tkColorDarkgreen = "darkgreen",
  tkColorDarkkhaki = "darkkhaki", tkColorDarkmagenta = "darkmagenta",
  tkColorDarkolivegreen = "darkolivegreen", tkColorDarkorange = "darkorange",
  tkColorDarkorchid = "darkorchid", tkColorDarkred = "darkred",
  tkColorDarksalmon = "darksalmon", tkColorDarkseagreen = "darkseagreen",
  tkColorDarkslateblue = "darkslateblue",
  tkColorDarkslategray = "darkslategray",
  tkColorDarkturquoise = "darkturquoise", tkColorDarkviolet = "darkviolet",
  tkColorDeeppink = "deeppink", tkColorDeepskyblue = "deepskyblue",
  tkColorDimgray = "dimgray", tkColorDodgerblue = "dodgerblue",
  tkColorFirebrick = "firebrick", tkColorFloralwhite = "floralwhite",
  tkColorForestgreen = "forestgreen", tkColorFuchsia = "fuchsia",
  tkColorGainsboro = "gainsboro", tkColorGhostwhite = "ghostwhite",
  tkColorGold = "gold", tkColorGoldenrod = "goldenrod", tkColorGray = "gray",
  tkColorGrey = "grey", tkColorGreen = "green",
  tkColorGreenyellow = "greenyellow", tkColorHoneydew = "honeydew",
  tkColorHotpink = "hotpink", tkColorIndianred = "indianred",
  tkColorIndigo = "indigo", tkColorIvory = "ivory", tkColorKhaki = "khaki",
  tkColorLavender = "lavender", tkColorLavenderblush = "lavenderblush",
  tkColorLawngreen = "lawngreen", tkColorLemonchiffon = "lemonchiffon",
  tkColorLightblue = "lightblue", tkColorLightcoral = "lightcoral",
  tkColorLightcyan = "lightcyan",
  tkColorLightgoldenrodyellow = "lightgoldenrodyellow",
  tkColorLightgray = "lightgray", tkColorLightgreen = "lightgreen",
  tkColorLightpink = "lightpink", tkColorLightsalmon = "lightsalmon",
  tkColorLightseagreen = "lightseagreen", tkColorLightskyblue = "lightskyblue",
  tkColorLightslategray = "lightslategray",
  tkColorLightsteelblue = "lightsteelblue", tkColorLightyellow = "lightyellow",
  tkColorLime = "lime", tkColorLimegreen = "limegreen", tkColorLinen = "linen",
  tkColorMagenta = "magenta", tkColorMaroon = "maroon",
  tkColorMediumaquamarine = "mediumaquamarine",
  tkColorMediumblue = "mediumblue", tkColorMediumorchid = "mediumorchid",
  tkColorMediumpurple = "mediumpurple",
  tkColorMediumseagreen = "mediumseagreen",
  tkColorMediumslateblue = "mediumslateblue",
  tkColorMediumspringgreen = "mediumspringgreen",
  tkColorMediumturquoise = "mediumturquoise",
  tkColorMediumvioletred = "mediumvioletred",
  tkColorMidnightblue = "midnightblue", tkColorMintcream = "mintcream",
  tkColorMistyrose = "mistyrose", tkColorMoccasin = "moccasin",
  tkColorNavajowhite = "navajowhite", tkColorNavy = "navy",
  tkColorOldlace = "oldlace", tkColorOlive = "olive",
  tkColorOlivedrab = "olivedrab", tkColorOrange = "orange",
  tkColorOrangered = "orangered", tkColorOrchid = "orchid",
  tkColorPalegoldenrod = "palegoldenrod", tkColorPalegreen = "palegreen",
  tkColorPaleturquoise = "paleturquoise",
  tkColorPalevioletred = "palevioletred", tkColorPapayawhip = "papayawhip",
  tkColorPeachpuff = "peachpuff", tkColorPeru = "peru", tkColorPink = "pink",
  tkColorPlum = "plum", tkColorPowderblue = "powderblue",
  tkColorPurple = "purple", tkColorRebeccapurple = "rebeccapurple",
  tkColorRed = "red", tkColorRosybrown = "rosybrown",
  tkColorRoyalblue = "royalblue", tkColorSaddlebrown = "saddlebrown",
  tkColorSalmon = "salmon", tkColorSandybrown = "sandybrown",
  tkColorSeagreen = "seagreen", tkColorSeashell = "seashell",
  tkColorSienna = "sienna", tkColorSilver = "silver",
  tkColorSkyblue = "skyblue", tkColorSlateblue = "slateblue",
  tkColorSlategray = "slategray", tkColorSnow = "snow",
  tkColorSpringgreen = "springgreen", tkColorSteelblue = "steelblue",
  tkColorTan = "tan", tkColorTeal = "teal", tkColorThistle = "thistle",
  tkColorTomato = "tomato", tkColorTurquoise = "turquoise",
  tkColorViolet = "violet", tkColorWheat = "wheat", tkColorWhite = "white",
  tkColorWhitesmoke = "whitesmoke", tkColorYellow = "yellow",
  tkColorYellowgreen = "yellowgreen", tkID, tkColor, tkImportant, tkDefault,
  tkPreview, tkFunctionCall, tkFunctionStmt, tkIf = "if", tkElif = "elif",
  tkElse = "else", tkFor = "for", tkIn = "in", tkWhen = "when", tkBool
TokenTuple = tuple[kind: TokenKind, value: string, wsno: int, line: int,
                   col: int, pos: int]

Procs

proc add(lex: var Lexer) {....raises: [], tags: [].}
proc current(lex: var Lexer): char {....raises: [], tags: [].}
proc generateIdentCase(lex: var Lexer) {....raises: [], tags: [].}
proc getDefaultToken(strtk: string): TokenKind {....raises: [], tags: [].}
proc getError(lex: Lexer): string {.inline, ...raises: [ValueError], tags: [].}
Retrieve error message from Lexer object
proc getToken(lex: var Lexer): TokenTuple {.
    ...raises: [IOError, OSError, Exception, ValueError],
    tags: [ReadIOEffect, RootEffect].}
proc handleCustomIdent[T: Lexer](lex: var T; kind: TokenKind)
Handle variable declarations based the following char sets {'a'..'z', 'A'..'Z', '_', '-'} and {'0'..'9'}
proc handleSnippets(lex: var Lexer; kind: TokenKind) {.
    ...raises: [IOError, OSError], tags: [ReadIOEffect].}
proc hasError(lex: Lexer): bool {.inline, ...raises: [], tags: [].}
Determine if Lexer has any errors
proc hasLetters(lex: var Lexer; pos: int): bool {....raises: [], tags: [].}
proc hasNumbers(lex: var Lexer; pos: int): bool {....raises: [], tags: [].}
proc inc(lex: var Lexer; offset = 1) {....raises: [], tags: [].}
proc init[L: Lexer](lex: typedesc[L]; fileContent: string;
                    allowMultilineStrings = false): L
Initialize a new BaseLexer instance with given Stream
proc lexReady(lex: var Lexer) {....raises: [], tags: [].}
proc setError(lex: var Lexer; message: string) {....raises: [], tags: [].}
proc skip(lex: var Lexer) {....raises: [IOError, OSError], tags: [ReadIOEffect].}