zevv / npeg

PEGs for Nim, another take
MIT License
330 stars 22 forks source link

Enhancing parser flexibility: improving type parsing with the push template #67

Closed khchen closed 1 year ago

khchen commented 1 year ago

I have developed a lexer/parser, similar to the example "tests/lexparse.nim", that offers the ability to parse types beyond just strings.

Using the push template within the parser has proven to be incredibly useful for achieving this functionality. I made a modification to the codegne.nim file:

template push(`s`: string) {.used.}

I made the following change to expand its capabilities:

template push(`s`: string|`sType`) {.used.}

By implementing this modification, the parser now performs smoothly and accurately.

zevv commented 1 year ago

makes sense, I'll put this in, thank you.