Macros
macro generateParser(c: char; k: openArray[char]; v: typed): untyped
-
Generates case statement for parsing characters to enum types.
Example of statement generated for DNA: case c
- of 'A':
- result = DNA(0)
- of 'G':
- result = DNA(1)
...
- else:
- raise newException(ValueError, "Invalid " & $DNA & "character: '" & c)