feat(ExpressionParser): add support for this
This commit is contained in:

committed by
Alex Rickabaugh

parent
26c9e1dc70
commit
0ca05eee45
@ -8,7 +8,6 @@
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import * as chars from '../chars';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {NumberWrapper, StringJoiner, StringWrapper, isPresent} from '../facade/lang';
|
||||
|
||||
export enum TokenType {
|
||||
@ -21,7 +20,7 @@ export enum TokenType {
|
||||
Error
|
||||
}
|
||||
|
||||
const KEYWORDS = ['var', 'let', 'null', 'undefined', 'true', 'false', 'if', 'else'];
|
||||
const KEYWORDS = ['var', 'let', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
|
||||
|
||||
@Injectable()
|
||||
export class Lexer {
|
||||
@ -74,6 +73,8 @@ export class Token {
|
||||
|
||||
isKeywordFalse(): boolean { return this.type == TokenType.Keyword && this.strValue == 'false'; }
|
||||
|
||||
isKeywordThis(): boolean { return this.type == TokenType.Keyword && this.strValue == 'this'; }
|
||||
|
||||
isError(): boolean { return this.type == TokenType.Error; }
|
||||
|
||||
toNumber(): number { return this.type == TokenType.Number ? this.numValue : -1; }
|
||||
|
Reference in New Issue
Block a user