From 78e976ec9b149af956405b17c060f715237daa54 Mon Sep 17 00:00:00 2001 From: George Lemon Date: Sun, 20 Aug 2023 20:03:54 +0300 Subject: [PATCH] update Signed-off-by: George Lemon --- src/bropkg/engine/ast.nim | 2 +- src/bropkg/engine/compiler.nim | 92 +++++++++++++--------- src/bropkg/engine/handlers/pAssignment.nim | 2 +- src/bropkg/engine/stdlib.nim | 2 +- tests/stylesheets/basic.css | 16 ++++ tests/stylesheets/for.bass | 11 ++- tests/stylesheets/forjson.bass | 5 -- tests/stylesheets/invalid.bass | 3 +- tests/stylesheets/json.bass | 10 +++ tests/stylesheets/sample.json | 4 +- tests/stylesheets/test_arrays.bass | 1 + tests/stylesheets/test_colors.bass | 17 +++- tests/stylesheets/test_math.bass | 6 +- tests/stylesheets/test_os.bass | 13 +-- tests/stylesheets/test_os.css | 0 tests/stylesheets/vars.bass | 21 ++--- tests/test1.nim | 87 ++++++++++++++------ 17 files changed, 188 insertions(+), 104 deletions(-) create mode 100644 tests/stylesheets/basic.css delete mode 100644 tests/stylesheets/forjson.bass create mode 100644 tests/stylesheets/json.bass delete mode 100644 tests/stylesheets/test_os.css diff --git a/src/bropkg/engine/ast.nim b/src/bropkg/engine/ast.nim index b1a3cd7..65ae8e0 100644 --- a/src/bropkg/engine/ast.nim +++ b/src/bropkg/engine/ast.nim @@ -160,7 +160,7 @@ type comment*: string of ntVariable: varName*: string - varValue*: Node + varValue*, varMod*: Node varMeta*: Meta varType*, varInitType*: NodeType varUsed*, varArg*, varImmutable*, diff --git a/src/bropkg/engine/compiler.nim b/src/bropkg/engine/compiler.nim index 7f9862f..59f5800 100644 --- a/src/bropkg/engine/compiler.nim +++ b/src/bropkg/engine/compiler.nim @@ -58,7 +58,7 @@ template exploreAst = else: "VarDef" else: $(node.nt) add info, "[$1:$2]" % [$(node.meta.line), $(node.meta.pos)] - echo indent(info, node.meta.pos) + # echo indent(info, node.meta.pos) macro newHandler(name: static string, body: untyped) = newProc(ident(name), @@ -149,16 +149,16 @@ proc getTypeInfo(node: Node): string = of ntAccessor: add result, getTypeInfo(node.callNode.accessorStorage) of ntVariable: - case node.callNode.varValue.nt: + case node.callNode.varMod.nt: of ntArray: # todo handle types of array (string, int, or mix for mixed values) - add result, "$1[$2]($3)" % [$(node.callNode.varValue.nt), - "mix", $(node.callNode.varValue.arrayItems.len)] + add result, "$1[$2]($3)" % [$(node.callNode.varMod.nt), + "mix", $(node.callNode.varMod.arrayItems.len)] of ntObject: - add result, "$1($2)" % [$(node.callNode.varValue.nt), - $(node.callNode.varValue.pairsVal.len)] + add result, "$1($2)" % [$(node.callNode.varMod.nt), + $(node.callNode.varMod.pairsVal.len)] else: - add result, "$1[$2]" % [$ntVariable, $(node.callNode.varValue.nt)] + add result, "$1[$2]" % [$ntVariable, $(node.callNode.varMod.nt)] else: discard else: discard of ntString: @@ -176,7 +176,7 @@ proc getTypeInfo(node: Node): string = of ntAccessor: add result, getTypeInfo(node.accessorStorage) of ntVariable: - add result, getTypeInfo(node.varValue) + add result, getTypeInfo(node.varMod) else: discard proc sizeString(v: Node): string = @@ -202,7 +202,7 @@ proc dumpHook*(s: var string, v: Node) = of ntArray: s.dumpHook(v.arrayItems) of ntVariable: - s.dumpHook(v.varValue) + s.dumpHook(v.varMod) else: discard proc dumpHook*(s: var string, v: seq[Node]) = @@ -543,9 +543,8 @@ proc walkAccessorStorage(c: Compiler, node, index: Node, scope: var seq[ScopeTab except FieldDefect: compileErrorWithArgs(invalidAccessorStorage, [index.toString]) of ntVariable: - # echo scope.hasKey(node.varName) var varNode = c.scoped(node.varName, scope) - return c.walkAccessorStorage(varNode.varValue, index, scope) + return c.walkAccessorStorage(varNode.varMod, index, scope) of ntStream: case node.streamContent.kind: of JObject: @@ -573,15 +572,14 @@ proc nodeEvaluator(c: Compiler, node: Node, scope: var seq[ScopeTable]): Node = of ntAccessor: # node.callNode.accessorStorage = varNode.varValue var x = c.walkAccessorStorage(node.callNode.accessorStorage, - node.callNode.accessorKey, scope) + node.callNode.accessorKey, scope) if likely(x != nil): return x - # return varNode.varValue echo $invalidAccessorStorage # compileErrorWithArgs(invalidAccessorStorage) else: - return varNode.varValue - else: return varNode.varValue + return varNode.varMod + else: return varNode.varMod compileErrorWithArgs(undeclaredVariable, [node.callIdent], node.meta) of ntInfix: return ast.newBool(c.infixEvaluator(node.infixLeft, node.infixRight, node.infixOp, scope)) @@ -620,8 +618,8 @@ proc nodeEvaluator(c: Compiler, node: Node, scope: var seq[ScopeTable]): Node = result = node of ntCallFunction: return runCallable() - of ntForStmt: - echo node + # of ntForStmt: + # echo node # of ntDotExpr: # var lht: Node # case node.dotLeft.nt: @@ -640,7 +638,7 @@ newHandler "varAssignment": #[ Handles variable assignments. - Bro has a strict type system, meaning that a string var + Bro has a strong type system, meaning that a string var cannot be changed to `int`, `float`, `bool`, `size` (and so on) once initialized. @@ -649,10 +647,10 @@ newHandler "varAssignment": let scopeVar = c.scoped(node.asgnVarIdent, scope) if likely(scopeVar != nil): let - varType = scopeVar.varValue.getNodeType + varType = scopeVar.varMod.getNodeType varModifier = c.nodeEvaluator(node.asgnVal, scope) if likely(varType == varModifier.nt): - scopeVar.varValue = varModifier + scopeVar.varMod = varModifier return compileErrorWithArgs(fnMismatchParam, [scopeVar.varName, $varModifier.nt, $varType], node.asgnVal.meta) compileErrorWithArgs(undeclaredVariable, [node.asgnVarIdent], node.meta) @@ -670,7 +668,11 @@ newHandler "varDefinition": Note: Global variables are publicly visible (at least for now) ]# if likely(inScope(node.varName, scope) == false): - node.varValue = c.nodeEvaluator(node.varValue, scope) + # case node.varValue.nt: + # of ntMathStmt: + node.varMod = c.nodeEvaluator(node.varValue, scope) + # else: + # node.varMod = c.nodeEvaluator(node.varValue, scope) c.stack(node, scope) return compileErrorWithArgs(varRedefine, [node.varName], node.meta) @@ -691,12 +693,18 @@ newHandler "command": let meta = " (" & $(node.meta.line) & ":" & $(node.meta.pos) & ") " let valNode: Node = c.nodeEvaluator(node.cmdValue, scope) if likely(valNode != nil): + let valNodeStr = + case valNode.nt + of ntMathStmt: + valNode.mathResult + else: + valNode # echo valNode.toString stdout.styledWriteLine( fgGreen, "Debug", fgDefault, meta, fgMagenta, getTypeInfo(valNode), - fgDefault, "\n" & valNode.toString + fgDefault, "\n" & valNodeStr.toString ) of cmdAssert: if c.infixEvaluator(node.cmdValue.infixLeft, node.cmdValue.infixRight, @@ -743,11 +751,11 @@ newHandler "forBlock": case itemsNode.nt of ntArray: let len = itemsNode.arrayItems.len - for item in 0 .. itemsNode.arrayItems.high: + for item in itemsNode.arrayItems: var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] + forScope[node.forItem[0].varName].varMod = item add scope, forScope - forScope[node.forItem[0].varName].varValue = itemsNode.arrayItems[item] for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) scope.delete(scope.high) # out of scope @@ -758,9 +766,9 @@ newHandler "forBlock": for k, v in itemsNode.pairsVal: var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] - forScope[node.forItem[0].varName].varValue = ast.newString(k) + forScope[node.forItem[0].varName].varMod = ast.newString(k) forScope[node.forItem[1].varName] = node.forItem[1] - forScope[node.forItem[1].varName].varValue = v + forScope[node.forItem[1].varName].varMod = v add scope, forScope for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) @@ -770,7 +778,7 @@ newHandler "forBlock": for k in keys(itemsNode.pairsVal): var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] - forScope[node.forItem[0].varName].varvalue = ast.newString(k) + forScope[node.forItem[0].varName].varMod = ast.newString(k) add scope, forScope for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) @@ -778,11 +786,16 @@ newHandler "forBlock": of ntStream: case itemsNode.streamContent.kind of JArray: + if unlikely(node.forItem[1] != nil): + compileErrorWithArgs(forInvalidIteration) let len = node.forBody.stmtList.len for item in items(itemsNode.streamContent): var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] - forScope[node.forItem[0].varName].varValue = newStream item + forScope[node.forItem[0].varName].varMod = + case item.kind + of JArray, JObject: newStream(item) + else: item.toNode add scope, forScope for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) @@ -794,9 +807,12 @@ newHandler "forBlock": for k, v in pairs(itemsNode.streamContent): var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] - forScope[node.forItem[0].varName].varValue = ast.newString(k) + forScope[node.forItem[0].varName].varMod = ast.newString(k) forScope[node.forItem[1].varName] = node.forItem[1] - forScope[node.forItem[1].varName].varValue = ast.newStream(v) + forScope[node.forItem[1].varName].varMod = + case v.kind + of JArray, JObject: newStream(v) + else: v.toNode add scope, forScope for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) @@ -806,16 +822,14 @@ newHandler "forBlock": for k in keys(itemsNode.streamContent): var forScope = ScopeTable() forScope[node.forItem[0].varName] = node.forItem[0] - forScope[node.forItem[0].varName].varValue = ast.newString(k) + forScope[node.forItem[0].varName].varMod = ast.newString(k) add scope, forScope for innerNode in node.forBody.stmtList: c.handleInnerNode(innerNode, parent, scope, len, ix) scope.delete(scope.high) else: compileErrorWithArgs(forInvalidIteration, node.meta) else: compileErrorWithArgs(forInvalidIterationGot, [$(itemsNode.nt)], node.meta) - else: - echo node - echo "invalid iteration" + else: compileErrorWithArgs(forInvalidIterationGot, ["null"], node.meta) newHandler "importModule": #[ @@ -893,8 +907,8 @@ proc handleInnerNode(c: Compiler, node, parent: Node, if unlikely(node.pseudo.len > 0): for k, psNode in node.pseudo: add c.deferred, c.getSelectorGroup(psNode, scope, node) - of ntVariable: c.varDefinition(node, scope, parent) - of ntAssign: c.varAssignment(node, scope, parent) + of ntVariable: c.varDefinition(node, scope, parent) + of ntAssign: c.varAssignment(node, scope, parent) of ntCallFunction: c.fnCallVoid(node, scope) of ntFunction: c.fnDefinition(node, scope) of ntCommand: c.command(node, scope) @@ -926,9 +940,9 @@ proc getSelectorGroup(c: Compiler, node: Node, # .my, .second, .selector add result, "," & node.extendBy.join(", ") for concatVar in node.identConcat: - var varValue = c.nodeEvaluator(concatVar, scope) - if likely(varValue != nil): - add result, varValue.toString + var varMod = c.nodeEvaluator(concatVar, scope) + if likely(varMod != nil): + add result, varMod.toString else: break add result, c.strCL # { for pName in node.properties.keys: diff --git a/src/bropkg/engine/handlers/pAssignment.nim b/src/bropkg/engine/handlers/pAssignment.nim index 3d0d48e..c50c652 100644 --- a/src/bropkg/engine/handlers/pAssignment.nim +++ b/src/bropkg/engine/handlers/pAssignment.nim @@ -77,7 +77,7 @@ proc parseAssignment(p: var Parser, ident: TokenTuple, varTypeDecl: TokenKind): if likely(varDef != nil): let varValue = p.getPrefixOrInfix() if likely(varValue != nil): - varDef.varType = varValue.getNodeType + # varDef.varType = varValue.getNodeType varDef.varValue = varValue return varDef let varValue = p.getPrefixOrInfix() diff --git a/src/bropkg/engine/stdlib.nim b/src/bropkg/engine/stdlib.nim index 021924d..8b9c4e2 100644 --- a/src/bropkg/engine/stdlib.nim +++ b/src/bropkg/engine/stdlib.nim @@ -91,7 +91,7 @@ macro initStdlib() = if not isAbsolute(args[0].value.sVal): absolutePath(args[0].value.sVal) else: args[0].value.sVal - let str = readFile(args[0].value.sVal) + let str = readFile(filepath) let ext = filepath.splitFile.ext if ext == ".json": return ast.newStream(str.fromJson(JsonNode)) diff --git a/tests/stylesheets/basic.css b/tests/stylesheets/basic.css new file mode 100644 index 0000000..50e137f --- /dev/null +++ b/tests/stylesheets/basic.css @@ -0,0 +1,16 @@ +.btn { + background-color: #FFFFFF; + border-color: #DBDBDB; + border-width: 1px; + color: #363636; + cursor: pointer; + justify-content: center; + padding: 10px 14px; + text-align: center; + white-space: nowrap +} +.btn .is-black { + background-color: #0A0A0A; + border-color: transparent; + color: #FFFFFF +} diff --git a/tests/stylesheets/for.bass b/tests/stylesheets/for.bass index 2c1dc5d..70c78c0 100644 --- a/tests/stylesheets/for.bass +++ b/tests/stylesheets/for.bass @@ -1,5 +1,8 @@ -var colors = [blue, yellow, pink, green] +import std/colors +var someArray = ["red", "green", "blue"] +for $str in $someArray: + var x = parseColor($str) + .btn-{$str} + background-color: $x -for $color in $colors: - .btn-{$color} - color: $color +assert parseColor($someArray[0]) == toHex(red) diff --git a/tests/stylesheets/forjson.bass b/tests/stylesheets/forjson.bass deleted file mode 100644 index 8e91b4a..0000000 --- a/tests/stylesheets/forjson.bass +++ /dev/null @@ -1,5 +0,0 @@ -const config = @json "sample.json" - -for $color in $config["colors"]: - .btn-{$color} - color: $color diff --git a/tests/stylesheets/invalid.bass b/tests/stylesheets/invalid.bass index 3dc0e81..0ee8c9c 100644 --- a/tests/stylesheets/invalid.bass +++ b/tests/stylesheets/invalid.bass @@ -1,2 +1 @@ -.element - fontsize: 12px \ No newline at end of file +echo $x \ No newline at end of file diff --git a/tests/stylesheets/json.bass b/tests/stylesheets/json.bass new file mode 100644 index 0000000..54eb3a9 --- /dev/null +++ b/tests/stylesheets/json.bass @@ -0,0 +1,10 @@ +import std/colors + +var stream = json("./tests/stylesheets/sample.json") + +for $str in $stream: + var x = parseColor($str) + .btn-{$str} + background-color: $x + +assert parseColor($stream[0]) == toHex(red) diff --git a/tests/stylesheets/sample.json b/tests/stylesheets/sample.json index 6a16aa2..6f33aa6 100644 --- a/tests/stylesheets/sample.json +++ b/tests/stylesheets/sample.json @@ -1,3 +1 @@ -{ - "colors": ["yellow", "blue", "pink"] -} \ No newline at end of file +["red", "green", "blue"] \ No newline at end of file diff --git a/tests/stylesheets/test_arrays.bass b/tests/stylesheets/test_arrays.bass index 8581546..7623b90 100644 --- a/tests/stylesheets/test_arrays.bass +++ b/tests/stylesheets/test_arrays.bass @@ -13,3 +13,4 @@ $x.shift() assert $x.contains("red") == false $x.shuffle() +echo $x \ No newline at end of file diff --git a/tests/stylesheets/test_colors.bass b/tests/stylesheets/test_colors.bass index 1158f1e..eea1f69 100644 --- a/tests/stylesheets/test_colors.bass +++ b/tests/stylesheets/test_colors.bass @@ -1,9 +1,9 @@ import std/colors -var strColors = json("sample.json") +var strColors = json("./tests/stylesheets/sample.json") echo $strColors -assert parseColor($strColors["colors"][1]) == blue +assert parseColor($strColors[1]) == green assert toHex(white) == #FFFFFF assert rgb(255,255,255) == white @@ -12,4 +12,15 @@ echo lighten($bluez, 20%) echo darken($bluez, 20%) echo saturate($bluez, 100%) -echo desaturate($bluez, 100%) \ No newline at end of file +echo desaturate($bluez, 100%) + +const stream = json("./tests/stylesheets/colors.json") +for $k, $v in $stream: + .bg-{$k} + background: parseColor($v) + assert parseColor($k) == parseColor($v) + +// parse some colors +assert parseColor($stream["aliceblue"]) == toHex(aliceblue) +assert parseColor($stream["coral"]) == #ff7f50 +assert parseColor($stream["gainsboro"]) == #dcdcdc \ No newline at end of file diff --git a/tests/stylesheets/test_math.bass b/tests/stylesheets/test_math.bass index 229a569..1f78e51 100644 --- a/tests/stylesheets/test_math.bass +++ b/tests/stylesheets/test_math.bass @@ -20,7 +20,7 @@ assert pow(100.0, 1.5) == 1000.0 assert sqrt(4.0) == 2.0 assert sqrt(1.44) == 1.2 -echo cos(deg2rad(60.0)) +// echo cos(deg2rad(60.0)) assert sin(1.0) == 0.8414709848078965 // echo tan(1.0) @@ -28,9 +28,9 @@ assert sin(1.0) == 0.8414709848078965 // bug assertion fails, while `tan(1.0)` call works. must be a conflict between `tan` color and function name assert rad2deg(acos(0.0)) == 90.0 -echo rad2deg(asin(0.5)) // 30.0 bug, assertion fails +// echo rad2deg(asin(0.5)) // 30.0 bug, assertion fails assert atan(1.0) == 0.7853981633974483 assert rad2deg(atan(1.0)) == 45.0 assert rad2deg(atan2(1.0, 0.0)) == 90.0 -echo random(1000 * 100) \ No newline at end of file +// echo random(1000 * 100) \ No newline at end of file diff --git a/tests/stylesheets/test_os.bass b/tests/stylesheets/test_os.bass index a326960..469d629 100644 --- a/tests/stylesheets/test_os.bass +++ b/tests/stylesheets/test_os.bass @@ -1,17 +1,18 @@ import std/os +import std/strings -var x = getCurrentDir() -var somePath = join($x, "test_strings.bass") +const x = getCurrentDir() +var somePath = join($x, "/tests/stylesheets/test_strings.bass") assert dirExists($x) == true assert isAbsolute($x) == true assert fileExists($somePath) == true assert getFilename($somePath) == "test_strings.bass" -assert parentDir($somePath) == $x +assert parentDir($somePath) == join($x, "/tests/stylesheets") assert $somePath.fileExists() == true -assert $somePath.parentDir() == $x +assert $somePath.parentDir() == $x.join("/tests/stylesheets") // os iterators -for $icon in walkFiles("./icons/*.svg"): - echo getFilename($icon) \ No newline at end of file +for $icon in walkFiles("./tests/stylesheets/icons/*.svg"): + assert endsWith(getFilename($icon), ".svg") == true \ No newline at end of file diff --git a/tests/stylesheets/test_os.css b/tests/stylesheets/test_os.css deleted file mode 100644 index e69de29..0000000 diff --git a/tests/stylesheets/vars.bass b/tests/stylesheets/vars.bass index f25cd79..1f21c25 100644 --- a/tests/stylesheets/vars.bass +++ b/tests/stylesheets/vars.bass @@ -1,11 +1,12 @@ -var a = 5px -var b = 10px -var c = true -var d = 10 -var e = 1.0 +var fox = "Quick brown fox" +assert $fox == "Quick brown fox" -assert $a == 5px -assert "abc" == "abc" -assert 1 == 1 -assert true == true -assert 10 + 10 == 20 \ No newline at end of file +var maxw = 1024px +echo $maxw +assert $maxw == 1024px +echo $maxw == 1024px + +.container + max-width: $maxw + +echo 1 - 1 * 2 diff --git a/tests/test1.nim b/tests/test1.nim index a8b9ce2..6d77231 100644 --- a/tests/test1.nim +++ b/tests/test1.nim @@ -4,16 +4,18 @@ import bro proc getPath(append: string): string = result = getCurrentDir() / "tests/stylesheets" / append & ".bass" -var paths = ["basic", "invalid", "for", "forjson", "case", "unused", "vars"] +var paths = ["basic", "invalid", "for", "json", "case", "unused", "vars"] +var stdlib = ["colors", "strings"] test "can parse": - var p = parseStylesheet(paths[0].getPath()) + var p = parseStylesheet(paths[0].getPath().readFile, paths[0].getPath()) check p.hasErrors == false check p.hasWarnings == false test "can compile": let basic = paths[0].getPath() - var p = parseStylesheet(basic) + echo readFile(basic) + var p = parseStylesheet(readFile(basic), basic) check p.hasErrors == false check p.hasWarnings == false @@ -24,44 +26,77 @@ test "can compile": # minified c = newCompiler(p.getStylesheet, minify = true) check c.getCSS.count("\n") == 0 - check c.getCSS == ".btn{border:2px #FFF solid}" + check c.getCSS == ".btn{border:2px #FFFFFF solid}" -test "can catch errors": - var p = parseStylesheet(paths[1].getPath) - check p.hasErrors == true - check p.logger.errorLogs[0].getMessage == invalidProperty +# test "can catch errors": +# var p = parseStylesheet(readFile(paths[1].getPath), paths[1].getPath) +# check p.hasErrors == true +# check p.logger.errorLogs[0].getMessage == undeclaredVariable -test "can catch warnings": - var p = parseStylesheet(paths[5].getPath) - check p.hasErrors == false - check p.hasWarnings == true +# test "can catch warnings": +# var p = parseStylesheet(paths[5].getPath.readFile, paths[5].getPath) +# check p.hasErrors == false +# check p.hasWarnings == true test "var declarations": - var p = parseStylesheet(paths[6].getPath) + var p = parseStylesheet(paths[6].getPath.readFile, paths[6].getPath) check p.hasErrors == false var c = newCompiler(p.getStylesheet) echo c.getCSS -test "`for` blocks": - let path = paths[2].getPath() - var p = parseStylesheet(path) +test "loops": + var p = parseStylesheet(paths[2].getPath.readFile, paths[2].getPath()) check p.hasErrors == false check p.hasWarnings == false - let c = newCompiler(p.getStylesheet) + let c = newCompiler(p.getStylesheet, imports = p.getStylesheets) echo c.getCSS -test "`for` blocks w/ @json": - let path = paths[3].getPath() - var p = parseStylesheet(path) +test "loops json": + var p = parseStylesheet(paths[3].getPath.readFile, paths[3].getPath()) check p.hasErrors == false check p.hasWarnings == false - let c = newCompiler(p.getStylesheet) + let c = newCompiler(p.getStylesheet, imports = p.getStylesheets) echo c.getCSS -test "`case` blocks": - let path = paths[4].getPath() - var p = parseStylesheet(path) +test "std/colors": + var src = getPath("test_colors") + var p = parseStylesheet(src.readFile, src) check p.hasErrors == false check p.hasWarnings == false - let c = newCompiler(p.getStylesheet) - echo c.getCSS + var c = newCompiler(p.getStylesheet, imports = p.getStylesheets) + +test "std/arrays": + var src = getPath("test_arrays") + var p = parseStylesheet(src.readFile, src) + check p.hasErrors == false + check p.hasWarnings == false + var c = newCompiler(p.getStylesheet, imports = p.getStylesheets) + +test "std/os": + var src = getPath("test_os") + var p = parseStylesheet(src.readFile, src) + check p.hasErrors == false + check p.hasWarnings == false + var c = newCompiler(p.getStylesheet, imports = p.getStylesheets) + +test "std/string": + var src = getPath("test_strings") + var p = parseStylesheet(src.readFile, src) + check p.hasErrors == false + check p.hasWarnings == false + var c = newCompiler(p.getStylesheet, imports = p.getStylesheets) + +test "std/math": + var src = getPath("test_math") + var p = parseStylesheet(src.readFile, src) + check p.hasErrors == false + check p.hasWarnings == false + var c = newCompiler(p.getStylesheet, imports = p.getStylesheets) + +# test "`case` blocks": +# let path = paths[4].getPath() +# var p = parseStylesheet(path.readFile, path) +# check p.hasErrors == false +# check p.hasWarnings == false +# let c = newCompiler(p.getStylesheet) +# echo c.getCSS