Named arguments in commands + many grammar fixes (#20994)
* Breaking parser changes, implement https://github.com/nim-lang/RFCs/issues/442 Types are separated from expressions and better reflected in the grammar. * add test * more accurate grammar * fix keyword typedescs * accept expressions in proc argument lists * CI "fixes" * fixes * allow full ref expressions again, adapt old tests * cleanup, fix some tests * improve grammar, try and revert semtypes change * restrict sigil binding to identOrLiteral * fix, should have caught this immediately * add changelog entry, fix double not nil bug * correct grammar * change section * fix * real fix hopefully * fix test * support LL(1) for tuples * make grammar.txt too
This commit is contained in:
parent
1564ae650f
commit
4ca2dcb404
1 changed files with 283 additions and 147 deletions
25
tests/parser/ttypeexprs.nim
Normal file
25
tests/parser/ttypeexprs.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
proc foo[T: ptr int | ptr string](x: T) = discard
|
||||
var x = "abc"
|
||||
foo(addr x)
|
||||
|
||||
let n = 3'u32
|
||||
type Double = (
|
||||
when n.sizeof == 4: uint64
|
||||
elif n.sizeof == 2: uint32
|
||||
else: uint16
|
||||
)
|
||||
|
||||
type
|
||||
A = (ref | ptr | pointer)
|
||||
B = pointer | ptr | ref
|
||||
C = ref | ptr | pointer
|
||||
|
||||
template `+`(a, b): untyped = (b, a)
|
||||
template `*`(a, b): untyped = (a, b)
|
||||
|
||||
doAssert (ref int + ref float * ref string + ref bool) is
|
||||
(ref bool, ((ref float, ref string), ref int))
|
||||
type X = ref int + ref float * ref string + ref bool
|
||||
doAssert X is (ref bool, ((ref float, ref string), ref int))
|
||||
|
||||
type SomePointer = proc | ref | ptr | pointer
|
||||
Loading…
Reference in a new issue