Types
BroParserError = object of ValueError fatal*: bool
Parser = object inValue*: bool inCaseBlock*: bool inBlockBody*: bool inForIterable*: bool arrayLits*: Table[string, Node]
PrefixFunction = proc (p: var Parser; minPrec = 0): Node
Consts
broValueFnNames = ["lighten", "darken", "saturate", "desaturate", "spin", "mix", "mixCMYK", "toHex", "toHexAlpha", "toHtmlHex", "parseHex", "parseHexAlpha", "parseHtmlHex", "parseColor", "parseHtmlName", "parseHtmlColor", "distance", "almostEqual", "parseLength", "parseAngle", "parseTime", "parseResolution", "parseFlex"]
- Bro stdlib procs that construct or combine strictly typed CSS values (see stdlib/libcolors, stdlib/libcss). Calls to these names in property value position parse as real calls so they evaluate to typed values; every other name(...) stays opaque raw CSS text (rgb, var, calc, linear-gradient, ...).
unitSizeSuffixes = ["px", "em", "rem", "%", "vh", "vw", "vmin", "vmax", "s", "ms", "deg", "rad", "grad", "turn", "dpi", "dpcm", "dppx", "Hz", "kHz", "fr", "ch", "ex", "cm", "mm", "in", "pt", "pc"]
Procs
proc isKnownCssProperty(name: string): bool {....raises: [KeyError, Exception], tags: [RootEffect], forbids: [].}
proc normVarName(name: string): string {....raises: [], tags: [], forbids: [].}
- Normalize a declared variable name: var accent registers $accent. $ is required at use sites; already-prefixed (and --prefixed, e.g. custom properties) names pass through untouched.
proc normVarNode(node: Node): Node {....raises: [], tags: [], forbids: [].}
- Apply normVarName to a declaration target (nkIdent, possibly wrapped in an export-marker nkPostfix). Anything else passes through.
proc parseScript(astProgram: var Ast; code: sink string; sourcePath: string) {. ...raises: [Exception, BroParserError, ValueError], tags: [RootEffect], forbids: [].}
- Parse the given code into an AST.