fix: disallow exponents, export identifier from lexer

This commit is contained in:
Gleb Koval 2025-02-01 02:13:55 +00:00
parent e384265189
commit 70aa58b879
Signed by: cyclane
GPG Key ID: 15E168A8B332382C

View File

@ -25,7 +25,6 @@ object lexer {
spaceDesc = SpaceDesc.plain.copy(
lineCommentStart = "#"
),
// TODO - See BNF 1.1 and Table 5 2.3.6
textDesc = TextDesc.plain.copy(
graphicCharacter =
Basic(c => c >= ' ' && c != '\\' && c != '\'' && c != '"'),
@ -40,21 +39,17 @@ object lexer {
"r" -> '\r'
)
)
),
numericDesc = NumericDesc.plain.copy(
decimalExponentDesc = ExponentDesc.NoExponents
)
)
private val lexer = Lexer(desc)
// Enforce 32-bit signed integer range - see 1.5
// TODO By default leadingZerosAllowed = true in NumericDesc - Wacc doesnt specify (I think) but should reach consensus
val ident = lexer.lexeme.names.identifier
val integer = lexer.lexeme.integer.decimal32[Int]
// TODO Check if textDesc can handle this
val charLit = lexer.lexeme.character.ascii
// TODO Check if textDesc can handle this
val stringLit = lexer.lexeme.string.ascii
val implicits = lexer.lexeme.symbol.implicits
def fully[A](p: Parsley[A]): Parsley[A] = lexer.fully(p)