beef331 / nimscripter

Quick and easy Nim <-> Nimscript interop
MIT License
149 stars 8 forks source link

add test for case objects #25

Closed elcritch closed 1 year ago

elcritch commented 1 year ago

Test for passing Peg's back from test script.

if vmNode.kind == nkNilLit: typeof(obj)(nil)
else:
  let name = fromVm(typeof(string), vmNode.sons[1].sons[1])
  let line = fromVm(typeof(int), vmNode.sons[2].sons[1])
  let col = fromVm(typeof(int), vmNode.sons[3].sons[1])
  let flags = fromVm(typeof(set[NonTerminalFlag]), vmNode.sons[4].sons[1])
  let rule = fromVm(typeof(Peg), vmNode.sons[5].sons[1])
  NonTerminal(name: name, line: line, col: col, flags: flags, rule: rule) [ExpandMacro]