I saw two approaches to creating parsers in Scala.
Firstly, it is an extension from RegexParsers and the definition of your won lexical patterns. The problem I see in this is that I really don't understand how this relates to the uncertainty of the keywords. For example, if my keyword matches the same pattern as idents, it treats the keywords as idents.
To meet this, I saw posts like this that show how to use StandardTokenParsers to specify keywords. But then I don’t understand how to specify regex patterns! Yes, StandardTokenParsers comes with an "identifier", but it does not come with the others I need (complex representations of floating point numbers, specific string literals and escaping rules, etc.).
How do you get both the ability to specify keywords and the ability to specify token templates with regular expressions?
source
share