more on arc codegen (#13178)
* arc codegen for union type * add more tests * fix offsetof * fix tsizeof test * fix style
This commit is contained in:
parent
bc14453f69
commit
416b4c3612
4 changed files with 81 additions and 26 deletions
|
|
@ -4,7 +4,7 @@ discard """
|
|||
"""
|
||||
|
||||
when defined(cpp):
|
||||
{.passC: "-std=gnu++17".}
|
||||
{.passC: "-std=gnu++2a".}
|
||||
|
||||
type
|
||||
TokenKind* = enum
|
||||
|
|
@ -24,6 +24,23 @@ type
|
|||
else: discard
|
||||
pos*: Natural
|
||||
|
||||
|
||||
Token2* = object
|
||||
case kind*: TokenKind
|
||||
of tkString: strVal*: string
|
||||
of tkNumber: numVal*: float
|
||||
of tkInt64, tkColon..tkComma:
|
||||
str1*: array[2, string]
|
||||
float: float
|
||||
else: discard
|
||||
pos*: Natural
|
||||
|
||||
Token3* = object
|
||||
case kind*: TokenKind
|
||||
of tkNumber: numVal*: float
|
||||
of tkInt64, tkComma..tkString: ff: seq[float]
|
||||
else: str1*: string
|
||||
|
||||
BaseLexer* = object of RootObj
|
||||
input*: string
|
||||
pos*: Natural
|
||||
|
|
@ -39,6 +56,8 @@ type
|
|||
Parser[T: Lexer] = object
|
||||
l: T
|
||||
tok: Token
|
||||
tok2: Token2
|
||||
tok3: Token3
|
||||
allowTrailingComma: bool
|
||||
allowIdentifierObjectKey: bool
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue