Seem to have fixed newlines and no-parentheses calls.
This commit is contained in:
parent
da05bb101b
commit
1d11a45c68
@ -1,9 +1,10 @@
|
||||
use crate::ast::node::{
|
||||
AssignmentStatement, BacktickString, Call, CompilationUnit, ConcreteUseStatement,
|
||||
ConcreteUseStatementSuffix, DString, Expression, ExpressionList, ExpressionStatement, Function,
|
||||
FunctionAliasBody, FunctionBlockBody, FunctionBody, FunctionEqualsBody, GenericParameters,
|
||||
Identifier, IdentifierExpression, IdentifierOrFqn, LValue, LValueSuffix, Literal,
|
||||
ModuleLevelDeclaration, ObjectIndex, Parameter, Parameters, PlatformFunction, PrimitiveType,
|
||||
AnySpaceSuffixOperator, AssignmentStatement, BacktickString, BoundSuffixOperator, Call,
|
||||
CompilationUnit, ConcreteUseStatement, ConcreteUseStatementSuffix, DString, Expression,
|
||||
ExpressionList, ExpressionStatement, Function, FunctionAliasBody, FunctionBlockBody,
|
||||
FunctionBody, FunctionEqualsBody, GenericParameters, Identifier, IdentifierExpression,
|
||||
IdentifierOrFqn, LValue, LValueSuffix, Literal, ModuleLevelDeclaration,
|
||||
NoNewlineSuffixOperator, ObjectIndex, Parameter, Parameters, PlatformFunction, PrimitiveType,
|
||||
ReturnType, StarUseStatement, Statement, SuffixExpression, SuffixOperator, TypeUse, TypedArray,
|
||||
UseStatement, UseStatementIdentifier, UseStatementPrefix, VariableDeclaration,
|
||||
};
|
||||
@ -676,20 +677,30 @@ fn na_p2_suffix_operator(
|
||||
diagnostics: &mut Vec<DmDiagnostic>,
|
||||
) {
|
||||
match suffix_operator {
|
||||
SuffixOperator::PlusPlus => {
|
||||
// no-op
|
||||
SuffixOperator::BoundSuffixOperator(bound_suffix) => {
|
||||
match bound_suffix {
|
||||
BoundSuffixOperator::PlusPlus => {
|
||||
// no-op
|
||||
}
|
||||
BoundSuffixOperator::MinusMinus => {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
}
|
||||
SuffixOperator::MinusMinus => {
|
||||
// no-op
|
||||
}
|
||||
SuffixOperator::ObjectProperty(_) => {
|
||||
// no-op; props checked during type checking
|
||||
}
|
||||
SuffixOperator::ObjectIndex(object_index) => {
|
||||
na_p2_object_index(object_index, symbol_table, diagnostics);
|
||||
}
|
||||
SuffixOperator::Call(call) => {
|
||||
na_p2_call(call, symbol_table, diagnostics);
|
||||
SuffixOperator::NoNewlineSuffixOperator(no_newline_suffix) => match no_newline_suffix {
|
||||
NoNewlineSuffixOperator::ObjectIndex(object_index) => {
|
||||
na_p2_object_index(object_index, symbol_table, diagnostics);
|
||||
}
|
||||
NoNewlineSuffixOperator::Call(call) => {
|
||||
na_p2_call(call, symbol_table, diagnostics);
|
||||
}
|
||||
},
|
||||
SuffixOperator::AnySpaceSuffixOperator(any_space_suffix) => {
|
||||
match any_space_suffix {
|
||||
AnySpaceSuffixOperator::ObjectProperty(_) => {
|
||||
// no-op; this is checked during type checking
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1160,13 +1160,23 @@ SuffixExpression:
|
||||
SuffixOperator:
|
||||
tree_enum:
|
||||
rules:
|
||||
- PlusPlus:
|
||||
child: false
|
||||
- MinusMinus:
|
||||
child: false
|
||||
- ObjectProperty
|
||||
- BoundSuffixOperator
|
||||
- NoNewlineSuffixOperator
|
||||
- AnySpaceSuffixOperator
|
||||
BoundSuffixOperator:
|
||||
leaf_enum:
|
||||
rules:
|
||||
- PlusPlus
|
||||
- MinusMinus
|
||||
NoNewlineSuffixOperator:
|
||||
tree_enum:
|
||||
rules:
|
||||
- ObjectIndex
|
||||
- Call
|
||||
AnySpaceSuffixOperator:
|
||||
tree_enum:
|
||||
rules:
|
||||
- ObjectProperty
|
||||
ObjectProperty:
|
||||
struct:
|
||||
children:
|
||||
|
||||
@ -260,7 +260,7 @@ FunctionTypeUse = {
|
||||
|
||||
// Generic Arguments
|
||||
|
||||
GenericArguments = {
|
||||
GenericArguments = !{
|
||||
"<"
|
||||
~ TypeUseList
|
||||
~ ">"
|
||||
@ -735,7 +735,8 @@ MultiplicativeOperator = {
|
||||
| Modulo
|
||||
}
|
||||
|
||||
PrefixExpression = {
|
||||
// Compound-atomic because all prefix operators are bound immediately (i.e., no spaces).
|
||||
PrefixExpression = ${
|
||||
PrefixOperator*
|
||||
~ SuffixExpression
|
||||
}
|
||||
@ -746,19 +747,31 @@ PrefixOperator = {
|
||||
| Negative
|
||||
}
|
||||
|
||||
SuffixExpression = {
|
||||
SuffixExpression = ${
|
||||
PrimaryExpression
|
||||
~ SuffixOperator*
|
||||
}
|
||||
|
||||
SuffixOperator = {
|
||||
SuffixOperator = ${
|
||||
BoundSuffixOperator
|
||||
| ( " " | "\t" )* ~ NoNewlineSuffixOperator ~ ( " " | "\t" )*
|
||||
| WHITESPACE* ~ AnySpaceSuffixOperator ~ WHITESPACE*
|
||||
}
|
||||
|
||||
BoundSuffixOperator = {
|
||||
PlusPlus
|
||||
| MinusMinus
|
||||
| ObjectProperty
|
||||
| ObjectIndex
|
||||
}
|
||||
|
||||
NoNewlineSuffixOperator = {
|
||||
ObjectIndex
|
||||
| Call
|
||||
}
|
||||
|
||||
AnySpaceSuffixOperator = {
|
||||
ObjectProperty
|
||||
}
|
||||
|
||||
ObjectProperty = {
|
||||
"."
|
||||
~ Identifier
|
||||
@ -770,10 +783,10 @@ ObjectIndex = {
|
||||
~ "]"
|
||||
}
|
||||
|
||||
PrimaryExpression = {
|
||||
PrimaryExpression = !{
|
||||
Literal
|
||||
| IdentifierExpression
|
||||
| FullyQualifiedName
|
||||
| IdentifierExpression
|
||||
| Closure
|
||||
| ListExpression
|
||||
| ParenthesizedExpression
|
||||
@ -810,28 +823,29 @@ ParenthesesCall = {
|
||||
~ Closure?
|
||||
}
|
||||
|
||||
NonParenthesesCall = {
|
||||
NonParenthesesCall = ${
|
||||
TurboFish?
|
||||
~ ( " " | "\t" )*
|
||||
~ (
|
||||
Closure
|
||||
| ExpressionList
|
||||
| ExpressionList ~ Closure
|
||||
| ExpressionList ~ ( " " | "\t" )* ~ Closure
|
||||
)
|
||||
}
|
||||
|
||||
TurboFish = {
|
||||
TurboFish = ${
|
||||
"::"
|
||||
~ GenericArguments
|
||||
}
|
||||
|
||||
ExpressionList = {
|
||||
ExpressionList = !{
|
||||
Expression
|
||||
~ ( "," ~ Expression )*
|
||||
}
|
||||
|
||||
// Closure
|
||||
|
||||
Closure = {
|
||||
Closure = !{
|
||||
"{"
|
||||
~ ( ClosureParameters? ~ "->" )?
|
||||
~ Statement*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user