custom integer literals (#17489)
* user defined integer literals; refs #17020 * updated renderer.nim * use mlexerutils helper * imported all test cases from https://github.com/nim-lang/Nim/pull/17020 * final grammar updated
This commit is contained in:
parent
7366a3da37
commit
5f5a92379f
12 changed files with 409 additions and 218 deletions
|
|
@ -6,13 +6,7 @@ discard """
|
|||
|
||||
import std/[macros, strutils]
|
||||
|
||||
macro lispReprStr*(a: untyped): untyped = newLit(a.lispRepr)
|
||||
|
||||
macro assertAST*(expected: string, struct: untyped): untyped =
|
||||
var ast = newLit(struct.treeRepr)
|
||||
result = quote do:
|
||||
if `ast` != `expected`:
|
||||
doAssert false, "\nGot:\n" & `ast`.indent(2) & "\nExpected:\n" & `expected`.indent(2)
|
||||
import mlexerutils
|
||||
|
||||
const one = 1
|
||||
const minusOne = `-`(one)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue