You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful in certain situations to specify a numeric amount of repetitions. For example, in JavaScript regexes I could do:
/[0-9A-F]{4}/i
Ohm could have similar convenience benefits, especially if a user might want a rule to require a specified amount of "things" without having to copy and paste said "thing" for however many repetitions they want.
The text was updated successfully, but these errors were encountered:
@MuhammedZakir Can you add some more details about your use case to #215?
Before going further, I would like to mention that I didn't "need" numeric quanitifer as much as I thought I would.
I was trying to write a grammar for Markdown parser according to CommonMark spec [1]. As you know, in Markdown, indenteding a line by 4+ spaces [2] will make it a code block. For this use case, I use lookahead for a string of 4 spaces. This works for me and I personally didn't need this feature (at least for now).
However, I can see this will be slightly ugly if, for example, trying to match a rule or a bigger string x number of times. This will also be problematic if there are a bunch of rules where we need an exact number of matches. Dong the way I am doing right now will make the grammar too verbose (which make it harder to read) and error-prone (when modifying).
Re: about using semantic action: I gave it some thought, but didn't like it (for my case). Because if I do it like that, I will have to parse each block again if the indentation is less than 4 spaces. This is probably not a problem per se, but I find this unsatifactory.
It would be useful in certain situations to specify a numeric amount of repetitions. For example, in JavaScript regexes I could do:
Ohm could have similar convenience benefits, especially if a user might want a rule to require a specified amount of "things" without having to copy and paste said "thing" for however many repetitions they want.
The text was updated successfully, but these errors were encountered: