angular/tools/transpiler/src/parser.js

24 lines
961 B
JavaScript
Raw Normal View History

2014-09-25 21:30:10 +00:00
import {Parser as TraceurParser} from 'traceur/src/syntax/Parser';
import {SyntaxErrorReporter} from 'traceur/src/util/SyntaxErrorReporter';
import {TypeName, ImportSpecifier, ImportedBinding, BindingIdentifier} from 'traceur/src/syntax/trees/ParseTrees';
import {PERIOD, IMPORT, STAR, AS, FROM, CLOSE_ANGLE, OPEN_ANGLE, COMMA, OPEN_CURLY, CLOSE_CURLY, COLON} from 'traceur/src/syntax/TokenType';
export class Parser extends TraceurParser {
constructor(file, errorReporter = new SyntaxErrorReporter(), options) {
super(file, errorReporter, options);
2014-09-25 21:30:10 +00:00
}
// TODO: add support for object type literals to traceur!
2014-09-25 21:30:10 +00:00
parseObjectType_() {
this.eat_(OPEN_CURLY);
2014-09-25 21:30:10 +00:00
do {
var identifier = this.eatId_();
this.eat_(COLON);
var type = this.parseNamedOrPredefinedType_();
var typeParameters = this.parseTypeParametersOpt_();
// TODO(misko): save the type information
2014-09-25 21:30:10 +00:00
} while (this.eatIf_(COMMA));
this.eat_(CLOSE_CURLY);
}
2014-10-11 03:44:55 +00:00
}