merge new changes from master into semantic errors #10

Merged
al4423 merged 19 commits from master into semantic-error-messages 2025-02-06 23:39:05 +00:00
7 changed files with 223 additions and 481 deletions
Showing only changes of commit bd779931b6 - Show all commits

View File

@@ -18,9 +18,9 @@ object parser {
import lexer.{ident, integer, charLit, stringLit, negateCheck, errTokens}
import ast._
//error extensions
// error extensions
extension [A](p: Parsley[A]) {
//combines label and explain together into one function call
// combines label and explain together into one function call
def labelAndExplain(label: String, explanation: String): Parsley[A] = {
p.label(label).explain(explanation)
}
@@ -30,7 +30,8 @@ object parser {
labelWithType(t).explain(
"a valid expression can start with: null, literals, identifiers, unary operators, or parentheses. " +
"Expressions can also contain array indexing and binary operators. " +
"Pair extraction is not allowed in expressions, only in assignments.")
"Pair extraction is not allowed in expressions, only in assignments."
)
case _ => labelWithType(t)
}
}