Hi John!
I am working on a migration thesis (for my phd). I happen to be doing a model on angular with typescript.
I am using the available typescript parser and parsing examples i learned that there are some missing features:
Classes can be abstract
Classes, methods, properties can be decorated ( this decoration look pretty much as a Java/C# annotation ).
I have managed to modify the existing grammar of js/jax/ts to support this specific cases.
Still i am not sure if the changes are smart enough, since i am kind of a newbie :).
I would like you to peek an eye on it, and point me where it can be enhanced if it is the case, to be able to contribute. After all i am using smacc since some years now, i would like to give back some happiness.
Hi John! I am working on a migration thesis (for my phd). I happen to be doing a model on angular with typescript. I am using the available typescript parser and parsing examples i learned that there are some missing features:
I have managed to modify the existing grammar of js/jax/ts to support this specific cases. Still i am not sure if the changes are smart enough, since i am kind of a newbie :).
I would like you to peek an eye on it, and point me where it can be enhanced if it is the case, to be able to contribute. After all i am using smacc since some years now, i would like to give back some happiness.
Here the details:
default
: abstract
;
ClassDeclaration
: 'abstract'? 'classToken' Identifier 'name'? ClassTail {{ClassExpression}} ##
Adds a Decorator expression for interpreting the @Decorators of Typescript
DecoratorExpression #TS default
: @
;
DecoratorExpression
: CallExpression 'decorator' {{DecoratorExpression}}
;
CallExpression
: MemberExpression 'expression' Arguments {{}} ##
| SuperCall
| ImportCall
| DecoratorExpression
| ........
;
Attach decorator expressions before each 'decorable' thing:
ConstructorDeclaration : DecoratorExpression 'decorator' ? AccessibilityModifier 'modifier'? 'constructorToken' 'leftParen' FormalParameters 'rightParen' 'leftBrace' FunctionBody 'rightBrace' {{}} ## changed ParameterList
| DecoratorExpression 'decorator' ? AccessibilityModifier 'modifier'? 'constructorToken' 'leftParen' FormalParameters 'rightParen' 'semicolon' {{}} ## changed ParameterList
;
MemberVariableDeclaration
: DecoratorExpression 'decorator'? AccessibilityModifier 'modifier'? 'staticToken'? PropertyName 'name' TypeAnnotation? Initializer? 'semicolon' {{}}
;
MemberFunctionDeclaration
: DecoratorExpression 'decorator'? AccessibilityModifier 'modifier'? 'staticToken'? PropertyName 'name' CallSignature 'signature' 'leftBrace' FunctionBody 'rightBrace' {{}}
| DecoratorExpression 'decorator'? AccessibilityModifier 'modifier'? 'staticToken'? PropertyName 'name' CallSignature 'signature' 'semicolon' {{}}
;
MemberAccessorDeclaration
: DecoratorExpression 'decorator'? AccessibilityModifier 'modifier'? 'staticToken'? GetAccessor 'accessor' {{}}
| DecoratorExpression 'decorator'? AccessibilityModifier 'modifier'? 'staticToken'? SetAccessor 'accessor' {{}}
;