fix: added error messages for functions missing type, and late function decls

This commit is contained in:
Barf-Vader
2025-02-07 01:35:16 +00:00
committed by Guy C
parent b3ecae5dbb
commit a65cc01815
2 changed files with 18 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ val errConfig = new ErrorConfig {
"false" -> Label("boolean literal"),
"true" -> Label("boolean literal"),
"=" -> Label("assignment"),
"[" -> Label("array index")
"[" -> Label("array index"),
)
}
object lexer {
@@ -85,9 +85,10 @@ 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.character.ascii).map(c => s"character literal \'$c\'"),
lexer.nonlexeme.string.ascii.map(s => s"string literal \"$s\""),
character.whitespace.map(_ => "")
// lexer.nonlexeme.symbol("()").as("function call, bruh use keyword 'call' to call functions"),
character.whitespace.map(_ => ""),
) ++ desc.symbolDesc.hardKeywords.map { k =>
lexer.nonlexeme.symbol(k).as(s"keyword $k")
}