Created
May 13, 2015 10:21
-
-
Save bluenote10/3787977625e6bf63e6af to your computer and use it in GitHub Desktop.
MacroStringParseTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro stringParseTest(s: string): stmt = | |
let trueString = s.strVal | |
let ne = parseExpr(trueString) | |
let ns = parseStmt(trueString) | |
echo treeRepr(ne) | |
echo treeRepr(ns) | |
# looking good: | |
# Infix | |
# Ident !"+" | |
# Ident !"y" | |
# IntLit 1 | |
# | |
# But how to get the type of the parsed node here? (int in the example) | |
# even ns.getType yields Error: node has no type | |
# let t = ns.getType | |
# echo "Type is: ", t.repr | |
result = quote do: | |
echo "does nothing" | |
var y = 1 | |
stringParseTest("y+1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment