From df0ee35460bbc547f21a7c543e956b7f8a0e707f Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 8 Aug 2017 15:46:49 -0700 Subject: [PATCH] Add documentation --- lib/utils/binding-parser.html | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) 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