Add `op` keyword for namespace properties
This commit is contained in:
Родитель
f056c012e4
Коммит
4f704c9cc3
|
@ -109,6 +109,7 @@ export function parse(code: string) {
|
|||
|
||||
function parseNamespaceProperty(decorators: Array<Types.DecoratorExpressionNode>): Types.NamespacePropertyNode {
|
||||
const pos = tokenPos();
|
||||
parseExpected(Token.OpKeyword);
|
||||
const id = parseIdentifier();
|
||||
parseExpected(Token.OpenParen);
|
||||
const modelPos = tokenPos();
|
||||
|
|
|
@ -49,6 +49,7 @@ export enum Token {
|
|||
ImportKeyword,
|
||||
ModelKeyword,
|
||||
NamespaceKeyword,
|
||||
OpKeyword,
|
||||
TrueKeyword,
|
||||
FalseKeyword
|
||||
}
|
||||
|
@ -57,6 +58,7 @@ const keywords = new Map([
|
|||
['import', Token.ImportKeyword],
|
||||
['model', Token.ModelKeyword],
|
||||
['namespace', Token.NamespaceKeyword],
|
||||
['op', Token.OpKeyword],
|
||||
['true', Token.TrueKeyword],
|
||||
['false', Token.FalseKeyword]
|
||||
]);
|
||||
|
|
|
@ -25,6 +25,7 @@ Keyword :
|
|||
`import`
|
||||
`model`
|
||||
`namespace`
|
||||
`op`
|
||||
|
||||
Identifier :
|
||||
IdentifierName but not Keyword
|
||||
|
@ -223,7 +224,7 @@ NamespacePropertyList :
|
|||
NamespacePropertyList `;` NamespaceProperty
|
||||
|
||||
NamespaceProperty :
|
||||
DecoratorList? Identifier `(` ModelPropertyList? `)` `:` Expression
|
||||
DecoratorList? `op` Identifier `(` ModelPropertyList? `)` `:` Expression
|
||||
|
||||
Expression :
|
||||
UnionExpressionOrHigher
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
   <a name="Keyword-0330acf5"></a>`` import ``
|
||||
   <a name="Keyword-fa60d604"></a>`` model ``
|
||||
   <a name="Keyword-94f12ff9"></a>`` namespace ``
|
||||
   <a name="Keyword-c93383ad"></a>`` op ``
|
||||
|
||||
  <a name="Identifier"></a>*Identifier* **:**
|
||||
   <a name="Identifier-11758399"></a>*[IdentifierName](#IdentifierName)* **but not** *[Keyword](#Keyword)*
|
||||
|
@ -209,7 +210,7 @@
|
|||
   <a name="NamespacePropertyList-89234f4f"></a>*[NamespacePropertyList](#NamespacePropertyList)* `` ; `` *[NamespaceProperty](#NamespaceProperty)*
|
||||
|
||||
  <a name="NamespaceProperty"></a>*NamespaceProperty* **:**
|
||||
   <a name="NamespaceProperty-6e1a4442"></a>*[DecoratorList](#DecoratorList)*<sub>opt</sub> *[Identifier](#Identifier)* `` ( `` *[ModelPropertyList](#ModelPropertyList)*<sub>opt</sub> `` ) `` `` : `` *[Expression](#Expression)*
|
||||
   <a name="NamespaceProperty-bdb0dff6"></a>*[DecoratorList](#DecoratorList)*<sub>opt</sub> `` op `` *[Identifier](#Identifier)* `` ( `` *[ModelPropertyList](#ModelPropertyList)*<sub>opt</sub> `` ) `` `` : `` *[Expression](#Expression)*
|
||||
|
||||
  <a name="Expression"></a>*Expression* **:**
|
||||
   <a name="Expression-3936659b"></a>*[UnionExpressionOrHigher](#UnionExpressionOrHigher)*
|
||||
|
|
Загрузка…
Ссылка в новой задаче