I am using Scala combinatorial parser by extending scala.util.parsing.combinator.syntactical.StandardTokenParser
. This class provides following methods
def ident : Parser[String]
for parsing identifiers and
def numericLit : Parser[String]
for parsing a number (decimal I suppose)
I am using scala.util.parsing.combinator.lexical.Scanners
from scala.util.parsing.combinator.lexical.StdLexical
for lexing.
My requirement is to parse a hexadecimal number (without the 0x
prefix) which can be of any length. Basically a grammar like: ([0-9]|[a-f])+
I tried integrating Regex parser but there are type issues there. Other ways to extend the definition of lexer delimiter and grammar rules lead to token not found!