Fixed several grammar bugs, updated status file for language_2.

The spec parser now parses all of language_2; many files are skipped,
but that is because they are multi-tests or because they contain
intentional syntax errors (negative tests).

Change-Id: I7061f0512702f3cb9631b32c79c3c1c1e2b7b0a6
Reviewed-on: https://dart-review.googlesource.com/8641
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This commit is contained in:
Erik Ernst 2017-09-29 11:34:52 +00:00 committed by commit-bot@chromium.org
parent 132d707f6a
commit df42be789b
2 changed files with 86 additions and 17 deletions

View file

@ -2,23 +2,20 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// *** This grammar is under development and it contains known bugs. ***
//
// CHANGES:
//
// v1.0 First version available in the SDK github repository. Covers the
// v0.2 Changed top level variable declarations to avoid redundant and
// misleading occurrence of (FINAL|CONST).
//
// v0.1 First version available in the SDK github repository. Covers the
// Dart language as specified in the language specification based on the
// many grammar rule snippets. That grammar was then adjusted to remove
// known issues (e.g., misplaced metadata) and to resolve ambiguities.
// HERE!
grammar Dart;
/*
options {
backtrack=true;
memoize=true;
}
*/
@parser::header{
import java.util.Stack;
}
@ -174,9 +171,12 @@ topLevelDefinition
| (type? SET identifier '(') => setterSignature functionBody
| (type? identifierNotFunction typeParameters? '(') =>
functionSignature functionBody
| ((FINAL | CONST) type? identifier '=') =>
(FINAL | CONST) type? staticFinalDeclarationList ';'
| initializedVariableDeclaration ';'
| (FINAL | CONST) type? staticFinalDeclarationList ';'
| topLevelVariableDeclaration ';'
;
topLevelVariableDeclaration
: varOrType identifier ('=' expression)? (',' initializedIdentifier)*
;
declaredIdentifier
@ -194,10 +194,6 @@ varOrType
| type
;
initializedVariableDeclaration
: declaredIdentifier ('=' expression)? (',' initializedIdentifier)*
;
initializedIdentifier
: identifier ('=' expression)?
;
@ -934,6 +930,10 @@ localVariableDeclaration
: initializedVariableDeclaration ';'
;
initializedVariableDeclaration
: declaredIdentifier ('=' expression)? (',' initializedIdentifier)*
;
localFunctionDeclaration
: functionSignature functionBody
;
@ -1179,7 +1179,12 @@ optionalPositionalParameterTypes
;
namedParameterTypes
: '{' typedIdentifier (',' typedIdentifier)* ','? '}'
: LBRACE namedParameterType (',' namedParameterType)* ','? RBRACE
;
namedParameterType
: typedIdentifier
| identifier
;
typedIdentifier

View file

