-
On page http://www.unicode.org/faq/blocks_ranges.html: So how do I express that in Ohm? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
(Caveat: I'm bumping up against the limits of my Unicode knowledge here, but I wanted to respond quickly so I can understand a bit more about your use case before I do some more reading.) It depends a bit on what exactly you're trying to do. You can embed those characters directly in a terminal expression, and that should work. E.g.: ohm.grammar('G { start = "😀" }').match('😀').succeeded() // true You can also encode it as a surrogate pair (same as in ES5 and JSON). E.g., assume you have the following grammar in
..then this will work:
What we don't yet support properly is ranges involving such code points. E.g., the following is not possible (but should be):
I've opened up #355 for that. If you can give me some more details about exactly what you need, we can see if any of these options would cover your use case, or if there's still something we're missing. |
Beta Was this translation helpful? Give feedback.
-
What do you mean by this? There is no way to disable built-in rules — but you can choose to not use them. The If you want to disable implicit space skipping entirely, you can use only lexical rules (i.e., rules that begin with a lowercase letter) in your grammar as you've done here. However, typically what you'd want to do is redefine the
You can use negative lookahead for this purpose. See Patterns & Pitfalls > Delimited strings for an example.
Can you attach the error that you're encountering and I can try to help you debug it? |
Beta Was this translation helpful? Give feedback.
(Caveat: I'm bumping up against the limits of my Unicode knowledge here, but I wanted to respond quickly so I can understand a bit more about your use case before I do some more reading.)
It depends a bit on what exactly you're trying to do. You can embed those characters directly in a terminal expression, and that should work. E.g.:
You can also encode it as a surrogate pair (same as in ES5 and JSON). E.g., assume you have the following grammar in
g.ohm
:..then this will work:
What we don't yet support properly is r…