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 ast;
|
||||||
pub mod diagnostic;
|
pub mod diagnostic;
|
||||||
pub mod module;
|
pub mod module;
|
||||||
pub mod name_analysis;
|
// pub mod name_analysis;
|
||||||
pub mod object_file;
|
pub mod object_file;
|
||||||
pub mod parser;
|
pub mod parser;
|
||||||
pub mod std_core;
|
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
|
# $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
|
# Top-level constructs
|
||||||
CompilationUnit:
|
CompilationUnit:
|
||||||
children:
|
children:
|
||||||
|
|||||||
@ -148,8 +148,6 @@ Operator = {
|
|||||||
| RightShift
|
| RightShift
|
||||||
// unary prefix
|
// unary prefix
|
||||||
| Spread
|
| Spread
|
||||||
| BorrowMut
|
|
||||||
| Borrow
|
|
||||||
| Star
|
| Star
|
||||||
| Not
|
| Not
|
||||||
| Negative
|
| Negative
|
||||||
@ -197,18 +195,14 @@ IdentifierList = {
|
|||||||
~ ( "," ~ Identifier )*
|
~ ( "," ~ Identifier )*
|
||||||
}
|
}
|
||||||
|
|
||||||
ParenthesesTypeUseList = {
|
|
||||||
"("
|
|
||||||
~ TypeUseList
|
|
||||||
~ ")"
|
|
||||||
}
|
|
||||||
|
|
||||||
ParenthesesOptionalTypeUseList = {
|
ParenthesesOptionalTypeUseList = {
|
||||||
"("
|
"("
|
||||||
~ TypeUseList?
|
~ TypeUseList?
|
||||||
~ ")"
|
~ ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type Use
|
||||||
|
|
||||||
// In general:
|
// In general:
|
||||||
// Arguments = usage
|
// Arguments = usage
|
||||||
// Parameters = declaration
|
// Parameters = declaration
|
||||||
@ -229,28 +223,27 @@ PrimitiveType = {
|
|||||||
| Double
|
| Double
|
||||||
| Bool
|
| Bool
|
||||||
| String
|
| String
|
||||||
| Array ~ GenericArguments?
|
| TypedArray
|
||||||
| Any
|
| Any
|
||||||
| Void
|
| Void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TypedArray = {
|
||||||
|
Array
|
||||||
|
~ GenericArguments?
|
||||||
|
}
|
||||||
|
|
||||||
InterfaceOrClassTypeUse = {
|
InterfaceOrClassTypeUse = {
|
||||||
Borrow*
|
FullyQualifiedName
|
||||||
~ Mut?
|
|
||||||
~ FullyQualifiedName
|
|
||||||
~ GenericArguments?
|
~ GenericArguments?
|
||||||
}
|
}
|
||||||
|
|
||||||
TupleTypeUse = {
|
TupleTypeUse = {
|
||||||
Borrow*
|
TupleArguments
|
||||||
~ Mut?
|
|
||||||
~ TupleArguments
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionTypeUse = {
|
FunctionTypeUse = {
|
||||||
Borrow*
|
Fn
|
||||||
~ FunctionTypeModifier?
|
|
||||||
~ Fn
|
|
||||||
~ GenericParameters?
|
~ GenericParameters?
|
||||||
~ Parameters
|
~ Parameters
|
||||||
~ ReturnType
|
~ ReturnType
|
||||||
@ -286,15 +279,6 @@ ImplementsList = {
|
|||||||
~ ( "+" ~ TypeUse )*
|
~ ( "+" ~ TypeUse )*
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function type modifier
|
|
||||||
|
|
||||||
FunctionTypeModifier = {
|
|
||||||
Cons
|
|
||||||
| Mut ~ Ref
|
|
||||||
| Mut
|
|
||||||
| Ref
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
|
|
||||||
Parameters = {
|
Parameters = {
|
||||||
@ -317,13 +301,6 @@ Parameter = {
|
|||||||
ReturnType = {
|
ReturnType = {
|
||||||
"->"
|
"->"
|
||||||
~ TypeUse
|
~ TypeUse
|
||||||
~ RefList?
|
|
||||||
}
|
|
||||||
|
|
||||||
RefList = {
|
|
||||||
Ref
|
|
||||||
~ Identifier
|
|
||||||
~ ( "," ~ Identifier )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top-level constructs
|
// Top-level constructs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user