1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
|
discard """
nimout: '''
StmtList
TypeSection
TypeDef
Ident "BarePtr"
Empty
PtrTy
TypeDef
Ident "GenericPtr"
Empty
PtrTy
Bracket
Ident "int"
TypeDef
Ident "PrefixPtr"
Empty
PtrTy
Ident "int"
TypeDef
Ident "PtrTuple"
Empty
PtrTy
TupleConstr
Ident "int"
Ident "string"
TypeDef
Ident "BareRef"
Empty
RefTy
TypeDef
Ident "GenericRef"
Empty
RefTy
Bracket
Ident "int"
TypeDef
Ident "RefTupleCl"
Empty
RefTy
TupleTy
TypeDef
Ident "RefTupleType"
Empty
RefTy
TupleConstr
Ident "int"
Ident "string"
TypeDef
Ident "RefTupleVars"
Empty
RefTy
TupleConstr
Ident "a"
Ident "b"
TypeDef
Ident "BareStatic"
Empty
Ident "static"
TypeDef
Ident "GenericStatic"
Empty
BracketExpr
Ident "static"
Ident "int"
TypeDef
Ident "PrefixStatic"
Empty
Command
Ident "static"
Ident "int"
TypeDef
Ident "StaticTupleCl"
Empty
Command
Ident "static"
TupleClassTy
TypeDef
Ident "StaticTuple"
Empty
Command
Ident "static"
TupleConstr
Ident "int"
Ident "string"
TypeDef
Ident "BareType"
Empty
Ident "type"
TypeDef
Ident "GenericType"
Empty
BracketExpr
Ident "type"
Ident "float"
TypeDef
Ident "TypeTupleGen"
Empty
BracketExpr
Ident "type"
TupleClassTy
TypeDef
Ident "TypeTupleCl"
Empty
Command
Ident "type"
TupleClassTy
TypeDef
Ident "TypeInstance"
Empty
Command
Ident "type"
BracketExpr
Ident "Foo"
RefTy
TypeDef
Ident "bareTypeDesc"
Empty
Ident "typedesc"
TypeDef
Ident "TypeOfVar"
Empty
Call
Ident "type"
Ident "a"
TypeDef
Ident "TypeOfVarAlt"
Empty
Command
Ident "type"
Par
Ident "a"
TypeDef
Ident "TypeOfTuple1"
Empty
Call
Ident "type"
Ident "a"
TypeDef
Ident "TypeOfTuple2"
Empty
Call
Ident "type"
Ident "a"
Ident "b"
TypeDef
Ident "TypeOfTuple1A"
Empty
Command
Ident "type"
TupleConstr
Ident "a"
TypeDef
Ident "TypeOfTuple2A"
Empty
Command
Ident "type"
TupleConstr
Ident "a"
Ident "b"
TypeDef
Ident "TypeTuple"
Empty
Command
Ident "type"
TupleConstr
Ident "int"
Ident "string"
TypeDef
Ident "GenericTypedesc"
Empty
BracketExpr
Ident "typedesc"
Ident "int"
TypeDef
Ident "T"
Empty
Ident "type"
ProcDef
Ident "foo"
Empty
Empty
FormalParams
Ident "type"
IdentDefs
Ident "bareType"
Ident "type"
Empty
IdentDefs
Ident "genType"
BracketExpr
Ident "type"
Ident "int"
Empty
IdentDefs
Ident "typeInt"
Command
Ident "type"
Ident "int"
Empty
IdentDefs
Ident "typeIntAlt"
Call
Ident "type"
Ident "int"
Empty
IdentDefs
Ident "typeOfVar"
Call
Ident "type"
Ident "a"
Empty
IdentDefs
Ident "typeDotType"
DotExpr
Ident "foo"
Ident "type"
Empty
IdentDefs
Ident "typeTupleCl"
Command
Ident "type"
TupleClassTy
Empty
IdentDefs
Ident "bareStatic"
Ident "static"
Empty
IdentDefs
Ident "genStatic"
BracketExpr
Ident "static"
Ident "int"
Empty
IdentDefs
Ident "staticInt"
Command
Ident "static"
Ident "int"
Empty
IdentDefs
Ident "staticVal1"
Command
Ident "static"
IntLit 10
Empty
IdentDefs
Ident "staticVal2"
Call
Ident "static"
StrLit "str"
Empty
IdentDefs
Ident "staticVal3"
Command
Ident "static"
StrLit "str"
Empty
IdentDefs
Ident "staticVal4"
CallStrLit
Ident "static"
RStrLit "str"
Empty
IdentDefs
Ident "staticDotVal"
DotExpr
IntLit 10
Ident "static"
Empty
IdentDefs
Ident "bareRef"
RefTy
Empty
IdentDefs
Ident "refTuple1"
RefTy
Par
Ident "int"
Empty
IdentDefs
Ident "refTuple1A"
RefTy
TupleConstr
Ident "int"
Empty
IdentDefs
Ident "refTuple2"
RefTy
TupleConstr
Ident "int"
Ident "string"
Empty
IdentDefs
Ident "genRef"
RefTy
Bracket
Ident "int"
Empty
IdentDefs
Ident "refInt"
RefTy
Ident "int"
Empty
IdentDefs
Ident "refCall"
RefTy
Par
Ident "a"
Empty
IdentDefs
Ident "macroCall1"
Command
Ident "foo"
Ident "bar"
Empty
IdentDefs
Ident "macroCall2"
Call
Ident "foo"
Ident "bar"
Empty
IdentDefs
Ident "macroCall3"
Call
DotExpr
Ident "foo"
Ident "bar"
Ident "baz"
Empty
IdentDefs
Ident "macroCall4"
Call
BracketExpr
Ident "foo"
Ident "bar"
Ident "baz"
Empty
IdentDefs
Ident "macroCall5"
Command
Ident "foo"
Command
Ident "bar"
Ident "baz"
IntLit 10
Empty
Empty
StmtList
Asgn
Ident "staticTen"
Command
Ident "static"
IntLit 10
Asgn
Ident "staticA"
Call
Ident "static"
Ident "a"
Asgn
Ident "staticCall"
Command
Ident "static"
Call
Ident "foo"
IntLit 1
Asgn
Ident "staticStrCall"
Command
Ident "static"
CallStrLit
Ident "foo"
RStrLit "x"
Asgn
Ident "staticChainCall"
Command
Ident "static"
Command
Ident "foo"
Ident "bar"
Asgn
Ident "typeTen"
Command
Ident "type"
IntLit 10
Asgn
Ident "typeA"
Call
Ident "type"
Ident "a"
Asgn
Ident "typeCall"
Command
Ident "type"
Call
Ident "foo"
IntLit 1
Asgn
Ident "typeStrCall"
Command
Ident "type"
CallStrLit
Ident "foo"
RStrLit "x"
Asgn
Ident "typeChainCall"
Command
Ident "type"
Command
Ident "foo"
Ident "bar"
Asgn
Ident "normalChainCall"
Command
Ident "foo"
Command
Ident "bar"
Ident "baz"
Asgn
Ident "normalTupleCall2"
Call
Ident "foo"
Ident "a"
Ident "b"
StaticStmt
StmtList
Ident "singleStaticStmt"
StaticStmt
StmtList
Ident "staticStmtList1"
Ident "staticStmtList2"
'''
"""
import macros
dumpTree:
type
BarePtr = ptr
GenericPtr = ptr[int]
PrefixPtr = ptr int
PtrTuple = ptr (int, string)
BareRef = ref
GenericRef = ref[int]
RefTupleCl = ref tuple
RefTupleType = ref (int, string)
RefTupleVars = ref (a, b)
BareStatic = static # Used to be Error: invalid indentation
GenericStatic = static[int]
PrefixStatic = static int
StaticTupleCl = static tuple
StaticTuple = static (int, string)
BareType = type
GenericType = type[float]
TypeTupleGen = type[tuple]
TypeTupleCl = type tuple # Used to be Error: invalid indentation
TypeInstance = type Foo[ref]
bareTypeDesc = typedesc
TypeOfVar = type(a)
TypeOfVarAlt = type (a) # Used to be Error: invalid indentation
TypeOfTuple1 = type(a,)
TypeOfTuple2 = type(a,b)
TypeOfTuple1A = type (a,) # Used to be Error: invalid indentation
TypeOfTuple2A = type (a,b) # Used to be Error: invalid indentation
TypeTuple = type (int, string) # Used to be Error: invalid indentation
GenericTypedesc = typedesc[int]
T = type
proc foo(
bareType : type,
genType : type[int],
typeInt : type int,
typeIntAlt : type(int),
typeOfVar : type(a),
typeDotType : foo.type,
typeTupleCl : type tuple, # Used to be Error: ')' expected
bareStatic : static, # Used to be Error: expression expected, but found ','
genStatic : static[int],
staticInt : static int,
staticVal1 : static 10,
staticVal2 : static("str"),
staticVal3 : static "str",
staticVal4 : static"str", # Used to be Error: expression expected, but found 'str'
staticDotVal : 10.static,
bareRef : ref,
refTuple1 : ref (int),
refTuple1A : ref (int,),
refTuple2 : ref (int,string),
genRef : ref[int],
refInt : ref int,
refCall : ref(a),
macroCall1 : foo bar,
macroCall2 : foo(bar),
macroCall3 : foo.bar(baz),
macroCall4 : foo[bar](baz),
macroCall5 : foo bar baz = 10
): type =
staticTen = static 10
staticA = static(a)
# staticAspace = static (a) # With newTypedesc: Error: invalid indentation
# staticAtuple = static (a,) # With newTypedesc: Error: invalid indentation
# staticTuple = static (a,b) # With newTypedesc: Error: invalid indentation
# staticTypeTuple = static (int,string) # With newTypedesc: Error: invalid indentation
staticCall = static foo(1)
staticStrCall = static foo"x"
staticChainCall = static foo bar
typeTen = type 10
typeA = type(a)
# typeAspace = type (a) # Error: invalid indentation
# typeAtuple = type (a,) # Error: invalid indentation
# typeTuple = type (a,b) # Error: invalid indentation
# typeTypeTuple = type (int,string) # Error: invalid indentation
typeCall = type foo(1)
typeStrCall = type foo"x"
typeChainCall = type foo bar
normalChainCall = foo bar baz
# normalTupleCall1 = foo(a,) # Error: invalid indentation
normalTupleCall2 = foo(a,b)
# normalTupleCall3 = foo (a,b) # Error: invalid indentation
static: singleStaticStmt
static:
staticStmtList1
staticStmtList2
|