diff --git a/lib/utils/binding-parser.html b/lib/utils/binding-parser.html index 57babfe7b5..66545003d3 100644 --- a/lib/utils/binding-parser.html +++ b/lib/utils/binding-parser.html @@ -13,11 +13,19 @@ (function() { 'use strict'; + /** + * The open and corresponding closing brackets for surrounding bindings. + * @enum {string} + */ const BINDINGS = { '{': '}', '[': ']' }; + /** + * All states that the parser can be in. The states represent the state-machine as a whole. + * @enum {number} + */ const STATE = { INITIAL: 1, FIRSTOPENINGBINDING: 2, @@ -98,26 +106,30 @@ } /** - * Module with utilities for converting between "dash-case" and "camelCase" - * identifiers. + * Module that parses binding expressions and generates corresponding metadata. * * @namespace * @memberof Polymer - * @summary Module that provides utilities for converting between "dash-case" - * and "camelCase". + * @summary Module that parses binding expressions and generates corresponding metadata. */ const BindingParser = { + /** + * @param {string} text Text to parse from attribute or textContent + * @param {Object} templateInfo Current template metadata + * @return {Array} Array of binding part metadata + */ parse(text, templateInfo) { const parts = []; let bindingData = {}; let escaped = false; + /** @type {string} */ let quote; + /** @type {number} */ let state = STATE.INITIAL; - let i,l; - for (i=0,l=text.length; i