Created
June 13, 2015 13:45
-
-
Save taotetek/173cc40c372c8b43217b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import os, streams, parsexml, strutils, macros | |
macro readModelAndBuildAST(filename: string): stmt = | |
let | |
inputString = slurp(filename.strVal) | |
var s = newStringStream(inputString) | |
var x: XmlParser | |
open(x, s, filename) | |
next(x) | |
while true: | |
case x.kind | |
of xmlEof: break | |
of xmlElementOpen, xmlElementStart: | |
case x.elementName | |
of "constant": | |
x.next | |
echo x.attrKey | |
echo x.attrValue | |
x.next | |
echo x.attrKey | |
echo x.attrValue | |
else: discard | |
else: discard | |
next(x) |
This file contains hidden or 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
parse.nim(9, 9) Error: type mismatch: got (XmlParser, StringStream, NimNode) | |
but expected one of: | |
system.open(f: var File, filename: string, mode: FileMode, bufSize: int) | |
parsexml.open(my: var XmlParser, input: Stream, filename: string, options: set[XmlParseOption]) | |
system.open(f: var File, filehandle: FileHandle, mode: FileMo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment