mlexerutils.nim 316 B

123456789
  1. import macros
  2. macro lispReprStr*(a: untyped): untyped = newLit(a.lispRepr)
  3. macro assertAST*(expected: string, struct: untyped): untyped =
  4. var ast = newLit(struct.treeRepr)
  5. result = quote do:
  6. if `ast` != `expected`:
  7. doAssert false, "\nGot:\n" & `ast`.indent(2) & "\nExpected:\n" & `expected`.indent(2)