mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-10-11 00:19:38 +00:00
fn -> func
This commit is contained in:
@ -170,7 +170,7 @@ class Parser(source: PeekableSource<Token>, val attribution: NodeAttribution) {
|
||||
}
|
||||
|
||||
private fun readFunctionDeclaration(): FunctionDeclaration = within {
|
||||
expect(TokenType.Fn)
|
||||
expect(TokenType.Func)
|
||||
val name = readSymbolRaw()
|
||||
expect(TokenType.LeftParentheses)
|
||||
val arguments = collect(TokenType.RightParentheses, TokenType.Comma) { readSymbolRaw() }
|
||||
@ -181,7 +181,7 @@ class Parser(source: PeekableSource<Token>, val attribution: NodeAttribution) {
|
||||
fun readDeclaration(): Declaration {
|
||||
val token = peek()
|
||||
return when (token.type) {
|
||||
TokenType.Fn -> readFunctionDeclaration()
|
||||
TokenType.Func -> readFunctionDeclaration()
|
||||
else -> throw RuntimeException(
|
||||
"Failed to parse token: ${token.type} '${token.text}' as" +
|
||||
" declaration (index ${unsanitizedSource.currentIndex})"
|
||||
|
@ -28,7 +28,7 @@ enum class TokenType(vararg properties: TokenTypeProperty) {
|
||||
If(Keyword("if"), KeywordFamily),
|
||||
Then(Keyword("then"), KeywordFamily),
|
||||
Else(Keyword("else"), KeywordFamily),
|
||||
Fn(Keyword("fn"), KeywordFamily),
|
||||
Func(Keyword("func"), KeywordFamily),
|
||||
Whitespace(CharConsumer { it == ' ' || it == '\r' || it == '\n' || it == '\t' }),
|
||||
BlockComment(CommentFamily),
|
||||
LineComment(CommentFamily),
|
||||
|
Reference in New Issue
Block a user