You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interface Item
class Number(val value: Int) : Item
class Variable(val name: String) : Item
object ItemsParser : Grammar<Item>() {
val num by token("\\d+")
val word by token("[A-Za-z]")
val comma by token(",\\s+")
val numParser = num use { Number(text.toInt()) }
val varParser = word use { Variable(text) }
override val <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE!>rootParser<!> = separatedTerms(numParser or varParser, comma)
}
val result: List<Item> = ItemsParser.<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>parseToEnd("one, 2, three, 4, five")<!>
Some errors reported on code copied from README
The text was updated successfully, but these errors were encountered:
Some errors reported on code copied from README
The text was updated successfully, but these errors were encountered: