Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3215)

Unified Diff: bower_components/context-free-parser/context-free-parser.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: bower_components/context-free-parser/context-free-parser.js
diff --git a/bower_components/context-free-parser/context-free-parser.js b/bower_components/context-free-parser/context-free-parser.js
deleted file mode 100644
index bd70d4b01931d2f653986a4e1887410c9453ee37..0000000000000000000000000000000000000000
--- a/bower_components/context-free-parser/context-free-parser.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-
-(function(scope) {
-
- var ContextFreeParser = {
- parse: function(text) {
- var top = {};
- var entities = [];
- var current = top;
- var subCurrent = {};
-
- var scriptDocCommentClause = '\\/\\*\\*([\\s\\S]*?)\\*\\/';
- var htmlDocCommentClause = '<!--([\\s\\S]*?)-->';
-
- // matches text between /** and */ inclusive and <!-- and --> inclusive
- var docCommentRegex = new RegExp(scriptDocCommentClause + '|' + htmlDocCommentClause, 'g');
-
- // acquire all script doc comments
- var docComments = text.match(docCommentRegex) || [];
-
- // each match represents a single block of doc comments
- docComments.forEach(function(m) {
- // unify line ends, remove all comment characters, split into individual lines
- var lines = m.replace(/\r\n/g, '\n').replace(/^\s*\/\*\*|^\s*\*\/|^\s*\* ?|^\s*\<\!-\-|^s*\-\-\>/gm, '').split('\n');
-
- // pragmas (@-rules) must occur on a line by themselves
- var pragmas = [];
- // filter lines whose first non-whitespace character is @ into the pragma list
- // (and out of the `lines` array)
- lines = lines.filter(function(l) {
- var m = l.match(/\s*@([\w-]*) (.*)/);
- if (!m) {
- return true;
- }
- pragmas.push(m);
- });
-
- // collect all other text into a single block
- var code = lines.join('\n');
-
- // process pragmas
- pragmas.forEach(function(m) {
- var pragma = m[1], content = m[2];
- switch (pragma) {
-
- // currently all entities are either @class or @element
- case 'class':
- case 'element':
- current = {
- name: content,
- description: code
- };
- entities.push(current);
- break;
-
- // an entity may have these describable sub-features
- case 'attribute':
- case 'property':
- case 'method':
- case 'event':
- subCurrent = {
- name: content,
- description: code
- };
- var label = pragma == 'property' ? 'properties' : pragma + 's';
- makePragma(current, label, subCurrent);
- break;
-
- // sub-feature pragmas
- case 'default':
- case 'type':
- subCurrent[pragma] = content;
- break;
-
- case 'param':
- var eventParmsRe = /\{(.+)\}\s+(\w+[.\w+]+)\s+(.*)$/;
-
- var params = content.match(eventParmsRe);
- if (params) {
- var subEventObj = {
- type: params[1],
- name: params[2],
- description: params[3]
- };
- makePragma(subCurrent, pragma + 's', subEventObj);
- }
-
- break;
-
- // everything else
- default:
- current[pragma] = content;
- break;
- }
- });
-
- // utility function, yay hoisting
- function makePragma(object, pragma, content) {
- var p$ = object;
- var p = p$[pragma];
- if (!p) {
- p$[pragma] = p = [];
- }
- p.push(content);
- }
-
- });
-
- if (entities.length === 0) {
- entities.push({name: 'Entity', description: '**Undocumented**'});
- }
- return entities;
- }
- };
-
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = ContextFreeParser;
- } else {
- scope.ContextFreeParser = ContextFreeParser;
- }
-
-})(this);
« no previous file with comments | « bower_components/context-free-parser/context-free-parser.html ('k') | bower_components/context-free-parser/demo.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698