diff --git a/packages/adl/compiler/parser.ts b/packages/adl/compiler/parser.ts index 861e95eab..2d67ace10 100644 --- a/packages/adl/compiler/parser.ts +++ b/packages/adl/compiler/parser.ts @@ -41,11 +41,6 @@ export function parse(code: string) { return parseModelStatement(decorators); case Kind.InterfaceKeyword: return parseInterfaceStatement(decorators); - case Kind.AliasKeyword: - if (decorators.length > 0) { - error('Cannot decorate an alias statement'); - } - return parseAliasStatement(); case Kind.Semicolon: if (decorators.length > 0) { error('Cannot decorate an empty statement'); @@ -550,23 +545,6 @@ export function parse(code: string) { }, pos); } - function parseAliasStatement(): Types.AliasStatementNode { - const pos = tokenPos(); - parseExpected(Kind.AliasKeyword); - - const id = parseIdentifier(); - parseExpected(Kind.Colon); - - const target = parseExpression(); - parseExpected(Kind.Semicolon); - - return finishNode({ - kind: Types.SyntaxKind.AliasStatement, - id, - target - }, pos); - } - // utility functions function token() { return scanner.token; @@ -668,9 +646,6 @@ export function visitChildren(node: Types.Node, cb: NodeCb): T | undefined switch (node.kind) { case Types.SyntaxKind.ADLScript: return visitEach(cb, (node).statements); - case Types.SyntaxKind.AliasStatement: - return visitNode(cb, (node).id) || - visitNode(cb, (node).target); case Types.SyntaxKind.ArrayExpression: return visitNode(cb, (node).elementType); case Types.SyntaxKind.DecoratorExpression: diff --git a/packages/adl/compiler/scanner.ts b/packages/adl/compiler/scanner.ts index 88fb9f31d..8a1a179fa 100644 --- a/packages/adl/compiler/scanner.ts +++ b/packages/adl/compiler/scanner.ts @@ -121,7 +121,6 @@ export enum Kind { ImportKeyword, ModelKeyword, InterfaceKeyword, - AliasKeyword, TrueKeyword, FalseKeyword } @@ -130,7 +129,6 @@ const keywords = new Map([ ['import', Kind.ImportKeyword], ['model', Kind.ModelKeyword], ['interface', Kind.InterfaceKeyword], - ['alias', Kind.AliasKeyword], ['true', Kind.TrueKeyword], ['false', Kind.FalseKeyword] ]); diff --git a/packages/adl/compiler/types.ts b/packages/adl/compiler/types.ts index 0c60b9399..6baf0161e 100644 --- a/packages/adl/compiler/types.ts +++ b/packages/adl/compiler/types.ts @@ -122,7 +122,6 @@ export enum SyntaxKind { StringLiteral, NumericLiteral, BooleanLiteral, - AliasStatement, TemplateApplication, TemplateParameterDeclaration } @@ -142,8 +141,7 @@ export interface ADLScriptNode extends Node { export type Statement = | ImportStatementNode | ModelStatementNode - | InterfaceStatementNode - | AliasStatementNode; + | InterfaceStatementNode; export interface ImportStatementNode extends Node { kind: SyntaxKind.ImportStatement; @@ -271,12 +269,6 @@ export interface IntersectionExpressionNode extends Node { options: Array; } -export interface AliasStatementNode extends Node { - kind: SyntaxKind.AliasStatement; - id: IdentifierNode; - target: Expression; -} - export interface TemplateApplicationNode extends Node { kind: SyntaxKind.TemplateApplication; target: Expression; diff --git a/packages/adl/language.grammar b/packages/adl/language.grammar index 437583094..7ef3cccd2 100644 --- a/packages/adl/language.grammar +++ b/packages/adl/language.grammar @@ -25,7 +25,6 @@ Keyword : `import` `model` `interface` - `alias` Identifier : IdentifierName but not Keyword @@ -182,7 +181,6 @@ StatementList : Statement : ImportStatement - AliasStatement ModelStatement InterfaceStatement @@ -194,9 +192,6 @@ NamedImports : Identifier NamedImports `,` Identifier -AliasStatement : - `alias` Identifier `:` Expression `;` - ModelStatement : DecoratorList? `model` Identifier `{` ModelBody? `}` DecoratorList? `model` Identifier `=` Expression `;` diff --git a/packages/adl/language.md b/packages/adl/language.md index 2344a5b8c..9ee0b3271 100644 --- a/packages/adl/language.md +++ b/packages/adl/language.md @@ -22,7 +22,6 @@    `` import ``    `` model ``    `` interface `` -   `` alias ``   *Identifier* **:**    *[IdentifierName](#IdentifierName)* **but not** *[Keyword](#Keyword)* @@ -168,7 +167,6 @@   *Statement* **:**    *[ImportStatement](#ImportStatement)* -   *[AliasStatement](#AliasStatement)*    *[ModelStatement](#ModelStatement)*    *[InterfaceStatement](#InterfaceStatement)* @@ -180,9 +178,6 @@    *[Identifier](#Identifier)*    *[NamedImports](#NamedImports)* `` , `` *[Identifier](#Identifier)* -  *AliasStatement* **:** -   `` alias `` *[Identifier](#Identifier)* `` : `` *[Expression](#Expression)* `` ; `` -   *ModelStatement* **:**    *[DecoratorList](#DecoratorList)*opt `` model `` *[Identifier](#Identifier)* `` { `` *[ModelBody](#ModelBody)*opt `` } ``    *[DecoratorList](#DecoratorList)*opt `` model `` *[Identifier](#Identifier)* `` = `` *[Expression](#Expression)* `` ; `` diff --git a/packages/adl/test/test-parser.ts b/packages/adl/test/test-parser.ts index fd7b3e0d5..aa724389e 100644 --- a/packages/adl/test/test-parser.ts +++ b/packages/adl/test/test-parser.ts @@ -155,14 +155,6 @@ describe('syntax', () => { ]); }); - describe('alias statements', () => { - parseEach([ - 'alias MyAlias : SomethingElse;', - 'alias MyAlias : { constantProperty: 4 };', - 'alias MyAlias : [ string, number ];' - ]); - }); - describe('multiple statements', () => { parseEach([` model A { };