json-string-mapper
Version:
transform json string to key value pair map
751 lines (749 loc) • 32.7 kB
JavaScript
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as chars from './chars';
import { escapeRegExp, isBlank, isPresent } from '../facade/lang';
import { DEFAULT_INTERPOLATION_CONFIG } from './interpolation-config';
import { ASTWithSource, Binary, BindingPipe, Chain, Conditional, EmptyExpr, FunctionCall, ImplicitReceiver, Interpolation, KeyedRead, KeyedWrite, LiteralArray, LiteralMap, LiteralPrimitive, MethodCall, ParseSpan, ParserError, PrefixNot, PropertyRead, PropertyWrite, Quote, SafeMethodCall, SafePropertyRead, TemplateBinding } from './ast';
import { EOF, TokenType, isIdentifier, isQuote } from './lexer';
var SplitInterpolation = (function () {
function SplitInterpolation(strings, expressions, offsets) {
this.strings = strings;
this.expressions = expressions;
this.offsets = offsets;
}
return SplitInterpolation;
}());
export { SplitInterpolation };
var TemplateBindingParseResult = (function () {
function TemplateBindingParseResult(templateBindings, warnings, errors) {
this.templateBindings = templateBindings;
this.warnings = warnings;
this.errors = errors;
}
return TemplateBindingParseResult;
}());
export { TemplateBindingParseResult };
function _createInterpolateRegExp(config) {
var pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
return new RegExp(pattern, 'g');
}
var Parser = (function () {
function Parser(_lexer) {
this._lexer = _lexer;
this.errors = [];
}
Parser.prototype.parseAction = function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
this._checkNoInterpolation(input, location, interpolationConfig);
var sourceToLex = this._stripComments(input);
var tokens = this._lexer.tokenize(this._stripComments(input));
var ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length)
.parseChain();
return new ASTWithSource(ast, input, location, this.errors);
};
Parser.prototype.parseBinding = function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var ast = this._parseBindingAst(input, location, interpolationConfig);
return new ASTWithSource(ast, input, location, this.errors);
};
Parser.prototype.parseSimpleBinding = function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var ast = this._parseBindingAst(input, location, interpolationConfig);
var errors = SimpleExpressionChecker.check(ast);
if (errors.length > 0) {
this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
}
return new ASTWithSource(ast, input, location, this.errors);
};
Parser.prototype._reportError = function (message, input, errLocation, ctxLocation) {
this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
};
Parser.prototype._parseBindingAst = function (input, location, interpolationConfig) {
// Quotes expressions use 3rd-party expression language. We don't want to use
// our lexer or parser for that, so we check for that ahead of time.
var quote = this._parseQuote(input, location);
if (isPresent(quote)) {
return quote;
}
this._checkNoInterpolation(input, location, interpolationConfig);
var sourceToLex = this._stripComments(input);
var tokens = this._lexer.tokenize(sourceToLex);
return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length)
.parseChain();
};
Parser.prototype._parseQuote = function (input, location) {
if (isBlank(input))
return null;
var prefixSeparatorIndex = input.indexOf(':');
if (prefixSeparatorIndex == -1)
return null;
var prefix = input.substring(0, prefixSeparatorIndex).trim();
if (!isIdentifier(prefix))
return null;
var uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location);
};
Parser.prototype.parseTemplateBindings = function (prefixToken, input, location) {
var tokens = this._lexer.tokenize(input);
if (prefixToken) {
// Prefix the tokens with the tokens from prefixToken but have them take no space (0 index).
var prefixTokens = this._lexer.tokenize(prefixToken).map(function (t) {
t.index = 0;
return t;
});
tokens.unshift.apply(tokens, prefixTokens);
}
return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0)
.parseTemplateBindings();
};
Parser.prototype.parseInterpolation = function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var split = this.splitInterpolation(input, location, interpolationConfig);
if (split == null)
return null;
var expressions = [];
for (var i = 0; i < split.expressions.length; ++i) {
var expressionText = split.expressions[i];
var sourceToLex = this._stripComments(expressionText);
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
var ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length))
.parseChain();
expressions.push(ast);
}
return new ASTWithSource(new Interpolation(new ParseSpan(0, isBlank(input) ? 0 : input.length), split.strings, expressions), input, location, this.errors);
};
Parser.prototype.splitInterpolation = function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var regexp = _createInterpolateRegExp(interpolationConfig);
var parts = input.split(regexp);
if (parts.length <= 1) {
return null;
}
var strings = [];
var expressions = [];
var offsets = [];
var offset = 0;
for (var i = 0; i < parts.length; i++) {
var part = parts[i];
if (i % 2 === 0) {
// fixed string
strings.push(part);
offset += part.length;
}
else if (part.trim().length > 0) {
offset += interpolationConfig.start.length;
expressions.push(part);
offsets.push(offset);
offset += part.length + interpolationConfig.end.length;
}
else {
this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location);
expressions.push('$implict');
offsets.push(offset);
}
}
return new SplitInterpolation(strings, expressions, offsets);
};
Parser.prototype.wrapLiteralPrimitive = function (input, location) {
return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, isBlank(input) ? 0 : input.length), input), input, location, this.errors);
};
Parser.prototype._stripComments = function (input) {
var i = this._commentStart(input);
return isPresent(i) ? input.substring(0, i).trim() : input;
};
Parser.prototype._commentStart = function (input) {
var outerQuote = null;
for (var i = 0; i < input.length - 1; i++) {
var char = input.charCodeAt(i);
var nextChar = input.charCodeAt(i + 1);
if (char === chars.$SLASH && nextChar == chars.$SLASH && isBlank(outerQuote))
return i;
if (outerQuote === char) {
outerQuote = null;
}
else if (isBlank(outerQuote) && isQuote(char)) {
outerQuote = char;
}
}
return null;
};
Parser.prototype._checkNoInterpolation = function (input, location, interpolationConfig) {
var regexp = _createInterpolateRegExp(interpolationConfig);
var parts = input.split(regexp);
if (parts.length > 1) {
this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location);
}
};
Parser.prototype._findInterpolationErrorColumn = function (parts, partInErrIdx, interpolationConfig) {
var errLocation = '';
for (var j = 0; j < partInErrIdx; j++) {
errLocation += j % 2 === 0 ?
parts[j] :
"" + interpolationConfig.start + parts[j] + interpolationConfig.end;
}
return errLocation.length;
};
return Parser;
}());
export { Parser };
var _ParseAST = (function () {
function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) {
this.input = input;
this.location = location;
this.tokens = tokens;
this.inputLength = inputLength;
this.parseAction = parseAction;
this.errors = errors;
this.offset = offset;
this.rparensExpected = 0;
this.rbracketsExpected = 0;
this.rbracesExpected = 0;
this.index = 0;
}
_ParseAST.prototype.peek = function (offset) {
var i = this.index + offset;
return i < this.tokens.length ? this.tokens[i] : EOF;
};
Object.defineProperty(_ParseAST.prototype, "next", {
get: function () { return this.peek(0); },
enumerable: true,
configurable: true
});
Object.defineProperty(_ParseAST.prototype, "inputIndex", {
get: function () {
return (this.index < this.tokens.length) ? this.next.index + this.offset :
this.inputLength + this.offset;
},
enumerable: true,
configurable: true
});
_ParseAST.prototype.span = function (start) { return new ParseSpan(start, this.inputIndex); };
_ParseAST.prototype.advance = function () { this.index++; };
_ParseAST.prototype.optionalCharacter = function (code) {
if (this.next.isCharacter(code)) {
this.advance();
return true;
}
else {
return false;
}
};
_ParseAST.prototype.peekKeywordLet = function () { return this.next.isKeywordLet(); };
_ParseAST.prototype.expectCharacter = function (code) {
if (this.optionalCharacter(code))
return;
this.error("Missing expected " + String.fromCharCode(code));
};
_ParseAST.prototype.optionalOperator = function (op) {
if (this.next.isOperator(op)) {
this.advance();
return true;
}
else {
return false;
}
};
_ParseAST.prototype.expectOperator = function (operator) {
if (this.optionalOperator(operator))
return;
this.error("Missing expected operator " + operator);
};
_ParseAST.prototype.expectIdentifierOrKeyword = function () {
var n = this.next;
if (!n.isIdentifier() && !n.isKeyword()) {
this.error("Unexpected token " + n + ", expected identifier or keyword");
return '';
}
this.advance();
return n.toString();
};
_ParseAST.prototype.expectIdentifierOrKeywordOrString = function () {
var n = this.next;
if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
this.error("Unexpected token " + n + ", expected identifier, keyword, or string");
return '';
}
this.advance();
return n.toString();
};
_ParseAST.prototype.parseChain = function () {
var exprs = [];
var start = this.inputIndex;
while (this.index < this.tokens.length) {
var expr = this.parsePipe();
exprs.push(expr);
if (this.optionalCharacter(chars.$SEMICOLON)) {
if (!this.parseAction) {
this.error('Binding expression cannot contain chained expression');
}
while (this.optionalCharacter(chars.$SEMICOLON)) {
} // read all semicolons
}
else if (this.index < this.tokens.length) {
this.error("Unexpected token '" + this.next + "'");
}
}
if (exprs.length == 0)
return new EmptyExpr(this.span(start));
if (exprs.length == 1)
return exprs[0];
return new Chain(this.span(start), exprs);
};
_ParseAST.prototype.parsePipe = function () {
var result = this.parseExpression();
if (this.optionalOperator('|')) {
if (this.parseAction) {
this.error('Cannot have a pipe in an action expression');
}
do {
var name_1 = this.expectIdentifierOrKeyword();
var args = [];
while (this.optionalCharacter(chars.$COLON)) {
args.push(this.parseExpression());
}
result = new BindingPipe(this.span(result.span.start), result, name_1, args);
} while (this.optionalOperator('|'));
}
return result;
};
_ParseAST.prototype.parseExpression = function () { return this.parseConditional(); };
_ParseAST.prototype.parseConditional = function () {
var start = this.inputIndex;
var result = this.parseLogicalOr();
if (this.optionalOperator('?')) {
var yes = this.parsePipe();
var no = void 0;
if (!this.optionalCharacter(chars.$COLON)) {
var end = this.inputIndex;
var expression = this.input.substring(start, end);
this.error("Conditional expression " + expression + " requires all 3 expressions");
no = new EmptyExpr(this.span(start));
}
else {
no = this.parsePipe();
}
return new Conditional(this.span(start), result, yes, no);
}
else {
return result;
}
};
_ParseAST.prototype.parseLogicalOr = function () {
// '||'
var result = this.parseLogicalAnd();
while (this.optionalOperator('||')) {
var right = this.parseLogicalAnd();
result = new Binary(this.span(result.span.start), '||', result, right);
}
return result;
};
_ParseAST.prototype.parseLogicalAnd = function () {
// '&&'
var result = this.parseEquality();
while (this.optionalOperator('&&')) {
var right = this.parseEquality();
result = new Binary(this.span(result.span.start), '&&', result, right);
}
return result;
};
_ParseAST.prototype.parseEquality = function () {
// '==','!=','===','!=='
var result = this.parseRelational();
while (this.next.type == TokenType.Operator) {
var operator = this.next.strValue;
switch (operator) {
case '==':
case '===':
case '!=':
case '!==':
this.advance();
var right = this.parseRelational();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
_ParseAST.prototype.parseRelational = function () {
// '<', '>', '<=', '>='
var result = this.parseAdditive();
while (this.next.type == TokenType.Operator) {
var operator = this.next.strValue;
switch (operator) {
case '<':
case '>':
case '<=':
case '>=':
this.advance();
var right = this.parseAdditive();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
_ParseAST.prototype.parseAdditive = function () {
// '+', '-'
var result = this.parseMultiplicative();
while (this.next.type == TokenType.Operator) {
var operator = this.next.strValue;
switch (operator) {
case '+':
case '-':
this.advance();
var right = this.parseMultiplicative();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
_ParseAST.prototype.parseMultiplicative = function () {
// '*', '%', '/'
var result = this.parsePrefix();
while (this.next.type == TokenType.Operator) {
var operator = this.next.strValue;
switch (operator) {
case '*':
case '%':
case '/':
this.advance();
var right = this.parsePrefix();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
_ParseAST.prototype.parsePrefix = function () {
if (this.next.type == TokenType.Operator) {
var start = this.inputIndex;
var operator = this.next.strValue;
var result = void 0;
switch (operator) {
case '+':
this.advance();
return this.parsePrefix();
case '-':
this.advance();
result = this.parsePrefix();
return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result);
case '!':
this.advance();
result = this.parsePrefix();
return new PrefixNot(this.span(start), result);
}
}
return this.parseCallChain();
};
_ParseAST.prototype.parseCallChain = function () {
var result = this.parsePrimary();
while (true) {
if (this.optionalCharacter(chars.$PERIOD)) {
result = this.parseAccessMemberOrMethodCall(result, false);
}
else if (this.optionalOperator('?.')) {
result = this.parseAccessMemberOrMethodCall(result, true);
}
else if (this.optionalCharacter(chars.$LBRACKET)) {
this.rbracketsExpected++;
var key = this.parsePipe();
this.rbracketsExpected--;
this.expectCharacter(chars.$RBRACKET);
if (this.optionalOperator('=')) {
var value = this.parseConditional();
result = new KeyedWrite(this.span(result.span.start), result, key, value);
}
else {
result = new KeyedRead(this.span(result.span.start), result, key);
}
}
else if (this.optionalCharacter(chars.$LPAREN)) {
this.rparensExpected++;
var args = this.parseCallArguments();
this.rparensExpected--;
this.expectCharacter(chars.$RPAREN);
result = new FunctionCall(this.span(result.span.start), result, args);
}
else {
return result;
}
}
};
_ParseAST.prototype.parsePrimary = function () {
var start = this.inputIndex;
if (this.optionalCharacter(chars.$LPAREN)) {
this.rparensExpected++;
var result = this.parsePipe();
this.rparensExpected--;
this.expectCharacter(chars.$RPAREN);
return result;
}
else if (this.next.isKeywordNull()) {
this.advance();
return new LiteralPrimitive(this.span(start), null);
}
else if (this.next.isKeywordUndefined()) {
this.advance();
return new LiteralPrimitive(this.span(start), void 0);
}
else if (this.next.isKeywordTrue()) {
this.advance();
return new LiteralPrimitive(this.span(start), true);
}
else if (this.next.isKeywordFalse()) {
this.advance();
return new LiteralPrimitive(this.span(start), false);
}
else if (this.next.isKeywordThis()) {
this.advance();
return new ImplicitReceiver(this.span(start));
}
else if (this.optionalCharacter(chars.$LBRACKET)) {
this.rbracketsExpected++;
var elements = this.parseExpressionList(chars.$RBRACKET);
this.rbracketsExpected--;
this.expectCharacter(chars.$RBRACKET);
return new LiteralArray(this.span(start), elements);
}
else if (this.next.isCharacter(chars.$LBRACE)) {
return this.parseLiteralMap();
}
else if (this.next.isIdentifier()) {
return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false);
}
else if (this.next.isNumber()) {
var value = this.next.toNumber();
this.advance();
return new LiteralPrimitive(this.span(start), value);
}
else if (this.next.isString()) {
var literalValue = this.next.toString();
this.advance();
return new LiteralPrimitive(this.span(start), literalValue);
}
else if (this.index >= this.tokens.length) {
this.error("Unexpected end of expression: " + this.input);
return new EmptyExpr(this.span(start));
}
else {
this.error("Unexpected token " + this.next);
return new EmptyExpr(this.span(start));
}
};
_ParseAST.prototype.parseExpressionList = function (terminator) {
var result = [];
if (!this.next.isCharacter(terminator)) {
do {
result.push(this.parsePipe());
} while (this.optionalCharacter(chars.$COMMA));
}
return result;
};
_ParseAST.prototype.parseLiteralMap = function () {
var keys = [];
var values = [];
var start = this.inputIndex;
this.expectCharacter(chars.$LBRACE);
if (!this.optionalCharacter(chars.$RBRACE)) {
this.rbracesExpected++;
do {
var key = this.expectIdentifierOrKeywordOrString();
keys.push(key);
this.expectCharacter(chars.$COLON);
values.push(this.parsePipe());
} while (this.optionalCharacter(chars.$COMMA));
this.rbracesExpected--;
this.expectCharacter(chars.$RBRACE);
}
return new LiteralMap(this.span(start), keys, values);
};
_ParseAST.prototype.parseAccessMemberOrMethodCall = function (receiver, isSafe) {
if (isSafe === void 0) { isSafe = false; }
var start = receiver.span.start;
var id = this.expectIdentifierOrKeyword();
if (this.optionalCharacter(chars.$LPAREN)) {
this.rparensExpected++;
var args = this.parseCallArguments();
this.expectCharacter(chars.$RPAREN);
this.rparensExpected--;
var span = this.span(start);
return isSafe ? new SafeMethodCall(span, receiver, id, args) :
new MethodCall(span, receiver, id, args);
}
else {
if (isSafe) {
if (this.optionalOperator('=')) {
this.error('The \'?.\' operator cannot be used in the assignment');
return new EmptyExpr(this.span(start));
}
else {
return new SafePropertyRead(this.span(start), receiver, id);
}
}
else {
if (this.optionalOperator('=')) {
if (!this.parseAction) {
this.error('Bindings cannot contain assignments');
return new EmptyExpr(this.span(start));
}
var value = this.parseConditional();
return new PropertyWrite(this.span(start), receiver, id, value);
}
else {
return new PropertyRead(this.span(start), receiver, id);
}
}
}
};
_ParseAST.prototype.parseCallArguments = function () {
if (this.next.isCharacter(chars.$RPAREN))
return [];
var positionals = [];
do {
positionals.push(this.parsePipe());
} while (this.optionalCharacter(chars.$COMMA));
return positionals;
};
/**
* An identifier, a keyword, a string with an optional `-` inbetween.
*/
_ParseAST.prototype.expectTemplateBindingKey = function () {
var result = '';
var operatorFound = false;
do {
result += this.expectIdentifierOrKeywordOrString();
operatorFound = this.optionalOperator('-');
if (operatorFound) {
result += '-';
}
} while (operatorFound);
return result.toString();
};
_ParseAST.prototype.parseTemplateBindings = function () {
var bindings = [];
var prefix = null;
var warnings = [];
while (this.index < this.tokens.length) {
var start = this.inputIndex;
var keyIsVar = this.peekKeywordLet();
if (keyIsVar) {
this.advance();
}
var key = this.expectTemplateBindingKey();
if (!keyIsVar) {
if (prefix == null) {
prefix = key;
}
else {
key = prefix + key[0].toUpperCase() + key.substring(1);
}
}
this.optionalCharacter(chars.$COLON);
var name_2 = null;
var expression = null;
if (keyIsVar) {
if (this.optionalOperator('=')) {
name_2 = this.expectTemplateBindingKey();
}
else {
name_2 = '\$implicit';
}
}
else if (this.next !== EOF && !this.peekKeywordLet()) {
var start_1 = this.inputIndex;
var ast = this.parsePipe();
var source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
expression = new ASTWithSource(ast, source, this.location, this.errors);
}
bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name_2, expression));
if (!this.optionalCharacter(chars.$SEMICOLON)) {
this.optionalCharacter(chars.$COMMA);
}
}
return new TemplateBindingParseResult(bindings, warnings, this.errors);
};
_ParseAST.prototype.error = function (message, index) {
if (index === void 0) { index = null; }
this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
this.skip();
};
_ParseAST.prototype.locationText = function (index) {
if (index === void 0) { index = null; }
if (isBlank(index))
index = this.index;
return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" :
"at the end of the expression";
};
// Error recovery should skip tokens until it encounters a recovery point. skip() treats
// the end of input and a ';' as unconditionally a recovery point. It also treats ')',
// '}' and ']' as conditional recovery points if one of calling productions is expecting
// one of these symbols. This allows skip() to recover from errors such as '(a.) + 1' allowing
// more of the AST to be retained (it doesn't skip any tokens as the ')' is retained because
// of the '(' begins an '(' <expr> ')' production). The recovery points of grouping symbols
// must be conditional as they must be skipped if none of the calling productions are not
// expecting the closing token else we will never make progress in the case of an
// extraneous group closing symbol (such as a stray ')'). This is not the case for ';' because
// parseChain() is always the root production and it expects a ';'.
// If a production expects one of these token it increments the corresponding nesting count,
// and then decrements it just prior to checking if the token is in the input.
_ParseAST.prototype.skip = function () {
var n = this.next;
while (this.index < this.tokens.length && !n.isCharacter(chars.$SEMICOLON) &&
(this.rparensExpected <= 0 || !n.isCharacter(chars.$RPAREN)) &&
(this.rbracesExpected <= 0 || !n.isCharacter(chars.$RBRACE)) &&
(this.rbracketsExpected <= 0 || !n.isCharacter(chars.$RBRACKET))) {
if (this.next.isError()) {
this.errors.push(new ParserError(this.next.toString(), this.input, this.locationText(), this.location));
}
this.advance();
n = this.next;
}
};
return _ParseAST;
}());
export { _ParseAST };
var SimpleExpressionChecker = (function () {
function SimpleExpressionChecker() {
this.errors = [];
}
SimpleExpressionChecker.check = function (ast) {
var s = new SimpleExpressionChecker();
ast.visit(s);
return s.errors;
};
SimpleExpressionChecker.prototype.visitImplicitReceiver = function (ast, context) { };
SimpleExpressionChecker.prototype.visitInterpolation = function (ast, context) { };
SimpleExpressionChecker.prototype.visitLiteralPrimitive = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPropertyRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPropertyWrite = function (ast, context) { };
SimpleExpressionChecker.prototype.visitSafePropertyRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitMethodCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitSafeMethodCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitFunctionCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitLiteralArray = function (ast, context) { this.visitAll(ast.expressions); };
SimpleExpressionChecker.prototype.visitLiteralMap = function (ast, context) { this.visitAll(ast.values); };
SimpleExpressionChecker.prototype.visitBinary = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPrefixNot = function (ast, context) { };
SimpleExpressionChecker.prototype.visitConditional = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPipe = function (ast, context) { this.errors.push('pipes'); };
SimpleExpressionChecker.prototype.visitKeyedRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitKeyedWrite = function (ast, context) { };
SimpleExpressionChecker.prototype.visitAll = function (asts) {
var _this = this;
return asts.map(function (node) { return node.visit(_this); });
};
SimpleExpressionChecker.prototype.visitChain = function (ast, context) { };
SimpleExpressionChecker.prototype.visitQuote = function (ast, context) { };
return SimpleExpressionChecker;
}());
//# sourceMappingURL=parser.js.map