@ -12,6 +12,22 @@
# Tests containing intentional syntax errors.
double_invalid_test: Skip # Contains illegaly formatted double.
getter_declaration_negative_test: Skip # Contains getter with argument.
issue1578_negative_test: Skip # Line noise.
is_not_class4_negative_test: Skip # Contains `a is A is A`.
is_not_class1_negative_test: Skip # Contains `a is "A"`.
interface_injection2_negative_test: Skip # `class C implements S;`.
interface_injection1_negative_test: Skip # `abstract class I implements S;`.
label8_negative_test: Skip # Contains misplaced label.
operator1_negative_test: Skip # Contains static operator declaration.
operator2_negative_test: Skip # Contains operator === declaration.
string_escape4_negative_test: Skip # Single line string literal with \n.
string_interpolate1_negative_test: Skip # Interpolation syntax error.
string_interpolate2_negative_test: Skip # Interpolation syntax error.
unary_plus_negative_test: Skip # Uses non-existing unary plus.
# Tests containing `native` (not part of the Dart grammar).
const_native_factory_test: Skip # Uses `native`.
# Wrong tests.
built_in_identifier_prefix_test: Skip # A built-in identifier can _not_ be a prefix.
@ -24,6 +40,7 @@ assign_static_type_test: Skip # Not yet supported.
assignable_expression_test: Skip # Not yet supported.
async_await_syntax_test: Skip # Not yet supported.
async_return_types_test: Skip # Not yet supported.
await_backwards_compatibility_test: Skip # Not yet supported.
bad_constructor_test: Skip # Not yet supported.
bad_override_test: Skip # Not yet supported.
bad_raw_string_test: Skip # Not yet supported.
@ -40,11 +57,53 @@ class_syntax_test: Skip # Not yet supported.
compile_time_constant10_test: Skip # Not yet supported.
compile_time_constant11_test: Skip # Not yet supported.
compile_time_constant13_test: Skip # Not yet supported.
const_syntax_test: Skip # Not yet supported.
constants_test: Skip # Not yet supported.
constructor_name_test: Skip # Not yet supported.
constructor_redirect2_test: Skip # Not yet supported.
covariant_test: Skip # Not yet supported.
cyclic_typedef_test: Skip # Not yet supported.
deferred_type_dependency_test: Skip # Not yet supported.
deferred_no_prefix_test: Skip # Not yet supported.
deferred_constraints_constants_test: Skip # Not yet supported.
function_syntax_test: Skip # Not yet supported.
get_set_syntax_test: Skip # Not yet supported.
mixin_super_constructor_named_test: Skip # Not yet supported.
mixin_super_constructor_positionals_test: Skip # Not yet supported.
mixin_super_constructor_named_test: Skip # Not yet supported.
mixin_super_constructor_positionals_test: Skip # Not yet supported.
getter_parameters_test: Skip # Not yet supported.
interface_cycle_test: Skip # Not yet supported.
illegal_declaration_test: Skip # Not yet supported.
illegal_initializer_test: Skip # Not yet supported.
keyword_type_expression_test: Skip # Not yet supported.
method_override2_test: Skip # Not yet supported.
mixin_supertype_subclass2_test: Skip # Not yet supported.
mixin_supertype_subclass4_test: Skip # Not yet supported.
mixin_supertype_subclass_test: Skip # Not yet supported.
named_constructor_test: Skip # Not yet supported.
named_parameters_aggregated_test: Skip # Not yet supported.
null_test: Skip # Not yet supported.
number_identifier_test: Skip # Not yet supported.
static_final_field2_test: Skip # Not yet supported.
static_parameter_test: Skip # Not yet supported.
static_top_level_test: Skip # Not yet supported.
string_interpolation1_test: Skip # Not yet supported.
string_interpolation2_test: Skip # Not yet supported.
string_interpolation3_test: Skip # Not yet supported.
string_interpolation4_test: Skip # Not yet supported.
string_interpolation5_test: Skip # Not yet supported.
string_interpolation6_test: Skip # Not yet supported.
string_interpolation9_test: Skip # Not yet supported.
unbalanced_brace_test: Skip # Not yet supported.
unsigned_right_shift_test: Skip # Not yet supported (but this will be OK!).
unsupported_operators_test: Skip # Not yet supported.
variable_declaration_metadata_test: Skip # Not yet supported.
# Tests using generic methods.
generic_methods_unused_parameter_test: Skip # Not yet supported.
generic_methods_named_parameters_test: Skip # Not yet supported.
generic_function_typedef2_test: Skip # Not yet supported.
# Tests using assert in initializer list.
assertion_initializer_test: Skip # Not yet supported.
@ -55,3 +114,8 @@ assertion_initializer_const_function_error_test: Skip # Not yet supported.
# Tests using generalized void.
void_type_function_types_test: Skip # Not yet supported.
# Tests that fail because of the deep nesting.
deep_nesting1_negative_test: Skip # Issue: nesting.
deep_nesting2_negative_test: Skip # Issue: nesting.
issue_1751477_test: Skip # Issue: nesting.