I’m learning how to write Lezer grammars. I need help understanding how the Lezer rule for a string works:
String {
'"' (![\\\n"] | "\\" _)* '"'? |
"'" (![\\\n'] | "\\" _)* "'"?
}
- What does the
_
before the right parentheses do? Match a single ASCII character? - Why is the optional repetition operator
?
used? Isn’t the closing quotation mark required to end a string?