Basic function types.

This commit is contained in:
Jesse Brault 2025-09-03 17:05:15 -05:00
parent a53388155a
commit 3b07cef209
2 changed files with 43 additions and 17 deletions

View File

@ -150,15 +150,51 @@ Function:
build:
type: boolean
on: rule_present
- modifier:
rule: Modifier
build: FunctionModifier
- fn_kw:
rule: Fn
skip: true
- generics:
rule: GenericParameters
optional: true
- identifier
- parameters
- return_type:
optional: true
- function_body
OperatorFunction:
children:
- is_public:
rule: Pub
build:
type: boolean
on: rule_present
- op_kw:
rule: Op
skip: true
- generics:
rule: GenericParameters
optional: true
- operator
- parameters
- return_type:
optional: true
- function_body
PlatformFunction:
children:
- is_public:
rule: Pub
build:
type: boolean
on: rule_present
- platform_kw:
rule: Platform
skip: true
- fn_kw:
rule: Fn
skip: true
- generics:
rule: GenericParameters
optional: true
- identifier
- parameters
- return_type
- function_body

View File

@ -427,9 +427,8 @@ Class = {
// Function constructs
FunctionDefinition = {
Function = {
Pub?
~ FunctionModifier?
~ Fn
~ GenericParameters?
~ Identifier
@ -438,9 +437,8 @@ FunctionDefinition = {
~ FunctionBody
}
OperatorFunctionDefinition = {
OperatorFunction = {
Pub?
~ FunctionModifier?
~ Op
~ GenericParameters?
~ Operator
@ -451,14 +449,12 @@ OperatorFunctionDefinition = {
PlatformFunction = {
Pub?
~ FunctionModifier?
~ Platform
~ Fn
~ GenericParameters?
~ Identifier
~ Parameters
~ ReturnType
~ ";"
}
InterfaceFunction = {
@ -501,13 +497,7 @@ InterfaceDefaultOperatorFunction = {
~ FunctionBody
}
FunctionModifier = {
Static
| Cons
| Mut ~ Ref
| Mut
| Ref
}
// Function Components
FunctionBody = {
FunctionAliasBody