diff options
author | cooldome <cdome@bk.ru> | 2020-01-16 13:16:17 +0000 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-01-16 14:16:17 +0100 |
commit | 5ef049467727cd2a0cce0c217e6223366842fb6c (patch) | |
tree | 778216c276e7c07f017b148abb1a4ab9f69d99e5 /tests | |
parent | 352232e62dea88191339af3aaa943cb93fb4db02 (diff) | |
download | Nim-5ef049467727cd2a0cce0c217e6223366842fb6c.tar.gz |
Working towards arc codegen (#13153)
fixes #13029
Diffstat (limited to 'tests')
-rw-r--r-- | tests/destructor/tarc3.nim | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/destructor/tarc3.nim b/tests/destructor/tarc3.nim new file mode 100644 index 000000000..1ca4c70e9 --- /dev/null +++ b/tests/destructor/tarc3.nim @@ -0,0 +1,57 @@ + +discard """ + cmd: '''nim c --gc:arc $file''' +""" + +when defined(cpp): + {.passC: "-std=gnu++17".} + +type + TokenKind* = enum + tkColon + tkComma + tkString + tkNumber + tkInt64 + tkIdent + + Token* = object + case kind*: TokenKind + of tkString: strVal*: string + of tkNumber: numVal*: float + of tkInt64: int64Val*: int64 + of tkIdent: ident*: string + else: discard + pos*: Natural + + BaseLexer* = object of RootObj + input*: string + pos*: Natural + + Json5Lexer* = object of BaseLexer + + JsonLexer* = object of BaseLexer + allowComments*: bool + allowSpecialFloats*: bool + + Lexer* = Json5Lexer | JsonLexer + + Parser[T: Lexer] = object + l: T + tok: Token + allowTrailingComma: bool + allowIdentifierObjectKey: bool + +proc initJson5Lexer*(input: string): Json5Lexer = + result.input = input + +proc parseJson5*(input: string) = + var p = Parser[Json5Lexer]( + l: initJson5Lexer(input), + allowTrailingComma: true, + allowIdentifierObjectKey: true + ) + + +let x = "string" +parseJson5(x) \ No newline at end of file |