Skip to content

Commit

Permalink
Added symbol punctuation fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Jan 29, 2024
1 parent 42c0f02 commit 40ed20d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ private [token] class ConcreteSymbol(nameDesc: NameDesc, symbolDesc: SymbolDesc,

override def apply(name: String): Parsley[Unit] = {
require(name.nonEmpty, "Symbols may not be empty strings")
lazy val compatLabel = err.labelSymbolPunctuation.get(name).map {
case None => parsley.token.errors.Hidden
case Some(l) => parsley.token.errors.Label(l)
}.getOrElse(NotConfigured)
if (symbolDesc.hardKeywords(name)) softKeyword(name)
else if (symbolDesc.hardOperators(name)) softOperator(name)
else err.labelSymbol.getOrElse(name, NotConfigured)(atomic(string(name)).void)
else err.labelSymbol.getOrElse(name, compatLabel)(atomic(string(name)).void)
}

override def apply(name: Char): Parsley[Unit] = err.labelSymbol.getOrElse(name.toString, NotConfigured)(char(name).void)
Expand Down

0 comments on commit 40ed20d

Please sign in to comment.