nodejs / llparse

Generating parsers in LLVM IR
http://llparse.org
Other
584 stars 30 forks source link

adding code macros #41

Closed drom closed 3 years ago

drom commented 3 years ago

I noticed that you have set of handy and efficient macros to perform common scan operations here: https://github.com/nodejs/llparse/tree/master/src/implementation/c/code I need something similar to mulAdd but to parse 4-state, variable length numbers. Do you have and example of adding such macros?

drom commented 3 years ago

Here I am invoking mulAdd https://github.com/wavedrom/vcd/blob/master/bin/build.js#L242

but want to invoke my code: https://github.com/wavedrom/vcd/blob/master/vcd_spans.c#L143

indutny commented 3 years ago

You can invoke c-functions this way (with p.code.match(...) or p.code.value(...)). Would that help?

drom commented 3 years ago

yes, p.code.value(...) works!