From c49cbae7f0a503f8a5ab38cf1814bc120677af03 Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Thu, 21 Sep 2017 09:36:10 +0000 Subject: [PATCH] Rietveld 2688903004 (spec_parser) migrated to Gerrit. Change-Id: Iddd1e8a795bfaed0092a30bb9d83070fe62d4a60 Reviewed-on: https://dart-review.googlesource.com/7261 Reviewed-by: Lasse R.H. Nielsen --- docs/language/Dart.g | 1718 +++++++++++++++++ tests/language/language_parser.status | 302 +++ tests/language_2/language_2_parser.status | 53 + .../language_strong_parser.status | 311 +++ tools/spec_parser/.gitignore | 5 + tools/spec_parser/Makefile | 34 + tools/spec_parser/SpecParser.java | 32 + tools/spec_parser/SpecParserRunner.java | 27 + tools/spec_parser/spec_parse.dart | 24 + 9 files changed, 2506 insertions(+) create mode 100644 docs/language/Dart.g create mode 100644 tests/language/language_parser.status create mode 100644 tests/language_2/language_2_parser.status create mode 100644 tests/language_strong/language_strong_parser.status create mode 100644 tools/spec_parser/.gitignore create mode 100644 tools/spec_parser/Makefile create mode 100644 tools/spec_parser/SpecParser.java create mode 100644 tools/spec_parser/SpecParserRunner.java create mode 100755 tools/spec_parser/spec_parse.dart diff --git a/docs/language/Dart.g b/docs/language/Dart.g new file mode 100644 index 00000000000..fe59c519c08 --- /dev/null +++ b/docs/language/Dart.g @@ -0,0 +1,1718 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// 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. + +// CHANGES: +// +// v1.0 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; +} + +@lexer::header{ +import java.util.Stack; +} + +@parser::members { + public static String filePath = null; + public static boolean filePathHasBeenPrinted = true; + + // Grammar debugging friendly output, 'The Definitive ANTLR Reference', p247. + public String getErrorMessage(RecognitionException e, String[] tokenNames) { + List stack = getRuleInvocationStack(e, this.getClass().getName()); + String msg = null; + if ( e instanceof NoViableAltException ) { + NoViableAltException nvae = (NoViableAltException)e; + msg = "no viable alt; token=" + e.token + + " (decision=" + nvae.decisionNumber + + " state " + nvae.stateNumber + ")" + + " decision=<<" + nvae.grammarDecisionDescription + ">>"; + } + else { + msg = super.getErrorMessage(e, tokenNames); + } + if (!filePathHasBeenPrinted) { + filePathHasBeenPrinted = true; + System.err.println(">>> Parse error in " + filePath + ":"); + } + return stack + " " + msg; + } + + public String getTokenErrorDisplay(Token t) { + return t.toString(); + } + + // Enable the parser to treat ASYNC/AWAIT/YIELD as keywords in the body of an + // `async`, `async*`, or `sync*` function. Access via methods below. + private Stack asyncEtcAreKeywords = new Stack(); + { asyncEtcAreKeywords.push(false); } + + // Use this to indicate that we are now entering an `async`, `async*`, + // or `sync*` function. + void startAsyncFunction() { asyncEtcAreKeywords.push(true); } + + // Use this to indicate that we are now entering a function which is + // neither `async`, `async*`, nor `sync*`. + void startNonAsyncFunction() { asyncEtcAreKeywords.push(false); } + + // Use this to indicate that we are now leaving any funciton. + void endFunction() { asyncEtcAreKeywords.pop(); } + + // Whether we can recognize ASYNC/AWAIT/YIELD as an identifier/typeIdentifier. + boolean asyncEtcPredicate(int tokenId) { + if (tokenId == ASYNC || tokenId == AWAIT || tokenId == YIELD) { + return !asyncEtcAreKeywords.peek(); + } + return false; + } + + // Debugging support methods. + void dp(int indent, String method, String sep) { + for (int i = 0; i < indent; i++) { + System.out.print(" "); + } + System.out.println(method + sep + " " + input.LT(1) + " " + state.failed); + } + + void dpBegin(int indent, String method) { dp(indent, method, ":"); } + void dpEnd(int indent, String method) { dp(indent, method, " END:"); } + void dpCall(int indent, String method) { dp(indent, method, "?"); } + void dpCalled(int indent, String method) { dp(indent, method, ".."); } + void dpResult(int indent, String method) { dp(indent, method, "!"); } +} + +@lexer::members{ + public static final int BRACE_NORMAL = 1; + public static final int BRACE_SINGLE = 2; + public static final int BRACE_DOUBLE = 3; + public static final int BRACE_THREE_SINGLE = 4; + public static final int BRACE_THREE_DOUBLE = 5; + + // Enable the parser to handle string interpolations via brace matching. + // The top of the `braceLevels` stack describes the most recent unmatched + // '{'. This is needed in order to enable/disable certain lexer rules. + // + // NORMAL: Most recent unmatched '{' was not string literal related. + // SINGLE: Most recent unmatched '{' was `'...${`. + // DOUBLE: Most recent unmatched '{' was `"...${`. + // THREE_SINGLE: Most recent unmatched '{' was `'''...${`. + // THREE_DOUBLE: Most recent unmatched '{' was `"""...${`. + // + // Access via functions below. + private Stack braceLevels = new Stack(); + + // Whether we are currently in a string literal context, and which one. + boolean currentBraceLevel(int braceLevel) { + if (braceLevels.empty()) return false; + return braceLevels.peek() == braceLevel; + } + + // Use this to indicate that we are now entering a specific '{...}'. + // Call it after accepting the '{'. + void enterBrace() { + braceLevels.push(BRACE_NORMAL); + } + void enterBraceSingleQuote() { + braceLevels.push(BRACE_SINGLE); + } + void enterBraceDoubleQuote() { + braceLevels.push(BRACE_DOUBLE); + } + void enterBraceThreeSingleQuotes() { + braceLevels.push(BRACE_THREE_SINGLE); + } + void enterBraceThreeDoubleQuotes() { + braceLevels.push(BRACE_THREE_DOUBLE); + } + + // Use this to indicate that we are now exiting a specific '{...}', + // no matter which kind. Call it before accepting the '}'. + void exitBrace() { + // We might raise a parse error here if the stack is empty, but the + // parsing rules should ensure that we get a parse error anyway, and + // it is not a big problem for the spec parser even if it misinterprets + // the brace structure of some programs with syntax errors. + if (!braceLevels.empty()) braceLevels.pop(); + } +} + +// ---------------------------------------- Grammar rules. + +libraryDefinition + : FEFF? SCRIPT_TAG? + ((metadata LIBRARY) => libraryName)? + ((metadata (IMPORT | EXPORT)) => importOrExport)* + ((metadata PART) => partDirective)* + (metadata topLevelDefinition)* + EOF + ; + +topLevelDefinition + : classDefinition + | enumType + | (TYPEDEF typeIdentifier typeParameters? '=') => typeAlias + | (TYPEDEF functionPrefix ('<' | '(')) => typeAlias + | (EXTERNAL functionSignature ';') => EXTERNAL functionSignature ';' + | (EXTERNAL getterSignature) => EXTERNAL getterSignature ';' + | (EXTERNAL type? SET identifier '(') => + EXTERNAL setterSignature ';' + | (getterSignature functionBodyPrefix) => getterSignature functionBody + | (type? SET identifier '(') => setterSignature functionBody + | (type? identifierNotFunction typeParameters? '(') => + functionSignature functionBody + | ((FINAL | CONST) type? identifier '=') => + (FINAL | CONST) type? staticFinalDeclarationList ';' + | initializedVariableDeclaration ';' + ; + +declaredIdentifier + : COVARIANT? finalConstVarOrType identifier + ; + +finalConstVarOrType + : FINAL type? + | CONST type? + | varOrType + ; + +varOrType + : VAR + | type + ; + +initializedVariableDeclaration + : declaredIdentifier ('=' expression)? (',' initializedIdentifier)* + ; + +initializedIdentifier + : identifier ('=' expression)? + ; + +initializedIdentifierList + : initializedIdentifier (',' initializedIdentifier)* + ; + +functionSignature + : type? identifierNotFunction formalParameterPart + ; + +functionBodyPrefix + : ASYNC? '=>' + | (ASYNC | ASYNC '*' | SYNC '*')? LBRACE + ; + +functionBody + : '=>' { startNonAsyncFunction(); } expression { endFunction(); } ';' + | { startNonAsyncFunction(); } block { endFunction(); } + | ASYNC '=>' + { startAsyncFunction(); } expression { endFunction(); } ';' + | (ASYNC | ASYNC '*' | SYNC '*') + { startAsyncFunction(); } block { endFunction(); } + ; + +block + : LBRACE statements RBRACE + ; + +formalParameterPart + : typeParameters? formalParameterList + ; + +formalParameterList + : '(' ')' + | '(' normalFormalParameters (','? | ',' optionalFormalParameters) ')' + | '(' optionalFormalParameters ')' + ; + +normalFormalParameters + : normalFormalParameter (',' normalFormalParameter)* + ; + +optionalFormalParameters + : optionalPositionalFormalParameters + | namedFormalParameters + ; + +optionalPositionalFormalParameters + : '[' defaultFormalParameter (',' defaultFormalParameter)* ','? ']' + ; + +namedFormalParameters + : LBRACE defaultNamedParameter (',' defaultNamedParameter)* ','? RBRACE + ; + +normalFormalParameter + : metadata normalFormalParameterNoMetadata + ; + +normalFormalParameterNoMetadata + : (COVARIANT? type? identifierNotFunction formalParameterPart) => + functionFormalParameter + | (finalConstVarOrType? THIS) => fieldFormalParameter + | simpleFormalParameter + ; + +functionFormalParameter + : COVARIANT? type? identifierNotFunction formalParameterPart + ; + +simpleFormalParameter + : declaredIdentifier + | COVARIANT? identifier + ; + +fieldFormalParameter + : finalConstVarOrType? THIS '.' identifier formalParameterPart? + ; + +defaultFormalParameter + : normalFormalParameter ('=' expression)? + ; + +defaultNamedParameter + : normalFormalParameter ((':' | '=') expression)? + ; + +typeApplication + : typeIdentifier typeParameters? + ; + +classDefinition + : (ABSTRACT? CLASS typeApplication (EXTENDS|IMPLEMENTS|LBRACE)) => + ABSTRACT? CLASS typeApplication (superclass mixins?)? interfaces? + LBRACE (metadata classMemberDefinition)* RBRACE + | (ABSTRACT? CLASS typeApplication '=') => + ABSTRACT? CLASS mixinApplicationClass + ; + +mixins + : WITH typeNotVoidNotFunctionList + ; + +classMemberDefinition + : (methodSignature functionBodyPrefix) => methodSignature functionBody + | declaration ';' + ; + +methodSignature + : (constructorSignature ':') => constructorSignature initializers + | (FACTORY constructorName '(') => factoryConstructorSignature + | (STATIC? type? identifierNotFunction typeParameters? '(') => + STATIC? functionSignature + | (STATIC? type? GET) => STATIC? getterSignature + | (STATIC? type? SET) => STATIC? setterSignature + | (type? OPERATOR operator '(') => operatorSignature + | constructorSignature + ; + +// https://github.com/dart-lang/sdk/issues/29501 reports on the problem which +// was solved by adding a case for redirectingFactoryConstructorSignature. +// TODO(eernst): Close that issue when this is integrated into the spec. + +// https://github.com/dart-lang/sdk/issues/29502 reports on the problem that +// than external const factory constructor declaration cannot be derived by +// the spec grammar (and also not by this grammar). The following fixes were +// introduced for that: Added the 'factoryConstructorSignature' case below in +// 'declaration'; also added 'CONST?' in the 'factoryConstructorSignature' +// rule, such that const factories in general are allowed. +// TODO(eernst): Close that issue when this is integrated into the spec. + +declaration + : (EXTERNAL CONST? FACTORY constructorName '(') => + EXTERNAL factoryConstructorSignature + | EXTERNAL constantConstructorSignature + | (EXTERNAL constructorName '(') => EXTERNAL constructorSignature + | ((EXTERNAL STATIC?)? type? GET) => (EXTERNAL STATIC?)? getterSignature + | ((EXTERNAL STATIC?)? type? SET) => (EXTERNAL STATIC?)? setterSignature + | (EXTERNAL? type? OPERATOR) => EXTERNAL? operatorSignature + | (STATIC (FINAL | CONST)) => + STATIC (FINAL | CONST) type? staticFinalDeclarationList + | FINAL type? initializedIdentifierList + | ((STATIC | COVARIANT)? (VAR | type) identifier ('=' | ',' | ';')) => + (STATIC | COVARIANT)? (VAR | type) initializedIdentifierList + | (EXTERNAL? STATIC? functionSignature ';') => + EXTERNAL? STATIC? functionSignature + | (CONST? FACTORY constructorName formalParameterList '=') => + redirectingFactoryConstructorSignature + | constantConstructorSignature (redirection | initializers)? + | constructorSignature (redirection | initializers)? + ; + +staticFinalDeclarationList + : staticFinalDeclaration (',' staticFinalDeclaration)* + ; + +staticFinalDeclaration + : identifier '=' expression + ; + +operatorSignature + : type? OPERATOR operator formalParameterList + ; + +operator + : '~' + | binaryOperator + | '[' ']' + | '[' ']' '=' + ; + +binaryOperator + : multiplicativeOperator + | additiveOperator + | (shiftOperator) => shiftOperator + | relationalOperator + | '==' + | bitwiseOperator + ; + +getterSignature + : type? GET identifier + ; + +setterSignature + : type? SET identifier formalParameterList + ; + +constructorSignature + : constructorName formalParameterList + ; + +constructorName + : typeIdentifier ('.' identifier)? + ; + +redirection + : ':' THIS ('.' identifier)? arguments + ; + +initializers + : ':' superCallOrFieldInitializer (',' superCallOrFieldInitializer)* + ; + +superCallOrFieldInitializer + : SUPER arguments + | SUPER '.' identifier arguments + | fieldInitializer + | assertClause + ; + +fieldInitializer + : (THIS '.')? identifier '=' conditionalExpression cascadeSection* + ; + +factoryConstructorSignature + : CONST? FACTORY constructorName formalParameterList + ; + +redirectingFactoryConstructorSignature + : CONST? FACTORY constructorName formalParameterList '=' + constructorDesignation + ; + +constantConstructorSignature + : CONST constructorName formalParameterList + ; + +superclass + : EXTENDS typeNotVoidNotFunction + ; + +interfaces + : IMPLEMENTS typeNotVoidNotFunctionList + ; + +mixinApplicationClass + : typeApplication '=' mixinApplication ';' + ; + +mixinApplication + : typeNotVoidNotFunction mixins interfaces? + ; + +enumType + : ENUM typeIdentifier LBRACE identifier (',' identifier)* (',')? RBRACE + ; + +typeParameter + : metadata typeIdentifier (EXTENDS typeNotVoid)? + ; + +typeParameters + : '<' typeParameter (',' typeParameter)* '>' + ; + +metadata + : ('@' metadatum)* + ; + +metadatum + : constructorDesignation arguments + | qualified + ; + +expression + : (formalParameterPart functionExpressionBodyPrefix) => + functionExpression + | throwExpression + | (assignableExpression assignmentOperator) => + assignableExpression assignmentOperator expression + | conditionalExpression cascadeSection* + ; + +expressionWithoutCascade + : (formalParameterPart functionExpressionBodyPrefix) => + functionExpressionWithoutCascade + | throwExpressionWithoutCascade + | (assignableExpression assignmentOperator) => + assignableExpression assignmentOperator expressionWithoutCascade + | conditionalExpression + ; + +expressionList + : expression (',' expression)* + ; + +primary + : thisExpression + | SUPER unconditionalAssignableSelector + | (CONST constructorDesignation) => constObjectExpression + | newExpression + | (formalParameterPart functionPrimaryBodyPrefix) => functionPrimary + | '(' expression ')' + | literal + | identifier + ; + +literal + : nullLiteral + | booleanLiteral + | numericLiteral + | stringLiteral + | symbolLiteral + | (CONST? typeArguments? LBRACE) => mapLiteral + | listLiteral + ; + +nullLiteral + : NULL + ; + +numericLiteral + : NUMBER + | HEX_NUMBER + ; + +booleanLiteral + : TRUE + | FALSE + ; + +stringLiteral + : (multiLineString | singleLineString)+ + ; + +stringLiteralWithoutInterpolation + : singleLineStringWithoutInterpolation+ + ; + +listLiteral + : CONST? typeArguments? '[' (expressionList ','?)? ']' + ; + +mapLiteral + : CONST? typeArguments? + LBRACE (mapLiteralEntry (',' mapLiteralEntry)* ','?)? RBRACE + ; + +mapLiteralEntry + : expression ':' expression + ; + +throwExpression + : THROW expression + ; + +throwExpressionWithoutCascade + : THROW expressionWithoutCascade + ; + +functionExpression + : formalParameterPart functionExpressionBody + ; + +functionExpressionBody + : '=>' { startNonAsyncFunction(); } expression { endFunction(); } + | ASYNC '=>' { startAsyncFunction(); } expression { endFunction(); } + ; + +functionExpressionBodyPrefix + : ASYNC? '=>' + ; + +functionExpressionWithoutCascade + : formalParameterPart functionExpressionWithoutCascadeBody + ; + +functionExpressionWithoutCascadeBody + : '=>' { startNonAsyncFunction(); } + expressionWithoutCascade { endFunction(); } + | ASYNC '=>' { startAsyncFunction(); } + expressionWithoutCascade { endFunction(); } + ; + +functionPrimary + : formalParameterPart functionPrimaryBody + ; + +functionPrimaryBody + : { startNonAsyncFunction(); } block { endFunction(); } + | (ASYNC | ASYNC '*' | SYNC '*') + { startAsyncFunction(); } block { endFunction(); } + ; + +functionPrimaryBodyPrefix + : (ASYNC | ASYNC '*' | SYNC '*')? LBRACE + ; + +thisExpression + : THIS + ; + +newExpression + : NEW constructorDesignation arguments + ; + +constObjectExpression + : CONST constructorDesignation arguments + ; + +arguments + : '(' (argumentList ','?)? ')' + ; + +argumentList + : namedArgument (',' namedArgument)* + | expressionList (',' namedArgument)* + ; + +namedArgument + : label expression + ; + +cascadeSection + : '..' + (cascadeSelector argumentPart*) + (assignableSelector argumentPart*)* + (assignmentOperator expressionWithoutCascade)? + ; + +cascadeSelector + : '[' expression ']' + | identifier + ; + +assignmentOperator + : '=' + | compoundAssignmentOperator + ; + +compoundAssignmentOperator + : '*=' + | '/=' + | '~/=' + | '%=' + | '+=' + | '-=' + | '<<=' + | '>' '>' '=' + | '&=' + | '^=' + | '|=' + | '??=' + ; + +conditionalExpression + : ifNullExpression + ('?' expressionWithoutCascade ':' expressionWithoutCascade)? + ; + +ifNullExpression + : logicalOrExpression ('??' logicalOrExpression)* + ; + +logicalOrExpression + : logicalAndExpression ('||' logicalAndExpression)* + ; + +logicalAndExpression + : equalityExpression ('&&' equalityExpression)* + ; + +equalityExpression + : relationalExpression (equalityOperator relationalExpression)? + | SUPER equalityOperator relationalExpression + ; + +equalityOperator + : '==' + | '!=' + ; + +relationalExpression + : bitwiseOrExpression + (typeTest | typeCast | relationalOperator bitwiseOrExpression)? + | SUPER relationalOperator bitwiseOrExpression + ; + +relationalOperator + : '>' '=' + | '>' + | '<=' + | '<' + ; + +bitwiseOrExpression + : bitwiseXorExpression ('|' bitwiseXorExpression)* + | SUPER ('|' bitwiseXorExpression)+ + ; + +bitwiseXorExpression + : bitwiseAndExpression ('^' bitwiseAndExpression)* + | SUPER ('^' bitwiseAndExpression)+ + ; + +bitwiseAndExpression + : shiftExpression ('&' shiftExpression)* + | SUPER ('&' shiftExpression)+ + ; + +bitwiseOperator + : '&' + | '^' + | '|' + ; + +shiftExpression + : additiveExpression (shiftOperator additiveExpression)* + | SUPER (shiftOperator additiveExpression)+ + ; + +shiftOperator + : '<<' + | '>' '>' + ; + +additiveExpression + : multiplicativeExpression (additiveOperator multiplicativeExpression)* + | SUPER (additiveOperator multiplicativeExpression)+ + ; + +additiveOperator + : '+' + | '-' + ; + +multiplicativeExpression + : unaryExpression (multiplicativeOperator unaryExpression)* + | SUPER (multiplicativeOperator unaryExpression)+ + ; + +multiplicativeOperator + : '*' + | '/' + | '%' + | '~/' + ; + +unaryExpression + : (prefixOperator ~SUPER) => prefixOperator unaryExpression + | (awaitExpression) => awaitExpression + | postfixExpression + | (minusOperator | tildeOperator) SUPER + | incrementOperator assignableExpression + ; + +prefixOperator + : minusOperator + | negationOperator + | tildeOperator + ; + +minusOperator + : '-' + ; + +negationOperator + : '!' + ; + +tildeOperator + : '~' + ; + +awaitExpression + : AWAIT unaryExpression + ; + +// The `(selector)` predicate ensures that the parser commits to the longest +// possible chain of selectors, e.g., `a(d)` as a call rather than as a +// sequence of two relational expressions. + +postfixExpression + : (assignableExpression postfixOperator) => + assignableExpression postfixOperator + | primary ((selector) => selector)* + ; + +postfixOperator + : incrementOperator + ; + +selector + : assignableSelector + | argumentPart + ; + +argumentPart + : typeArguments? arguments + ; + +incrementOperator + : '++' + | '--' + ; + +// The `(assignableSelectorPart)` predicate ensures that the parser +// commits to the longest possible chain, e.g., `a(d).e` as one rather +// than two expressions. The first `identifier` alternative handles all +// the simple cases; the final `identifier` alternative at the end catches +// the case where we have `identifier '<'` and the '<' is used as a +// relationalOperator, not the beginning of typeArguments. + +assignableExpression + : (SUPER unconditionalAssignableSelector + ~('<' | '(' | '[' | '.' | '?.')) => + SUPER unconditionalAssignableSelector + | (identifier ~('<' | '(' | '[' | '.' | '?.')) => identifier + | (primary argumentPart* assignableSelector) => + primary ((assignableSelectorPart) => assignableSelectorPart)+ + | identifier + ; + +assignableSelectorPart + : argumentPart* assignableSelector + ; + +unconditionalAssignableSelector + : '[' expression ']' + | '.' identifier + ; + +assignableSelector + : unconditionalAssignableSelector + | '?.' identifier + ; + +identifierNotFunction + : IDENTIFIER + | ABSTRACT + | AS + | COVARIANT + | DEFERRED + | DYNAMIC + | EXPORT + | EXTERNAL + | FACTORY + | GET + | IMPLEMENTS + | IMPORT + | LIBRARY + | OPERATOR + | PART + | SET + | STATIC + | TYPEDEF + | HIDE // Not a built-in identifier. + | OF // Not a built-in identifier. + | ON // Not a built-in identifier. + | SHOW // Not a built-in identifier. + | SYNC // Not a built-in identifier. + | { asyncEtcPredicate(input.LA(1)) }? (ASYNC|AWAIT|YIELD) + ; + +identifier + : identifierNotFunction + | FUNCTION // Not a built-in identifier. + ; + +qualified + : identifier ('.' identifier)? + ; + +typeIdentifier + : IDENTIFIER + | DYNAMIC // The only built-in identifier that can be used as a type. + | HIDE // Not a built-in identifier. + | OF // Not a built-in identifier. + | ON // Not a built-in identifier. + | SHOW // Not a built-in identifier. + | SYNC // Not a built-in identifier. + | FUNCTION // Not a built-in identifier. + | { asyncEtcPredicate(input.LA(1)) }? (ASYNC|AWAIT|YIELD) + ; + +typeTest + : isOperator typeNotVoid + ; + +isOperator + : IS '!'? + ; + +typeCast + : asOperator typeNotVoid + ; + +asOperator + : AS + ; + +statements + : statement* + ; + +statement + : label* nonLabelledStatement + ; + +// Exception in the language specification: An expressionStatement cannot +// start with LBRACE. We force anything that starts with LBRACE to be a block, +// which will prevent an expressionStatement from starting with LBRACE, and +// which will not interfere with the recognition of any other case. If we +// add another statement which can start with LBRACE we must adjust this +// check. +nonLabelledStatement + : (LBRACE) => block + | (declaredIdentifier ('='|','|';')) => localVariableDeclaration + | (AWAIT? FOR) => forStatement + | whileStatement + | doStatement + | switchStatement + | ifStatement + | rethrowStatement + | tryStatement + | breakStatement + | continueStatement + | returnStatement + | (functionSignature functionBodyPrefix) => localFunctionDeclaration + | assertStatement + | (YIELD ~'*') => yieldStatement + | yieldEachStatement + | expressionStatement + ; + +expressionStatement + : expression? ';' + ; + +localVariableDeclaration + : initializedVariableDeclaration ';' + ; + +localFunctionDeclaration + : functionSignature functionBody + ; + +ifStatement + : IF '(' expression ')' statement ((ELSE) => ELSE statement | ()) + ; + +forStatement + : AWAIT? FOR '(' forLoopParts ')' statement + ; + +forLoopParts + : (declaredIdentifier IN) => declaredIdentifier IN expression + | (identifier IN) => identifier IN expression + | forInitializerStatement expression? ';' expressionList? + ; + +// The localVariableDeclaration cannot be CONST, but that can +// be enforced in a later phase, and the grammar allows it. +forInitializerStatement + : (localVariableDeclaration) => localVariableDeclaration + | expression? ';' + ; + +whileStatement + : WHILE '(' expression ')' statement + ; + +doStatement + : DO statement WHILE '(' expression ')' ';' + ; + +switchStatement + : SWITCH '(' expression ')' LBRACE switchCase* defaultCase? RBRACE + ; + +switchCase + : label* CASE expression ':' statements + ; + +defaultCase + : label* DEFAULT ':' statements + ; + +rethrowStatement + : RETHROW ';' + ; + +tryStatement + : TRY block (onParts finallyPart? | finallyPart) + ; + +onPart + : catchPart block + | ON typeNotVoid catchPart? block + ; + +onParts + : (onPart (ON|CATCH)) => onPart onParts + | onPart + ; + +catchPart + : CATCH '(' identifier (',' identifier)? ')' + ; + +finallyPart + : FINALLY block + ; + +returnStatement + : RETURN expression? ';' + ; + +label + : identifier ':' + ; + +breakStatement + : BREAK identifier? ';' + ; + +continueStatement + : CONTINUE identifier? ';' + ; + +yieldStatement + : YIELD expression ';' + ; + +yieldEachStatement + : YIELD '*' expression ';' + ; + +assertStatement + : assertClause ';' + ; + +assertClause + : ASSERT '(' expression (',' expression)? ')' + ; + +libraryName + : metadata LIBRARY identifier ('.' identifier)* ';' + ; + +importOrExport + : (metadata IMPORT) => libraryImport + | (metadata EXPORT) => libraryExport + ; + +libraryImport + : metadata importSpecification + ; + +importSpecification + : IMPORT uri (AS identifier)? combinator* ';' + | IMPORT uri DEFERRED AS identifier combinator* ';' + ; + +combinator + : SHOW identifierList + | HIDE identifierList + ; + +identifierList + : identifier (',' identifier)* + ; + +libraryExport + : metadata EXPORT uri combinator* ';' + ; + +partDirective + : metadata PART uri ';' + ; + +partHeader + : metadata PART OF identifier ('.' identifier)* ';' + ; + +partDeclaration + : partHeader topLevelDefinition* EOF + ; + +uri + : stringLiteralWithoutInterpolation + ; + +type + : (FUNCTION ('('|'<')) => functionTypeTails + | (typeNotFunction FUNCTION ('('|'<')) => + typeNotFunction functionTypeTails + | typeNotFunction + ; + +typeNotFunction + : typeNotVoidNotFunction + | VOID + ; + +typeNotVoid + : (typeNotFunction? FUNCTION ('('|'<')) => functionType + | typeNotVoidNotFunction + ; + +typeNotVoidNotFunction + : typeName typeArguments? + ; + +typeName + : typeIdentifier ('.' typeIdentifier)? + ; + +typeArguments + : '<' typeList '>' + ; + +typeList + : type (',' type)* + ; + +typeNotVoidNotFunctionList + : typeNotVoidNotFunction (',' typeNotVoidNotFunction)* + ; + +typeAlias + : (TYPEDEF typeIdentifier typeParameters? '=') => + TYPEDEF typeIdentifier typeParameters? '=' functionType ';' + | TYPEDEF functionTypeAlias + ; + +functionTypeAlias + : functionPrefix formalParameterPart ';' + ; + +functionPrefix + : (type identifier) => type identifier + | identifier + ; + +functionTypeTail + : FUNCTION typeParameters? parameterTypeList + ; + +functionTypeTails + : (functionTypeTail FUNCTION ('<'|'(')) => + functionTypeTail functionTypeTails + | functionTypeTail + ; + +functionType + : (FUNCTION ('<'|'(')) => functionTypeTails + | typeNotFunction functionTypeTails + ; + +parameterTypeList + : ('(' ')') => '(' ')' + | ('(' normalParameterTypes ',' ('['|'{')) => + '(' normalParameterTypes ',' optionalParameterTypes ')' + | ('(' normalParameterTypes ','? ')') => + '(' normalParameterTypes ','? ')' + | '(' optionalParameterTypes ')' + ; + +normalParameterTypes + : normalParameterType (',' normalParameterType)* + ; + +normalParameterType + : (typedIdentifier) => typedIdentifier + | type + ; + +optionalParameterTypes + : optionalPositionalParameterTypes + | namedParameterTypes + ; + +optionalPositionalParameterTypes + : '[' normalParameterTypes ','? ']' + ; + +namedParameterTypes + : '{' typedIdentifier (',' typedIdentifier)* ','? '}' + ; + +typedIdentifier + : type identifier + ; + +constructorDesignation + : typeIdentifier + | identifier '.' identifier + | identifier '.' typeIdentifier '.' identifier + | typeName typeArguments ('.' identifier)? + ; + +// Predicate: Force resolution as composite symbolLiteral as far as possible. +symbolLiteral + : '#' (operator | (identifier (('.' identifier) => '.' identifier)*)) + ; + +singleLineStringWithoutInterpolation + : RAW_SINGLE_LINE_STRING + | SINGLE_LINE_STRING_DQ_BEGIN_END + | SINGLE_LINE_STRING_SQ_BEGIN_END + ; + +singleLineString + : RAW_SINGLE_LINE_STRING + | SINGLE_LINE_STRING_SQ_BEGIN_END + | SINGLE_LINE_STRING_SQ_BEGIN_MID expression + (SINGLE_LINE_STRING_SQ_MID_MID expression)* + SINGLE_LINE_STRING_SQ_MID_END + | SINGLE_LINE_STRING_DQ_BEGIN_END + | SINGLE_LINE_STRING_DQ_BEGIN_MID expression + (SINGLE_LINE_STRING_DQ_MID_MID expression)* + SINGLE_LINE_STRING_DQ_MID_END + ; + +multiLineString + : RAW_MULTI_LINE_STRING + | MULTI_LINE_STRING_SQ_BEGIN_END + | MULTI_LINE_STRING_SQ_BEGIN_MID expression + (MULTI_LINE_STRING_SQ_MID_MID expression)* + MULTI_LINE_STRING_SQ_MID_END + | MULTI_LINE_STRING_DQ_BEGIN_END + | MULTI_LINE_STRING_DQ_BEGIN_MID expression + (MULTI_LINE_STRING_DQ_MID_MID expression)* + MULTI_LINE_STRING_DQ_MID_END + ; + +// ---------------------------------------- Lexer rules. + +fragment +LETTER + : 'a' .. 'z' + | 'A' .. 'Z' + ; + +fragment +DIGIT + : '0' .. '9' + ; + +fragment +EXPONENT + : ('e' | 'E') ('+' | '-')? DIGIT+ + ; + +fragment +HEX_DIGIT + : ('a' | 'b' | 'c' | 'd' | 'e' | 'f') + | ('A' | 'B' | 'C' | 'D' | 'E' | 'F') + | DIGIT + ; + +FINAL + : 'final' + ; + +CONST + : 'const' + ; + +VAR + : 'var' + ; + +VOID + : 'void' + ; + +ASYNC + : 'async' + ; + +THIS + : 'this' + ; + +ABSTRACT + : 'abstract' + ; + +AS + : 'as' + ; + +SYNC + : 'sync' + ; + +CLASS + : 'class' + ; + +WITH + : 'with' + ; + +STATIC + : 'static' + ; + +DYNAMIC + : 'dynamic' + ; + +EXTERNAL + : 'external' + ; + +GET + : 'get' + ; + +SET + : 'set' + ; + +OPERATOR + : 'operator' + ; + +SUPER + : 'super' + ; + +FACTORY + : 'factory' + ; + +EXTENDS + : 'extends' + ; + +IMPLEMENTS + : 'implements' + ; + +ENUM + : 'enum' + ; + +NULL + : 'null' + ; + +TRUE + : 'true' + ; + +FALSE + : 'false' + ; + +THROW + : 'throw' + ; + +NEW + : 'new' + ; + +AWAIT + : 'await' + ; + +DEFERRED + : 'deferred' + ; + +EXPORT + : 'export' + ; + +IMPORT + : 'import' + ; + +LIBRARY + : 'library' + ; + +PART + : 'part' + ; + +TYPEDEF + : 'typedef' + ; + +IS + : 'is' + ; + +IF + : 'if' + ; + +ELSE + : 'else' + ; + +WHILE + : 'while' + ; + +FOR + : 'for' + ; + +IN + : 'in' + ; + +DO + : 'do' + ; + +SWITCH + : 'switch' + ; + +CASE + : 'case' + ; + +DEFAULT + : 'default' + ; + +RETHROW + : 'rethrow' + ; + +TRY + : 'try' + ; + +ON + : 'on' + ; + +CATCH + : 'catch' + ; + +FINALLY + : 'finally' + ; + +RETURN + : 'return' + ; + +BREAK + : 'break' + ; + +CONTINUE + : 'continue' + ; + +YIELD + : 'yield' + ; + +SHOW + : 'show' + ; + +HIDE + : 'hide' + ; + +OF + : 'of' + ; + +ASSERT + : 'assert' + ; + +COVARIANT + : 'covariant' + ; + +FUNCTION + : 'Function' + ; + +NUMBER + : (DIGIT+ '.' DIGIT) => DIGIT+ '.' DIGIT+ EXPONENT? + | DIGIT+ EXPONENT? + | '.' DIGIT+ EXPONENT? + ; + +HEX_NUMBER + : '0x' HEX_DIGIT+ + | '0X' HEX_DIGIT+ + ; + +RAW_SINGLE_LINE_STRING + : 'r' '\'' (~('\'' | '\r' | '\n'))* '\'' + | 'r' '"' (~('"' | '\r' | '\n'))* '"' + ; + +RAW_MULTI_LINE_STRING + : 'r' '"""' (options {greedy=false;} : .)* '"""' + | 'r' '\'\'\'' (options {greedy=false;} : .)* '\'\'\'' + ; + +fragment +SIMPLE_STRING_INTERPOLATION + : '$' IDENTIFIER_NO_DOLLAR + ; + +fragment +STRING_CONTENT_SQ + : ~('\\' | '\'' | '$' | '\r' | '\n') + | '\\' ~( '\r' | '\n') + | SIMPLE_STRING_INTERPOLATION + ; + +SINGLE_LINE_STRING_SQ_BEGIN_END + : '\'' STRING_CONTENT_SQ* '\'' + ; + +SINGLE_LINE_STRING_SQ_BEGIN_MID + : '\'' STRING_CONTENT_SQ* '${' { enterBraceSingleQuote(); } + ; + +SINGLE_LINE_STRING_SQ_MID_MID + : { currentBraceLevel(BRACE_SINGLE) }? => + ('}' STRING_CONTENT_SQ* '${') => + { exitBrace(); } '}' STRING_CONTENT_SQ* '${' + { enterBraceSingleQuote(); } + ; + +SINGLE_LINE_STRING_SQ_MID_END + : { currentBraceLevel(BRACE_SINGLE) }? => + ('}' STRING_CONTENT_SQ* '\'') => + { exitBrace(); } '}' STRING_CONTENT_SQ* '\'' + ; + +fragment +STRING_CONTENT_DQ + : ~('\\' | '"' | '$' | '\r' | '\n') + | '\\' ~('\r' | '\n') + | SIMPLE_STRING_INTERPOLATION + ; + +SINGLE_LINE_STRING_DQ_BEGIN_END + : '"' STRING_CONTENT_DQ* '"' + ; + +SINGLE_LINE_STRING_DQ_BEGIN_MID + : '"' STRING_CONTENT_DQ* '${' { enterBraceDoubleQuote(); } + ; + +SINGLE_LINE_STRING_DQ_MID_MID + : { currentBraceLevel(BRACE_DOUBLE) }? => + ('}' STRING_CONTENT_DQ* '${') => + { exitBrace(); } '}' STRING_CONTENT_DQ* '${' + { enterBraceDoubleQuote(); } + ; + +SINGLE_LINE_STRING_DQ_MID_END + : { currentBraceLevel(BRACE_DOUBLE) }? => + ('}' STRING_CONTENT_DQ* '"') => + { exitBrace(); } '}' STRING_CONTENT_DQ* '"' + ; + +fragment +QUOTES_SQ + : + | '\'' + | '\'\'' + ; + +// Read string contents, which may be almost anything, but stop when seeing +// '\'\'\'' and when seeing '${'. We do this by allowing all other +// possibilities including escapes, simple interpolation, and fewer than +// three '\''. +fragment +STRING_CONTENT_TSQ + : QUOTES_SQ + (~('\\' | '$' | '\'') | '\\' . | SIMPLE_STRING_INTERPOLATION) + ; + +MULTI_LINE_STRING_SQ_BEGIN_END + : '\'\'\'' STRING_CONTENT_TSQ* '\'\'\'' + ; + +MULTI_LINE_STRING_SQ_BEGIN_MID + : '\'\'\'' STRING_CONTENT_TSQ* QUOTES_SQ '${' + { enterBraceThreeSingleQuotes(); } + ; + +MULTI_LINE_STRING_SQ_MID_MID + : { currentBraceLevel(BRACE_THREE_SINGLE) }? => + ('}' STRING_CONTENT_TSQ* QUOTES_SQ '${') => + { exitBrace(); } '}' STRING_CONTENT_TSQ* QUOTES_SQ '${' + { enterBraceThreeSingleQuotes(); } + ; + +MULTI_LINE_STRING_SQ_MID_END + : { currentBraceLevel(BRACE_THREE_SINGLE) }? => + ('}' STRING_CONTENT_TSQ* '\'\'\'') => + { exitBrace(); } '}' STRING_CONTENT_TSQ* '\'\'\'' + ; + +fragment +QUOTES_DQ + : + | '"' + | '""' + ; + +// Read string contents, which may be almost anything, but stop when seeing +// '"""' and when seeing '${'. We do this by allowing all other possibilities +// including escapes, simple interpolation, and fewer-than-three '"'. +fragment +STRING_CONTENT_TDQ + : QUOTES_DQ + (~('\\' | '$' | '"') | '\\' . | SIMPLE_STRING_INTERPOLATION) + ; + +MULTI_LINE_STRING_DQ_BEGIN_END + : '"""' STRING_CONTENT_TDQ* '"""' + ; + +MULTI_LINE_STRING_DQ_BEGIN_MID + : '"""' STRING_CONTENT_TDQ* QUOTES_DQ '${' + { enterBraceThreeDoubleQuotes(); } + ; + +MULTI_LINE_STRING_DQ_MID_MID + : { currentBraceLevel(BRACE_THREE_DOUBLE) }? => + ('}' STRING_CONTENT_TDQ* QUOTES_DQ '${') => + { exitBrace(); } '}' STRING_CONTENT_TDQ* QUOTES_DQ '${' + { enterBraceThreeDoubleQuotes(); } + ; + +MULTI_LINE_STRING_DQ_MID_END + : { currentBraceLevel(BRACE_THREE_DOUBLE) }? => + ('}' STRING_CONTENT_TDQ* '"""') => + { exitBrace(); } '}' STRING_CONTENT_TDQ* '"""' + ; + +LBRACE + : '{' { enterBrace(); } + ; + +RBRACE + : { currentBraceLevel(BRACE_NORMAL) }? => ('}') => { exitBrace(); } '}' + ; + +fragment +IDENTIFIER_START_NO_DOLLAR + : LETTER + | '_' + ; + +fragment +IDENTIFIER_PART_NO_DOLLAR + : IDENTIFIER_START_NO_DOLLAR + | DIGIT + ; + +fragment +IDENTIFIER_NO_DOLLAR + : IDENTIFIER_START_NO_DOLLAR IDENTIFIER_PART_NO_DOLLAR* + ; + +fragment +IDENTIFIER_START + : IDENTIFIER_START_NO_DOLLAR + | '$' + ; + +fragment +IDENTIFIER_PART + : IDENTIFIER_START + | DIGIT + ; + +SCRIPT_TAG + : '#!' (~('\r' | '\n'))* NEWLINE + ; + +IDENTIFIER + : IDENTIFIER_START IDENTIFIER_PART* + ; + +SINGLE_LINE_COMMENT + : '//' (~('\r' | '\n'))* NEWLINE? + { skip(); } + ; + +MULTI_LINE_COMMENT + : '/*' (options {greedy=false;} : (MULTI_LINE_COMMENT | .))* '*/' + { skip(); } + ; + +fragment +NEWLINE + : ('\r' | '\n' | '\r\n') + ; + +FEFF + : '\uFEFF' + ; + +WS + : (' ' | '\t' | '\r' | '\n')+ + { skip(); } + ; diff --git a/tests/language/language_parser.status b/tests/language/language_parser.status new file mode 100644 index 00000000000..14aef5d666b --- /dev/null +++ b/tests/language/language_parser.status @@ -0,0 +1,302 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# 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 file specifies the status of tests for runs with spec_parser.dart. +# Note that there are overlaps between groups, because a single test may +# be skipped for more than one reason. As features are added, groups are +# expected to be eliminated entirely, and this would not work if all +# duplicates were removed. + +[ $compiler == parser ] + +# Negative tests which contain syntax errors. +field3_negative_test: Skip # Test has syntax error. +getter_declaration_negative_test: Skip # Test has syntax error. +interface_injection1_negative_test: Skip # Test has syntax error. +interface_injection2_negative_test: Skip # Test has syntax error. +is_not_class1_negative_test: Skip # Test has syntax error. +is_not_class4_negative_test: Skip # Test has syntax error. +issue1578_negative_test: Skip # Test has syntax error. +label8_negative_test: Skip # Test has syntax error. +list_literal_negative_test: Skip # Test has syntax error. +map_literal_negative_test: Skip # Test has syntax error. +new_expression1_negative_test: Skip # Test has syntax error. +new_expression2_negative_test: Skip # Test has syntax error. +new_expression3_negative_test: Skip # Test has syntax error. +operator1_negative_test: Skip # Test has syntax error. +operator2_negative_test: Skip # Test has syntax error. +prefix18_negative_test: Skip # Test has syntax error. +string_escape4_negative_test: Skip # Test has syntax error. +string_interpolate1_negative_test: Skip # Test has syntax error. +string_interpolate2_negative_test: Skip # Test has syntax error. +switch1_negative_test: Skip # Test has syntax error. +test_negative_test: Skip # Test has syntax error. +unary_plus_negative_test: Skip # Test has syntax error. +unhandled_exception_negative_test: Skip # Test has syntax error. + +# Multi-tests containing compile-time errors. +abstract_syntax_test: Skip # Not yet supported. +arg_param_trailing_comma_test: Skip # Not yet supported. +argument_definition_test: Skip # Not yet supported. +assert_initializer_test: Skip # Not yet supported. +assert_trailing_comma_test: Skip # Not yet supported. +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. +async_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. +bad_typedef_test: Skip # Not yet supported. +black_listed_test: Skip # Not yet supported. +built_in_identifier_illegal_test: Skip # Not yet supported. +canonical_const2_test: Skip # Not yet supported. +canonical_const_test: Skip # Not yet supported. +cascade_test: Skip # Not yet supported. +check_member_static_test: Skip # Not yet supported. +class_cycle2_test: Skip # Not yet supported. +class_cycle_test: Skip # Not yet supported. +class_keyword_test: Skip # Not yet supported. +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. +compile_time_constant_arguments_test: Skip # Not yet supported. +compile_time_constant_c_test: Skip # Not yet supported. +compile_time_constant_checked2_test: Skip # Not yet supported. +compile_time_constant_checked3_test: Skip # Not yet supported. +compile_time_constant_checked4_test: Skip # Not yet supported. +compile_time_constant_checked5_test: Skip # Not yet supported. +compile_time_constant_checked_test: Skip # Not yet supported. +compile_time_constant_o_test: Skip # Not yet supported. +compile_time_constant_p_test: Skip # Not yet supported. +compile_time_constant_r_test: Skip # Not yet supported. +compile_time_constant_test: Skip # Not yet supported. +conditional_method_invocation_test: Skip # Not yet supported. +conditional_property_access_test: Skip # Not yet supported. +conditional_property_assignment_test: Skip # Not yet supported. +const_conditional_test: Skip # Not yet supported. +const_constructor2_test: Skip # Not yet supported. +const_constructor3_test: Skip # Not yet supported. +const_constructor_mixin2_test: Skip # Not yet supported. +const_constructor_mixin3_test: Skip # Not yet supported. +const_constructor_mixin_test: Skip # Not yet supported. +const_constructor_nonconst_field_test: Skip # Not yet supported. +const_constructor_super_test: Skip # Not yet supported. +const_constructor_syntax_test: Skip # Not yet supported. +const_constructor_test: Skip # Not yet supported. +const_error_multiply_initialized_test: Skip # Not yet supported. +const_evaluation_test: Skip # Not yet supported. +const_factory_redirection_test: Skip # Not yet supported. +const_factory_with_body_test: Skip # Not yet supported. +const_for_in_variable_test: Skip # Not yet supported. +const_getter_test: Skip # Not yet supported. +const_init2_test: Skip # Not yet supported. +const_init_test: Skip # Not yet supported. +const_instance_field_test: Skip # Not yet supported. +const_locals_test: Skip # Not yet supported. +const_map2_test: Skip # Not yet supported. +const_map3_test: Skip # Not yet supported. +const_native_factory_test: Skip # Not yet supported. +const_nested_test: Skip # Not yet supported. +const_qq_test: Skip # Not yet supported. +const_string_test: Skip # Not yet supported. +const_switch2_test: Skip # Not yet supported. +const_syntax_test: Skip # Not yet supported. +const_types_test: Skip # Not yet supported. +constant_locals_test: Skip # Not yet supported. +constant_type_literal_test: Skip # Not yet supported. +constants_test: Skip # Not yet supported. +constructor10_test: Skip # Not yet supported. +constructor_duplicate_final_test: Skip # Not yet supported. +constructor_duplicate_initializers_test: Skip # Not yet supported. +constructor_initializer_test: Skip # Not yet supported. +constructor_name_test: Skip # Not yet supported. +constructor_redirect2_test: Skip # Not yet supported. +constructor_redirect_test: Skip # Not yet supported. +constructor_return_test: Skip # Not yet supported. +covariant_test: Skip # Not yet supported. +ct_const2_test: Skip # Not yet supported. +ct_const4_test: Skip # Not yet supported. +ct_const_test: Skip # Not yet supported. +cyclic_class_member_test: Skip # Not yet supported. +cyclic_constructor_test: Skip # Not yet supported. +cyclic_typedef_test: Skip # Not yet supported. +deferred_constraints_constants_test: Skip # Not yet supported. +deferred_duplicate_prefix1_test: Skip # Not yet supported. +deferred_duplicate_prefix2_test: Skip # Not yet supported. +deferred_duplicate_prefix3_test: Skip # Not yet supported. +deferred_inheritance_constraints_test: Skip # Not yet supported. +deferred_load_constants_test: Skip # Not yet supported. +deferred_no_prefix_test: Skip # Not yet supported. +deferred_type_dependency_test: Skip # Not yet supported. +duplicate_constructor_test: Skip # Not yet supported. +duplicate_export_test: Skip # Not yet supported. +duplicate_implements_test: Skip # Not yet supported. +duplicate_interface_negative_test: Skip # Not yet supported. +dynamic2_test: Skip # Not yet supported. +enum_is_keyword_test: Skip # Not yet supported. +enum_syntax_test: Skip # Not yet supported. +export_private_test: Skip # Not yet supported. +external_test: Skip # Not yet supported. +factory2_negative_test: Skip # Not yet supported. +factory3_negative_test: Skip # Not yet supported. +factory_implementation_test: Skip # Not yet supported. +factory_negative_test: Skip # Not yet supported. +factory_redirection2_test: Skip # Not yet supported. +factory_redirection3_cyclic_test: Skip # Not yet supported. +factory_redirection_test: Skip # Not yet supported. +fauxverride_test: Skip # Not yet supported. +field_decl_missing_var_type_test: Skip # Not yet supported. +field_override3_test: Skip # Not yet supported. +field_override4_test: Skip # Not yet supported. +final_initializer_instance_reference_test: Skip # Not yet supported. +final_is_not_const_test: Skip # Not yet supported. +final_syntax_test: Skip # Not yet supported. +function_syntax_test: Skip # Not yet supported. +function_type_alias5_test: Skip # Not yet supported. +function_type_alias6_test: Skip # Not yet supported. +function_type_alias7_test: Skip # Not yet supported. +function_type_alias9_test: Skip # Not yet supported. +function_type_parameter2_negative_test: Skip # Not yet supported. +function_type_parameter_negative_test: Skip # Not yet supported. +function_type_test: Skip # Not yet supported. +generic_function_typedef2_test: Skip # Not yet supported. +generic_function_typedef_test: Skip # Not yet supported. +generic_metadata_test: Skip # Not yet supported. +get_set_syntax_test: Skip # Not yet supported. +getter_no_setter2_test: Skip # Not yet supported. +getter_no_setter_test: Skip # Not yet supported. +getter_override2_test: Skip # Not yet supported. +getter_override_test: Skip # Not yet supported. +getter_parameters_test: Skip # Not yet supported. +identical_const_test: Skip # Not yet supported. +if_null_assignment_behavior_test: Skip # Not yet supported. +illegal_declaration_test: Skip # Not yet supported. +illegal_initializer_test: Skip # Not yet supported. +illegal_invocation_test: Skip # Not yet supported. +import_private_test: Skip # Not yet supported. +interface_cycle_test: Skip # Not yet supported. +internal_library_test: Skip # Not yet supported. +keyword_type_expression_test: Skip # Not yet supported. +library_ambiguous_test: Skip # Not yet supported. +list_literal1_test: Skip # Not yet supported. +list_literal_syntax_test: Skip # Not yet supported. +literal_unary_plus_test: Skip # Not yet supported. +malformed2_test: Skip # Not yet supported. +malformed_inheritance_test: Skip # Not yet supported. +malformed_test: Skip # Not yet supported. +map_literal1_test: Skip # Not yet supported. +method_override7_test: Skip # Not yet supported. +method_override8_test: Skip # Not yet supported. +methods_as_constants2_test: Skip # Not yet supported. +missing_const_constructor_test: Skip # Not yet supported. +missing_part_of_tag_test: Skip # Not yet supported. +mixin_black_listed_test: Skip # Not yet supported. +mixin_cyclic_test: Skip # Not yet supported. +mixin_forwarding_constructor4_test: Skip # Not yet supported. +mixin_illegal_constructor_test: Skip # Not yet supported. +mixin_illegal_cycles_test: Skip # Not yet supported. +mixin_illegal_object_test: Skip # Not yet supported. +mixin_illegal_super_use_test: Skip # Not yet supported. +mixin_illegal_superclass_test: Skip # Not yet supported. +mixin_illegal_syntax_test: Skip # Not yet supported. +mixin_invalid_inheritance1_test: Skip # Not yet supported. +mixin_invalid_inheritance2_test: Skip # Not yet supported. +mixin_super_constructor_named_test: Skip # Not yet supported. +mixin_super_constructor_positionals_test: Skip # Not yet supported. +multiline_newline_test: Skip # Not yet supported. +named_constructor_test: Skip # Not yet supported. +named_parameters_aggregated_test: Skip # Not yet supported. +named_parameters_default_eq_test: Skip # Not yet supported. +null_is_test: Skip # Not yet supported. +null_test: Skip # Not yet supported. +number_identifier_test: Skip # Not yet supported. +override_field_test: Skip # Not yet supported. +override_inheritance_mixed_test: Skip # Not yet supported. +override_method_with_field_test: Skip # Not yet supported. +parameter_default_test: Skip # Not yet supported. +parameter_initializer6_negative_test: Skip # Not yet supported. +parser_quirks_test: Skip # Not yet supported. +prefix_assignment_test: Skip # Not yet supported. +prefix_identifier_reference_test: Skip # Not yet supported. +prefix_unqualified_invocation_test: Skip # Not yet supported. +private_super_constructor_test: Skip # Not yet supported. +redirecting_factory_default_values_test: Skip # Not yet supported. +redirecting_factory_infinite_steps_test: Skip # Not yet supported. +ref_before_declaration_test: Skip # Not yet supported. +regress_20394_test: Skip # Not yet supported. +regress_23038_test: Skip # Not yet supported. +regress_23051_test: Skip # Not yet supported. +regress_26855_test: Skip # Not yet supported. +regress_27164_test: Skip # Not yet supported. +regress_27617_test: Skip # Not yet supported. +regress_28217_test: Skip # Not yet supported. +reify_typevar_static_test: Skip # Not yet supported. +scope_variable_test: Skip # Not yet supported. +setter_override2_test: Skip # Not yet supported. +setter_override_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. +super_call3_test: Skip # Not yet supported. +super_conditional_operator_test: Skip # Not yet supported. +switch8_test: Skip # Not yet supported. +switch_bad_case_test: Skip # Not yet supported. +switch_case_test: Skip # Not yet supported. +sync_generator2_test: Skip # Not yet supported. +syntax_test: Skip # Not yet supported. +this_conditional_operator_test: Skip # Not yet supported. +this_test: Skip # Not yet supported. +toplevel_collision1_test: Skip # Not yet supported. +toplevel_collision2_test: Skip # Not yet supported. +try_catch_on_syntax_test: Skip # Not yet supported. +try_catch_syntax_test: Skip # Not yet supported. +try_catch_test: Skip # Not yet supported. +type_check_const_function_typedef2_test: Skip # Not yet supported. +type_parameter_test: Skip # Not yet supported. +type_variable_conflict2_test: Skip # Not yet supported. +type_variable_conflict_test: Skip # Not yet supported. +type_variable_scope3_test: Skip # Not yet supported. +unbalanced_brace_test: Skip # Not yet supported. +unsigned_right_shift_test: Skip # Not yet supported. +unsupported_operators_test: Skip # Not yet supported. +variable_declaration_metadata_test: Skip # Not yet supported. + +# Syntax errors caused by tests being multi-tests. +main_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. +override_inheritance_generic_test: Skip # Not yet supported. +type_variable_bounds2_test: Skip # Not yet supported. + +# Tests containing conditional imports. +conditional_import_string_test: Skip # Not yet supported. +conditional_import_test: Skip # Not yet supported. +config_import_corelib_test: Skip # Not yet supported. +config_import_test: Skip # Not yet supported. + +# Tests using assert in initializer list. +assertion_initializer_test: Skip # Not yet supported. +assertion_initializer_const_error_test: Skip # Not yet supported. +assertion_initializer_const_error2_test: Skip # Not yet supported. +assertion_initializer_const_function_test: Skip # Not yet supported. +assertion_initializer_const_function_error_test: Skip # Not yet supported. + +# Not working for miscellaneous other reasons. +deep_nesting1_negative_test: Skip # Stack overflow, not important here. +deep_nesting2_negative_test: Skip # Stack overflow, not important here. +issue_1751477_test: Skip # Slow: 9 levels, exponential blowup => 430 secs. +metadata_test: Skip # Syntax error, uses metadata on function expression. diff --git a/tests/language_2/language_2_parser.status b/tests/language_2/language_2_parser.status new file mode 100644 index 00000000000..a7c70ed85b0 --- /dev/null +++ b/tests/language_2/language_2_parser.status @@ -0,0 +1,53 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# 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 file specifies the status of tests for runs with spec_parser.dart. +# Note that there are overlaps between groups, because a single test may +# be skipped for more than one reason. As features are added, groups are +# expected to be eliminated entirely, and this would not work if all +# duplicates were removed. + +[ $compiler == parser ] + +# Tests containing intentional syntax errors. +double_invalid_test: Skip # Contains illegaly formatted double. + +# Wrong tests. +built_in_identifier_prefix_test: Skip # A built-in identifier can _not_ be a prefix. + +# Multi-tests containing compile-time errors. +abstract_syntax_test: Skip # Not yet supported. +arg_param_trailing_comma_test: Skip # Not yet supported. +assert_trailing_comma_test: Skip # Not yet supported. +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. +bad_constructor_test: Skip # Not yet supported. +bad_override_test: Skip # Not yet supported. +bad_raw_string_test: Skip # Not yet supported. +bad_typedef_test: Skip # Not yet supported. +black_listed_test: Skip # Not yet supported. +built_in_identifier_illegal_test: Skip # Not yet supported. +canonical_const2_test: Skip # Not yet supported. +canonical_const_test: Skip # Not yet supported. +cascade_test: Skip # Not yet supported. +class_cycle2_test: Skip # Not yet supported. +class_cycle_test: Skip # Not yet supported. +class_keyword_test: Skip # Not yet supported. +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. +get_set_syntax_test: Skip # Not yet supported. + +# Tests using assert in initializer list. +assertion_initializer_test: Skip # Not yet supported. +assertion_initializer_const_error_test: Skip # Not yet supported. +assertion_initializer_const_error2_test: Skip # Not yet supported. +assertion_initializer_const_function_test: Skip # Not yet supported. +assertion_initializer_const_function_error_test: Skip # Not yet supported. + +# Tests using generalized void. +void_type_function_types_test: Skip # Not yet supported. diff --git a/tests/language_strong/language_strong_parser.status b/tests/language_strong/language_strong_parser.status new file mode 100644 index 00000000000..b9a9a9b4e7b --- /dev/null +++ b/tests/language_strong/language_strong_parser.status @@ -0,0 +1,311 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# 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 file specifies the status of tests for runs with spec_parser.dart. +# Note that there are overlaps between groups, because a single test may +# be skipped for more than one reason. As features are added, groups are +# expected to be eliminated entirely, and this would not work if all +# duplicates were removed. + +[ $compiler == parser ] + +# Files causing near-stuck parsing (due to exponential complexity) +issue_1751477_test: Skip # Slow. + +# Negative tests which contain syntax errors. +field3_negative_test: Skip # Test has syntax error. +getter_declaration_negative_test: Skip # Test has syntax error. +interface_injection1_negative_test: Skip # Test has syntax error. +interface_injection2_negative_test: Skip # Test has syntax error. +is_not_class1_negative_test: Skip # Test has syntax error. +is_not_class4_negative_test: Skip # Test has syntax error. +issue1578_negative_test: Skip # Test has syntax error. +label8_negative_test: Skip # Test has syntax error. +list_literal_negative_test: Skip # Test has syntax error. +map_literal_negative_test: Skip # Test has syntax error. +new_expression1_negative_test: Skip # Test has syntax error. +new_expression2_negative_test: Skip # Test has syntax error. +new_expression3_negative_test: Skip # Test has syntax error. +operator1_negative_test: Skip # Test has syntax error. +operator2_negative_test: Skip # Test has syntax error. +prefix18_negative_test: Skip # Test has syntax error. +string_escape4_negative_test: Skip # Test has syntax error. +string_interpolate1_negative_test: Skip # Test has syntax error. +string_interpolate2_negative_test: Skip # Test has syntax error. +string_interpolation1_negative_test: Skip # Test has syntax error. +string_interpolation2_negative_test: Skip # Test has syntax error. +string_interpolation3_negative_test: Skip # Test has syntax error. +string_interpolation4_negative_test: Skip # Test has syntax error. +string_interpolation5_negative_test: Skip # Test has syntax error. +string_interpolation6_negative_test: Skip # Test has syntax error. +switch1_negative_test: Skip # Test has syntax error. +test_negative_test: Skip # Test has syntax error. +unary_plus_negative_test: Skip # Test has syntax error. +unhandled_exception_negative_test: Skip # Test has syntax error. + +# Multi-tests containing compile-time errors. +abstract_syntax_test: Skip # Not yet supported. +arg_param_trailing_comma_test: Skip # Not yet supported. +argument_definition_test: Skip # Not yet supported. +assert_initializer_test: Skip # Not yet supported. +assert_trailing_comma_test: Skip # Not yet supported. +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. +async_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. +bad_typedef_test: Skip # Not yet supported. +black_listed_test: Skip # Not yet supported. +built_in_identifier_illegal_test: Skip # Not yet supported. +canonical_const2_test: Skip # Not yet supported. +canonical_const_test: Skip # Not yet supported. +cascade_test: Skip # Not yet supported. +check_member_static_test: Skip # Not yet supported. +class_cycle2_test: Skip # Not yet supported. +class_cycle_test: Skip # Not yet supported. +class_keyword_test: Skip # Not yet supported. +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. +compile_time_constant_arguments_test: Skip # Not yet supported. +compile_time_constant_c_test: Skip # Not yet supported. +compile_time_constant_checked2_test: Skip # Not yet supported. +compile_time_constant_checked3_test: Skip # Not yet supported. +compile_time_constant_checked4_test: Skip # Not yet supported. +compile_time_constant_checked5_test: Skip # Not yet supported. +compile_time_constant_checked_test: Skip # Not yet supported. +compile_time_constant_o_test: Skip # Not yet supported. +compile_time_constant_p_test: Skip # Not yet supported. +compile_time_constant_r_test: Skip # Not yet supported. +compile_time_constant_test: Skip # Not yet supported. +conditional_method_invocation_test: Skip # Not yet supported. +conditional_property_access_test: Skip # Not yet supported. +conditional_property_assignment_test: Skip # Not yet supported. +const_conditional_test: Skip # Not yet supported. +const_constructor2_test: Skip # Not yet supported. +const_constructor3_test: Skip # Not yet supported. +const_constructor_mixin2_test: Skip # Not yet supported. +const_constructor_mixin3_test: Skip # Not yet supported. +const_constructor_mixin_test: Skip # Not yet supported. +const_constructor_nonconst_field_test: Skip # Not yet supported. +const_constructor_super_test: Skip # Not yet supported. +const_constructor_syntax_test: Skip # Not yet supported. +const_constructor_test: Skip # Not yet supported. +const_error_multiply_initialized_test: Skip # Not yet supported. +const_evaluation_test: Skip # Not yet supported. +const_factory_redirection_test: Skip # Not yet supported. +const_factory_with_body_test: Skip # Not yet supported. +const_for_in_variable_test: Skip # Not yet supported. +const_getter_test: Skip # Not yet supported. +const_init2_test: Skip # Not yet supported. +const_init_test: Skip # Not yet supported. +const_instance_field_test: Skip # Not yet supported. +const_locals_test: Skip # Not yet supported. +const_map2_test: Skip # Not yet supported. +const_map3_test: Skip # Not yet supported. +const_native_factory_test: Skip # Not yet supported. +const_nested_test: Skip # Not yet supported. +const_qq_test: Skip # Not yet supported. +const_string_test: Skip # Not yet supported. +const_switch2_test: Skip # Not yet supported. +const_syntax_test: Skip # Not yet supported. +const_types_test: Skip # Not yet supported. +constant_locals_test: Skip # Not yet supported. +constant_type_literal_test: Skip # Not yet supported. +constants_test: Skip # Not yet supported. +constructor10_test: Skip # Not yet supported. +constructor_duplicate_final_test: Skip # Not yet supported. +constructor_duplicate_initializers_test: Skip # Not yet supported. +constructor_initializer_test: Skip # Not yet supported. +constructor_name_test: Skip # Not yet supported. +constructor_redirect2_test: Skip # Not yet supported. +constructor_redirect_test: Skip # Not yet supported. +constructor_return_test: Skip # Not yet supported. +covariant_test: Skip # Not yet supported. +ct_const2_test: Skip # Not yet supported. +ct_const4_test: Skip # Not yet supported. +ct_const_test: Skip # Not yet supported. +cyclic_class_member_test: Skip # Not yet supported. +cyclic_constructor_test: Skip # Not yet supported. +cyclic_typedef_test: Skip # Not yet supported. +deferred_constraints_constants_test: Skip # Not yet supported. +deferred_duplicate_prefix1_test: Skip # Not yet supported. +deferred_duplicate_prefix2_test: Skip # Not yet supported. +deferred_duplicate_prefix3_test: Skip # Not yet supported. +deferred_inheritance_constraints_test: Skip # Not yet supported. +deferred_load_constants_test: Skip # Not yet supported. +deferred_no_prefix_test: Skip # Not yet supported. +deferred_type_dependency_test: Skip # Not yet supported. +duplicate_constructor_test: Skip # Not yet supported. +duplicate_export_test: Skip # Not yet supported. +duplicate_implements_test: Skip # Not yet supported. +duplicate_interface_negative_test: Skip # Not yet supported. +dynamic2_test: Skip # Not yet supported. +enum_is_keyword_test: Skip # Not yet supported. +enum_syntax_test: Skip # Not yet supported. +export_private_test: Skip # Not yet supported. +external_test: Skip # Not yet supported. +factory2_negative_test: Skip # Not yet supported. +factory3_negative_test: Skip # Not yet supported. +factory_implementation_test: Skip # Not yet supported. +factory_negative_test: Skip # Not yet supported. +factory_redirection2_test: Skip # Not yet supported. +factory_redirection3_cyclic_test: Skip # Not yet supported. +factory_redirection_test: Skip # Not yet supported. +fauxverride_test: Skip # Not yet supported. +field_decl_missing_var_type_test: Skip # Not yet supported. +field_override3_test: Skip # Not yet supported. +field_override4_test: Skip # Not yet supported. +final_initializer_instance_reference_test: Skip # Not yet supported. +final_is_not_const_test: Skip # Not yet supported. +final_syntax_test: Skip # Not yet supported. +function_syntax_test: Skip # Not yet supported. +function_type_alias5_test: Skip # Not yet supported. +function_type_alias6_test: Skip # Not yet supported. +function_type_alias7_test: Skip # Not yet supported. +function_type_alias9_test: Skip # Not yet supported. +function_type_parameter2_negative_test: Skip # Not yet supported. +function_type_parameter_negative_test: Skip # Not yet supported. +function_type_test: Skip # Not yet supported. +generic_function_typedef2_test: Skip # Not yet supported. +generic_function_typedef_test: Skip # Not yet supported. +generic_metadata_test: Skip # Not yet supported. +get_set_syntax_test: Skip # Not yet supported. +getter_no_setter2_test: Skip # Not yet supported. +getter_no_setter_test: Skip # Not yet supported. +getter_override2_test: Skip # Not yet supported. +getter_override_test: Skip # Not yet supported. +getter_parameters_test: Skip # Not yet supported. +identical_const_test: Skip # Not yet supported. +if_null_assignment_behavior_test: Skip # Not yet supported. +illegal_declaration_test: Skip # Not yet supported. +illegal_initializer_test: Skip # Not yet supported. +illegal_invocation_test: Skip # Not yet supported. +import_private_test: Skip # Not yet supported. +interface_cycle_test: Skip # Not yet supported. +internal_library_test: Skip # Not yet supported. +keyword_type_expression_test: Skip # Not yet supported. +library_ambiguous_test: Skip # Not yet supported. +list_literal1_test: Skip # Not yet supported. +list_literal_syntax_test: Skip # Not yet supported. +literal_unary_plus_test: Skip # Not yet supported. +malformed2_test: Skip # Not yet supported. +malformed_inheritance_test: Skip # Not yet supported. +malformed_test: Skip # Not yet supported. +map_literal1_test: Skip # Not yet supported. +method_override7_test: Skip # Not yet supported. +method_override8_test: Skip # Not yet supported. +methods_as_constants2_test: Skip # Not yet supported. +missing_const_constructor_test: Skip # Not yet supported. +missing_part_of_tag_test: Skip # Not yet supported. +mixin_black_listed_test: Skip # Not yet supported. +mixin_cyclic_test: Skip # Not yet supported. +mixin_forwarding_constructor4_test: Skip # Not yet supported. +mixin_illegal_constructor_test: Skip # Not yet supported. +mixin_illegal_cycles_test: Skip # Not yet supported. +mixin_illegal_object_test: Skip # Not yet supported. +mixin_illegal_super_use_test: Skip # Not yet supported. +mixin_illegal_superclass_test: Skip # Not yet supported. +mixin_illegal_syntax_test: Skip # Not yet supported. +mixin_invalid_inheritance1_test: Skip # Not yet supported. +mixin_invalid_inheritance2_test: Skip # Not yet supported. +mixin_super_constructor_named_test: Skip # Not yet supported. +mixin_super_constructor_positionals_test: Skip # Not yet supported. +multiline_newline_test: Skip # Not yet supported. +named_constructor_test: Skip # Not yet supported. +named_parameters_aggregated_test: Skip # Not yet supported. +named_parameters_default_eq_test: Skip # Not yet supported. +null_is_test: Skip # Not yet supported. +null_test: Skip # Not yet supported. +number_identifier_test: Skip # Not yet supported. +override_field_test: Skip # Not yet supported. +override_inheritance_mixed_test: Skip # Not yet supported. +override_method_with_field_test: Skip # Not yet supported. +parameter_default_test: Skip # Not yet supported. +parameter_initializer6_negative_test: Skip # Not yet supported. +parser_quirks_test: Skip # Not yet supported. +prefix_assignment_test: Skip # Not yet supported. +prefix_identifier_reference_test: Skip # Not yet supported. +prefix_unqualified_invocation_test: Skip # Not yet supported. +private_super_constructor_test: Skip # Not yet supported. +redirecting_factory_default_values_test: Skip # Not yet supported. +redirecting_factory_infinite_steps_test: Skip # Not yet supported. +ref_before_declaration_test: Skip # Not yet supported. +regress_20394_test: Skip # Not yet supported. +regress_23038_test: Skip # Not yet supported. +regress_23051_test: Skip # Not yet supported. +regress_26855_test: Skip # Not yet supported. +regress_27164_test: Skip # Not yet supported. +regress_27617_test: Skip # Not yet supported. +regress_28217_test: Skip # Not yet supported. +reify_typevar_static_test: Skip # Not yet supported. +scope_variable_test: Skip # Not yet supported. +setter_override2_test: Skip # Not yet supported. +setter_override_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. +super_call3_test: Skip # Not yet supported. +super_conditional_operator_test: Skip # Not yet supported. +switch8_test: Skip # Not yet supported. +switch_bad_case_test: Skip # Not yet supported. +switch_case_test: Skip # Not yet supported. +sync_generator2_test: Skip # Not yet supported. +syntax_test: Skip # Not yet supported. +this_conditional_operator_test: Skip # Not yet supported. +this_test: Skip # Not yet supported. +toplevel_collision1_test: Skip # Not yet supported. +toplevel_collision2_test: Skip # Not yet supported. +try_catch_on_syntax_test: Skip # Not yet supported. +try_catch_syntax_test: Skip # Not yet supported. +try_catch_test: Skip # Not yet supported. +type_check_const_function_typedef2_test: Skip # Not yet supported. +type_parameter_test: Skip # Not yet supported. +type_variable_conflict2_test: Skip # Not yet supported. +type_variable_conflict_test: Skip # Not yet supported. +type_variable_scope3_test: Skip # Not yet supported. +unbalanced_brace_test: Skip # Not yet supported. +unsigned_right_shift_test: Skip # Not yet supported. +unsupported_operators_test: Skip # Not yet supported. +variable_declaration_metadata_test: Skip # Not yet supported. + +# Syntax errors caused by tests being multi-tests. +main_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. +override_inheritance_generic_test: Skip # Not yet supported. +type_variable_bounds2_test: Skip # Not yet supported. + +# Tests containing conditional imports. +conditional_import_string_test: Skip # Not yet supported. +conditional_import_test: Skip # Not yet supported. +config_import_corelib_test: Skip # Not yet supported. +config_import_test: Skip # Not yet supported. + +# Tests using assert in initializer list. +assertion_initializer_test: Skip # Not yet supported. +assertion_initializer_const_error_test: Skip # Not yet supported. +assertion_initializer_const_error2_test: Skip # Not yet supported. +assertion_initializer_const_function_test: Skip # Not yet supported. +assertion_initializer_const_function_error_test: Skip # Not yet supported. + +# Not working for miscellaneous other reasons. +deep_nesting1_negative_test: Skip # Stack overflow, not important here. +deep_nesting2_negative_test: Skip # Stack overflow, not important here. +issue_1751477_test: Skip # Slow: 9 levels, exponential blowup => 430 secs. +metadata_test: Skip # Syntax error, uses metadata on function expression. diff --git a/tools/spec_parser/.gitignore b/tools/spec_parser/.gitignore new file mode 100644 index 00000000000..58106522710 --- /dev/null +++ b/tools/spec_parser/.gitignore @@ -0,0 +1,5 @@ +*Lexer.java +*Parser.java +*.tokens +*.class +*.dot diff --git a/tools/spec_parser/Makefile b/tools/spec_parser/Makefile new file mode 100644 index 00000000000..f91e7d3e366 --- /dev/null +++ b/tools/spec_parser/Makefile @@ -0,0 +1,34 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# 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. + +GRAMMAR=../../docs/language/Dart.g +JAVA_PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin +JAVA=$(JAVA_PATH)/java +JAVAC=javac +ANTLR_JAR=/usr/share/java/antlr3-runtime.jar +ANTLR_FILES=DartLexer.java DartParser.java Dart.tokens +ANTLR_CMD=PATH=$(JAVA_PATH):$(PATH) antlr3 -dfa -fo . $< +JAVA_FILES=DartLexer.java DartParser.java +CLASS_FILES=SpecParser.class SpecParserRunner.class DartLexer.class DartParser.class + +.PHONY: default parser clean touch parse_hello + +default: $(JAVA_FILES) + +parser: SpecParser.class + +SpecParser.class: $(ANTLR_FILES) SpecParser.java + $(JAVAC) -cp .:$(ANTLR_JAR) SpecParser.java + +%Lexer.java: ../../docs/language/%.g Makefile ; $(ANTLR_CMD) + +%Parser.java: ../../docs/language/%.g Makefile ; $(ANTLR_CMD) + +%.tokens: ../../docs/language/%.g Makefile ; $(ANTLR_CMD) + +clean: + rm -f $(CLASS_FILES) $(ANTLR_FILES) + +touch: + touch $(GRAMMAR) diff --git a/tools/spec_parser/SpecParser.java b/tools/spec_parser/SpecParser.java new file mode 100644 index 00000000000..ad08cb2349d --- /dev/null +++ b/tools/spec_parser/SpecParser.java @@ -0,0 +1,32 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// 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. + +import org.antlr.runtime.*; + +/// Class for `main` which will parse files given as command line arguments. +public class SpecParser { + static boolean verbose = false; + + public static void main(String[] args) throws Exception { + if (args.length == 0) { + System.err.println("Expected a file path as argument."); + System.exit(1); + } + for (int i = 0; i < args.length; i++) { + String filePath = args[i]; + if (filePath.equals("--verbose")) { + verbose = true; + continue; + } + CharStream charStream = new ANTLRFileStream(filePath); + DartLexer lexer = new DartLexer(charStream); + CommonTokenStream tokens = new CommonTokenStream(lexer); + DartParser parser = new DartParser(tokens); + DartParser.filePath = filePath; + DartParser.filePathHasBeenPrinted = false; + if (verbose) System.err.println(">>> Parsing file: " + filePath); + parser.libraryDefinition(); + } + } +} diff --git a/tools/spec_parser/SpecParserRunner.java b/tools/spec_parser/SpecParserRunner.java new file mode 100644 index 00000000000..33308528d51 --- /dev/null +++ b/tools/spec_parser/SpecParserRunner.java @@ -0,0 +1,27 @@ +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// 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. + +import java.util.Scanner; +import java.util.List; +import java.util.ArrayList; + +/// Class for `main` which will parse files given as lines on stdio. +public class SpecParserRunner { + public static void main(String[] args) throws Exception { + if (args.length != 0) { + System.err.println("No command line arguments expected."); + System.err.println("Files to parse are accepted on the standard input."); + System.exit(1); + } + + Scanner scanner = new Scanner(System.in); + String[] filenames = new String[1]; + while (scanner.hasNextLine()) { + String filename = scanner.nextLine().trim(); + filenames[0] = filename; + System.out.println("---------- " + filename + " ----------"); + SpecParser.main(filenames); + } + } +} diff --git a/tools/spec_parser/spec_parse.dart b/tools/spec_parser/spec_parse.dart new file mode 100755 index 00000000000..d94ce95beef --- /dev/null +++ b/tools/spec_parser/spec_parse.dart @@ -0,0 +1,24 @@ +#!/usr/bin/env dart +// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +// 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. + +import 'dart:io'; + +const String ClassPath = '.:/usr/share/java/antlr3-runtime.jar'; +const String MainClass = 'SpecParser'; +const String JavaExecutable = 'java'; + +main([arguments]) { + for (String arg in arguments) { + handleResult(ProcessResult result) { + if (result.stderr.length != 0) { + print('Error parsing $arg:\n${result.stderr}'); + } + print(result.stdout); + } + + List javaArguments = ['-cp', ClassPath, MainClass, arg]; + Process.run(JavaExecutable, javaArguments).then(handleResult); + } +}