More generation of node types.
This commit is contained in:
parent
c2c885d85b
commit
0842690e6f
@ -5,7 +5,7 @@ extern crate core;
|
||||
pub mod ast;
|
||||
pub mod diagnostic;
|
||||
pub mod module;
|
||||
pub mod name_analysis;
|
||||
// pub mod name_analysis;
|
||||
pub mod object_file;
|
||||
pub mod parser;
|
||||
pub mod std_core;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1320
src/name_analysis/gather.rs.bak
Normal file
1320
src/name_analysis/gather.rs.bak
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,148 @@
|
||||
# $schema: ./ast.schema.yaml
|
||||
# Operators
|
||||
Operator:
|
||||
type: leaf_enum
|
||||
rules:
|
||||
- Or
|
||||
- And
|
||||
- EqualTo
|
||||
- NotEqualTo
|
||||
- Greater
|
||||
- Less
|
||||
- GreaterEqual
|
||||
- LessEqual
|
||||
- Add
|
||||
- Subtract
|
||||
- Multiply
|
||||
- Divide
|
||||
- Moduolo
|
||||
- LeftShift
|
||||
- RightShift
|
||||
- Spread
|
||||
- Star
|
||||
- Not
|
||||
- Negative
|
||||
- PlusPlus
|
||||
- MinusMinus
|
||||
- CallOp
|
||||
- Index
|
||||
|
||||
# Names
|
||||
Identifier:
|
||||
children:
|
||||
- name:
|
||||
build:
|
||||
type: string
|
||||
from: parse_whole_pair
|
||||
FullyQualifiedName:
|
||||
children:
|
||||
- identifiers:
|
||||
rule: Identifier
|
||||
vec: true
|
||||
|
||||
# Lists
|
||||
TypeUseList:
|
||||
children:
|
||||
- type_uses:
|
||||
rule: TypeUse
|
||||
vec: true
|
||||
IdentifierList:
|
||||
children:
|
||||
- identifiers:
|
||||
rule: Identifier
|
||||
vec: true
|
||||
ParenthesesOptionalTypeUseList:
|
||||
children:
|
||||
- type_use_list:
|
||||
optional: true
|
||||
|
||||
# Type Use
|
||||
TypeUse:
|
||||
rules:
|
||||
- PrimitiveType
|
||||
- InterfaceOrClassTypeUse
|
||||
- TupleTypeUse
|
||||
- FunctionTypeUse
|
||||
PrimitiveType:
|
||||
type: leaf_enum
|
||||
rules:
|
||||
- Byte
|
||||
- Short
|
||||
- Char
|
||||
- Int
|
||||
- Long
|
||||
- Double
|
||||
- Bool
|
||||
- String
|
||||
- TypedArray
|
||||
- Any
|
||||
- Void
|
||||
TypedArray:
|
||||
children:
|
||||
- array_kw:
|
||||
rule: Array
|
||||
skip: true
|
||||
- generic_arguments
|
||||
InterfaceOrClassTypeUse:
|
||||
children:
|
||||
- fully_qualified_name
|
||||
- generic_arguments:
|
||||
build:
|
||||
or_else_default: true
|
||||
TupleTypeUse:
|
||||
children:
|
||||
- tuple_arguments
|
||||
FunctionTypeUse:
|
||||
children:
|
||||
- fn_kw:
|
||||
rule: Fn
|
||||
skip: true
|
||||
- generic_parameters:
|
||||
build:
|
||||
or_else_default: true
|
||||
- parameters:
|
||||
build:
|
||||
or_else_default: true
|
||||
- return_type
|
||||
|
||||
# Generic Arguments
|
||||
GenericArguments:
|
||||
children:
|
||||
- type_use_list
|
||||
|
||||
# Generic Parameters
|
||||
GenericParameters:
|
||||
children:
|
||||
- identifier_list
|
||||
|
||||
# Tuple Arguments
|
||||
TupleArguments:
|
||||
children:
|
||||
- parentheses_optional_type_use_list
|
||||
|
||||
# Implements List
|
||||
ImplementsList:
|
||||
children:
|
||||
- type_uses:
|
||||
rule: TypeUse
|
||||
vec: true
|
||||
|
||||
# Parameters
|
||||
Parameters:
|
||||
children:
|
||||
- parameters:
|
||||
rule: Parameter
|
||||
vec: true
|
||||
Parameter:
|
||||
children:
|
||||
- identifier
|
||||
- type_use
|
||||
|
||||
# Return Type
|
||||
ReturnType:
|
||||
children:
|
||||
- type_use
|
||||
|
||||
# Top-level constructs
|
||||
CompilationUnit:
|
||||
children:
|
||||
|
||||
@ -148,8 +148,6 @@ Operator = {
|
||||
| RightShift
|
||||
// unary prefix
|
||||
| Spread
|
||||
| BorrowMut
|
||||
| Borrow
|
||||
| Star
|
||||
| Not
|
||||
| Negative
|
||||
@ -197,18 +195,14 @@ IdentifierList = {
|
||||
~ ( "," ~ Identifier )*
|
||||
}
|
||||
|
||||
ParenthesesTypeUseList = {
|
||||
"("
|
||||
~ TypeUseList
|
||||
~ ")"
|
||||
}
|
||||
|
||||
ParenthesesOptionalTypeUseList = {
|
||||
"("
|
||||
~ TypeUseList?
|
||||
~ ")"
|
||||
}
|
||||
|
||||
// Type Use
|
||||
|
||||
// In general:
|
||||
// Arguments = usage
|
||||
// Parameters = declaration
|
||||
@ -229,28 +223,27 @@ PrimitiveType = {
|
||||
| Double
|
||||
| Bool
|
||||
| String
|
||||
| Array ~ GenericArguments?
|
||||
| TypedArray
|
||||
| Any
|
||||
| Void
|
||||
}
|
||||
|
||||
TypedArray = {
|
||||
Array
|
||||
~ GenericArguments?
|
||||
}
|
||||
|
||||
InterfaceOrClassTypeUse = {
|
||||
Borrow*
|
||||
~ Mut?
|
||||
~ FullyQualifiedName
|
||||
FullyQualifiedName
|
||||
~ GenericArguments?
|
||||
}
|
||||
|
||||
TupleTypeUse = {
|
||||
Borrow*
|
||||
~ Mut?
|
||||
~ TupleArguments
|
||||
TupleArguments
|
||||
}
|
||||
|
||||
FunctionTypeUse = {
|
||||
Borrow*
|
||||
~ FunctionTypeModifier?
|
||||
~ Fn
|
||||
Fn
|
||||
~ GenericParameters?
|
||||
~ Parameters
|
||||
~ ReturnType
|
||||
@ -286,15 +279,6 @@ ImplementsList = {
|
||||
~ ( "+" ~ TypeUse )*
|
||||
}
|
||||
|
||||
// Function type modifier
|
||||
|
||||
FunctionTypeModifier = {
|
||||
Cons
|
||||
| Mut ~ Ref
|
||||
| Mut
|
||||
| Ref
|
||||
}
|
||||
|
||||
// Parameters
|
||||
|
||||
Parameters = {
|
||||
@ -317,13 +301,6 @@ Parameter = {
|
||||
ReturnType = {
|
||||
"->"
|
||||
~ TypeUse
|
||||
~ RefList?
|
||||
}
|
||||
|
||||
RefList = {
|
||||
Ref
|
||||
~ Identifier
|
||||
~ ( "," ~ Identifier )
|
||||
}
|
||||
|
||||
// Top-level constructs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user