fix: quotes around char and str errors, added errors for assign and arrayIndex

This commit is contained in:
Barf-Vader
2025-02-06 23:52:13 +00:00
committed by Guy C
parent f24f8c87d8
commit b3ecae5dbb
2 changed files with 12 additions and 10 deletions

View File

@@ -31,7 +31,9 @@ val errConfig = new ErrorConfig {
"fst" -> Label("pair extraction"),
"snd" -> Label("pair extraction"),
"false" -> Label("boolean literal"),
"true" -> Label("boolean literal")
"true" -> Label("boolean literal"),
"=" -> Label("assignment"),
"[" -> Label("array index")
)
}
object lexer {
@@ -83,8 +85,8 @@ object lexer {
val errTokens = Seq(
lexer.nonlexeme.names.identifier.map(v => s"identifier $v"),
lexer.nonlexeme.integer.decimal32[Int].map(n => s"integer $n"),
lexer.nonlexeme.character.ascii.map(c => s"character literal $c"),
lexer.nonlexeme.string.ascii.map(s => s"string literal $s"),
lexer.nonlexeme.character.ascii.map(c => s"character literal \'$c\'"),
lexer.nonlexeme.string.ascii.map(s => s"string literal \"$s\""),
character.whitespace.map(_ => "")
) ++ desc.symbolDesc.hardKeywords.map { k =>
lexer.nonlexeme.symbol(k).as(s"keyword $k")