mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
language: none support
This commit is contained in:
@ -192,6 +192,11 @@ class Parser(source: PeekableSource<Token>, val attribution: NodeAttribution) {
|
||||
Continue()
|
||||
}
|
||||
|
||||
TokenType.None -> {
|
||||
expect(TokenType.None)
|
||||
NoneLiteral()
|
||||
}
|
||||
|
||||
else -> {
|
||||
throw ParseError(
|
||||
"Failed to parse token: ${token.type} '${token.text}' as" +
|
||||
|
@ -81,6 +81,10 @@ class Printer(buffer: StringBuilder) : NodeVisitor<Unit> {
|
||||
visit(node.definition)
|
||||
}
|
||||
|
||||
override fun visitNoneLiteral(node: NoneLiteral) {
|
||||
append("none")
|
||||
}
|
||||
|
||||
override fun visitSymbol(node: Symbol) {
|
||||
append(node.id)
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ enum class TokenType(vararg properties: TokenTypeProperty) {
|
||||
StringLiteral(StringLiteralFamily),
|
||||
Equality(OperatorFamily),
|
||||
Inequality(ManyChars("!="), OperatorFamily),
|
||||
ExclaimationPoint(SingleChar('!'), Promotion('=', Inequality)),
|
||||
ExclamationPoint(SingleChar('!'), Promotion('=', Inequality)),
|
||||
None(ManyChars("None"), KeywordFamily),
|
||||
Equals(SingleChar('='), Promotion('=', Equality)),
|
||||
PlusPlus(ManyChars("++"), OperatorFamily),
|
||||
MinusMinus(ManyChars("--"), OperatorFamily),
|
||||
|
Reference in New Issue
Block a user