├── .gitignore ├── README.md ├── app.css ├── astNodeType ├── application.js ├── functionName.js ├── int.js └── list.js ├── ast_transformations.js ├── ast_transformations_spec.js ├── bower.json ├── bower_components ├── lodash │ ├── .bower.json │ ├── LICENSE.txt │ ├── bower.json │ └── dist │ │ ├── lodash.compat.js │ │ ├── lodash.compat.min.js │ │ ├── lodash.js │ │ ├── lodash.min.js │ │ ├── lodash.underscore.js │ │ └── lodash.underscore.min.js ├── node-uuid │ ├── .bower.json │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── benchmark │ │ ├── README.md │ │ ├── bench.gnu │ │ ├── bench.sh │ │ ├── benchmark-native.c │ │ └── benchmark.js │ ├── component.json │ ├── package.json │ ├── test │ │ ├── compare_v1.js │ │ ├── test.html │ │ └── test.js │ └── uuid.js ├── pegjs │ ├── .bower.json │ ├── .gitignore │ ├── .jshintrc │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── VERSION │ ├── benchmark │ │ ├── README │ │ ├── benchmarks.js │ │ ├── css │ │ │ ├── 960.gs │ │ │ │ ├── min │ │ │ │ │ ├── 960.css │ │ │ │ │ ├── 960_24_col.css │ │ │ │ │ ├── reset.css │ │ │ │ │ └── text.css │ │ │ │ └── src │ │ │ │ │ ├── 960.css │ │ │ │ │ ├── 960_24_col.css │ │ │ │ │ ├── reset.css │ │ │ │ │ └── text.css │ │ │ └── blueprint │ │ │ │ ├── min │ │ │ │ ├── ie.css │ │ │ │ ├── print.css │ │ │ │ └── screen.css │ │ │ │ └── src │ │ │ │ ├── forms.css │ │ │ │ ├── grid.css │ │ │ │ ├── ie.css │ │ │ │ ├── print.css │ │ │ │ ├── reset.css │ │ │ │ └── typography.css │ │ ├── index.css │ │ ├── index.html │ │ ├── index.js │ │ ├── json │ │ │ ├── example1.json │ │ │ ├── example2.json │ │ │ ├── example3.json │ │ │ ├── example4.json │ │ │ └── example5.json │ │ ├── run │ │ ├── runner.js │ │ └── vendor │ │ │ ├── jquery.scrollto │ │ │ ├── LICENSE │ │ │ └── jquery.scrollTo.js │ │ │ └── jquery │ │ │ ├── MIT-LICENSE.txt │ │ │ └── jquery.js │ ├── bin │ │ └── pegjs │ ├── examples │ │ ├── arithmetics.pegjs │ │ ├── css.pegjs │ │ ├── javascript.pegjs │ │ └── json.pegjs │ ├── lib │ │ ├── compiler.js │ │ ├── compiler │ │ │ ├── opcodes.js │ │ │ └── passes │ │ │ │ ├── generate-bytecode.js │ │ │ │ ├── generate-javascript.js │ │ │ │ ├── remove-proxy-rules.js │ │ │ │ ├── report-left-recursion.js │ │ │ │ └── report-missing-rules.js │ │ ├── grammar-error.js │ │ ├── parser.js │ │ ├── peg.js │ │ └── utils.js │ ├── package.json │ ├── spec │ │ ├── README │ │ ├── compiler │ │ │ └── passes │ │ │ │ ├── generate-bytecode.spec.js │ │ │ │ ├── remove-proxy-rules.spec.js │ │ │ │ ├── report-left-recursion.spec.js │ │ │ │ └── report-missing-rules.spec.js │ │ ├── generated-parser.spec.js │ │ ├── helpers.js │ │ ├── index.html │ │ ├── parser.spec.js │ │ └── vendor │ │ │ └── jasmine │ │ │ ├── MIT.LICENSE │ │ │ ├── jasmine-html.js │ │ │ ├── jasmine.css │ │ │ └── jasmine.js │ ├── src │ │ └── parser.pegjs │ └── tools │ │ └── impact ├── react │ ├── .bower.json │ ├── JSXTransformer.js │ ├── bower.json │ ├── react-with-addons.js │ ├── react-with-addons.min.js │ ├── react.js │ └── react.min.js └── underscore │ ├── .bower.json │ ├── .editorconfig │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── component.json │ ├── package.json │ └── underscore.js ├── components ├── ApplicationComponent.js ├── FunctionEditorComponent.js ├── FunctionNameComponent.js ├── IntComponent.js ├── LineComponent.js ├── LinesComponent.js ├── ListComponent.js ├── Mixins.js ├── NodeComponent.js └── ProgramComponent.js ├── functions ├── cons.js ├── minus.js └── plus.js ├── haskell-parser.js ├── haskell.pegjs ├── index.html ├── initial_ast.js ├── karma.conf.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | hs.js 2 | ===== 3 | -------------------------------------------------------------------------------- /app.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Optima', 'Arial', 'Helvetica', 'sans-serif'; 3 | background: white; 4 | } 5 | 6 | a { 7 | color: gray; 8 | } 9 | 10 | pre { 11 | margin-left: 30px; 12 | } 13 | 14 | .mapInLesson { 15 | color: rgb(253, 46, 46); 16 | } 17 | 18 | .foldInLesson { 19 | color: blue; 20 | } 21 | 22 | .foldlInLesson { 23 | color: green; 24 | } 25 | 26 | .foldrInLesson { 27 | color: rgb(255, 100, 224); 28 | } 29 | 30 | #mapLesson { 31 | font-size: 1em; 32 | } 33 | 34 | .lesson-highlight { 35 | background: rgb(228, 246, 255); 36 | } 37 | 38 | .int { 39 | padding-right: 2px; 40 | padding-left: 2px; 41 | } 42 | 43 | .lines { 44 | font-family: monospace; 45 | padding: 1em; 46 | margin: 5em; 47 | /*box-shadow: 0 0 1.5px #777;*/ 48 | margin: 1em 0; 49 | 50 | min-height: 220px; 51 | } 52 | 53 | #mapLines .lines { 54 | border: 1px solid rgb(253, 46, 46); 55 | } 56 | 57 | #foldrLines .lines { 58 | border: 1px solid rgb(255, 100, 224); 59 | } 60 | 61 | #foldlLines .lines{ 62 | border: 1px solid green; 63 | } 64 | 65 | .lines-edit { 66 | font-size: 1em; 67 | color: #777; 68 | margin-left: 1em; 69 | cursor: pointer; 70 | text-decoration: underline; 71 | } 72 | 73 | .line.span { 74 | font-size: 23px; 75 | } 76 | 77 | .line-highlight { 78 | background: #fee; 79 | } 80 | .line-inner { 81 | position: relative; 82 | } 83 | .line-context { 84 | font-size: 1em; 85 | position: absolute; 86 | bottom: 0; 87 | right: 0px; 88 | color: #777; 89 | background: #fee; 90 | white-space: pre-line; 91 | padding: 0 5px; 92 | } 93 | 94 | .application { 95 | border: 1px solid white; 96 | border-radius: 20em; 97 | padding: 2px; 98 | display: inline-block; 99 | width:auto; 100 | background-color: deepskyblue; 101 | /*background:-moz-radial-gradient(center 45deg, ellipse closest-corner, rgba(75,190,200,0), rgba(75,190,200,.1), rgba(75,190,200,.3), rgba(255,255,255,.7)); 102 | background:-webkit-radial-gradient(center center, ellipse cover, rgba(75,190,200,.2), rgba(255,255,255,.5)); 103 | background:radial-gradient(center 45deg, circle closest-corner, rgba(75,190,200,0), rgba(75,190,200,.1), rgba(75,190,200,.3), rgba(255,255,255,.7)); 104 | background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,0) 0%, rgba(9,133,167,0.1) 51%, rgba(9,133,167,0.3) 71%, rgba(9,133,167,.7) 100%);*/ 105 | } 106 | 107 | @-webkit-keyframes bubblePop { 108 | 0% {-webkit-transform:scale(.9);opacity:1} 109 | 100% {-webkit-transform:scale(2);opacity:0} 110 | } 111 | 112 | @keyframes bubblePop { 113 | 0% {-webkit-transform:scale(.9);font-size:8px;opacity:1} 114 | 100% {-webkit-transform:scale(2);font-size:72px;opacity:0} 115 | } 116 | 117 | .bubble-pop { 118 | animation:bubblePop 0.25s ease-in-out; 119 | -webkit-animation:bubblePop 0.25s ease-in-out; 120 | -o-animation:bubblePop 0.25s ease-in-out; 121 | -moz-animation:bubblePop 0.25s ease-in-out; 122 | } 123 | 124 | .application-applicable:hover { 125 | background: #fcc; 126 | cursor: pointer; 127 | } 128 | 129 | .application-highlight-clicked-computation, 130 | .node-highlight-just-computed { 131 | background: #fcc; 132 | } 133 | 134 | .bubble-animation-enter { 135 | display:inline-block; 136 | /*max-width:0; 137 | max-height: 0;*/ 138 | font-size: 0; 139 | padding: 0; 140 | border-width: 0; 141 | transform: scale(0); 142 | -webkit-transform: scale(0); 143 | transition: all 0.2s; 144 | -webkit-transition: all 0.2s; 145 | transition-delay: 0.25s; 146 | -webkit-transition-delay: 0.25s; 147 | } 148 | 149 | .bubble-animation-enter-active { 150 | display:inline-block; 151 | /*max-height:200px; 152 | max-width: 500px;*/ 153 | font-size: 12px; 154 | padding: 2px; 155 | border-width: 1px; 156 | transform: scale(1); 157 | -webkit-transform: scale(1); 158 | } 159 | .bubble-animation-leave { 160 | opacity: 1; 161 | display:inline-block; 162 | transform: scale(1); 163 | -webkit-transform: scale(1); 164 | transition: all 0.2s; 165 | -webkit-transition: all 0.2s; 166 | } 167 | 168 | .bubble-animation-leave-active { 169 | opacity: 0; 170 | display:inline-block; 171 | transform: scale(3); 172 | -webkit-transform: scale(3); 173 | } 174 | 175 | .lines-animation-enter { 176 | opacity: 0; 177 | transform: translateY(-100%); 178 | -webkit-transform: translateY(-100%); 179 | -moz-transform: none; 180 | transition: opacity 0.3s, transform 0.15s; 181 | -webkit-transition: opacity 0.3s, -webkit-transform 0.15s; 182 | -moz-transition: opacity 0.3s; 183 | } 184 | .lines-animation-enter-active { 185 | opacity: 1; 186 | transform: translateY(0); 187 | -webkit-transform: translateY(0); 188 | -moz-transform: none; 189 | } 190 | .lines-animation-leave { 191 | transition: opacity 0.1s, transform 0.3s; 192 | -webkit-transition: opacity 0.1s, -webkit-transform 0.3s; 193 | -moz-transition: opacity 0.1s; 194 | } 195 | .lines-animation-leave-active { 196 | opacity: 0; 197 | transform: translateY(200%); 198 | -webkit-transform: translateY(200%); 199 | -moz-transform: none; 200 | } 201 | 202 | .line-editing-container { 203 | position: relative; 204 | } 205 | .line-editing-error { 206 | position: absolute; 207 | top: 1.5em; 208 | background: #fcc; 209 | } 210 | 211 | input { 212 | margin: 0; 213 | padding: 0; 214 | font: 1em monospace; 215 | border: none; 216 | outline: none; 217 | background: none; 218 | } 219 | input.input-error { 220 | outline: 1px solid red; 221 | } 222 | 223 | .help-text { 224 | font: 0.7em Helvetica, sans-serif; 225 | margin-top: 0.5em; 226 | color: #777; 227 | width: 175px; 228 | text-align: center; 229 | } 230 | 231 | .function-editor-container { 232 | position: fixed; 233 | width: 23%; 234 | right: 10px; 235 | top: 0; 236 | bottom: 10px; 237 | } 238 | 239 | .function-editor-link { 240 | color: #777; 241 | cursor: pointer; 242 | font: 1em monospace; 243 | padding-left: 10px; 244 | } 245 | 246 | .function-editor-title { 247 | color:rgb(149, 105, 196);; 248 | font-weight:bold; 249 | } 250 | 251 | .function-editor-title-big{ 252 | font-size: 1.3em; 253 | } 254 | 255 | .function-editor-top { 256 | position: absolute; 257 | top: 5px; 258 | left: 0; 259 | } 260 | 261 | .function-editor { 262 | box-shadow: 0 0 1.5px #777; 263 | position: absolute; 264 | top: 30px; 265 | left: 0; 266 | width: 100%; 267 | bottom: 0; 268 | font: 1em monospace; 269 | border: 1px solid #ccc; 270 | padding: 10px; 271 | white-space: nowrap; 272 | } 273 | 274 | .function-editor:focus { 275 | box-shadow: 0 0 4px #007AFF; 276 | outline:none; 277 | } 278 | 279 | .function-editor-error { 280 | outline: 1px solid red !important; 281 | } 282 | 283 | .function-editor-error-message { 284 | position: absolute; 285 | left: -5px; 286 | margin-top: 40px; 287 | -webkit-transform: translateX(-100%); 288 | transform: translateX(-100%); 289 | background: #fcc; 290 | font: 1em monospace; 291 | padding: 5px; 292 | } 293 | -------------------------------------------------------------------------------- /astNodeType/application.js: -------------------------------------------------------------------------------- 1 | window.astNodeTypes['application'] = { 2 | type: 'application', 3 | astToString: function(node) { 4 | var funcAndArgs = node.arguments.map((function(arg){ 5 | return window.ASTTransformations.astToString(arg); 6 | })) 7 | 8 | var funcName = window.ASTTransformations.astToString(node.functionName); 9 | 10 | indexToAddFunction = node.functionName.infix ? 1 : 0; 11 | funcAndArgs.splice(indexToAddFunction, 0, funcName); 12 | return "(" + funcAndArgs.join(" ") + ")"; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /astNodeType/functionName.js: -------------------------------------------------------------------------------- 1 | window.astNodeTypes['functionName'] = { 2 | type: 'functionName', 3 | astToString: function(node) { 4 | // var functions = Object.keys(window.functions); 5 | // if ((functions.indexOf(node.functionName.name) >= 0) && 6 | // window.functions[node.functionName.name].astToString) { 7 | // var funcName = window.functions[node.functionName.name].astToString(node.functionName); 8 | // } else { 9 | // var funcName = node.functionName.name; // default for functionName 10 | // } 11 | 12 | var funcName = node.name; 13 | return funcName; 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /astNodeType/int.js: -------------------------------------------------------------------------------- 1 | window.astNodeTypes['int'] = { 2 | type: 'int', 3 | color: 'pink', 4 | typeSignature: 'Int', 5 | astToString: function(node) { 6 | return node.value; 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /astNodeType/list.js: -------------------------------------------------------------------------------- 1 | window.astNodeTypes['list'] = { 2 | type: 'list', 3 | color: 'blue', 4 | typeSignature: '[a]', 5 | astToString: function(node) { 6 | var items = node.items.map(function(item){ 7 | return window.ASTTransformations.astToString(item); 8 | }); 9 | 10 | return '[' + items.join(",") + ']'; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /ast_transformations.js: -------------------------------------------------------------------------------- 1 | window.functions = {}; 2 | window.astNodeTypes = {}; 3 | 4 | var _isValidApplication = function(functionName, arguments) { // TODO REMOVE THIS METHOD 5 | if (window.functions[functionName] != undefined){ 6 | return window.functions[functionName].isValidApplication(arguments); 7 | } else { 8 | return false; 9 | } 10 | }; 11 | 12 | var _matchingPatternIndex = function(func, arguments){ 13 | for (var i = 0; i < func.patterns.length; i ++){ 14 | if (func.patterns[i].doesMatch(arguments)){ 15 | return i; 16 | } 17 | } 18 | throw "Inexhaustive pattern matching for function '" + func.name + "'."; 19 | }; 20 | 21 | var _verifyApplication = function(node) { 22 | if (node.type !== 'application') { 23 | throw 'node needs to be an application'; 24 | } 25 | 26 | if (!_isValidApplication(node.functionName.name, node.arguments)) { 27 | throw 'invalid application'; 28 | } 29 | 30 | if (!window.functions[node.functionName.name]) { 31 | throw 'function not defined for application'; 32 | } 33 | }; 34 | 35 | var _applyFunction = function(node) { 36 | _verifyApplication(node); 37 | 38 | var func = window.functions[node.functionName.name]; 39 | var index = _matchingPatternIndex(func, node.arguments); 40 | return func.patterns[index].apply(node.arguments); 41 | } 42 | 43 | var _giveDifferentIds = function(AST) { 44 | if (AST.id) AST.id = uuid.v4(); 45 | var keys = Object.keys(AST) 46 | for (var i=0; i= 0) { 92 | newAST = _giveDifferentIds(_.cloneDeep(functionArguments[_.pluck(patternArguments, 'name').indexOf(newAST.name)])); 93 | newAST.id = uuid.v4(); 94 | } else if (_.isArray(newAST)) { 95 | newAST = newAST.map(function(item) { 96 | return _fillInArgumentsInternal(item, patternArguments, functionArguments); 97 | }); 98 | } else if (newAST.type === 'application') { 99 | newAST.functionName = _fillInArgumentsInternal(newAST.functionName, patternArguments, functionArguments); 100 | newAST.arguments = _fillInArgumentsInternal(newAST.arguments, patternArguments, functionArguments); 101 | } else if (newAST.type === 'list') { 102 | newAST.items = _fillInArgumentsInternal(newAST.items, patternArguments, functionArguments); 103 | } 104 | return newAST; 105 | }; 106 | 107 | window.ASTTransformations = { 108 | subtreeById: function(AST, id) { 109 | if (AST.id === id) { 110 | return AST; 111 | } 112 | 113 | var keys = Object.keys(AST) 114 | for (var i=0; i'; 143 | 144 | var html = functionName + ' :: ' + func.typeSignature; 145 | if (func.patterns[index].definitionLine) { 146 | html += '
' + functionName + ' ' + func.patterns[index].definitionLine 147 | } 148 | return html; 149 | }, 150 | 151 | replaceSubtree: function(oldAST, id, newSubtree) { 152 | var newAST = _.cloneDeep(oldAST); 153 | var subtree = ASTTransformations.subtreeById(newAST, id); 154 | 155 | // delete all keys of subtree 156 | var keys = Object.keys(subtree) 157 | for (var i=0; i= 0){ 178 | return window.astNodeTypes[node.type].astToString(node); 179 | } else { 180 | throw "cannot convert type '" + node.type + "' to String"; 181 | } 182 | }, 183 | 184 | fillInArguments: function(AST, patternArguments, functionArguments) { 185 | var converted = _convertListPatternToSeparateArguments(patternArguments, functionArguments); 186 | return _fillInArgumentsInternal(AST, converted.patternArguments, converted.functionArguments); 187 | } 188 | }; 189 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hs.js", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/stevekrouse/hs.js", 5 | "authors": [ 6 | "stevekrouse " 7 | ], 8 | "license": "MIT", 9 | "ignore": [ 10 | "**/.*", 11 | "node_modules", 12 | "bower_components", 13 | "test", 14 | "tests" 15 | ], 16 | "dependencies": { 17 | "react": "~0.11.1", 18 | "lodash": "~2.4.1", 19 | "node-uuid": "~1.4.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bower_components/lodash/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lodash", 3 | "version": "2.4.1", 4 | "main": "dist/lodash.compat.js", 5 | "ignore": [ 6 | ".*", 7 | "*.custom.*", 8 | "*.template.*", 9 | "*.map", 10 | "*.md", 11 | "/*.min.*", 12 | "/lodash.js", 13 | "index.js", 14 | "component.json", 15 | "package.json", 16 | "doc", 17 | "modularize", 18 | "node_modules", 19 | "perf", 20 | "test", 21 | "vendor" 22 | ], 23 | "homepage": "https://github.com/lodash/lodash", 24 | "_release": "2.4.1", 25 | "_resolution": { 26 | "type": "version", 27 | "tag": "2.4.1", 28 | "commit": "c7aa842eded639d6d90a5714d3195a8802c86687" 29 | }, 30 | "_source": "git://github.com/lodash/lodash.git", 31 | "_target": "~2.4.1", 32 | "_originalSource": "lodash", 33 | "_direct": true 34 | } -------------------------------------------------------------------------------- /bower_components/lodash/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012-2013 The Dojo Foundation 2 | Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas, 3 | DocumentCloud and Investigative Reporters & Editors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /bower_components/lodash/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lodash", 3 | "version": "2.4.1", 4 | "main": "dist/lodash.compat.js", 5 | "ignore": [ 6 | ".*", 7 | "*.custom.*", 8 | "*.template.*", 9 | "*.map", 10 | "*.md", 11 | "/*.min.*", 12 | "/lodash.js", 13 | "index.js", 14 | "component.json", 15 | "package.json", 16 | "doc", 17 | "modularize", 18 | "node_modules", 19 | "perf", 20 | "test", 21 | "vendor" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /bower_components/node-uuid/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-uuid", 3 | "homepage": "https://github.com/broofa/node-uuid", 4 | "version": "1.4.1", 5 | "_release": "1.4.1", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v1.4.1", 9 | "commit": "38ac27d89f6f880e0f42b17aa89921d490692bbf" 10 | }, 11 | "_source": "git://github.com/broofa/node-uuid.git", 12 | "_target": "~1.4.1", 13 | "_originalSource": "node-uuid", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /bower_components/node-uuid/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /bower_components/node-uuid/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2012 Robert Kieffer 2 | MIT License - http://opensource.org/licenses/mit-license.php 3 | -------------------------------------------------------------------------------- /bower_components/node-uuid/README.md: -------------------------------------------------------------------------------- 1 | # node-uuid 2 | 3 | Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. 4 | 5 | Features: 6 | 7 | * Generate RFC4122 version 1 or version 4 UUIDs 8 | * Runs in node.js and all browsers. 9 | * Registered as a [ComponentJS](https://github.com/component/component) [component](https://github.com/component/component/wiki/Components) ('broofa/node-uuid'). 10 | * Cryptographically strong random # generation on supporting platforms 11 | * 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! ) 12 | * [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html) 13 | 14 | ## Getting Started 15 | 16 | Install it in your browser: 17 | 18 | ```html 19 | 20 | ``` 21 | 22 | Or in node.js: 23 | 24 | ``` 25 | npm install node-uuid 26 | ``` 27 | 28 | ```javascript 29 | var uuid = require('node-uuid'); 30 | ``` 31 | 32 | Then create some ids ... 33 | 34 | ```javascript 35 | // Generate a v1 (time-based) id 36 | uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' 37 | 38 | // Generate a v4 (random) id 39 | uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1' 40 | ``` 41 | 42 | ## API 43 | 44 | ### uuid.v1([`options` [, `buffer` [, `offset`]]]) 45 | 46 | Generate and return a RFC4122 v1 (timestamp-based) UUID. 47 | 48 | * `options` - (Object) Optional uuid state to apply. Properties may include: 49 | 50 | * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. 51 | * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. 52 | * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used. 53 | * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. 54 | 55 | * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. 56 | * `offset` - (Number) Starting index in `buffer` at which to begin writing. 57 | 58 | Returns `buffer`, if specified, otherwise the string form of the UUID 59 | 60 | Notes: 61 | 62 | 1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) 63 | 64 | Example: Generate string UUID with fully-specified options 65 | 66 | ```javascript 67 | uuid.v1({ 68 | node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], 69 | clockseq: 0x1234, 70 | msecs: new Date('2011-11-01').getTime(), 71 | nsecs: 5678 72 | }); // -> "710b962e-041c-11e1-9234-0123456789ab" 73 | ``` 74 | 75 | Example: In-place generation of two binary IDs 76 | 77 | ```javascript 78 | // Generate two ids in an array 79 | var arr = new Array(32); // -> [] 80 | uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15] 81 | uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15] 82 | 83 | // Optionally use uuid.unparse() to get stringify the ids 84 | uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115' 85 | uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115' 86 | ``` 87 | 88 | ### uuid.v4([`options` [, `buffer` [, `offset`]]]) 89 | 90 | Generate and return a RFC4122 v4 UUID. 91 | 92 | * `options` - (Object) Optional uuid state to apply. Properties may include: 93 | 94 | * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values 95 | * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values. 96 | 97 | * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. 98 | * `offset` - (Number) Starting index in `buffer` at which to begin writing. 99 | 100 | Returns `buffer`, if specified, otherwise the string form of the UUID 101 | 102 | Example: Generate string UUID with fully-specified options 103 | 104 | ```javascript 105 | uuid.v4({ 106 | random: [ 107 | 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, 108 | 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 109 | ] 110 | }); 111 | // -> "109156be-c4fb-41ea-b1b4-efe1671c5836" 112 | ``` 113 | 114 | Example: Generate two IDs in a single buffer 115 | 116 | ```javascript 117 | var buffer = new Array(32); // (or 'new Buffer' in node.js) 118 | uuid.v4(null, buffer, 0); 119 | uuid.v4(null, buffer, 16); 120 | ``` 121 | 122 | ### uuid.parse(id[, buffer[, offset]]) 123 | ### uuid.unparse(buffer[, offset]) 124 | 125 | Parse and unparse UUIDs 126 | 127 | * `id` - (String) UUID(-like) string 128 | * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used 129 | * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0 130 | 131 | Example parsing and unparsing a UUID string 132 | 133 | ```javascript 134 | var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> 135 | var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10' 136 | ``` 137 | 138 | ### uuid.noConflict() 139 | 140 | (Browsers only) Set `uuid` property back to it's previous value. 141 | 142 | Returns the node-uuid object. 143 | 144 | Example: 145 | 146 | ```javascript 147 | var myUuid = uuid.noConflict(); 148 | myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' 149 | ``` 150 | 151 | ## Deprecated APIs 152 | 153 | Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version. 154 | 155 | ### uuid([format [, buffer [, offset]]]) 156 | 157 | uuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary). 158 | 159 | ### uuid.BufferClass 160 | 161 | The class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API. 162 | 163 | ## Testing 164 | 165 | In node.js 166 | 167 | ``` 168 | > cd test 169 | > node test.js 170 | ``` 171 | 172 | In Browser 173 | 174 | ``` 175 | open test/test.html 176 | ``` 177 | 178 | ### Benchmarking 179 | 180 | Requires node.js 181 | 182 | ``` 183 | npm install uuid uuid-js 184 | node benchmark/benchmark.js 185 | ``` 186 | 187 | For a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark) 188 | 189 | For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance). 190 | 191 | ## Release notes 192 | 193 | ### 1.4.0 194 | 195 | * Improved module context detection 196 | * Removed public RNG functions 197 | 198 | ### 1.3.2 199 | 200 | * Improve tests and handling of v1() options (Issue #24) 201 | * Expose RNG option to allow for perf testing with different generators 202 | 203 | ### 1.3.0 204 | 205 | * Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! 206 | * Support for node.js crypto API 207 | * De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code 208 | -------------------------------------------------------------------------------- /bower_components/node-uuid/benchmark/README.md: -------------------------------------------------------------------------------- 1 | # node-uuid Benchmarks 2 | 3 | ### Results 4 | 5 | To see the results of our benchmarks visit https://github.com/broofa/node-uuid/wiki/Benchmark 6 | 7 | ### Run them yourself 8 | 9 | node-uuid comes with some benchmarks to measure performance of generating UUIDs. These can be run using node.js. node-uuid is being benchmarked against some other uuid modules, that are available through npm namely `uuid` and `uuid-js`. 10 | 11 | To prepare and run the benchmark issue; 12 | 13 | ``` 14 | npm install uuid uuid-js 15 | node benchmark/benchmark.js 16 | ``` 17 | 18 | You'll see an output like this one: 19 | 20 | ``` 21 | # v4 22 | nodeuuid.v4(): 854700 uuids/second 23 | nodeuuid.v4('binary'): 788643 uuids/second 24 | nodeuuid.v4('binary', buffer): 1336898 uuids/second 25 | uuid(): 479386 uuids/second 26 | uuid('binary'): 582072 uuids/second 27 | uuidjs.create(4): 312304 uuids/second 28 | 29 | # v1 30 | nodeuuid.v1(): 938086 uuids/second 31 | nodeuuid.v1('binary'): 683060 uuids/second 32 | nodeuuid.v1('binary', buffer): 1644736 uuids/second 33 | uuidjs.create(1): 190621 uuids/second 34 | ``` 35 | 36 | * The `uuid()` entries are for Nikhil Marathe's [uuid module](https://bitbucket.org/nikhilm/uuidjs) which is a wrapper around the native libuuid library. 37 | * The `uuidjs()` entries are for Patrick Negri's [uuid-js module](https://github.com/pnegri/uuid-js) which is a pure javascript implementation based on [UUID.js](https://github.com/LiosK/UUID.js) by LiosK. 38 | 39 | If you want to get more reliable results you can run the benchmark multiple times and write the output into a log file: 40 | 41 | ``` 42 | for i in {0..9}; do node benchmark/benchmark.js >> benchmark/bench_0.4.12.log; done; 43 | ``` 44 | 45 | If you're interested in how performance varies between different node versions, you can issue the above command multiple times. 46 | 47 | You can then use the shell script `bench.sh` provided in this directory to calculate the averages over all benchmark runs and draw a nice plot: 48 | 49 | ``` 50 | (cd benchmark/ && ./bench.sh) 51 | ``` 52 | 53 | This assumes you have [gnuplot](http://www.gnuplot.info/) and [ImageMagick](http://www.imagemagick.org/) installed. You'll find a nice `bench.png` graph in the `benchmark/` directory then. 54 | -------------------------------------------------------------------------------- /bower_components/node-uuid/benchmark/bench.gnu: -------------------------------------------------------------------------------- 1 | #!/opt/local/bin/gnuplot -persist 2 | # 3 | # 4 | # G N U P L O T 5 | # Version 4.4 patchlevel 3 6 | # last modified March 2011 7 | # System: Darwin 10.8.0 8 | # 9 | # Copyright (C) 1986-1993, 1998, 2004, 2007-2010 10 | # Thomas Williams, Colin Kelley and many others 11 | # 12 | # gnuplot home: http://www.gnuplot.info 13 | # faq, bugs, etc: type "help seeking-assistance" 14 | # immediate help: type "help" 15 | # plot window: hit 'h' 16 | set terminal postscript eps noenhanced defaultplex \ 17 | leveldefault color colortext \ 18 | solid linewidth 1.2 butt noclip \ 19 | palfuncparam 2000,0.003 \ 20 | "Helvetica" 14 21 | set output 'bench.eps' 22 | unset clip points 23 | set clip one 24 | unset clip two 25 | set bar 1.000000 front 26 | set border 31 front linetype -1 linewidth 1.000 27 | set xdata 28 | set ydata 29 | set zdata 30 | set x2data 31 | set y2data 32 | set timefmt x "%d/%m/%y,%H:%M" 33 | set timefmt y "%d/%m/%y,%H:%M" 34 | set timefmt z "%d/%m/%y,%H:%M" 35 | set timefmt x2 "%d/%m/%y,%H:%M" 36 | set timefmt y2 "%d/%m/%y,%H:%M" 37 | set timefmt cb "%d/%m/%y,%H:%M" 38 | set boxwidth 39 | set style fill empty border 40 | set style rectangle back fc lt -3 fillstyle solid 1.00 border lt -1 41 | set style circle radius graph 0.02, first 0, 0 42 | set dummy x,y 43 | set format x "% g" 44 | set format y "% g" 45 | set format x2 "% g" 46 | set format y2 "% g" 47 | set format z "% g" 48 | set format cb "% g" 49 | set angles radians 50 | unset grid 51 | set key title "" 52 | set key outside left top horizontal Right noreverse enhanced autotitles columnhead nobox 53 | set key noinvert samplen 4 spacing 1 width 0 height 0 54 | set key maxcolumns 2 maxrows 0 55 | unset label 56 | unset arrow 57 | set style increment default 58 | unset style line 59 | set style line 1 linetype 1 linewidth 2.000 pointtype 1 pointsize default pointinterval 0 60 | unset style arrow 61 | set style histogram clustered gap 2 title offset character 0, 0, 0 62 | unset logscale 63 | set offsets graph 0.05, 0.15, 0, 0 64 | set pointsize 1.5 65 | set pointintervalbox 1 66 | set encoding default 67 | unset polar 68 | unset parametric 69 | unset decimalsign 70 | set view 60, 30, 1, 1 71 | set samples 100, 100 72 | set isosamples 10, 10 73 | set surface 74 | unset contour 75 | set clabel '%8.3g' 76 | set mapping cartesian 77 | set datafile separator whitespace 78 | unset hidden3d 79 | set cntrparam order 4 80 | set cntrparam linear 81 | set cntrparam levels auto 5 82 | set cntrparam points 5 83 | set size ratio 0 1,1 84 | set origin 0,0 85 | set style data points 86 | set style function lines 87 | set xzeroaxis linetype -2 linewidth 1.000 88 | set yzeroaxis linetype -2 linewidth 1.000 89 | set zzeroaxis linetype -2 linewidth 1.000 90 | set x2zeroaxis linetype -2 linewidth 1.000 91 | set y2zeroaxis linetype -2 linewidth 1.000 92 | set ticslevel 0.5 93 | set mxtics default 94 | set mytics default 95 | set mztics default 96 | set mx2tics default 97 | set my2tics default 98 | set mcbtics default 99 | set xtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 100 | set xtics norangelimit 101 | set xtics () 102 | set ytics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 103 | set ytics autofreq norangelimit 104 | set ztics border in scale 1,0.5 nomirror norotate offset character 0, 0, 0 105 | set ztics autofreq norangelimit 106 | set nox2tics 107 | set noy2tics 108 | set cbtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 109 | set cbtics autofreq norangelimit 110 | set title "" 111 | set title offset character 0, 0, 0 font "" norotate 112 | set timestamp bottom 113 | set timestamp "" 114 | set timestamp offset character 0, 0, 0 font "" norotate 115 | set rrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) 116 | set autoscale rfixmin 117 | set autoscale rfixmax 118 | set trange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] ) 119 | set autoscale tfixmin 120 | set autoscale tfixmax 121 | set urange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) 122 | set autoscale ufixmin 123 | set autoscale ufixmax 124 | set vrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) 125 | set autoscale vfixmin 126 | set autoscale vfixmax 127 | set xlabel "" 128 | set xlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate 129 | set x2label "" 130 | set x2label offset character 0, 0, 0 font "" textcolor lt -1 norotate 131 | set xrange [ * : * ] noreverse nowriteback # (currently [-0.150000:3.15000] ) 132 | set autoscale xfixmin 133 | set autoscale xfixmax 134 | set x2range [ * : * ] noreverse nowriteback # (currently [0.00000:3.00000] ) 135 | set autoscale x2fixmin 136 | set autoscale x2fixmax 137 | set ylabel "" 138 | set ylabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 139 | set y2label "" 140 | set y2label offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 141 | set yrange [ 0.00000 : 1.90000e+06 ] noreverse nowriteback # (currently [:] ) 142 | set autoscale yfixmin 143 | set autoscale yfixmax 144 | set y2range [ * : * ] noreverse nowriteback # (currently [0.00000:1.90000e+06] ) 145 | set autoscale y2fixmin 146 | set autoscale y2fixmax 147 | set zlabel "" 148 | set zlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate 149 | set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) 150 | set autoscale zfixmin 151 | set autoscale zfixmax 152 | set cblabel "" 153 | set cblabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 154 | set cbrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) 155 | set autoscale cbfixmin 156 | set autoscale cbfixmax 157 | set zero 1e-08 158 | set lmargin -1 159 | set bmargin -1 160 | set rmargin -1 161 | set tmargin -1 162 | set pm3d explicit at s 163 | set pm3d scansautomatic 164 | set pm3d interpolate 1,1 flush begin noftriangles nohidden3d corners2color mean 165 | set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB 166 | set palette rgbformulae 7, 5, 15 167 | set colorbox default 168 | set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault 169 | set loadpath 170 | set fontpath 171 | set fit noerrorvariables 172 | GNUTERM = "aqua" 173 | plot 'bench_results.txt' using 2:xticlabel(1) w lp lw 2, '' using 3:xticlabel(1) w lp lw 2, '' using 4:xticlabel(1) w lp lw 2, '' using 5:xticlabel(1) w lp lw 2, '' using 6:xticlabel(1) w lp lw 2, '' using 7:xticlabel(1) w lp lw 2, '' using 8:xticlabel(1) w lp lw 2, '' using 9:xticlabel(1) w lp lw 2 174 | # EOF 175 | -------------------------------------------------------------------------------- /bower_components/node-uuid/benchmark/bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # for a given node version run: 4 | # for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done; 5 | 6 | PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte') 7 | FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es) 8 | INDICES=(2 3 2 3 2 2 2 2 2) 9 | VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " ) 10 | TMPJOIN="tmp_join" 11 | OUTPUT="bench_results.txt" 12 | 13 | for I in ${!FILES[*]}; do 14 | F=${FILES[$I]} 15 | P=${PATTERNS[$I]} 16 | INDEX=${INDICES[$I]} 17 | echo "version $F" > $F 18 | for V in $VERSIONS; do 19 | (VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F 20 | done 21 | if [ $I == 0 ]; then 22 | cat $F > $TMPJOIN 23 | else 24 | join $TMPJOIN $F > $OUTPUT 25 | cp $OUTPUT $TMPJOIN 26 | fi 27 | rm $F 28 | done 29 | 30 | rm $TMPJOIN 31 | 32 | gnuplot bench.gnu 33 | convert -density 200 -resize 800x560 -flatten bench.eps bench.png 34 | rm bench.eps 35 | -------------------------------------------------------------------------------- /bower_components/node-uuid/benchmark/benchmark-native.c: -------------------------------------------------------------------------------- 1 | /* 2 | Test performance of native C UUID generation 3 | 4 | To Compile: cc -luuid benchmark-native.c -o benchmark-native 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main() { 13 | uuid_t myid; 14 | char buf[36+1]; 15 | int i; 16 | struct timeval t; 17 | double start, finish; 18 | 19 | gettimeofday(&t, NULL); 20 | start = t.tv_sec + t.tv_usec/1e6; 21 | 22 | int n = 2e5; 23 | for (i = 0; i < n; i++) { 24 | uuid_generate(myid); 25 | uuid_unparse(myid, buf); 26 | } 27 | 28 | gettimeofday(&t, NULL); 29 | finish = t.tv_sec + t.tv_usec/1e6; 30 | double dur = finish - start; 31 | 32 | printf("%d uuids/sec", (int)(n/dur)); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /bower_components/node-uuid/benchmark/benchmark.js: -------------------------------------------------------------------------------- 1 | try { 2 | var nodeuuid = require('../uuid'); 3 | } catch (e) { 4 | console.error('node-uuid require failed - skipping tests'); 5 | } 6 | 7 | try { 8 | var uuid = require('uuid'); 9 | } catch (e) { 10 | console.error('uuid require failed - skipping tests'); 11 | } 12 | 13 | try { 14 | var uuidjs = require('uuid-js'); 15 | } catch (e) { 16 | console.error('uuid-js require failed - skipping tests'); 17 | } 18 | 19 | var N = 5e5; 20 | 21 | function rate(msg, t) { 22 | console.log(msg + ': ' + 23 | (N / (Date.now() - t) * 1e3 | 0) + 24 | ' uuids/second'); 25 | } 26 | 27 | console.log('# v4'); 28 | 29 | // node-uuid - string form 30 | if (nodeuuid) { 31 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4(); 32 | rate('nodeuuid.v4() - using node.js crypto RNG', t); 33 | 34 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4({rng: nodeuuid.mathRNG}); 35 | rate('nodeuuid.v4() - using Math.random() RNG', t); 36 | 37 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary'); 38 | rate('nodeuuid.v4(\'binary\')', t); 39 | 40 | var buffer = new nodeuuid.BufferClass(16); 41 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer); 42 | rate('nodeuuid.v4(\'binary\', buffer)', t); 43 | } 44 | 45 | // libuuid - string form 46 | if (uuid) { 47 | for (var i = 0, t = Date.now(); i < N; i++) uuid(); 48 | rate('uuid()', t); 49 | 50 | for (var i = 0, t = Date.now(); i < N; i++) uuid('binary'); 51 | rate('uuid(\'binary\')', t); 52 | } 53 | 54 | // uuid-js - string form 55 | if (uuidjs) { 56 | for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4); 57 | rate('uuidjs.create(4)', t); 58 | } 59 | 60 | // 140byte.es 61 | for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)}); 62 | rate('140byte.es_v4', t); 63 | 64 | console.log(''); 65 | console.log('# v1'); 66 | 67 | // node-uuid - v1 string form 68 | if (nodeuuid) { 69 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1(); 70 | rate('nodeuuid.v1()', t); 71 | 72 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary'); 73 | rate('nodeuuid.v1(\'binary\')', t); 74 | 75 | var buffer = new nodeuuid.BufferClass(16); 76 | for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary', buffer); 77 | rate('nodeuuid.v1(\'binary\', buffer)', t); 78 | } 79 | 80 | // uuid-js - v1 string form 81 | if (uuidjs) { 82 | for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(1); 83 | rate('uuidjs.create(1)', t); 84 | } 85 | -------------------------------------------------------------------------------- /bower_components/node-uuid/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-uuid", 3 | "repo": "broofa/node-uuid", 4 | "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", 5 | "version": "1.4.0", 6 | "author": "Robert Kieffer ", 7 | "contributors": [ 8 | {"name": "Christoph Tavan ", "github": "https://github.com/ctavan"} 9 | ], 10 | "keywords": ["uuid", "guid", "rfc4122"], 11 | "dependencies": {}, 12 | "development": {}, 13 | "main": "uuid.js", 14 | "scripts": [ 15 | "uuid.js" 16 | ], 17 | "license": "MIT" 18 | } -------------------------------------------------------------------------------- /bower_components/node-uuid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "node-uuid", 3 | "description" : "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", 4 | "url" : "http://github.com/broofa/node-uuid", 5 | "keywords" : ["uuid", "guid", "rfc4122"], 6 | "author" : "Robert Kieffer ", 7 | "contributors" : [ 8 | {"name": "Christoph Tavan ", "github": "https://github.com/ctavan"} 9 | ], 10 | "lib" : ".", 11 | "main" : "./uuid.js", 12 | "repository" : { "type" : "git", "url" : "https://github.com/broofa/node-uuid.git" }, 13 | "version" : "1.4.1" 14 | } 15 | -------------------------------------------------------------------------------- /bower_components/node-uuid/test/compare_v1.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | nodeuuid = require('../uuid'), 3 | uuidjs = require('uuid-js'), 4 | libuuid = require('uuid').generate, 5 | util = require('util'), 6 | exec = require('child_process').exec, 7 | os = require('os'); 8 | 9 | // On Mac Os X / macports there's only the ossp-uuid package that provides uuid 10 | // On Linux there's uuid-runtime which provides uuidgen 11 | var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t'; 12 | 13 | function compare(ids) { 14 | console.log(ids); 15 | for (var i = 0; i < ids.length; i++) { 16 | var id = ids[i].split('-'); 17 | id = [id[2], id[1], id[0]].join(''); 18 | ids[i] = id; 19 | } 20 | var sorted = ([].concat(ids)).sort(); 21 | 22 | if (sorted.toString() !== ids.toString()) { 23 | console.log('Warning: sorted !== ids'); 24 | } else { 25 | console.log('everything in order!'); 26 | } 27 | } 28 | 29 | // Test time order of v1 uuids 30 | var ids = []; 31 | while (ids.length < 10e3) ids.push(nodeuuid.v1()); 32 | 33 | var max = 10; 34 | console.log('node-uuid:'); 35 | ids = []; 36 | for (var i = 0; i < max; i++) ids.push(nodeuuid.v1()); 37 | compare(ids); 38 | 39 | console.log(''); 40 | console.log('uuidjs:'); 41 | ids = []; 42 | for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString()); 43 | compare(ids); 44 | 45 | console.log(''); 46 | console.log('libuuid:'); 47 | ids = []; 48 | var count = 0; 49 | var last = function() { 50 | compare(ids); 51 | } 52 | var cb = function(err, stdout, stderr) { 53 | ids.push(stdout.substring(0, stdout.length-1)); 54 | count++; 55 | if (count < max) { 56 | return next(); 57 | } 58 | last(); 59 | }; 60 | var next = function() { 61 | exec(uuidCmd, cb); 62 | }; 63 | next(); 64 | -------------------------------------------------------------------------------- /bower_components/node-uuid/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /bower_components/node-uuid/test/test.js: -------------------------------------------------------------------------------- 1 | if (!this.uuid) { 2 | // node.js 3 | uuid = require('../uuid'); 4 | } 5 | 6 | // 7 | // x-platform log/assert shims 8 | // 9 | 10 | function _log(msg, type) { 11 | type = type || 'log'; 12 | 13 | if (typeof(document) != 'undefined') { 14 | document.write('
' + msg.replace(/\n/g, '
') + '
'); 15 | } 16 | if (typeof(console) != 'undefined') { 17 | var color = { 18 | log: '\033[39m', 19 | warn: '\033[33m', 20 | error: '\033[31m' 21 | }; 22 | console[type](color[type] + msg + color.log); 23 | } 24 | } 25 | 26 | function log(msg) {_log(msg, 'log');} 27 | function warn(msg) {_log(msg, 'warn');} 28 | function error(msg) {_log(msg, 'error');} 29 | 30 | function assert(res, msg) { 31 | if (!res) { 32 | error('FAIL: ' + msg); 33 | } else { 34 | log('Pass: ' + msg); 35 | } 36 | } 37 | 38 | // 39 | // Unit tests 40 | // 41 | 42 | // Verify ordering of v1 ids created with explicit times 43 | var TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00 44 | 45 | function compare(name, ids) { 46 | ids = ids.map(function(id) { 47 | return id.split('-').reverse().join('-'); 48 | }).sort(); 49 | var sorted = ([].concat(ids)).sort(); 50 | 51 | assert(sorted.toString() == ids.toString(), name + ' have expected order'); 52 | } 53 | 54 | // Verify ordering of v1 ids created using default behavior 55 | compare('uuids with current time', [ 56 | uuid.v1(), 57 | uuid.v1(), 58 | uuid.v1(), 59 | uuid.v1(), 60 | uuid.v1() 61 | ]); 62 | 63 | // Verify ordering of v1 ids created with explicit times 64 | compare('uuids with time option', [ 65 | uuid.v1({msecs: TIME - 10*3600*1000}), 66 | uuid.v1({msecs: TIME - 1}), 67 | uuid.v1({msecs: TIME}), 68 | uuid.v1({msecs: TIME + 1}), 69 | uuid.v1({msecs: TIME + 28*24*3600*1000}) 70 | ]); 71 | 72 | assert( 73 | uuid.v1({msecs: TIME}) != uuid.v1({msecs: TIME}), 74 | 'IDs created at same msec are different' 75 | ); 76 | 77 | // Verify throw if too many ids created 78 | var thrown = false; 79 | try { 80 | uuid.v1({msecs: TIME, nsecs: 10000}); 81 | } catch (e) { 82 | thrown = true; 83 | } 84 | assert(thrown, 'Exception thrown when > 10K ids created in 1 ms'); 85 | 86 | // Verify clock regression bumps clockseq 87 | var uidt = uuid.v1({msecs: TIME}); 88 | var uidtb = uuid.v1({msecs: TIME - 1}); 89 | assert( 90 | parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1, 91 | 'Clock regression by msec increments the clockseq' 92 | ); 93 | 94 | // Verify clock regression bumps clockseq 95 | var uidtn = uuid.v1({msecs: TIME, nsecs: 10}); 96 | var uidtnb = uuid.v1({msecs: TIME, nsecs: 9}); 97 | assert( 98 | parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1, 99 | 'Clock regression by nsec increments the clockseq' 100 | ); 101 | 102 | // Verify explicit options produce expected id 103 | var id = uuid.v1({ 104 | msecs: 1321651533573, 105 | nsecs: 5432, 106 | clockseq: 0x385c, 107 | node: [ 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10 ] 108 | }); 109 | assert(id == 'd9428888-122b-11e1-b85c-61cd3cbb3210', 'Explicit options produce expected id'); 110 | 111 | // Verify adjacent ids across a msec boundary are 1 time unit apart 112 | var u0 = uuid.v1({msecs: TIME, nsecs: 9999}); 113 | var u1 = uuid.v1({msecs: TIME + 1, nsecs: 0}); 114 | 115 | var before = u0.split('-')[0], after = u1.split('-')[0]; 116 | var dt = parseInt(after, 16) - parseInt(before, 16); 117 | assert(dt === 1, 'Ids spanning 1ms boundary are 100ns apart'); 118 | 119 | // 120 | // Test parse/unparse 121 | // 122 | 123 | id = '00112233445566778899aabbccddeeff'; 124 | assert(uuid.unparse(uuid.parse(id.substr(0,10))) == 125 | '00112233-4400-0000-0000-000000000000', 'Short parse'); 126 | assert(uuid.unparse(uuid.parse('(this is the uuid -> ' + id + id)) == 127 | '00112233-4455-6677-8899-aabbccddeeff', 'Dirty parse'); 128 | 129 | // 130 | // Perf tests 131 | // 132 | 133 | var generators = { 134 | v1: uuid.v1, 135 | v4: uuid.v4 136 | }; 137 | 138 | var UUID_FORMAT = { 139 | v1: /[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i, 140 | v4: /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i 141 | }; 142 | 143 | var N = 1e4; 144 | 145 | // Get %'age an actual value differs from the ideal value 146 | function divergence(actual, ideal) { 147 | return Math.round(100*100*(actual - ideal)/ideal)/100; 148 | } 149 | 150 | function rate(msg, t) { 151 | log(msg + ': ' + (N / (Date.now() - t) * 1e3 | 0) + ' uuids\/second'); 152 | } 153 | 154 | for (var version in generators) { 155 | var counts = {}, max = 0; 156 | var generator = generators[version]; 157 | var format = UUID_FORMAT[version]; 158 | 159 | log('\nSanity check ' + N + ' ' + version + ' uuids'); 160 | for (var i = 0, ok = 0; i < N; i++) { 161 | id = generator(); 162 | if (!format.test(id)) { 163 | throw Error(id + ' is not a valid UUID string'); 164 | } 165 | 166 | if (id != uuid.unparse(uuid.parse(id))) { 167 | assert(fail, id + ' is not a valid id'); 168 | } 169 | 170 | // Count digits for our randomness check 171 | if (version == 'v4') { 172 | var digits = id.replace(/-/g, '').split(''); 173 | for (var j = digits.length-1; j >= 0; j--) { 174 | var c = digits[j]; 175 | max = Math.max(max, counts[c] = (counts[c] || 0) + 1); 176 | } 177 | } 178 | } 179 | 180 | // Check randomness for v4 UUIDs 181 | if (version == 'v4') { 182 | // Limit that we get worried about randomness. (Purely empirical choice, this!) 183 | var limit = 2*100*Math.sqrt(1/N); 184 | 185 | log('\nChecking v4 randomness. Distribution of Hex Digits (% deviation from ideal)'); 186 | 187 | for (var i = 0; i < 16; i++) { 188 | var c = i.toString(16); 189 | var bar = '', n = counts[c], p = Math.round(n/max*100|0); 190 | 191 | // 1-3,5-8, and D-F: 1:16 odds over 30 digits 192 | var ideal = N*30/16; 193 | if (i == 4) { 194 | // 4: 1:1 odds on 1 digit, plus 1:16 odds on 30 digits 195 | ideal = N*(1 + 30/16); 196 | } else if (i >= 8 && i <= 11) { 197 | // 8-B: 1:4 odds on 1 digit, plus 1:16 odds on 30 digits 198 | ideal = N*(1/4 + 30/16); 199 | } else { 200 | // Otherwise: 1:16 odds on 30 digits 201 | ideal = N*30/16; 202 | } 203 | var d = divergence(n, ideal); 204 | 205 | // Draw bar using UTF squares (just for grins) 206 | var s = n/max*50 | 0; 207 | while (s--) bar += '='; 208 | 209 | assert(Math.abs(d) < limit, c + ' |' + bar + '| ' + counts[c] + ' (' + d + '% < ' + limit + '%)'); 210 | } 211 | } 212 | } 213 | 214 | // Perf tests 215 | for (var version in generators) { 216 | log('\nPerformance testing ' + version + ' UUIDs'); 217 | var generator = generators[version]; 218 | var buf = new uuid.BufferClass(16); 219 | 220 | for (var i = 0, t = Date.now(); i < N; i++) generator(); 221 | rate('uuid.' + version + '()', t); 222 | 223 | for (var i = 0, t = Date.now(); i < N; i++) generator('binary'); 224 | rate('uuid.' + version + '(\'binary\')', t); 225 | 226 | for (var i = 0, t = Date.now(); i < N; i++) generator('binary', buf); 227 | rate('uuid.' + version + '(\'binary\', buffer)', t); 228 | } 229 | -------------------------------------------------------------------------------- /bower_components/pegjs/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pegjs", 3 | "homepage": "https://github.com/dmajda/pegjs", 4 | "version": "0.8.0", 5 | "_release": "0.8.0", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v0.8.0", 9 | "commit": "2263a3003498bfee5c42c507c67306f9f87b2b30" 10 | }, 11 | "_source": "git://github.com/dmajda/pegjs.git", 12 | "_target": "~0.8.0", 13 | "_originalSource": "pegjs", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /bower_components/pegjs/.gitignore: -------------------------------------------------------------------------------- 1 | browser/* 2 | examples/*.js 3 | node_modules/* 4 | -------------------------------------------------------------------------------- /bower_components/pegjs/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "evil": true, 5 | "forin": true, 6 | "freeze": true, 7 | "immed": true, 8 | "latedef": "nofunc", 9 | "laxbreak": true, 10 | "noarg": true, 11 | "noempty": true, 12 | "nonew": true, 13 | "trailing": true 14 | } 15 | -------------------------------------------------------------------------------- /bower_components/pegjs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 5 | -------------------------------------------------------------------------------- /bower_components/pegjs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2013 David Majda 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /bower_components/pegjs/Makefile: -------------------------------------------------------------------------------- 1 | # ===== Variables ===== 2 | 3 | PEGJS_VERSION = `cat $(VERSION_FILE)` 4 | 5 | # ===== Modules ===== 6 | 7 | # Order matters -- dependencies must be listed before modules dependent on them. 8 | MODULES = utils \ 9 | grammar-error \ 10 | parser \ 11 | compiler/opcodes \ 12 | compiler/passes/generate-bytecode \ 13 | compiler/passes/generate-javascript \ 14 | compiler/passes/remove-proxy-rules \ 15 | compiler/passes/report-left-recursion \ 16 | compiler/passes/report-missing-rules \ 17 | compiler \ 18 | peg 19 | 20 | # ===== Directories ===== 21 | 22 | SRC_DIR = src 23 | LIB_DIR = lib 24 | BIN_DIR = bin 25 | BROWSER_DIR = browser 26 | SPEC_DIR = spec 27 | BENCHMARK_DIR = benchmark 28 | NODE_MODULES_DIR = node_modules 29 | NODE_MODULES_BIN_DIR = $(NODE_MODULES_DIR)/.bin 30 | 31 | # ===== Files ===== 32 | 33 | PARSER_SRC_FILE = $(SRC_DIR)/parser.pegjs 34 | PARSER_OUT_FILE = $(LIB_DIR)/parser.js 35 | 36 | BROWSER_FILE_DEV = $(BROWSER_DIR)/peg-$(PEGJS_VERSION).js 37 | BROWSER_FILE_MIN = $(BROWSER_DIR)/peg-$(PEGJS_VERSION).min.js 38 | 39 | VERSION_FILE = VERSION 40 | 41 | # ===== Executables ===== 42 | 43 | JSHINT = $(NODE_MODULES_BIN_DIR)/jshint 44 | UGLIFYJS = $(NODE_MODULES_BIN_DIR)/uglifyjs 45 | JASMINE_NODE = $(NODE_MODULES_BIN_DIR)/jasmine-node 46 | PEGJS = $(BIN_DIR)/pegjs 47 | BENCHMARK_RUN = $(BENCHMARK_DIR)/run 48 | 49 | # ===== Targets ===== 50 | 51 | # Default target 52 | all: browser 53 | 54 | # Generate the grammar parser 55 | parser: 56 | $(PEGJS) $(PARSER_SRC_FILE) $(PARSER_OUT_FILE) 57 | 58 | # Build the browser version of the library 59 | browser: 60 | mkdir -p $(BROWSER_DIR) 61 | 62 | rm -f $(BROWSER_FILE_DEV) 63 | rm -f $(BROWSER_FILE_MIN) 64 | 65 | # The following code is inspired by CoffeeScript's Cakefile. 66 | 67 | echo '/*' >> $(BROWSER_FILE_DEV) 68 | echo " * PEG.js $(PEGJS_VERSION)" >> $(BROWSER_FILE_DEV) 69 | echo ' *' >> $(BROWSER_FILE_DEV) 70 | echo ' * http://pegjs.majda.cz/' >> $(BROWSER_FILE_DEV) 71 | echo ' *' >> $(BROWSER_FILE_DEV) 72 | echo ' * Copyright (c) 2010-2013 David Majda' >> $(BROWSER_FILE_DEV) 73 | echo ' * Licensed under the MIT license.' >> $(BROWSER_FILE_DEV) 74 | echo ' */' >> $(BROWSER_FILE_DEV) 75 | echo 'var PEG = (function(undefined) {' >> $(BROWSER_FILE_DEV) 76 | echo ' var modules = {' >> $(BROWSER_FILE_DEV) 77 | echo ' define: function(name, factory) {' >> $(BROWSER_FILE_DEV) 78 | echo ' var dir = name.replace(/(^|\/)[^/]+$$/, "$$1"),' >> $(BROWSER_FILE_DEV) 79 | echo ' module = { exports: {} };' >> $(BROWSER_FILE_DEV) 80 | echo '' >> $(BROWSER_FILE_DEV) 81 | echo ' function require(path) {' >> $(BROWSER_FILE_DEV) 82 | echo ' var name = dir + path,' >> $(BROWSER_FILE_DEV) 83 | echo ' regexp = /[^\/]+\/\.\.\/|\.\//;' >> $(BROWSER_FILE_DEV) 84 | echo '' >> $(BROWSER_FILE_DEV) 85 | echo " /* Can't use /.../g because we can move backwards in the string. */" >> $(BROWSER_FILE_DEV) 86 | echo ' while (regexp.test(name)) {' >> $(BROWSER_FILE_DEV) 87 | echo ' name = name.replace(regexp, "");' >> $(BROWSER_FILE_DEV) 88 | echo ' }' >> $(BROWSER_FILE_DEV) 89 | echo '' >> $(BROWSER_FILE_DEV) 90 | echo ' return modules[name];' >> $(BROWSER_FILE_DEV) 91 | echo ' }' >> $(BROWSER_FILE_DEV) 92 | echo '' >> $(BROWSER_FILE_DEV) 93 | echo ' factory(module, require);' >> $(BROWSER_FILE_DEV) 94 | echo ' this[name] = module.exports;' >> $(BROWSER_FILE_DEV) 95 | echo ' }' >> $(BROWSER_FILE_DEV) 96 | echo ' };' >> $(BROWSER_FILE_DEV) 97 | echo '' >> $(BROWSER_FILE_DEV) 98 | 99 | for module in $(MODULES); do \ 100 | echo " modules.define(\"$$module\", function(module, require) {" >> $(BROWSER_FILE_DEV); \ 101 | sed -e 's/^/ /' lib/$$module.js >> $(BROWSER_FILE_DEV); \ 102 | echo ' });' >> $(BROWSER_FILE_DEV); \ 103 | echo '' >> $(BROWSER_FILE_DEV); \ 104 | done 105 | 106 | echo ' return modules["peg"]' >> $(BROWSER_FILE_DEV) 107 | echo '})();' >> $(BROWSER_FILE_DEV) 108 | 109 | $(UGLIFYJS) \ 110 | --mangle \ 111 | --compress warnings=false \ 112 | --comments /Copyright/ \ 113 | -o $(BROWSER_FILE_MIN) \ 114 | $(BROWSER_FILE_DEV) 115 | 116 | # Remove browser version of the library (created by "browser") 117 | browserclean: 118 | rm -rf $(BROWSER_DIR) 119 | 120 | # Run the spec suite 121 | spec: 122 | $(JASMINE_NODE) --verbose $(SPEC_DIR) 123 | 124 | # Run the benchmark suite 125 | benchmark: 126 | $(BENCHMARK_RUN) 127 | 128 | # Run JSHint on the source 129 | hint: 130 | $(JSHINT) \ 131 | `find $(LIB_DIR) -name '*.js'` \ 132 | `find $(SPEC_DIR) -name '*.js' -and -not -path '$(SPEC_DIR)/vendor/*'` \ 133 | $(BENCHMARK_DIR)/*.js \ 134 | $(BENCHMARK_RUN) \ 135 | $(PEGJS) 136 | 137 | .PHONY: all parser browser browserclean spec benchmark hint 138 | .SILENT: all parser browser browserclean spec benchmark hint 139 | -------------------------------------------------------------------------------- /bower_components/pegjs/VERSION: -------------------------------------------------------------------------------- 1 | 0.8.0 2 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/README: -------------------------------------------------------------------------------- 1 | PEG.js Benchmark Suite 2 | ====================== 3 | 4 | This is the PEG.js benchmark suite. It measures speed of the parsers generated 5 | by PEG.js on various inputs. Its main goal is to provide data for code generator 6 | optimization. 7 | 8 | Running in a browser 9 | -------------------- 10 | 11 | 1. Make sure you have Node.js and all the development dependencies specified 12 | in package.json installed. 13 | 14 | 2. Run the following command in the PEG.js root directory (one level up from 15 | this one): 16 | 17 | make browser 18 | 19 | 3. Start a web server and make it serve the PEG.js root directory. 20 | 21 | 4. Point your browser to an URL corresponding to the index.html file. 22 | 23 | 5. Click the "Run" button and wait for the table to fill. 24 | 25 | If you have Python installed, you can fulfill steps 3 and 4 by running the 26 | following command in the PEG.js root directory 27 | 28 | python -m SimpleHTTPServer 29 | 30 | and load http://localhost:8000/benchmark/index.html in your browser. 31 | 32 | Running from a command-line 33 | --------------------------- 34 | 35 | 1. Make sure you have Node.js and all the development dependencies specified 36 | in package.json installed. 37 | 38 | 2. Run the following command in the PEG.js root directory (one level up from 39 | this one): 40 | 41 | make benchmark 42 | 43 | 3. Wait for the table to fill. 44 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/benchmarks.js: -------------------------------------------------------------------------------- 1 | benchmarks = [ 2 | { 3 | id: "json", 4 | title: "JSON", 5 | tests: [ 6 | { file: "example1.json", title: "Example 1" }, 7 | { file: "example2.json", title: "Example 2" }, 8 | { file: "example3.json", title: "Example 3" }, 9 | { file: "example4.json", title: "Example 4" }, 10 | { file: "example5.json", title: "Example 5" } 11 | ] 12 | }, 13 | { 14 | id: "css", 15 | title: "CSS", 16 | tests: [ 17 | { file: "blueprint/src/reset.css", title: "Blueprint - reset.css (source)" }, 18 | { file: "blueprint/src/typography.css", title: "Blueprint - typography.css (source)" }, 19 | { file: "blueprint/src/forms.css", title: "Blueprint - forms.css (source)" }, 20 | { file: "blueprint/src/grid.css", title: "Blueprint - grid.css (source)" }, 21 | { file: "blueprint/src/print.css", title: "Blueprint - print.css (source)" }, 22 | // Contains syntax errors. 23 | // { file: "blueprint/src/ie.css", title: "Blueprint - ie.css (source)" }, 24 | { file: "blueprint/min/screen.css", title: "Blueprint - screen.css (minified)" }, 25 | { file: "blueprint/min/print.css", title: "Blueprint - print.css (minified)" }, 26 | // Contains syntax errors. 27 | // { file: "blueprint/min/ie.css", title: "Blueprint - ie.css (minified)" }, 28 | { file: "960.gs/src/reset.css", title: "960.gs - reset.css (source)" }, 29 | { file: "960.gs/src/text.css", title: "960.gs - text.css (source)" }, 30 | { file: "960.gs/src/960.css", title: "960.gs - 960.css (source)" }, 31 | { file: "960.gs/src/960_24_col.css", title: "960.gs - 960_24_col.css (source)" }, 32 | { file: "960.gs/min/reset.css", title: "960.gs - reset.css (minified)" }, 33 | { file: "960.gs/min/text.css", title: "960.gs - text.css (minified)" }, 34 | { file: "960.gs/min/960.css", title: "960.gs - 960.css (minified)" }, 35 | { file: "960.gs/min/960_24_col.css", title: "960.gs - 960_24_col.css (minified)" } 36 | ] 37 | } 38 | ]; 39 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/min/960.css: -------------------------------------------------------------------------------- 1 | .container_12,.container_16{margin-left:auto;margin-right:auto;width:960px}.grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16{display:inline;float:left;position:relative;margin-left:10px;margin-right:10px}.container_12 .grid_3,.container_16 .grid_4{width:220px}.container_12 .grid_6,.container_16 .grid_8{width:460px}.container_12 .grid_9,.container_16 .grid_12{width:700px}.container_12 .grid_12,.container_16 .grid_16{width:940px}.alpha{margin-left:0}.omega{margin-right:0}.container_12 .grid_1{width:60px}.container_12 .grid_2{width:140px}.container_12 .grid_4{width:300px}.container_12 .grid_5{width:380px}.container_12 .grid_7{width:540px}.container_12 .grid_8{width:620px}.container_12 .grid_10{width:780px}.container_12 .grid_11{width:860px}.container_16 .grid_1{width:40px}.container_16 .grid_2{width:100px}.container_16 .grid_3{width:160px}.container_16 .grid_5{width:280px}.container_16 .grid_6{width:340px}.container_16 .grid_7{width:400px}.container_16 .grid_9{width:520px}.container_16 .grid_10{width:580px}.container_16 .grid_11{width:640px}.container_16 .grid_13{width:760px}.container_16 .grid_14{width:820px}.container_16 .grid_15{width:880px}.container_12 .prefix_3,.container_16 .prefix_4{padding-left:240px}.container_12 .prefix_6,.container_16 .prefix_8{padding-left:480px}.container_12 .prefix_9,.container_16 .prefix_12{padding-left:720px}.container_12 .prefix_1{padding-left:80px}.container_12 .prefix_2{padding-left:160px}.container_12 .prefix_4{padding-left:320px}.container_12 .prefix_5{padding-left:400px}.container_12 .prefix_7{padding-left:560px}.container_12 .prefix_8{padding-left:640px}.container_12 .prefix_10{padding-left:800px}.container_12 .prefix_11{padding-left:880px}.container_16 .prefix_1{padding-left:60px}.container_16 .prefix_2{padding-left:120px}.container_16 .prefix_3{padding-left:180px}.container_16 .prefix_5{padding-left:300px}.container_16 .prefix_6{padding-left:360px}.container_16 .prefix_7{padding-left:420px}.container_16 .prefix_9{padding-left:540px}.container_16 .prefix_10{padding-left:600px}.container_16 .prefix_11{padding-left:660px}.container_16 .prefix_13{padding-left:780px}.container_16 .prefix_14{padding-left:840px}.container_16 .prefix_15{padding-left:900px}.container_12 .suffix_3,.container_16 .suffix_4{padding-right:240px}.container_12 .suffix_6,.container_16 .suffix_8{padding-right:480px}.container_12 .suffix_9,.container_16 .suffix_12{padding-right:720px}.container_12 .suffix_1{padding-right:80px}.container_12 .suffix_2{padding-right:160px}.container_12 .suffix_4{padding-right:320px}.container_12 .suffix_5{padding-right:400px}.container_12 .suffix_7{padding-right:560px}.container_12 .suffix_8{padding-right:640px}.container_12 .suffix_10{padding-right:800px}.container_12 .suffix_11{padding-right:880px}.container_16 .suffix_1{padding-right:60px}.container_16 .suffix_2{padding-right:120px}.container_16 .suffix_3{padding-right:180px}.container_16 .suffix_5{padding-right:300px}.container_16 .suffix_6{padding-right:360px}.container_16 .suffix_7{padding-right:420px}.container_16 .suffix_9{padding-right:540px}.container_16 .suffix_10{padding-right:600px}.container_16 .suffix_11{padding-right:660px}.container_16 .suffix_13{padding-right:780px}.container_16 .suffix_14{padding-right:840px}.container_16 .suffix_15{padding-right:900px}.container_12 .push_3,.container_16 .push_4{left:240px}.container_12 .push_6,.container_16 .push_8{left:480px}.container_12 .push_9,.container_16 .push_12{left:720px}.container_12 .push_1{left:80px}.container_12 .push_2{left:160px}.container_12 .push_4{left:320px}.container_12 .push_5{left:400px}.container_12 .push_7{left:560px}.container_12 .push_8{left:640px}.container_12 .push_10{left:800px}.container_12 .push_11{left:880px}.container_16 .push_1{left:60px}.container_16 .push_2{left:120px}.container_16 .push_3{left:180px}.container_16 .push_5{left:300px}.container_16 .push_6{left:360px}.container_16 .push_7{left:420px}.container_16 .push_9{left:540px}.container_16 .push_10{left:600px}.container_16 .push_11{left:660px}.container_16 .push_13{left:780px}.container_16 .push_14{left:840px}.container_16 .push_15{left:900px}.container_12 .pull_3,.container_16 .pull_4{left:-240px}.container_12 .pull_6,.container_16 .pull_8{left:-480px}.container_12 .pull_9,.container_16 .pull_12{left:-720px}.container_12 .pull_1{left:-80px}.container_12 .pull_2{left:-160px}.container_12 .pull_4{left:-320px}.container_12 .pull_5{left:-400px}.container_12 .pull_7{left:-560px}.container_12 .pull_8{left:-640px}.container_12 .pull_10{left:-800px}.container_12 .pull_11{left:-880px}.container_16 .pull_1{left:-60px}.container_16 .pull_2{left:-120px}.container_16 .pull_3{left:-180px}.container_16 .pull_5{left:-300px}.container_16 .pull_6{left:-360px}.container_16 .pull_7{left:-420px}.container_16 .pull_9{left:-540px}.container_16 .pull_10{left:-600px}.container_16 .pull_11{left:-660px}.container_16 .pull_13{left:-780px}.container_16 .pull_14{left:-840px}.container_16 .pull_15{left:-900px}.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:after{clear:both;content:' ';display:block;font-size:0;line-height:0;visibility:hidden;width:0;height:0}* html .clearfix,*:first-child+html .clearfix{zoom:1} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/min/960_24_col.css: -------------------------------------------------------------------------------- 1 | .container_24{margin-left:auto;margin-right:auto;width:960px}.grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16,.grid_17,.grid_18,.grid_19,.grid_20,.grid_21,.grid_22,.grid_23,.grid_24{display:inline;float:left;position:relative;margin-left:5px;margin-right:5px}.alpha{margin-left:0}.omega{margin-right:0}.container_24 .grid_1{width:30px}.container_24 .grid_2{width:70px}.container_24 .grid_3{width:110px}.container_24 .grid_4{width:150px}.container_24 .grid_5{width:190px}.container_24 .grid_6{width:230px}.container_24 .grid_7{width:270px}.container_24 .grid_8{width:310px}.container_24 .grid_9{width:350px}.container_24 .grid_10{width:390px}.container_24 .grid_11{width:430px}.container_24 .grid_12{width:470px}.container_24 .grid_13{width:510px}.container_24 .grid_14{width:550px}.container_24 .grid_15{width:590px}.container_24 .grid_16{width:630px}.container_24 .grid_17{width:670px}.container_24 .grid_18{width:710px}.container_24 .grid_19{width:750px}.container_24 .grid_20{width:790px}.container_24 .grid_21{width:830px}.container_24 .grid_22{width:870px}.container_24 .grid_23{width:910px}.container_24 .grid_24{width:950px}.container_24 .prefix_1{padding-left:40px}.container_24 .prefix_2{padding-left:80px}.container_24 .prefix_3{padding-left:120px}.container_24 .prefix_4{padding-left:160px}.container_24 .prefix_5{padding-left:200px}.container_24 .prefix_6{padding-left:240px}.container_24 .prefix_7{padding-left:280px}.container_24 .prefix_8{padding-left:320px}.container_24 .prefix_9{padding-left:360px}.container_24 .prefix_10{padding-left:400px}.container_24 .prefix_11{padding-left:440px}.container_24 .prefix_12{padding-left:480px}.container_24 .prefix_13{padding-left:520px}.container_24 .prefix_14{padding-left:560px}.container_24 .prefix_15{padding-left:600px}.container_24 .prefix_16{padding-left:640px}.container_24 .prefix_17{padding-left:680px}.container_24 .prefix_18{padding-left:720px}.container_24 .prefix_19{padding-left:760px}.container_24 .prefix_20{padding-left:800px}.container_24 .prefix_21{padding-left:840px}.container_24 .prefix_22{padding-left:880px}.container_24 .prefix_23{padding-left:920px}.container_24 .suffix_1{padding-right:40px}.container_24 .suffix_2{padding-right:80px}.container_24 .suffix_3{padding-right:120px}.container_24 .suffix_4{padding-right:160px}.container_24 .suffix_5{padding-right:200px}.container_24 .suffix_6{padding-right:240px}.container_24 .suffix_7{padding-right:280px}.container_24 .suffix_8{padding-right:320px}.container_24 .suffix_9{padding-right:360px}.container_24 .suffix_10{padding-right:400px}.container_24 .suffix_11{padding-right:440px}.container_24 .suffix_12{padding-right:480px}.container_24 .suffix_13{padding-right:520px}.container_24 .suffix_14{padding-right:560px}.container_24 .suffix_15{padding-right:600px}.container_24 .suffix_16{padding-right:640px}.container_24 .suffix_17{padding-right:680px}.container_24 .suffix_18{padding-right:720px}.container_24 .suffix_19{padding-right:760px}.container_24 .suffix_20{padding-right:800px}.container_24 .suffix_21{padding-right:840px}.container_24 .suffix_22{padding-right:880px}.container_24 .suffix_23{padding-right:920px}.container_24 .push_1{left:40px}.container_24 .push_2{left:80px}.container_24 .push_3{left:120px}.container_24 .push_4{left:160px}.container_24 .push_5{left:200px}.container_24 .push_6{left:240px}.container_24 .push_7{left:280px}.container_24 .push_8{left:320px}.container_24 .push_9{left:360px}.container_24 .push_10{left:400px}.container_24 .push_11{left:440px}.container_24 .push_12{left:480px}.container_24 .push_13{left:520px}.container_24 .push_14{left:560px}.container_24 .push_15{left:600px}.container_24 .push_16{left:640px}.container_24 .push_17{left:680px}.container_24 .push_18{left:720px}.container_24 .push_19{left:760px}.container_24 .push_20{left:800px}.container_24 .push_21{left:840px}.container_24 .push_22{left:880px}.container_24 .push_23{left:920px}.container_24 .pull_1{left:-40px}.container_24 .pull_2{left:-80px}.container_24 .pull_3{left:-120px}.container_24 .pull_4{left:-160px}.container_24 .pull_5{left:-200px}.container_24 .pull_6{left:-240px}.container_24 .pull_7{left:-280px}.container_24 .pull_8{left:-320px}.container_24 .pull_9{left:-360px}.container_24 .pull_10{left:-400px}.container_24 .pull_11{left:-440px}.container_24 .pull_12{left:-480px}.container_24 .pull_13{left:-520px}.container_24 .pull_14{left:-560px}.container_24 .pull_15{left:-600px}.container_24 .pull_16{left:-640px}.container_24 .pull_17{left:-680px}.container_24 .pull_18{left:-720px}.container_24 .pull_19{left:-760px}.container_24 .pull_20{left:-800px}.container_24 .pull_21{left:-840px}.container_24 .pull_22{left:-880px}.container_24 .pull_23{left:-920px}.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:after{clear:both;content:' ';display:block;font-size:0;line-height:0;visibility:hidden;width:0;height:0}* html .clearfix,*:first-child+html .clearfix{zoom:1} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/min/reset.css: -------------------------------------------------------------------------------- 1 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outline:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/min/text.css: -------------------------------------------------------------------------------- 1 | body{font:13px/1.5 'Helvetica Neue',Arial,'Liberation Sans',FreeSans,sans-serif}a:focus{outline:1px dotted}hr{border:0 #ccc solid;border-top-width:1px;clear:both;height:0}h1{font-size:25px}h2{font-size:23px}h3{font-size:21px}h4{font-size:19px}h5{font-size:17px}h6{font-size:15px}ol{list-style:decimal}ul{list-style:disc}li{margin-left:30px}p,dl,hr,h1,h2,h3,h4,h5,h6,ol,ul,pre,table,address,fieldset{margin-bottom:20px} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/src/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ */ 2 | /* v1.0 | 20080212 */ 3 | 4 | html, body, div, span, applet, object, iframe, 5 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 6 | a, abbr, acronym, address, big, cite, code, 7 | del, dfn, em, font, img, ins, kbd, q, s, samp, 8 | small, strike, strong, sub, sup, tt, var, 9 | b, u, i, center, 10 | dl, dt, dd, ol, ul, li, 11 | fieldset, form, label, legend, 12 | table, caption, tbody, tfoot, thead, tr, th, td { 13 | margin: 0; 14 | padding: 0; 15 | border: 0; 16 | outline: 0; 17 | font-size: 100%; 18 | vertical-align: baseline; 19 | background: transparent; 20 | } 21 | body { 22 | line-height: 1; 23 | } 24 | ol, ul { 25 | list-style: none; 26 | } 27 | blockquote, q { 28 | quotes: none; 29 | } 30 | blockquote:before, blockquote:after, 31 | q:before, q:after { 32 | content: ''; 33 | content: none; 34 | } 35 | 36 | /* remember to define focus styles! */ 37 | :focus { 38 | outline: 0; 39 | } 40 | 41 | /* remember to highlight inserts somehow! */ 42 | ins { 43 | text-decoration: none; 44 | } 45 | del { 46 | text-decoration: line-through; 47 | } 48 | 49 | /* tables still need 'cellspacing="0"' in the markup */ 50 | table { 51 | border-collapse: collapse; 52 | border-spacing: 0; 53 | } -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/960.gs/src/text.css: -------------------------------------------------------------------------------- 1 | /* 2 | 960 Grid System ~ Text CSS. 3 | Learn more ~ http://960.gs/ 4 | 5 | Licensed under GPL and MIT. 6 | */ 7 | 8 | /* `Basic HTML 9 | ----------------------------------------------------------------------------------------------------*/ 10 | 11 | body { 12 | font: 13px/1.5 'Helvetica Neue', Arial, 'Liberation Sans', FreeSans, sans-serif; 13 | } 14 | 15 | a:focus { 16 | outline: 1px dotted; 17 | } 18 | 19 | hr { 20 | border: 0 #ccc solid; 21 | border-top-width: 1px; 22 | clear: both; 23 | height: 0; 24 | } 25 | 26 | /* `Headings 27 | ----------------------------------------------------------------------------------------------------*/ 28 | 29 | h1 { 30 | font-size: 25px; 31 | } 32 | 33 | h2 { 34 | font-size: 23px; 35 | } 36 | 37 | h3 { 38 | font-size: 21px; 39 | } 40 | 41 | h4 { 42 | font-size: 19px; 43 | } 44 | 45 | h5 { 46 | font-size: 17px; 47 | } 48 | 49 | h6 { 50 | font-size: 15px; 51 | } 52 | 53 | /* `Spacing 54 | ----------------------------------------------------------------------------------------------------*/ 55 | 56 | ol { 57 | list-style: decimal; 58 | } 59 | 60 | ul { 61 | list-style: disc; 62 | } 63 | 64 | li { 65 | margin-left: 30px; 66 | } 67 | 68 | p, 69 | dl, 70 | hr, 71 | h1, 72 | h2, 73 | h3, 74 | h4, 75 | h5, 76 | h6, 77 | ol, 78 | ul, 79 | pre, 80 | table, 81 | address, 82 | fieldset { 83 | margin-bottom: 20px; 84 | } -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/min/ie.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | 3 | 4 | Blueprint CSS Framework 0.9 5 | http://blueprintcss.org 6 | 7 | * Copyright (c) 2007-Present. See LICENSE for more info. 8 | * See README for instructions on how to use Blueprint. 9 | * For credits and origins, see AUTHORS. 10 | * This is a compressed file. See the sources in the 'src' directory. 11 | 12 | ----------------------------------------------------------------------- */ 13 | 14 | /* ie.css */ 15 | body {text-align:center;} 16 | .container {text-align:left;} 17 | * html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {display:inline;overflow-x:hidden;} 18 | * html legend {margin:0px -8px 16px 0;padding:0;} 19 | sup {vertical-align:text-top;} 20 | sub {vertical-align:text-bottom;} 21 | html>body p code {*white-space:normal;} 22 | hr {margin:-8px auto 11px;} 23 | img {-ms-interpolation-mode:bicubic;} 24 | .clearfix, .container {display:inline-block;} 25 | * html .clearfix, * html .container {height:1%;} 26 | fieldset {padding-top:0;} 27 | textarea {overflow:auto;} 28 | input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} 29 | input.text:focus, input.title:focus {border-color:#666;} 30 | input.text, input.title, textarea, select {margin:0.5em 0;} 31 | input.checkbox, input.radio {position:relative;top:.25em;} 32 | form.inline div, form.inline p {vertical-align:middle;} 33 | form.inline label {position:relative;top:-0.25em;} 34 | form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} 35 | button, input.button {position:relative;top:0.25em;} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/min/print.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | 3 | 4 | Blueprint CSS Framework 0.9 5 | http://blueprintcss.org 6 | 7 | * Copyright (c) 2007-Present. See LICENSE for more info. 8 | * See README for instructions on how to use Blueprint. 9 | * For credits and origins, see AUTHORS. 10 | * This is a compressed file. See the sources in the 'src' directory. 11 | 12 | ----------------------------------------------------------------------- */ 13 | 14 | /* print.css */ 15 | body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;} 16 | .container {background:none;} 17 | hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;} 18 | hr.space {background:#fff;color:#fff;visibility:hidden;} 19 | h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;} 20 | code {font:.9em "Courier New", Monaco, Courier, monospace;} 21 | a img {border:none;} 22 | p img.top {margin-top:0;} 23 | blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;} 24 | .small {font-size:.9em;} 25 | .large {font-size:1.1em;} 26 | .quiet {color:#999;} 27 | .hide {display:none;} 28 | a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;} 29 | a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;} -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/src/forms.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | forms.css 4 | * Sets up some default styling for forms 5 | * Gives you classes to enhance your forms 6 | 7 | Usage: 8 | * For text fields, use class .title or .text 9 | * For inline forms, use .inline (even when using columns) 10 | 11 | -------------------------------------------------------------- */ 12 | 13 | label { font-weight: bold; } 14 | fieldset { padding:1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; } 15 | legend { font-weight: bold; font-size:1.2em; } 16 | 17 | 18 | /* Form fields 19 | -------------------------------------------------------------- */ 20 | 21 | input[type=text], input[type=password], 22 | input.text, input.title, 23 | textarea, select { 24 | background-color:#fff; 25 | border:1px solid #bbb; 26 | } 27 | input[type=text]:focus, input[type=password]:focus, 28 | input.text:focus, input.title:focus, 29 | textarea:focus, select:focus { 30 | border-color:#666; 31 | } 32 | 33 | input[type=text], input[type=password], 34 | input.text, input.title, 35 | textarea, select { 36 | margin:0.5em 0; 37 | } 38 | 39 | input.text, 40 | input.title { width: 300px; padding:5px; } 41 | input.title { font-size:1.5em; } 42 | textarea { width: 390px; height: 250px; padding:5px; } 43 | 44 | input[type=checkbox], input[type=radio], 45 | input.checkbox, input.radio { 46 | position:relative; top:.25em; 47 | } 48 | 49 | form.inline { line-height:3; } 50 | form.inline p { margin-bottom:0; } 51 | 52 | 53 | /* Success, notice and error boxes 54 | -------------------------------------------------------------- */ 55 | 56 | .error, 57 | .notice, 58 | .success { padding: .8em; margin-bottom: 1em; border: 2px solid #ddd; } 59 | 60 | .error { background: #FBE3E4; color: #8a1f11; border-color: #FBC2C4; } 61 | .notice { background: #FFF6BF; color: #514721; border-color: #FFD324; } 62 | .success { background: #E6EFC2; color: #264409; border-color: #C6D880; } 63 | .error a { color: #8a1f11; } 64 | .notice a { color: #514721; } 65 | .success a { color: #264409; } 66 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/src/ie.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | ie.css 4 | 5 | Contains every hack for Internet Explorer, 6 | so that our core files stay sweet and nimble. 7 | 8 | -------------------------------------------------------------- */ 9 | 10 | /* Make sure the layout is centered in IE5 */ 11 | body { text-align: center; } 12 | .container { text-align: left; } 13 | 14 | /* Fixes IE margin bugs */ 15 | * html .column, * html .span-1, * html .span-2, 16 | * html .span-3, * html .span-4, * html .span-5, 17 | * html .span-6, * html .span-7, * html .span-8, 18 | * html .span-9, * html .span-10, * html .span-11, 19 | * html .span-12, * html .span-13, * html .span-14, 20 | * html .span-15, * html .span-16, * html .span-17, 21 | * html .span-18, * html .span-19, * html .span-20, 22 | * html .span-21, * html .span-22, * html .span-23, 23 | * html .span-24 { display:inline; overflow-x: hidden; } 24 | 25 | 26 | /* Elements 27 | -------------------------------------------------------------- */ 28 | 29 | /* Fixes incorrect styling of legend in IE6. */ 30 | * html legend { margin:0px -8px 16px 0; padding:0; } 31 | 32 | /* Fixes wrong line-height on sup/sub in IE. */ 33 | sup { vertical-align:text-top; } 34 | sub { vertical-align:text-bottom; } 35 | 36 | /* Fixes IE7 missing wrapping of code elements. */ 37 | html>body p code { *white-space: normal; } 38 | 39 | /* IE 6&7 has problems with setting proper
margins. */ 40 | hr { margin:-8px auto 11px; } 41 | 42 | /* Explicitly set interpolation, allowing dynamically resized images to not look horrible */ 43 | img { -ms-interpolation-mode:bicubic; } 44 | 45 | /* Clearing 46 | -------------------------------------------------------------- */ 47 | 48 | /* Makes clearfix actually work in IE */ 49 | .clearfix, .container { display:inline-block; } 50 | * html .clearfix, 51 | * html .container { height:1%; } 52 | 53 | 54 | /* Forms 55 | -------------------------------------------------------------- */ 56 | 57 | /* Fixes padding on fieldset */ 58 | fieldset { padding-top:0; } 59 | 60 | /* Makes classic textareas in IE 6 resemble other browsers */ 61 | textarea { overflow:auto; } 62 | 63 | /* Fixes rule that IE 6 ignores */ 64 | input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; } 65 | input.text:focus, input.title:focus { border-color:#666; } 66 | input.text, input.title, textarea, select { margin:0.5em 0; } 67 | input.checkbox, input.radio { position:relative; top:.25em; } 68 | 69 | /* Fixes alignment of inline form elements */ 70 | form.inline div, form.inline p { vertical-align:middle; } 71 | form.inline label { position:relative;top:-0.25em; } 72 | form.inline input.checkbox, form.inline input.radio, 73 | form.inline input.button, form.inline button { 74 | margin:0.5em 0; 75 | } 76 | button, input.button { position:relative;top:0.25em; } 77 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/src/print.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | print.css 4 | * Gives you some sensible styles for printing pages. 5 | * See Readme file in this directory for further instructions. 6 | 7 | Some additions you'll want to make, customized to your markup: 8 | #header, #footer, #navigation { display:none; } 9 | 10 | -------------------------------------------------------------- */ 11 | 12 | body { 13 | line-height: 1.5; 14 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 15 | color:#000; 16 | background: none; 17 | font-size: 10pt; 18 | } 19 | 20 | 21 | /* Layout 22 | -------------------------------------------------------------- */ 23 | 24 | .container { 25 | background: none; 26 | } 27 | 28 | hr { 29 | background:#ccc; 30 | color:#ccc; 31 | width:100%; 32 | height:2px; 33 | margin:2em 0; 34 | padding:0; 35 | border:none; 36 | } 37 | hr.space { 38 | background: #fff; 39 | color: #fff; 40 | visibility: hidden; 41 | } 42 | 43 | 44 | /* Text 45 | -------------------------------------------------------------- */ 46 | 47 | h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; } 48 | code { font:.9em "Courier New", Monaco, Courier, monospace; } 49 | 50 | a img { border:none; } 51 | p img.top { margin-top: 0; } 52 | 53 | blockquote { 54 | margin:1.5em; 55 | padding:1em; 56 | font-style:italic; 57 | font-size:.9em; 58 | } 59 | 60 | .small { font-size: .9em; } 61 | .large { font-size: 1.1em; } 62 | .quiet { color: #999; } 63 | .hide { display:none; } 64 | 65 | 66 | /* Links 67 | -------------------------------------------------------------- */ 68 | 69 | a:link, a:visited { 70 | background: transparent; 71 | font-weight:700; 72 | text-decoration: underline; 73 | } 74 | 75 | a:link:after, a:visited:after { 76 | content: " (" attr(href) ")"; 77 | font-size: 90%; 78 | } 79 | 80 | /* If you're having trouble printing relative links, uncomment and customize this: 81 | (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */ 82 | 83 | /* a[href^="/"]:after { 84 | content: " (http://www.yourdomain.com" attr(href) ") "; 85 | } */ 86 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/src/reset.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | reset.css 4 | * Resets default browser CSS. 5 | 6 | -------------------------------------------------------------- */ 7 | 8 | html, body, div, span, object, iframe, 9 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 10 | a, abbr, acronym, address, code, 11 | del, dfn, em, img, q, dl, dt, dd, ol, ul, li, 12 | fieldset, form, label, legend, 13 | table, caption, tbody, tfoot, thead, tr, th, td, 14 | article, aside, dialog, figure, footer, header, 15 | hgroup, nav, section { 16 | margin: 0; 17 | padding: 0; 18 | border: 0; 19 | font-weight: inherit; 20 | font-style: inherit; 21 | font-size: 100%; 22 | font-family: inherit; 23 | vertical-align: baseline; 24 | } 25 | 26 | article, aside, dialog, figure, footer, header, 27 | hgroup, nav, section { 28 | display:block; 29 | } 30 | 31 | body { 32 | line-height: 1.5; 33 | } 34 | 35 | /* Tables still need 'cellspacing="0"' in the markup. */ 36 | table { border-collapse: separate; border-spacing: 0; } 37 | caption, th, td { text-align: left; font-weight: normal; } 38 | table, td, th { vertical-align: middle; } 39 | 40 | /* Remove possible quote marks (") from ,
. */ 41 | blockquote:before, blockquote:after, q:before, q:after { content: ""; } 42 | blockquote, q { quotes: "" ""; } 43 | 44 | /* Remove annoying border on linked images. */ 45 | a img { border: none; } 46 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/css/blueprint/src/typography.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | typography.css 4 | * Sets up some sensible default typography. 5 | 6 | -------------------------------------------------------------- */ 7 | 8 | /* Default font settings. 9 | The font-size percentage is of 16px. (0.75 * 16px = 12px) */ 10 | html { font-size:100.01%; } 11 | body { 12 | font-size: 75%; 13 | color: #222; 14 | background: #fff; 15 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 16 | } 17 | 18 | 19 | /* Headings 20 | -------------------------------------------------------------- */ 21 | 22 | h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; } 23 | 24 | h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; } 25 | h2 { font-size: 2em; margin-bottom: 0.75em; } 26 | h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; } 27 | h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; } 28 | h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; } 29 | h6 { font-size: 1em; font-weight: bold; } 30 | 31 | h1 img, h2 img, h3 img, 32 | h4 img, h5 img, h6 img { 33 | margin: 0; 34 | } 35 | 36 | 37 | /* Text elements 38 | -------------------------------------------------------------- */ 39 | 40 | p { margin: 0 0 1.5em; } 41 | p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } 42 | p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; } 43 | 44 | a:focus, 45 | a:hover { color: #000; } 46 | a { color: #009; text-decoration: underline; } 47 | 48 | blockquote { margin: 1.5em; color: #666; font-style: italic; } 49 | strong { font-weight: bold; } 50 | em,dfn { font-style: italic; } 51 | dfn { font-weight: bold; } 52 | sup, sub { line-height: 0; } 53 | 54 | abbr, 55 | acronym { border-bottom: 1px dotted #666; } 56 | address { margin: 0 0 1.5em; font-style: italic; } 57 | del { color:#666; } 58 | 59 | pre { margin: 1.5em 0; white-space: pre; } 60 | pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } 61 | 62 | 63 | /* Lists 64 | -------------------------------------------------------------- */ 65 | 66 | li ul, 67 | li ol { margin: 0; } 68 | ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 3.333em; } 69 | 70 | ul { list-style-type: disc; } 71 | ol { list-style-type: decimal; } 72 | 73 | dl { margin: 0 0 1.5em 0; } 74 | dl dt { font-weight: bold; } 75 | dd { margin-left: 1.5em;} 76 | 77 | 78 | /* Tables 79 | -------------------------------------------------------------- */ 80 | 81 | table { margin-bottom: 1.4em; width:100%; } 82 | th { font-weight: bold; } 83 | thead th { background: #c3d9ff; } 84 | th,td,caption { padding: 4px 10px 4px 5px; } 85 | tr.even td { background: #e5ecf9; } 86 | tfoot { font-style: italic; } 87 | caption { background: #eee; } 88 | 89 | 90 | /* Misc classes 91 | -------------------------------------------------------------- */ 92 | 93 | .small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; } 94 | .large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; } 95 | .hide { display: none; } 96 | 97 | .quiet { color: #666; } 98 | .loud { color: #000; } 99 | .highlight { background:#ff0; } 100 | .added { background:#060; color: #fff; } 101 | .removed { background:#900; color: #fff; } 102 | 103 | .first { margin-left:0; padding-left:0; } 104 | .last { margin-right:0; padding-right:0; } 105 | .top { margin-top:0; padding-top:0; } 106 | .bottom { margin-bottom:0; padding-bottom:0; } 107 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 2em 4em; 3 | font-family: "Trebuchet MS", lucida, sans-serif; 4 | line-height: 1.5; 5 | color: black; background-color: white; 6 | } 7 | 8 | h1 { margin: 0 0 .75em 0; text-align: center; font-size: 200%; } 9 | 10 | table { width: 48em; margin: 0 auto; border-spacing: 0; border-collapse: collapse; } 11 | table td, table th { border: 1px solid silver; padding: .25em 1em; } 12 | table td .unit { font-size: 75%; color: gray; } 13 | table td.no-results { padding: 1em; text-align: center; } 14 | table td.input-size { text-align: right; } 15 | table td.parse-time { text-align: right; } 16 | table td.parse-speed { text-align: right; } 17 | table tr.columns th { border-color: #404040; color: white; background-color: #404040; } 18 | table tr.heading th { background-color: #e0e0e0; } 19 | table tr.benchmark-total td { font-weight: bold; } 20 | table tr.total td { background-color: #ffff80; font-weight: bold; } 21 | table tr.total td .unit { color: #808000; } 22 | table tr.total td.parse-speed .value { font-size: 175%; } 23 | 24 | a, a:visited { color: #3d586c; } 25 | 26 | #options { 27 | width: 45em; 28 | margin: 2em auto; border-radius: .5em; -moz-border-radius: .5em; padding: .5em 1.5em; 29 | background-color: #f0f0f0; 30 | } 31 | #options #run-count { width: 3em; } 32 | #options #cache { margin-left: 2em; } 33 | #options label[for=optimize] { margin-left: 2em; } 34 | #options #run { float:right; width: 5em; } 35 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PEG.js Benchmark Suite 6 | 7 | 8 | 9 |

PEG.js Benchmark Suite

10 | 11 |
12 | 13 | times 14 | 15 | 16 | 17 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
TestInput SizeAverage Parse TimeAverage Parse Speed
No results available yet.
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/index.js: -------------------------------------------------------------------------------- 1 | $("#run").click(function() { 2 | 3 | /* Results Table Manipulation */ 4 | 5 | var resultsTable = $("#results-table"); 6 | 7 | function appendHeading(heading) { 8 | resultsTable.append( 9 | "" + heading + "" 10 | ); 11 | } 12 | 13 | function appendResult(klass, title, url, inputSize, parseTime) { 14 | var KB = 1024; 15 | var MS_IN_S = 1000; 16 | 17 | resultsTable.append( 18 | "" 19 | + "" 20 | + (url !== null ? "" : "") 21 | + title 22 | + (url !== null ? "" : "") 23 | + "" 24 | + "" 25 | + "" 26 | + (inputSize / KB).toFixed(2) 27 | + "" 28 | + " kB" 29 | + "" 30 | + "" 31 | + "" 32 | + parseTime.toFixed(2) 33 | + "" 34 | + " ms" 35 | + "" 36 | + "" 37 | + "" 38 | + ((inputSize / KB) / (parseTime / MS_IN_S)).toFixed(2) 39 | + "" 40 | + " kB/s" 41 | + "" 42 | + "" 43 | ); 44 | } 45 | 46 | /* Main */ 47 | 48 | /* 49 | * Each input is parsed multiple times and the results are averaged. We 50 | * do this for two reasons: 51 | * 52 | * 1. To warm up the interpreter (PEG.js-generated parsers will be 53 | * most likely used repeatedly, so it makes sense to measure 54 | * performance after warming up). 55 | * 56 | * 2. To minimize random errors. 57 | */ 58 | 59 | var runCount = parseInt($("#run-count").val(), 10); 60 | if (isNaN(runCount) || runCount <= 0) { 61 | alert("Number of runs must be a positive integer."); 62 | return; 63 | } 64 | 65 | var options = { 66 | cache: $("#cache").is(":checked"), 67 | optimize: $("#optimize").val() 68 | }; 69 | 70 | Runner.run(benchmarks, runCount, options, { 71 | readFile: function(file) { 72 | return $.ajax({ 73 | type: "GET", 74 | url: file, 75 | dataType: "text", 76 | async: false 77 | }).responseText; 78 | }, 79 | 80 | testStart: function(benchmark, test) { 81 | /* Nothing to do. */ 82 | }, 83 | 84 | testFinish: function(benchmark, test, inputSize, parseTime) { 85 | appendResult( 86 | "individual", 87 | test.title, 88 | benchmark.id + "/" + test.file, 89 | inputSize, 90 | parseTime 91 | ); 92 | }, 93 | 94 | benchmarkStart: function(benchmark) { 95 | appendHeading(benchmark.title); 96 | }, 97 | 98 | benchmarkFinish: function(benchmark, inputSize, parseTime) { 99 | appendResult( 100 | "benchmark-total", 101 | benchmark.title + " total", 102 | null, 103 | inputSize, 104 | parseTime 105 | ); 106 | }, 107 | 108 | start: function() { 109 | $("#run-count, #cache, #run").attr("disabled", "disabled"); 110 | 111 | resultsTable.show(); 112 | $("#results-table tr").slice(1).remove(); 113 | }, 114 | 115 | finish: function(inputSize, parseTime) { 116 | appendResult( 117 | "total", 118 | "Total", 119 | null, 120 | inputSize, 121 | parseTime 122 | ); 123 | 124 | $.scrollTo("max", { axis: "y", duration: 500 }); 125 | 126 | $("#run-count, #cache, #run").removeAttr("disabled"); 127 | } 128 | }); 129 | 130 | }); 131 | 132 | $(document).ready(function() { 133 | $("#run").focus(); 134 | }); 135 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/json/example1.json: -------------------------------------------------------------------------------- 1 | { 2 | "glossary": { 3 | "title": "example glossary", 4 | "GlossDiv": { 5 | "title": "S", 6 | "GlossList": { 7 | "GlossEntry": { 8 | "ID": "SGML", 9 | "SortAs": "SGML", 10 | "GlossTerm": "Standard Generalized Markup Language", 11 | "Acronym": "SGML", 12 | "Abbrev": "ISO 8879:1986", 13 | "GlossDef": { 14 | "para": "A meta-markup language, used to create markup languages such as DocBook.", 15 | "GlossSeeAlso": ["GML", "XML"] 16 | }, 17 | "GlossSee": "markup" 18 | } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/json/example2.json: -------------------------------------------------------------------------------- 1 | {"menu": { 2 | "id": "file", 3 | "value": "File", 4 | "popup": { 5 | "menuitem": [ 6 | {"value": "New", "onclick": "CreateNewDoc()"}, 7 | {"value": "Open", "onclick": "OpenDoc()"}, 8 | {"value": "Close", "onclick": "CloseDoc()"} 9 | ] 10 | } 11 | }} 12 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/json/example3.json: -------------------------------------------------------------------------------- 1 | {"widget": { 2 | "debug": "on", 3 | "window": { 4 | "title": "Sample Konfabulator Widget", 5 | "name": "main_window", 6 | "width": 500, 7 | "height": 500 8 | }, 9 | "image": { 10 | "src": "Images/Sun.png", 11 | "name": "sun1", 12 | "hOffset": 250, 13 | "vOffset": 250, 14 | "alignment": "center" 15 | }, 16 | "text": { 17 | "data": "Click Here", 18 | "size": 36, 19 | "style": "bold", 20 | "name": "text1", 21 | "hOffset": 250, 22 | "vOffset": 100, 23 | "alignment": "center", 24 | "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" 25 | } 26 | }} 27 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/json/example4.json: -------------------------------------------------------------------------------- 1 | {"web-app": { 2 | "servlet": [ 3 | { 4 | "servlet-name": "cofaxCDS", 5 | "servlet-class": "org.cofax.cds.CDSServlet", 6 | "init-param": { 7 | "configGlossary:installationAt": "Philadelphia, PA", 8 | "configGlossary:adminEmail": "ksm@pobox.com", 9 | "configGlossary:poweredBy": "Cofax", 10 | "configGlossary:poweredByIcon": "/images/cofax.gif", 11 | "configGlossary:staticPath": "/content/static", 12 | "templateProcessorClass": "org.cofax.WysiwygTemplate", 13 | "templateLoaderClass": "org.cofax.FilesTemplateLoader", 14 | "templatePath": "templates", 15 | "templateOverridePath": "", 16 | "defaultListTemplate": "listTemplate.htm", 17 | "defaultFileTemplate": "articleTemplate.htm", 18 | "useJSP": false, 19 | "jspListTemplate": "listTemplate.jsp", 20 | "jspFileTemplate": "articleTemplate.jsp", 21 | "cachePackageTagsTrack": 200, 22 | "cachePackageTagsStore": 200, 23 | "cachePackageTagsRefresh": 60, 24 | "cacheTemplatesTrack": 100, 25 | "cacheTemplatesStore": 50, 26 | "cacheTemplatesRefresh": 15, 27 | "cachePagesTrack": 200, 28 | "cachePagesStore": 100, 29 | "cachePagesRefresh": 10, 30 | "cachePagesDirtyRead": 10, 31 | "searchEngineListTemplate": "forSearchEnginesList.htm", 32 | "searchEngineFileTemplate": "forSearchEngines.htm", 33 | "searchEngineRobotsDb": "WEB-INF/robots.db", 34 | "useDataStore": true, 35 | "dataStoreClass": "org.cofax.SqlDataStore", 36 | "redirectionClass": "org.cofax.SqlRedirection", 37 | "dataStoreName": "cofax", 38 | "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", 39 | "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", 40 | "dataStoreUser": "sa", 41 | "dataStorePassword": "dataStoreTestQuery", 42 | "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", 43 | "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", 44 | "dataStoreInitConns": 10, 45 | "dataStoreMaxConns": 100, 46 | "dataStoreConnUsageLimit": 100, 47 | "dataStoreLogLevel": "debug", 48 | "maxUrlLength": 500}}, 49 | { 50 | "servlet-name": "cofaxEmail", 51 | "servlet-class": "org.cofax.cds.EmailServlet", 52 | "init-param": { 53 | "mailHost": "mail1", 54 | "mailHostOverride": "mail2"}}, 55 | { 56 | "servlet-name": "cofaxAdmin", 57 | "servlet-class": "org.cofax.cds.AdminServlet"}, 58 | 59 | { 60 | "servlet-name": "fileServlet", 61 | "servlet-class": "org.cofax.cds.FileServlet"}, 62 | { 63 | "servlet-name": "cofaxTools", 64 | "servlet-class": "org.cofax.cms.CofaxToolsServlet", 65 | "init-param": { 66 | "templatePath": "toolstemplates/", 67 | "log": 1, 68 | "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", 69 | "logMaxSize": "", 70 | "dataLog": 1, 71 | "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", 72 | "dataLogMaxSize": "", 73 | "removePageCache": "/content/admin/remove?cache=pages&id=", 74 | "removeTemplateCache": "/content/admin/remove?cache=templates&id=", 75 | "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", 76 | "lookInContext": 1, 77 | "adminGroupID": 4, 78 | "betaServer": true}}], 79 | "servlet-mapping": { 80 | "cofaxCDS": "/", 81 | "cofaxEmail": "/cofaxutil/aemail/*", 82 | "cofaxAdmin": "/admin/*", 83 | "fileServlet": "/static/*", 84 | "cofaxTools": "/tools/*"}, 85 | 86 | "taglib": { 87 | "taglib-uri": "cofax.tld", 88 | "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} 89 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/json/example5.json: -------------------------------------------------------------------------------- 1 | {"menu": { 2 | "header": "SVG Viewer", 3 | "items": [ 4 | {"id": "Open"}, 5 | {"id": "OpenNew", "label": "Open New"}, 6 | null, 7 | {"id": "ZoomIn", "label": "Zoom In"}, 8 | {"id": "ZoomOut", "label": "Zoom Out"}, 9 | {"id": "OriginalView", "label": "Original View"}, 10 | null, 11 | {"id": "Quality"}, 12 | {"id": "Pause"}, 13 | {"id": "Mute"}, 14 | null, 15 | {"id": "Find", "label": "Find..."}, 16 | {"id": "FindAgain", "label": "Find Again"}, 17 | {"id": "Copy"}, 18 | {"id": "CopyAgain", "label": "Copy Again"}, 19 | {"id": "CopySVG", "label": "Copy SVG"}, 20 | {"id": "ViewSVG", "label": "View SVG"}, 21 | {"id": "ViewSource", "label": "View Source"}, 22 | {"id": "SaveAs", "label": "Save As"}, 23 | null, 24 | {"id": "Help"}, 25 | {"id": "About", "label": "About Adobe CVG Viewer..."} 26 | ] 27 | }} 28 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var util = require("util"); 4 | var fs = require("fs"); 5 | var PEG = require("../lib/peg"); 6 | 7 | [ 8 | "benchmarks.js", 9 | "runner.js", 10 | ].forEach(function(file) { 11 | eval(fs.readFileSync(__dirname + "/" + file, "utf8")); 12 | }); 13 | 14 | /* Results Table Manipulation */ 15 | 16 | function dup(text, count) { 17 | var result = ""; 18 | for (var i = 1; i <= count; i++) { 19 | result += text; 20 | } 21 | return result; 22 | } 23 | 24 | function padLeft(text, length) { 25 | return dup(" ", length - text.length) + text; 26 | } 27 | 28 | function padRight(text, length) { 29 | return text + dup(" ", length - text.length); 30 | } 31 | 32 | function center(text, length) { 33 | var padLength = (length - text.length) / 2; 34 | return dup(" ", Math.floor(padLength)) 35 | + text 36 | + dup(" ", Math.ceil(padLength)); 37 | } 38 | 39 | function writeTableHeader() { 40 | util.puts("┌─────────────────────────────────────┬───────────┬────────────┬──────────────┐"); 41 | util.puts("│ Test │ Inp. size │ Avg. time │ Avg. speed │"); 42 | } 43 | 44 | function writeHeading(heading) { 45 | util.puts("├─────────────────────────────────────┴───────────┴────────────┴──────────────┤"); 46 | util.puts("│ " + center(heading, 75) + " │"); 47 | util.puts("├─────────────────────────────────────┬───────────┬────────────┬──────────────┤"); 48 | } 49 | 50 | function writeResult(title, inputSize, parseTime) { 51 | var KB = 1024; 52 | var MS_IN_S = 1000; 53 | 54 | util.puts("│ " 55 | + padRight(title, 35) 56 | + " │ " 57 | + padLeft((inputSize / KB).toFixed(2), 6) 58 | + " kB │ " 59 | + padLeft(parseTime.toFixed(2), 7) 60 | + " ms │ " 61 | + padLeft(((inputSize / KB) / (parseTime / MS_IN_S)).toFixed(2), 7) 62 | + " kB/s │" 63 | ); 64 | } 65 | 66 | function writeSeparator() { 67 | util.puts("├─────────────────────────────────────┼───────────┼────────────┼──────────────┤"); 68 | } 69 | 70 | function writeTableFooter() { 71 | util.puts("└─────────────────────────────────────┴───────────┴────────────┴──────────────┘"); 72 | } 73 | 74 | /* Helpers */ 75 | 76 | function printHelp() { 77 | util.puts("Usage: run [options]"); 78 | util.puts(""); 79 | util.puts("Runs PEG.js benchmark suite."); 80 | util.puts(""); 81 | util.puts("Options:"); 82 | util.puts(" -n, --run-count number of runs (default: 10)"); 83 | util.puts(" --cache make tested parsers cache results"); 84 | util.puts(" -o, --optimize select optimization for speed or size (default:"); 85 | util.puts(" speed)"); 86 | } 87 | 88 | function exitSuccess() { 89 | process.exit(0); 90 | } 91 | 92 | function exitFailure() { 93 | process.exit(1); 94 | } 95 | 96 | function abort(message) { 97 | util.error(message); 98 | exitFailure(); 99 | } 100 | 101 | /* Arguments */ 102 | 103 | var args = process.argv.slice(2); // Trim "node" and the script path. 104 | 105 | function isOption(arg) { 106 | return (/^-/).test(arg); 107 | } 108 | 109 | function nextArg() { 110 | args.shift(); 111 | } 112 | 113 | /* Main */ 114 | 115 | var runCount = 10; 116 | var options = { 117 | cache: false, 118 | optimize: "speed" 119 | }; 120 | 121 | while (args.length > 0 && isOption(args[0])) { 122 | switch (args[0]) { 123 | case "-n": 124 | case "--run-count": 125 | nextArg(); 126 | if (args.length === 0) { 127 | abort("Missing parameter of the -n/--run-count option."); 128 | } 129 | var runCount = parseInt(args[0], 10); 130 | if (isNaN(runCount) || runCount <= 0) { 131 | abort("Number of runs must be a positive integer."); 132 | } 133 | break; 134 | 135 | case "--cache": 136 | options.cache = true; 137 | break; 138 | 139 | case "-o": 140 | case "--optimize": 141 | nextArg(); 142 | if (args.length === 0) { 143 | abort("Missing parameter of the -o/--optimize option."); 144 | } 145 | if (args[0] !== "speed" && args[0] !== "size") { 146 | abort("Optimization goal must be either \"speed\" or \"size\"."); 147 | } 148 | options.optimize = args[0]; 149 | break; 150 | 151 | case "-h": 152 | case "--help": 153 | printHelp(); 154 | exitSuccess(); 155 | break; 156 | 157 | default: 158 | abort("Unknown option: " + args[0] + "."); 159 | } 160 | nextArg(); 161 | } 162 | 163 | if (args.length > 0) { 164 | abort("No arguments are allowed."); 165 | } 166 | 167 | Runner.run(benchmarks, runCount, options, { 168 | readFile: function(file) { 169 | return fs.readFileSync(__dirname + "/" + file, "utf8"); 170 | }, 171 | 172 | testStart: function(benchmark, test) { 173 | /* Nothing to do. */ 174 | }, 175 | 176 | testFinish: function(benchmark, test, inputSize, parseTime) { 177 | writeResult(test.title, inputSize, parseTime); 178 | }, 179 | 180 | benchmarkStart: function(benchmark) { 181 | writeHeading(benchmark.title); 182 | }, 183 | 184 | benchmarkFinish: function(benchmark, inputSize, parseTime) { 185 | writeSeparator(); 186 | writeResult(benchmark.title + " total", inputSize, parseTime); 187 | }, 188 | 189 | start: function() { 190 | writeTableHeader(); 191 | }, 192 | 193 | finish: function(inputSize, parseTime) { 194 | writeSeparator(); 195 | writeResult("Total", inputSize, parseTime); 196 | writeTableFooter(); 197 | }, 198 | }); 199 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/runner.js: -------------------------------------------------------------------------------- 1 | Runner = { 2 | run: function(benchmarks, runCount, options, callbacks) { 3 | 4 | /* Queue */ 5 | 6 | var Q = { 7 | functions: [], 8 | 9 | add: function(f) { 10 | this.functions.push(f); 11 | }, 12 | 13 | run: function() { 14 | if (this.functions.length > 0) { 15 | this.functions.shift()(); 16 | 17 | /* 18 | * We can't use |arguments.callee| here because |this| would get 19 | * messed-up in that case. 20 | */ 21 | setTimeout(function() { Q.run(); }, 0); 22 | } 23 | } 24 | }; 25 | 26 | /* 27 | * The benchmark itself is factored out into several functions (some of them 28 | * generated), which are enqueued and run one by one using |setTimeout|. We 29 | * do this for two reasons: 30 | * 31 | * 1. To avoid bowser mechanism for interrupting long-running scripts to 32 | * kick-in (or at least to not kick-in that often). 33 | * 34 | * 2. To ensure progressive rendering of results in the browser (some 35 | * browsers do not render at all when running JavaScript code). 36 | * 37 | * The enqueued functions share state, which is all stored in the properties 38 | * of the |state| object. 39 | */ 40 | 41 | var state = {}; 42 | 43 | function initialize() { 44 | callbacks.start(); 45 | 46 | state.totalInputSize = 0; 47 | state.totalParseTime = 0; 48 | } 49 | 50 | function benchmarkInitializer(i) { 51 | return function() { 52 | callbacks.benchmarkStart(benchmarks[i]); 53 | 54 | state.parser = PEG.buildParser( 55 | callbacks.readFile("../examples/" + benchmarks[i].id + ".pegjs"), 56 | options 57 | ); 58 | state.benchmarkInputSize = 0; 59 | state.benchmarkParseTime = 0; 60 | }; 61 | } 62 | 63 | function testRunner(i, j) { 64 | return function() { 65 | var benchmark = benchmarks[i]; 66 | var test = benchmark.tests[j]; 67 | 68 | callbacks.testStart(benchmark, test); 69 | 70 | var input = callbacks.readFile(benchmark.id + "/" + test.file); 71 | 72 | var parseTime = 0; 73 | for (var k = 0; k < runCount; k++) { 74 | var t = (new Date()).getTime(); 75 | state.parser.parse(input); 76 | parseTime += (new Date()).getTime() - t; 77 | } 78 | var averageParseTime = parseTime / runCount; 79 | 80 | callbacks.testFinish(benchmark, test, input.length, averageParseTime); 81 | 82 | state.benchmarkInputSize += input.length; 83 | state.benchmarkParseTime += averageParseTime; 84 | }; 85 | } 86 | 87 | function benchmarkFinalizer(i) { 88 | return function() { 89 | callbacks.benchmarkFinish( 90 | benchmarks[i], 91 | state.benchmarkInputSize, 92 | state.benchmarkParseTime 93 | ); 94 | 95 | state.totalInputSize += state.benchmarkInputSize; 96 | state.totalParseTime += state.benchmarkParseTime; 97 | }; 98 | } 99 | 100 | function finalize() { 101 | callbacks.finish(state.totalInputSize, state.totalParseTime); 102 | } 103 | 104 | /* Main */ 105 | 106 | Q.add(initialize); 107 | for (var i = 0; i < benchmarks.length; i++) { 108 | Q.add(benchmarkInitializer(i)); 109 | for (var j = 0; j < benchmarks[i].tests.length; j++) { 110 | Q.add(testRunner(i, j)); 111 | } 112 | Q.add(benchmarkFinalizer(i)); 113 | } 114 | Q.add(finalize); 115 | 116 | Q.run(); 117 | } 118 | }; 119 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/vendor/jquery.scrollto/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2007-2013 Ariel Flesler 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/vendor/jquery.scrollto/jquery.scrollTo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2013 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com 3 | * Licensed under MIT 4 | * @author Ariel Flesler 5 | * @version 1.4.7 6 | */ 7 | (function(d){function h(b){return"object"==typeof b?b:{top:b,left:b}}var n=d.scrollTo=function(b,c,a){return d(window).scrollTo(b,c,a)};n.defaults={axis:"xy",duration:1.3<=parseFloat(d.fn.jquery)?0:1,limit:!0};n.window=function(b){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){if(this.nodeName&&-1==d.inArray(this.nodeName.toLowerCase(),["iframe","#document","html","body"]))return this;var b=(this.contentWindow||this).document||this.ownerDocument||this;return/webkit/i.test(navigator.userAgent)|| "BackCompat"==b.compatMode?b.body:b.documentElement})};d.fn.scrollTo=function(b,c,a){"object"==typeof c&&(a=c,c=0);"function"==typeof a&&(a={onAfter:a});"max"==b&&(b=9E9);a=d.extend({},n.defaults,a);c=c||a.duration;a.queue=a.queue&&1=e[f]?0:Math.min(e[f],r));!b&&a.queue&&(h!=e[f]&&q(a.onAfterFirst),delete e[f])});q(a.onAfter)}}).end()};n.max=function(b,c){var a="x"==c?"Width":"Height",h="scroll"+a;if(!d(b).is("html,body"))return b[h]-d(b)[a.toLowerCase()]();var a="client"+a,l=b.ownerDocument.documentElement,k=b.ownerDocument.body;return Math.max(l[h],k[h])-Math.min(l[a],k[a])}})(jQuery); 8 | -------------------------------------------------------------------------------- /bower_components/pegjs/benchmark/vendor/jquery/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013 jQuery Foundation and other contributors 2 | http://jquery.com/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /bower_components/pegjs/bin/pegjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var util = require("util"); 4 | var fs = require("fs"); 5 | var path = require("path"); 6 | var PEG = require("../lib/peg"); 7 | 8 | /* Helpers */ 9 | 10 | function printVersion() { 11 | util.puts("PEG.js " + PEG.VERSION); 12 | } 13 | 14 | function printHelp() { 15 | util.puts("Usage: pegjs [options] [--] [] []"); 16 | util.puts(""); 17 | util.puts("Generates a parser from the PEG grammar specified in the and writes"); 18 | util.puts("it to the ."); 19 | util.puts(""); 20 | util.puts("If the is omitted, its name is generated by changing the"); 21 | util.puts(" extension to \".js\". If both and are"); 22 | util.puts("omitted, standard input and output are used."); 23 | util.puts(""); 24 | util.puts("Options:"); 25 | util.puts(" -e, --export-var name of the variable where the parser"); 26 | util.puts(" object will be stored (default:"); 27 | util.puts(" \"module.exports\")"); 28 | util.puts(" --cache make generated parser cache results"); 29 | util.puts(" --allowed-start-rules comma-separated list of rules the generated"); 30 | util.puts(" parser will be allowed to start parsing"); 31 | util.puts(" from (default: the first rule in the"); 32 | util.puts(" grammar)"); 33 | util.puts(" -o, --optimize select optimization for speed or size"); 34 | util.puts(" (default: speed)"); 35 | util.puts(" --plugin use a specified plugin (can be specified"); 36 | util.puts(" multiple times)"); 37 | util.puts(" --extra-options additional options (in JSON format) to pass"); 38 | util.puts(" to PEG.buildParser"); 39 | util.puts(" --extra-options-file file with additional options (in JSON"); 40 | util.puts(" format) to pass to PEG.buildParser"); 41 | util.puts(" -v, --version print version information and exit"); 42 | util.puts(" -h, --help print help and exit"); 43 | } 44 | 45 | function exitSuccess() { 46 | process.exit(0); 47 | } 48 | 49 | function exitFailure() { 50 | process.exit(1); 51 | } 52 | 53 | function abort(message) { 54 | util.error(message); 55 | exitFailure(); 56 | } 57 | 58 | function addExtraOptions(options, json) { 59 | var extraOptions; 60 | 61 | try { 62 | extraOptions = JSON.parse(json); 63 | } catch (e) { 64 | if (!(e instanceof SyntaxError)) { throw e; } 65 | 66 | abort("Error parsing JSON: " + e.message); 67 | } 68 | if (typeof extraOptions !== "object") { 69 | abort("The JSON with extra options has to represent an object."); 70 | } 71 | 72 | for (var key in extraOptions) { 73 | if (extraOptions.hasOwnProperty(key)) { 74 | options[key] = extraOptions[key]; 75 | } 76 | } 77 | } 78 | 79 | /* 80 | * Extracted into a function just to silence JSHint complaining about creating 81 | * functions in a loop. 82 | */ 83 | function trim(s) { 84 | return s.trim(); 85 | } 86 | 87 | /* Arguments */ 88 | 89 | var args = process.argv.slice(2); // Trim "node" and the script path. 90 | 91 | function isOption(arg) { 92 | return (/^-/).test(arg); 93 | } 94 | 95 | function nextArg() { 96 | args.shift(); 97 | } 98 | 99 | /* Files */ 100 | 101 | function readStream(inputStream, callback) { 102 | var input = ""; 103 | inputStream.on("data", function(data) { input += data; }); 104 | inputStream.on("end", function() { callback(input); }); 105 | } 106 | 107 | /* Main */ 108 | 109 | /* This makes the generated parser a CommonJS module by default. */ 110 | var exportVar = "module.exports"; 111 | var options = { 112 | cache: false, 113 | output: "source", 114 | optimize: "speed", 115 | plugins: [] 116 | }; 117 | 118 | while (args.length > 0 && isOption(args[0])) { 119 | switch (args[0]) { 120 | case "-e": 121 | case "--export-var": 122 | nextArg(); 123 | if (args.length === 0) { 124 | abort("Missing parameter of the -e/--export-var option."); 125 | } 126 | exportVar = args[0]; 127 | break; 128 | 129 | case "--cache": 130 | options.cache = true; 131 | break; 132 | 133 | case "--allowed-start-rules": 134 | nextArg(); 135 | if (args.length === 0) { 136 | abort("Missing parameter of the -e/--allowed-start-rules option."); 137 | } 138 | options.allowedStartRules = args[0] 139 | .split(",") 140 | .map(trim); 141 | break; 142 | 143 | case "-o": 144 | case "--optimize": 145 | nextArg(); 146 | if (args.length === 0) { 147 | abort("Missing parameter of the -o/--optimize option."); 148 | } 149 | if (args[0] !== "speed" && args[0] !== "size") { 150 | abort("Optimization goal must be either \"speed\" or \"size\"."); 151 | } 152 | options.optimize = args[0]; 153 | break; 154 | 155 | case "--plugin": 156 | nextArg(); 157 | if (args.length === 0) { 158 | abort("Missing parameter of the --plugin option."); 159 | } 160 | var id = /^(\.\/|\.\.\/)/.test(args[0]) ? path.resolve(args[0]) : args[0]; 161 | var mod; 162 | try { 163 | mod = require(id); 164 | } catch (e) { 165 | if (e.code !== "MODULE_NOT_FOUND") { throw e; } 166 | 167 | abort("Can't load module \"" + id + "\"."); 168 | } 169 | options.plugins.push(mod); 170 | break; 171 | 172 | case "--extra-options": 173 | nextArg(); 174 | if (args.length === 0) { 175 | abort("Missing parameter of the --extra-options option."); 176 | } 177 | addExtraOptions(options, args[0]); 178 | break; 179 | 180 | case "--extra-options-file": 181 | nextArg(); 182 | if (args.length === 0) { 183 | abort("Missing parameter of the --extra-options-file option."); 184 | } 185 | try { 186 | var json = fs.readFileSync(args[0]); 187 | } catch(e) { 188 | abort("Can't read from file \"" + args[0] + "\"."); 189 | } 190 | addExtraOptions(options, json); 191 | break; 192 | 193 | case "-v": 194 | case "--version": 195 | printVersion(); 196 | exitSuccess(); 197 | break; 198 | 199 | case "-h": 200 | case "--help": 201 | printHelp(); 202 | exitSuccess(); 203 | break; 204 | 205 | case "--": 206 | nextArg(); 207 | break; 208 | 209 | default: 210 | abort("Unknown option: " + args[0] + "."); 211 | } 212 | nextArg(); 213 | } 214 | 215 | switch (args.length) { 216 | case 0: 217 | process.stdin.resume(); 218 | var inputStream = process.stdin; 219 | var outputStream = process.stdout; 220 | break; 221 | 222 | case 1: 223 | case 2: 224 | var inputFile = args[0]; 225 | var inputStream = fs.createReadStream(inputFile); 226 | inputStream.on("error", function() { 227 | abort("Can't read from file \"" + inputFile + "\"."); 228 | }); 229 | 230 | var outputFile = args.length === 1 231 | ? args[0].replace(/\.[^.]*$/, ".js") 232 | : args[1]; 233 | var outputStream = fs.createWriteStream(outputFile); 234 | outputStream.on("error", function() { 235 | abort("Can't write to file \"" + outputFile + "\"."); 236 | }); 237 | 238 | break; 239 | 240 | default: 241 | abort("Too many arguments."); 242 | } 243 | 244 | readStream(inputStream, function(input) { 245 | var source; 246 | 247 | try { 248 | source = PEG.buildParser(input, options); 249 | } catch (e) { 250 | if (e.line !== undefined && e.column !== undefined) { 251 | abort(e.line + ":" + e.column + ": " + e.message); 252 | } else { 253 | abort(e.message); 254 | } 255 | } 256 | 257 | outputStream.write( 258 | exportVar !== "" ? exportVar + " = " + source + ";\n" : source + "\n" 259 | ); 260 | if (outputStream !== process.stdout) { 261 | outputStream.end(); 262 | } 263 | }); 264 | -------------------------------------------------------------------------------- /bower_components/pegjs/examples/arithmetics.pegjs: -------------------------------------------------------------------------------- 1 | /* 2 | * Classic example grammar, which recognizes simple arithmetic expressions like 3 | * "2*(3+4)". The parser generated from this grammar then computes their value. 4 | */ 5 | 6 | start 7 | = additive 8 | 9 | additive 10 | = left:multiplicative "+" right:additive { return left + right; } 11 | / multiplicative 12 | 13 | multiplicative 14 | = left:primary "*" right:multiplicative { return left * right; } 15 | / primary 16 | 17 | primary 18 | = integer 19 | / "(" additive:additive ")" { return additive; } 20 | 21 | integer "integer" 22 | = digits:$[0-9]+ { return parseInt(digits, 10); } 23 | -------------------------------------------------------------------------------- /bower_components/pegjs/examples/json.pegjs: -------------------------------------------------------------------------------- 1 | /* JSON parser based on the grammar described at http://json.org/. */ 2 | 3 | /* ===== Syntactical Elements ===== */ 4 | 5 | start 6 | = _ object:object { return object; } 7 | 8 | object 9 | = "{" _ "}" _ { return {}; } 10 | / "{" _ members:members "}" _ { return members; } 11 | 12 | members 13 | = head:pair tail:("," _ pair)* { 14 | var result = {}; 15 | result[head[0]] = head[1]; 16 | for (var i = 0; i < tail.length; i++) { 17 | result[tail[i][2][0]] = tail[i][2][1]; 18 | } 19 | return result; 20 | } 21 | 22 | pair 23 | = name:string ":" _ value:value { return [name, value]; } 24 | 25 | array 26 | = "[" _ "]" _ { return []; } 27 | / "[" _ elements:elements "]" _ { return elements; } 28 | 29 | elements 30 | = head:value tail:("," _ value)* { 31 | var result = [head]; 32 | for (var i = 0; i < tail.length; i++) { 33 | result.push(tail[i][2]); 34 | } 35 | return result; 36 | } 37 | 38 | value 39 | = string 40 | / number 41 | / object 42 | / array 43 | / "true" _ { return true; } 44 | / "false" _ { return false; } 45 | / "null" _ { return null; } 46 | 47 | /* ===== Lexical Elements ===== */ 48 | 49 | string "string" 50 | = '"' '"' _ { return ""; } 51 | / '"' chars:chars '"' _ { return chars; } 52 | 53 | chars 54 | = chars:char+ { return chars.join(""); } 55 | 56 | char 57 | // In the original JSON grammar: "any-Unicode-character-except-"-or-\-or-control-character" 58 | = [^"\\\0-\x1F\x7f] 59 | / '\\"' { return '"'; } 60 | / "\\\\" { return "\\"; } 61 | / "\\/" { return "/"; } 62 | / "\\b" { return "\b"; } 63 | / "\\f" { return "\f"; } 64 | / "\\n" { return "\n"; } 65 | / "\\r" { return "\r"; } 66 | / "\\t" { return "\t"; } 67 | / "\\u" digits:$(hexDigit hexDigit hexDigit hexDigit) { 68 | return String.fromCharCode(parseInt(digits, 16)); 69 | } 70 | 71 | number "number" 72 | = parts:$(int frac exp) _ { return parseFloat(parts); } 73 | / parts:$(int frac) _ { return parseFloat(parts); } 74 | / parts:$(int exp) _ { return parseFloat(parts); } 75 | / parts:$(int) _ { return parseFloat(parts); } 76 | 77 | int 78 | = digit19 digits 79 | / digit 80 | / "-" digit19 digits 81 | / "-" digit 82 | 83 | frac 84 | = "." digits 85 | 86 | exp 87 | = e digits 88 | 89 | digits 90 | = digit+ 91 | 92 | e 93 | = [eE] [+-]? 94 | 95 | /* 96 | * The following rules are not present in the original JSON gramar, but they are 97 | * assumed to exist implicitly. 98 | * 99 | * FIXME: Define them according to ECMA-262, 5th ed. 100 | */ 101 | 102 | digit 103 | = [0-9] 104 | 105 | digit19 106 | = [1-9] 107 | 108 | hexDigit 109 | = [0-9a-fA-F] 110 | 111 | /* ===== Whitespace ===== */ 112 | 113 | _ "whitespace" 114 | = whitespace* 115 | 116 | // Whitespace is undefined in the original JSON grammar, so I assume a simple 117 | // conventional definition consistent with ECMA-262, 5th ed. 118 | whitespace 119 | = [ \t\n\r] 120 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/compiler.js: -------------------------------------------------------------------------------- 1 | var utils = require("./utils"); 2 | 3 | module.exports = { 4 | /* 5 | * Compiler passes. 6 | * 7 | * Each pass is a function that is passed the AST. It can perform checks on it 8 | * or modify it as needed. If the pass encounters a semantic error, it throws 9 | * |PEG.GrammarError|. 10 | */ 11 | passes: { 12 | check: { 13 | reportMissingRules: require("./compiler/passes/report-missing-rules"), 14 | reportLeftRecursion: require("./compiler/passes/report-left-recursion") 15 | }, 16 | transform: { 17 | removeProxyRules: require("./compiler/passes/remove-proxy-rules") 18 | }, 19 | generate: { 20 | generateBytecode: require("./compiler/passes/generate-bytecode"), 21 | generateJavascript: require("./compiler/passes/generate-javascript") 22 | } 23 | }, 24 | 25 | /* 26 | * Generates a parser from a specified grammar AST. Throws |PEG.GrammarError| 27 | * if the AST contains a semantic error. Note that not all errors are detected 28 | * during the generation and some may protrude to the generated parser and 29 | * cause its malfunction. 30 | */ 31 | compile: function(ast, passes) { 32 | var options = arguments.length > 2 ? utils.clone(arguments[2]) : {}, 33 | stage; 34 | 35 | /* 36 | * Extracted into a function just to silence JSHint complaining about 37 | * creating functions in a loop. 38 | */ 39 | function runPass(pass) { 40 | pass(ast, options); 41 | } 42 | 43 | utils.defaults(options, { 44 | allowedStartRules: [ast.rules[0].name], 45 | cache: false, 46 | optimize: "speed", 47 | output: "parser" 48 | }); 49 | 50 | for (stage in passes) { 51 | if (passes.hasOwnProperty(stage)) { 52 | utils.each(passes[stage], runPass); 53 | } 54 | } 55 | 56 | switch (options.output) { 57 | case "parser": return eval(ast.code); 58 | case "source": return ast.code; 59 | } 60 | } 61 | }; 62 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/compiler/opcodes.js: -------------------------------------------------------------------------------- 1 | /* Bytecode instruction opcodes. */ 2 | module.exports = { 3 | /* Stack Manipulation */ 4 | 5 | PUSH: 0, // PUSH c 6 | PUSH_CURR_POS: 1, // PUSH_CURR_POS 7 | POP: 2, // POP 8 | POP_CURR_POS: 3, // POP_CURR_POS 9 | POP_N: 4, // POP_N n 10 | NIP: 5, // NIP 11 | APPEND: 6, // APPEND 12 | WRAP: 7, // WRAP n 13 | TEXT: 8, // TEXT 14 | 15 | /* Conditions and Loops */ 16 | 17 | IF: 9, // IF t, f 18 | IF_ERROR: 10, // IF_ERROR t, f 19 | IF_NOT_ERROR: 11, // IF_NOT_ERROR t, f 20 | WHILE_NOT_ERROR: 12, // WHILE_NOT_ERROR b 21 | 22 | /* Matching */ 23 | 24 | MATCH_ANY: 13, // MATCH_ANY a, f, ... 25 | MATCH_STRING: 14, // MATCH_STRING s, a, f, ... 26 | MATCH_STRING_IC: 15, // MATCH_STRING_IC s, a, f, ... 27 | MATCH_REGEXP: 16, // MATCH_REGEXP r, a, f, ... 28 | ACCEPT_N: 17, // ACCEPT_N n 29 | ACCEPT_STRING: 18, // ACCEPT_STRING s 30 | FAIL: 19, // FAIL e 31 | 32 | /* Calls */ 33 | 34 | REPORT_SAVED_POS: 20, // REPORT_SAVED_POS p 35 | REPORT_CURR_POS: 21, // REPORT_CURR_POS 36 | CALL: 22, // CALL f, n, pc, p1, p2, ..., pN 37 | 38 | /* Rules */ 39 | 40 | RULE: 23, // RULE r 41 | 42 | /* Failure Reporting */ 43 | 44 | SILENT_FAILS_ON: 24, // SILENT_FAILS_ON 45 | SILENT_FAILS_OFF: 25 // SILENT_FAILS_FF 46 | }; 47 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/compiler/passes/remove-proxy-rules.js: -------------------------------------------------------------------------------- 1 | var utils = require("../../utils"); 2 | 3 | /* 4 | * Removes proxy rules -- that is, rules that only delegate to other rule. 5 | */ 6 | module.exports = function(ast, options) { 7 | function isProxyRule(node) { 8 | return node.type === "rule" && node.expression.type === "rule_ref"; 9 | } 10 | 11 | function replaceRuleRefs(ast, from, to) { 12 | function nop() {} 13 | 14 | function replaceInExpression(node, from, to) { 15 | replace(node.expression, from, to); 16 | } 17 | 18 | function replaceInSubnodes(propertyName) { 19 | return function(node, from, to) { 20 | utils.each(node[propertyName], function(subnode) { 21 | replace(subnode, from, to); 22 | }); 23 | }; 24 | } 25 | 26 | var replace = utils.buildNodeVisitor({ 27 | grammar: replaceInSubnodes("rules"), 28 | rule: replaceInExpression, 29 | named: replaceInExpression, 30 | choice: replaceInSubnodes("alternatives"), 31 | sequence: replaceInSubnodes("elements"), 32 | labeled: replaceInExpression, 33 | text: replaceInExpression, 34 | simple_and: replaceInExpression, 35 | simple_not: replaceInExpression, 36 | semantic_and: nop, 37 | semantic_not: nop, 38 | optional: replaceInExpression, 39 | zero_or_more: replaceInExpression, 40 | one_or_more: replaceInExpression, 41 | action: replaceInExpression, 42 | 43 | rule_ref: 44 | function(node, from, to) { 45 | if (node.name === from) { 46 | node.name = to; 47 | } 48 | }, 49 | 50 | literal: nop, 51 | "class": nop, 52 | any: nop 53 | }); 54 | 55 | replace(ast, from, to); 56 | } 57 | 58 | var indices = []; 59 | 60 | utils.each(ast.rules, function(rule, i) { 61 | if (isProxyRule(rule)) { 62 | replaceRuleRefs(ast, rule.name, rule.expression.name); 63 | if (!utils.contains(options.allowedStartRules, rule.name)) { 64 | indices.push(i); 65 | } 66 | } 67 | }); 68 | 69 | indices.reverse(); 70 | 71 | utils.each(indices, function(index) { 72 | ast.rules.splice(index, 1); 73 | }); 74 | }; 75 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/compiler/passes/report-left-recursion.js: -------------------------------------------------------------------------------- 1 | var utils = require("../../utils"), 2 | GrammarError = require("../../grammar-error"); 3 | 4 | /* Checks that no left recursion is present. */ 5 | module.exports = function(ast) { 6 | function nop() {} 7 | 8 | function checkExpression(node, appliedRules) { 9 | check(node.expression, appliedRules); 10 | } 11 | 12 | function checkSubnodes(propertyName) { 13 | return function(node, appliedRules) { 14 | utils.each(node[propertyName], function(subnode) { 15 | check(subnode, appliedRules); 16 | }); 17 | }; 18 | } 19 | 20 | var check = utils.buildNodeVisitor({ 21 | grammar: checkSubnodes("rules"), 22 | 23 | rule: 24 | function(node, appliedRules) { 25 | check(node.expression, appliedRules.concat(node.name)); 26 | }, 27 | 28 | named: checkExpression, 29 | choice: checkSubnodes("alternatives"), 30 | action: checkExpression, 31 | 32 | sequence: 33 | function(node, appliedRules) { 34 | if (node.elements.length > 0) { 35 | check(node.elements[0], appliedRules); 36 | } 37 | }, 38 | 39 | labeled: checkExpression, 40 | text: checkExpression, 41 | simple_and: checkExpression, 42 | simple_not: checkExpression, 43 | semantic_and: nop, 44 | semantic_not: nop, 45 | optional: checkExpression, 46 | zero_or_more: checkExpression, 47 | one_or_more: checkExpression, 48 | 49 | rule_ref: 50 | function(node, appliedRules) { 51 | if (utils.contains(appliedRules, node.name)) { 52 | throw new GrammarError( 53 | "Left recursion detected for rule \"" + node.name + "\"." 54 | ); 55 | } 56 | check(utils.findRuleByName(ast, node.name), appliedRules); 57 | }, 58 | 59 | literal: nop, 60 | "class": nop, 61 | any: nop 62 | }); 63 | 64 | check(ast, []); 65 | }; 66 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/compiler/passes/report-missing-rules.js: -------------------------------------------------------------------------------- 1 | var utils = require("../../utils"), 2 | GrammarError = require("../../grammar-error"); 3 | 4 | /* Checks that all referenced rules exist. */ 5 | module.exports = function(ast) { 6 | function nop() {} 7 | 8 | function checkExpression(node) { check(node.expression); } 9 | 10 | function checkSubnodes(propertyName) { 11 | return function(node) { utils.each(node[propertyName], check); }; 12 | } 13 | 14 | var check = utils.buildNodeVisitor({ 15 | grammar: checkSubnodes("rules"), 16 | rule: checkExpression, 17 | named: checkExpression, 18 | choice: checkSubnodes("alternatives"), 19 | action: checkExpression, 20 | sequence: checkSubnodes("elements"), 21 | labeled: checkExpression, 22 | text: checkExpression, 23 | simple_and: checkExpression, 24 | simple_not: checkExpression, 25 | semantic_and: nop, 26 | semantic_not: nop, 27 | optional: checkExpression, 28 | zero_or_more: checkExpression, 29 | one_or_more: checkExpression, 30 | 31 | rule_ref: 32 | function(node) { 33 | if (!utils.findRuleByName(ast, node.name)) { 34 | throw new GrammarError( 35 | "Referenced rule \"" + node.name + "\" does not exist." 36 | ); 37 | } 38 | }, 39 | 40 | literal: nop, 41 | "class": nop, 42 | any: nop 43 | }); 44 | 45 | check(ast); 46 | }; 47 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/grammar-error.js: -------------------------------------------------------------------------------- 1 | var utils = require("./utils"); 2 | 3 | /* Thrown when the grammar contains an error. */ 4 | module.exports = function(message) { 5 | this.name = "GrammarError"; 6 | this.message = message; 7 | }; 8 | 9 | utils.subclass(module.exports, Error); 10 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/peg.js: -------------------------------------------------------------------------------- 1 | var utils = require("./utils"); 2 | 3 | module.exports = { 4 | /* PEG.js version (uses semantic versioning). */ 5 | VERSION: "0.8.0", 6 | 7 | GrammarError: require("./grammar-error"), 8 | parser: require("./parser"), 9 | compiler: require("./compiler"), 10 | 11 | /* 12 | * Generates a parser from a specified grammar and returns it. 13 | * 14 | * The grammar must be a string in the format described by the metagramar in 15 | * the parser.pegjs file. 16 | * 17 | * Throws |PEG.parser.SyntaxError| if the grammar contains a syntax error or 18 | * |PEG.GrammarError| if it contains a semantic error. Note that not all 19 | * errors are detected during the generation and some may protrude to the 20 | * generated parser and cause its malfunction. 21 | */ 22 | buildParser: function(grammar) { 23 | function convertPasses(passes) { 24 | var converted = {}, stage; 25 | 26 | for (stage in passes) { 27 | if (passes.hasOwnProperty(stage)) { 28 | converted[stage] = utils.values(passes[stage]); 29 | } 30 | } 31 | 32 | return converted; 33 | } 34 | 35 | var options = arguments.length > 1 ? utils.clone(arguments[1]) : {}, 36 | plugins = "plugins" in options ? options.plugins : [], 37 | config = { 38 | parser: this.parser, 39 | passes: convertPasses(this.compiler.passes) 40 | }; 41 | 42 | utils.each(plugins, function(p) { p.use(config, options); }); 43 | 44 | return this.compiler.compile( 45 | config.parser.parse(grammar), 46 | config.passes, 47 | options 48 | ); 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /bower_components/pegjs/lib/utils.js: -------------------------------------------------------------------------------- 1 | var utils = { 2 | /* Like Python's |range|, but without |step|. */ 3 | range: function(start, stop) { 4 | if (stop === undefined) { 5 | stop = start; 6 | start = 0; 7 | } 8 | 9 | var result = new Array(Math.max(0, stop - start)); 10 | for (var i = 0, j = start; j < stop; i++, j++) { 11 | result[i] = j; 12 | } 13 | return result; 14 | }, 15 | 16 | find: function(array, callback) { 17 | var length = array.length; 18 | for (var i = 0; i < length; i++) { 19 | if (callback(array[i])) { 20 | return array[i]; 21 | } 22 | } 23 | }, 24 | 25 | indexOf: function(array, callback) { 26 | var length = array.length; 27 | for (var i = 0; i < length; i++) { 28 | if (callback(array[i])) { 29 | return i; 30 | } 31 | } 32 | return -1; 33 | }, 34 | 35 | contains: function(array, value) { 36 | /* 37 | * Stupid IE does not have Array.prototype.indexOf, otherwise this function 38 | * would be a one-liner. 39 | */ 40 | var length = array.length; 41 | for (var i = 0; i < length; i++) { 42 | if (array[i] === value) { 43 | return true; 44 | } 45 | } 46 | return false; 47 | }, 48 | 49 | each: function(array, callback) { 50 | var length = array.length; 51 | for (var i = 0; i < length; i++) { 52 | callback(array[i], i); 53 | } 54 | }, 55 | 56 | map: function(array, callback) { 57 | var result = []; 58 | var length = array.length; 59 | for (var i = 0; i < length; i++) { 60 | result[i] = callback(array[i], i); 61 | } 62 | return result; 63 | }, 64 | 65 | pluck: function(array, key) { 66 | return utils.map(array, function (e) { return e[key]; }); 67 | }, 68 | 69 | keys: function(object) { 70 | var result = []; 71 | for (var key in object) { 72 | if (object.hasOwnProperty(key)) { 73 | result.push(key); 74 | } 75 | } 76 | return result; 77 | }, 78 | 79 | values: function(object) { 80 | var result = []; 81 | for (var key in object) { 82 | if (object.hasOwnProperty(key)) { 83 | result.push(object[key]); 84 | } 85 | } 86 | return result; 87 | }, 88 | 89 | clone: function(object) { 90 | var result = {}; 91 | for (var key in object) { 92 | if (object.hasOwnProperty(key)) { 93 | result[key] = object[key]; 94 | } 95 | } 96 | return result; 97 | }, 98 | 99 | defaults: function(object, defaults) { 100 | for (var key in defaults) { 101 | if (defaults.hasOwnProperty(key)) { 102 | if (!(key in object)) { 103 | object[key] = defaults[key]; 104 | } 105 | } 106 | } 107 | }, 108 | 109 | /* 110 | * The code needs to be in sync with the code template in the compilation 111 | * function for "action" nodes. 112 | */ 113 | subclass: function(child, parent) { 114 | function ctor() { this.constructor = child; } 115 | ctor.prototype = parent.prototype; 116 | child.prototype = new ctor(); 117 | }, 118 | 119 | /* 120 | * Returns a string padded on the left to a desired length with a character. 121 | * 122 | * The code needs to be in sync with the code template in the compilation 123 | * function for "action" nodes. 124 | */ 125 | padLeft: function(input, padding, length) { 126 | var result = input; 127 | 128 | var padLength = length - input.length; 129 | for (var i = 0; i < padLength; i++) { 130 | result = padding + result; 131 | } 132 | 133 | return result; 134 | }, 135 | 136 | /* 137 | * Returns an escape sequence for given character. Uses \x for characters <= 138 | * 0xFF to save space, \u for the rest. 139 | * 140 | * The code needs to be in sync with the code template in the compilation 141 | * function for "action" nodes. 142 | */ 143 | escape: function(ch) { 144 | var charCode = ch.charCodeAt(0); 145 | var escapeChar; 146 | var length; 147 | 148 | if (charCode <= 0xFF) { 149 | escapeChar = 'x'; 150 | length = 2; 151 | } else { 152 | escapeChar = 'u'; 153 | length = 4; 154 | } 155 | 156 | return '\\' + escapeChar + utils.padLeft(charCode.toString(16).toUpperCase(), '0', length); 157 | }, 158 | 159 | /* 160 | * Surrounds the string with quotes and escapes characters inside so that the 161 | * result is a valid JavaScript string. 162 | * 163 | * The code needs to be in sync with the code template in the compilation 164 | * function for "action" nodes. 165 | */ 166 | quote: function(s) { 167 | /* 168 | * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string 169 | * literal except for the closing quote character, backslash, carriage 170 | * return, line separator, paragraph separator, and line feed. Any character 171 | * may appear in the form of an escape sequence. 172 | * 173 | * For portability, we also escape all control and non-ASCII characters. 174 | * Note that "\0" and "\v" escape sequences are not used because JSHint does 175 | * not like the first and IE the second. 176 | */ 177 | return '"' + s 178 | .replace(/\\/g, '\\\\') // backslash 179 | .replace(/"/g, '\\"') // closing quote character 180 | .replace(/\x08/g, '\\b') // backspace 181 | .replace(/\t/g, '\\t') // horizontal tab 182 | .replace(/\n/g, '\\n') // line feed 183 | .replace(/\f/g, '\\f') // form feed 184 | .replace(/\r/g, '\\r') // carriage return 185 | .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, utils.escape) 186 | + '"'; 187 | }, 188 | 189 | /* 190 | * Escapes characters inside the string so that it can be used as a list of 191 | * characters in a character class of a regular expression. 192 | */ 193 | quoteForRegexpClass: function(s) { 194 | /* 195 | * Based on ECMA-262, 5th ed., 7.8.5 & 15.10.1. 196 | * 197 | * For portability, we also escape all control and non-ASCII characters. 198 | */ 199 | return s 200 | .replace(/\\/g, '\\\\') // backslash 201 | .replace(/\//g, '\\/') // closing slash 202 | .replace(/\]/g, '\\]') // closing bracket 203 | .replace(/\^/g, '\\^') // caret 204 | .replace(/-/g, '\\-') // dash 205 | .replace(/\0/g, '\\0') // null 206 | .replace(/\t/g, '\\t') // horizontal tab 207 | .replace(/\n/g, '\\n') // line feed 208 | .replace(/\v/g, '\\x0B') // vertical tab 209 | .replace(/\f/g, '\\f') // form feed 210 | .replace(/\r/g, '\\r') // carriage return 211 | .replace(/[\x01-\x08\x0E-\x1F\x80-\uFFFF]/g, utils.escape); 212 | }, 213 | 214 | /* 215 | * Builds a node visitor -- a function which takes a node and any number of 216 | * other parameters, calls an appropriate function according to the node type, 217 | * passes it all its parameters and returns its value. The functions for 218 | * various node types are passed in a parameter to |buildNodeVisitor| as a 219 | * hash. 220 | */ 221 | buildNodeVisitor: function(functions) { 222 | return function(node) { 223 | return functions[node.type].apply(null, arguments); 224 | }; 225 | }, 226 | 227 | findRuleByName: function(ast, name) { 228 | return utils.find(ast.rules, function(r) { return r.name === name; }); 229 | }, 230 | 231 | indexOfRuleByName: function(ast, name) { 232 | return utils.indexOf(ast.rules, function(r) { return r.name === name; }); 233 | } 234 | }; 235 | 236 | module.exports = utils; 237 | -------------------------------------------------------------------------------- /bower_components/pegjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pegjs", 3 | "version": "0.8.0", 4 | "description": "Parser generator for JavaScript", 5 | "homepage": "http://pegjs.majda.cz/", 6 | "author": { 7 | "name": "David Majda", 8 | "email": "david@majda.cz", 9 | "url": "http://majda.cz/" 10 | }, 11 | "files": [ 12 | "CHANGELOG.md", 13 | "LICENSE", 14 | "README.md", 15 | "VERSION", 16 | "bin/pegjs", 17 | "examples/arithmetics.pegjs", 18 | "examples/css.pegjs", 19 | "examples/javascript.pegjs", 20 | "examples/json.pegjs", 21 | "lib/compiler.js", 22 | "lib/compiler/opcodes.js", 23 | "lib/compiler/passes/generate-bytecode.js", 24 | "lib/compiler/passes/generate-javascript.js", 25 | "lib/compiler/passes/remove-proxy-rules.js", 26 | "lib/compiler/passes/report-left-recursion.js", 27 | "lib/compiler/passes/report-missing-rules.js", 28 | "lib/grammar-error.js", 29 | "lib/parser.js", 30 | "lib/peg.js", 31 | "lib/utils.js", 32 | "package.json" 33 | ], 34 | "main": "lib/peg", 35 | "bin": "bin/pegjs", 36 | "scripts": { 37 | "test": "make spec" 38 | }, 39 | "repository": { 40 | "type": "git", 41 | "url": "http://github.com/dmajda/pegjs.git" 42 | }, 43 | "devDependencies": { 44 | "jasmine-node": "= 1.11.0", 45 | "uglify-js": "= 2.4.7", 46 | "jshint": "= 2.3.0" 47 | }, 48 | "engines": { 49 | "node": ">= 0.8" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/README: -------------------------------------------------------------------------------- 1 | PEG.js Spec Suite 2 | ================= 3 | 4 | This is the PEG.js spec suite. It ensures PEG.js works correctly. All specs 5 | should always pass on all supported platforms. 6 | 7 | Running in a browser 8 | -------------------- 9 | 10 | 1. Make sure you have Node.js and all the development dependencies specified 11 | in package.json installed. 12 | 13 | 2. Run the following command in the PEG.js root directory (one level up from 14 | this one): 15 | 16 | make browser 17 | 18 | 3. Start a web server and make it serve the PEG.js root directory. 19 | 20 | 4. Point your browser to an URL corresponding to the index.html file. 21 | 22 | 5. Watch the specs pass (or fail). 23 | 24 | If you have Python installed, you can fulfill steps 3 and 4 by running the 25 | following command in the PEG.js root directory 26 | 27 | python -m SimpleHTTPServer 28 | 29 | and loading http://localhost:8000/spec/index.html in your browser. 30 | 31 | Running from a command-line 32 | --------------------------- 33 | 34 | 1. Make sure you have Node.js and all the development dependencies specified 35 | in package.json installed. 36 | 37 | 2. Run the following command in the PEG.js root directory (one level up from 38 | this one): 39 | 40 | make spec 41 | 42 | 3. Watch the specs pass (or fail). 43 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/compiler/passes/remove-proxy-rules.spec.js: -------------------------------------------------------------------------------- 1 | describe("compiler pass |removeProxyRules|", function() { 2 | var pass = PEG.compiler.passes.transform.removeProxyRules; 3 | 4 | function proxyGrammar(rule) { 5 | return [rule, 'proxy = proxied', 'proxied = "a"'].join("\n"); 6 | } 7 | 8 | function expressionDetails(details) { 9 | return { 10 | rules: [ 11 | { type: "rule", name: "start", expression: details }, 12 | { type: "rule", name: "proxied" } 13 | ] 14 | }; 15 | } 16 | 17 | var defaultOptions = { allowedStartRules: ["start"] }, 18 | proxiedRefDetails = { type: "rule_ref", name: "proxied" }, 19 | simpleDetails = expressionDetails({ expression: proxiedRefDetails }); 20 | 21 | it("removes proxy rule from a rule", function() { 22 | expect(pass).toChangeAST(proxyGrammar('start = proxy'), defaultOptions, { 23 | rules: [ 24 | { type: "rule", name: "start", expression: proxiedRefDetails }, 25 | { type: "rule", name: "proxied" } 26 | ] 27 | }); 28 | }); 29 | 30 | it("removes proxy rule from a named", function() { 31 | expect(pass).toChangeAST( 32 | proxyGrammar('start "start" = proxy'), 33 | defaultOptions, 34 | simpleDetails 35 | ); 36 | }); 37 | 38 | it("removes proxy rule from a choice", function() { 39 | expect(pass).toChangeAST( 40 | proxyGrammar('start = proxy / "a" / "b"'), 41 | defaultOptions, 42 | expressionDetails({ alternatives: [proxiedRefDetails, {}, {}] }) 43 | ); 44 | expect(pass).toChangeAST( 45 | proxyGrammar('start = "a" / "b" / proxy'), 46 | defaultOptions, 47 | expressionDetails({ alternatives: [{}, {}, proxiedRefDetails] }) 48 | ); 49 | }); 50 | 51 | it("removes proxy rule from an action", function() { 52 | expect(pass).toChangeAST( 53 | proxyGrammar('start = proxy { }'), 54 | defaultOptions, 55 | simpleDetails 56 | ); 57 | }); 58 | 59 | it("removes proxy rule from a sequence", function() { 60 | expect(pass).toChangeAST( 61 | proxyGrammar('start = proxy "a" "b"'), 62 | defaultOptions, 63 | expressionDetails({ elements: [proxiedRefDetails, {}, {}] }) 64 | ); 65 | expect(pass).toChangeAST( 66 | proxyGrammar('start = "a" "b" proxy'), 67 | defaultOptions, 68 | expressionDetails({ elements: [{}, {}, proxiedRefDetails] }) 69 | ); 70 | }); 71 | 72 | it("removes proxy rule from a labeled", function() { 73 | expect(pass).toChangeAST( 74 | proxyGrammar('start = label:proxy'), 75 | defaultOptions, 76 | simpleDetails 77 | ); 78 | }); 79 | 80 | it("removes proxy rule from a text", function() { 81 | expect(pass).toChangeAST( 82 | proxyGrammar('start = $proxy'), 83 | defaultOptions, 84 | simpleDetails 85 | ); 86 | }); 87 | 88 | it("removes proxy rule from a simple and", function() { 89 | expect(pass).toChangeAST( 90 | proxyGrammar('start = &proxy'), 91 | defaultOptions, 92 | simpleDetails 93 | ); 94 | }); 95 | 96 | it("removes proxy rule from a simple not", function() { 97 | expect(pass).toChangeAST( 98 | proxyGrammar('start = &proxy'), 99 | defaultOptions, 100 | simpleDetails 101 | ); 102 | }); 103 | 104 | it("removes proxy rule from an optional", function() { 105 | expect(pass).toChangeAST( 106 | proxyGrammar('start = proxy?'), 107 | defaultOptions, 108 | simpleDetails 109 | ); 110 | }); 111 | 112 | it("removes proxy rule from a zero or more", function() { 113 | expect(pass).toChangeAST( 114 | proxyGrammar('start = proxy*'), 115 | defaultOptions, 116 | simpleDetails 117 | ); 118 | }); 119 | 120 | it("removes proxy rule from a one or more", function() { 121 | expect(pass).toChangeAST( 122 | proxyGrammar('start = proxy+'), 123 | defaultOptions, 124 | simpleDetails 125 | ); 126 | }); 127 | 128 | it("doesn't remove a proxy rule listed in |allowedStartRules|", function() { 129 | expect(pass).toChangeAST( 130 | proxyGrammar('start = proxy'), 131 | { allowedStartRules: ["proxy"] }, 132 | { 133 | rules: [ 134 | { name: "proxy" }, 135 | { name: "proxied" } 136 | ] 137 | } 138 | ); 139 | }); 140 | }); 141 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/compiler/passes/report-left-recursion.spec.js: -------------------------------------------------------------------------------- 1 | describe("compiler pass |reportLeftRecursion|", function() { 2 | var pass = PEG.compiler.passes.check.reportLeftRecursion; 3 | 4 | beforeEach(function() { 5 | this.addMatchers({ 6 | toReportLeftRecursionIn: function(grammar) { 7 | var ast = PEG.parser.parse(grammar); 8 | 9 | try { 10 | this.actual(ast); 11 | 12 | this.message = function() { 13 | return "Expected the pass to report left recursion for grammar " 14 | + jasmine.pp(grammar) + ", " 15 | + "but it didn't."; 16 | }; 17 | 18 | return false; 19 | } catch (e) { 20 | if (this.isNot) { 21 | this.message = function() { 22 | return "Expected the pass not to report left recursion for grammar " 23 | + jasmine.pp(grammar) + ", " 24 | + "but it did."; 25 | }; 26 | } else { 27 | this.message = function() { 28 | return "Expected the pass to report left recursion for grammar " 29 | + jasmine.pp(grammar) + ", " 30 | + "but it reported an error with message " 31 | + jasmine.pp(e.message) + "."; 32 | }; 33 | } 34 | 35 | return e.message === 'Left recursion detected for rule \"start\".'; 36 | } 37 | } 38 | }); 39 | }); 40 | 41 | it("reports left recursion inside a rule", function() { 42 | expect(pass).toReportLeftRecursionIn('start = start'); 43 | }); 44 | 45 | it("reports left recursion inside a named", function() { 46 | expect(pass).toReportLeftRecursionIn('start "start" = start'); 47 | }); 48 | 49 | it("reports left recursion inside a choice", function() { 50 | expect(pass).toReportLeftRecursionIn('start = start / "a" / "b"'); 51 | expect(pass).toReportLeftRecursionIn('start = "a" / "b" / start'); 52 | }); 53 | 54 | it("reports left recursion inside an action", function() { 55 | expect(pass).toReportLeftRecursionIn('start = start { }'); 56 | }); 57 | 58 | it("reports left recursion inside a sequence", function() { 59 | expect(pass).toReportLeftRecursionIn('start = start "a" "b"'); 60 | }); 61 | 62 | it("reports left recursion inside a labeled", function() { 63 | expect(pass).toReportLeftRecursionIn('start = label:start'); 64 | }); 65 | 66 | it("reports left recursion inside a text", function() { 67 | expect(pass).toReportLeftRecursionIn('start = $start'); 68 | }); 69 | 70 | it("reports left recursion inside a simple and", function() { 71 | expect(pass).toReportLeftRecursionIn('start = &start'); 72 | }); 73 | 74 | it("reports left recursion inside a simple not", function() { 75 | expect(pass).toReportLeftRecursionIn('start = &start'); 76 | }); 77 | 78 | it("reports left recursion inside an optional", function() { 79 | expect(pass).toReportLeftRecursionIn('start = start?'); 80 | }); 81 | 82 | it("reports left recursion inside a zero or more", function() { 83 | expect(pass).toReportLeftRecursionIn('start = start*'); 84 | }); 85 | 86 | it("reports left recursion inside a one or more", function() { 87 | expect(pass).toReportLeftRecursionIn('start = start+'); 88 | }); 89 | 90 | it("reports indirect left recursion", function() { 91 | expect(pass).toReportLeftRecursionIn([ 92 | 'start = stop', 93 | 'stop = start' 94 | ].join("\n")); 95 | }); 96 | }); 97 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/compiler/passes/report-missing-rules.spec.js: -------------------------------------------------------------------------------- 1 | describe("compiler pass |reportMissingRules|", function() { 2 | var pass = PEG.compiler.passes.check.reportMissingRules; 3 | 4 | beforeEach(function() { 5 | this.addMatchers({ 6 | toReportMissingRuleIn: function(grammar) { 7 | var ast = PEG.parser.parse(grammar); 8 | 9 | try { 10 | this.actual(ast); 11 | 12 | this.message = function() { 13 | return "Expected the pass to report a missing rule for grammar " 14 | + jasmine.pp(grammar) + ", " 15 | + "but it didn't."; 16 | }; 17 | 18 | return false; 19 | } catch (e) { 20 | if (this.isNot) { 21 | this.message = function() { 22 | return "Expected the pass not to report a missing rule for grammar " 23 | + jasmine.pp(grammar) + ", " 24 | + "but it did."; 25 | }; 26 | } else { 27 | this.message = function() { 28 | return "Expected the pass to report a missing rule for grammar " 29 | + jasmine.pp(grammar) + ", " 30 | + "but it reported an error with message " 31 | + jasmine.pp(e.message) + "."; 32 | }; 33 | } 34 | 35 | return e.message === 'Referenced rule "missing" does not exist.'; 36 | } 37 | } 38 | }); 39 | }); 40 | 41 | it("reports missing rule referenced from a rule", function() { 42 | expect(pass).toReportMissingRuleIn('start = missing'); 43 | }); 44 | 45 | it("reports missing rule referenced from a named", function() { 46 | expect(pass).toReportMissingRuleIn('start "start" = missing'); 47 | }); 48 | 49 | it("reports missing rule referenced from a choice", function() { 50 | expect(pass).toReportMissingRuleIn('start = missing / "a" / "b"'); 51 | expect(pass).toReportMissingRuleIn('start = "a" / "b" / missing'); 52 | }); 53 | 54 | it("reports missing rule referenced from an action", function() { 55 | expect(pass).toReportMissingRuleIn('start = missing { }'); 56 | }); 57 | 58 | it("reports missing rule referenced from a sequence", function() { 59 | expect(pass).toReportMissingRuleIn('start = missing "a" "b"'); 60 | expect(pass).toReportMissingRuleIn('start = "a" "b" missing'); 61 | }); 62 | 63 | it("reports missing rule referenced from a labeled", function() { 64 | expect(pass).toReportMissingRuleIn('start = label:missing'); 65 | }); 66 | 67 | it("reports missing rule referenced from a text", function() { 68 | expect(pass).toReportMissingRuleIn('start = $missing'); 69 | }); 70 | 71 | it("reports missing rule referenced from a simple and", function() { 72 | expect(pass).toReportMissingRuleIn('start = &missing'); 73 | }); 74 | 75 | it("reports missing rule referenced from a simple not", function() { 76 | expect(pass).toReportMissingRuleIn('start = &missing'); 77 | }); 78 | 79 | it("reports missing rule referenced from an optional", function() { 80 | expect(pass).toReportMissingRuleIn('start = missing?'); 81 | }); 82 | 83 | it("reports missing rule referenced from a zero or more", function() { 84 | expect(pass).toReportMissingRuleIn('start = missing*'); 85 | }); 86 | 87 | it("reports missing rule referenced from a one or more", function() { 88 | expect(pass).toReportMissingRuleIn('start = missing+'); 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/helpers.js: -------------------------------------------------------------------------------- 1 | if (typeof module !== "undefined") { 2 | PEG = require("../lib/peg.js"); 3 | } 4 | 5 | beforeEach(function() { 6 | this.addMatchers({ 7 | toChangeAST: function(grammar) { 8 | function matchDetails(value, details) { 9 | function isArray(value) { 10 | return Object.prototype.toString.apply(value) === "[object Array]"; 11 | } 12 | 13 | function isObject(value) { 14 | return value !== null && typeof value === "object"; 15 | } 16 | 17 | var i, key; 18 | 19 | if (isArray(details)) { 20 | if (!isArray(value)) { return false; } 21 | 22 | if (value.length !== details.length) { return false; } 23 | for (i = 0; i < details.length; i++) { 24 | if (!matchDetails(value[i], details[i])) { return false; } 25 | } 26 | 27 | return true; 28 | } else if (isObject(details)) { 29 | if (!isObject(value)) { return false; } 30 | 31 | for (key in details) { 32 | if (details.hasOwnProperty(key)) { 33 | if (!(key in value)) { return false; } 34 | 35 | if (!matchDetails(value[key], details[key])) { return false; } 36 | } 37 | } 38 | 39 | return true; 40 | } else { 41 | return value === details; 42 | } 43 | } 44 | 45 | var options = arguments.length > 2 ? arguments[1] : {}, 46 | details = arguments[arguments.length - 1], 47 | ast = PEG.parser.parse(grammar); 48 | 49 | this.actual(ast, options); 50 | 51 | this.message = function() { 52 | return "Expected the pass " 53 | + "with options " + jasmine.pp(options) + " " 54 | + (this.isNot ? "not " : "") 55 | + "to change the AST " + jasmine.pp(ast) + " " 56 | + "to match " + jasmine.pp(details) + ", " 57 | + "but it " + (this.isNot ? "did" : "didn't") + "."; 58 | }; 59 | 60 | return matchDetails(ast, details); 61 | } 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PEG.js Spec Suite 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/vendor/jasmine/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2011 Pivotal Labs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /bower_components/pegjs/spec/vendor/jasmine/jasmine.css: -------------------------------------------------------------------------------- 1 | body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } 2 | 3 | #HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } 4 | #HTMLReporter a { text-decoration: none; } 5 | #HTMLReporter a:hover { text-decoration: underline; } 6 | #HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; } 7 | #HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; } 8 | #HTMLReporter #jasmine_content { position: fixed; right: 100%; } 9 | #HTMLReporter .version { color: #aaaaaa; } 10 | #HTMLReporter .banner { margin-top: 14px; } 11 | #HTMLReporter .duration { color: #aaaaaa; float: right; } 12 | #HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; } 13 | #HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; } 14 | #HTMLReporter .symbolSummary li.passed { font-size: 14px; } 15 | #HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; } 16 | #HTMLReporter .symbolSummary li.failed { line-height: 9px; } 17 | #HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } 18 | #HTMLReporter .symbolSummary li.skipped { font-size: 14px; } 19 | #HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; } 20 | #HTMLReporter .symbolSummary li.pending { line-height: 11px; } 21 | #HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; } 22 | #HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } 23 | #HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } 24 | #HTMLReporter .runningAlert { background-color: #666666; } 25 | #HTMLReporter .skippedAlert { background-color: #aaaaaa; } 26 | #HTMLReporter .skippedAlert:first-child { background-color: #333333; } 27 | #HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; } 28 | #HTMLReporter .passingAlert { background-color: #a6b779; } 29 | #HTMLReporter .passingAlert:first-child { background-color: #5e7d00; } 30 | #HTMLReporter .failingAlert { background-color: #cf867e; } 31 | #HTMLReporter .failingAlert:first-child { background-color: #b03911; } 32 | #HTMLReporter .results { margin-top: 14px; } 33 | #HTMLReporter #details { display: none; } 34 | #HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; } 35 | #HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } 36 | #HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } 37 | #HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } 38 | #HTMLReporter.showDetails .summary { display: none; } 39 | #HTMLReporter.showDetails #details { display: block; } 40 | #HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } 41 | #HTMLReporter .summary { margin-top: 14px; } 42 | #HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; } 43 | #HTMLReporter .summary .specSummary.passed a { color: #5e7d00; } 44 | #HTMLReporter .summary .specSummary.failed a { color: #b03911; } 45 | #HTMLReporter .description + .suite { margin-top: 0; } 46 | #HTMLReporter .suite { margin-top: 14px; } 47 | #HTMLReporter .suite a { color: #333333; } 48 | #HTMLReporter #details .specDetail { margin-bottom: 28px; } 49 | #HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; } 50 | #HTMLReporter .resultMessage { padding-top: 14px; color: #333333; } 51 | #HTMLReporter .resultMessage span.result { display: block; } 52 | #HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } 53 | 54 | #TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ } 55 | #TrivialReporter a:visited, #TrivialReporter a { color: #303; } 56 | #TrivialReporter a:hover, #TrivialReporter a:active { color: blue; } 57 | #TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; } 58 | #TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; } 59 | #TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; } 60 | #TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; } 61 | #TrivialReporter .runner.running { background-color: yellow; } 62 | #TrivialReporter .options { text-align: right; font-size: .8em; } 63 | #TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; } 64 | #TrivialReporter .suite .suite { margin: 5px; } 65 | #TrivialReporter .suite.passed { background-color: #dfd; } 66 | #TrivialReporter .suite.failed { background-color: #fdd; } 67 | #TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; } 68 | #TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; } 69 | #TrivialReporter .spec.failed { background-color: #fbb; border-color: red; } 70 | #TrivialReporter .spec.passed { background-color: #bfb; border-color: green; } 71 | #TrivialReporter .spec.skipped { background-color: #bbb; } 72 | #TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; } 73 | #TrivialReporter .passed { background-color: #cfc; display: none; } 74 | #TrivialReporter .failed { background-color: #fbb; } 75 | #TrivialReporter .skipped { color: #777; background-color: #eee; display: none; } 76 | #TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; } 77 | #TrivialReporter .resultMessage .mismatch { color: black; } 78 | #TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; } 79 | #TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; } 80 | #TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; } 81 | #TrivialReporter #jasmine_content { position: fixed; right: 100%; } 82 | #TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; } 83 | -------------------------------------------------------------------------------- /bower_components/pegjs/tools/impact: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Measures impact of a Git commit (or multiple commits) on generated parsers' 4 | # speed and size. Makes sense to use only on PEG.js Git repository checkout. 5 | 6 | set -e 7 | 8 | # Measurement 9 | 10 | prepare() { 11 | git checkout --quiet "$1" 12 | } 13 | 14 | run_benchmark() { 15 | echo $(make benchmark | awk 'BEGIN { FS = " *│ *" } /Total/ { split($5, a, " "); print a[1] }') 16 | } 17 | 18 | measure_speed() { 19 | bc <<-EOT 20 | scale = 2 21 | ($(run_benchmark) + $(run_benchmark) + $(run_benchmark) + $(run_benchmark) + $(run_benchmark)) / 5 22 | EOT 23 | } 24 | 25 | measure_size() { 26 | for file in examples/*.pegjs; do 27 | bin/pegjs "$file" 28 | done 29 | 30 | echo $(cat examples/*.js | wc -c) 31 | 32 | rm examples/*.js 33 | } 34 | 35 | difference() { 36 | bc <<-EOT 37 | scale = 4 38 | ($2 / $1 - 1) * 100 39 | EOT 40 | } 41 | 42 | # Helpers 43 | 44 | print_results() { 45 | echo 46 | 47 | echo "Speed impact" 48 | echo "------------" 49 | echo "Before: $1 kB/s" 50 | echo "After: $2 kB/s" 51 | printf "Difference: %0.2f%%\n" $(difference $1 $2) 52 | 53 | echo 54 | 55 | echo "Size impact" 56 | echo "-----------" 57 | echo "Before: $3 b" 58 | echo "After: $4 b" 59 | printf "Difference: %0.2f%%\n" $(difference $3 $4) 60 | 61 | echo 62 | 63 | echo "(Measured by /tools/impact with Node.js $(node --version) on $(uname --operating-system --machine).)" 64 | } 65 | 66 | print_usage() { 67 | echo "Usage:" 68 | echo " $0 " 69 | echo " $0 " 70 | echo 71 | echo "Measures impact of a Git commit (or multiple commits) on generated parsers'" 72 | echo "speed and size. Makes sense to use only on PEG.js Git repository checkout." 73 | } 74 | 75 | cd_to_root() { 76 | if [ -L "$0" ]; then 77 | THIS_FILE=$(readlink "$0") 78 | else 79 | THIS_FILE="$0" 80 | fi 81 | cd "$(dirname "$THIS_FILE")/.." 82 | } 83 | 84 | exit_failure() { 85 | exit 1 86 | } 87 | 88 | # Main 89 | 90 | if [ $# -eq 1 ]; then 91 | commit_before="$1~1" 92 | commit_after="$1" 93 | elif [ $# -eq 2 ]; then 94 | commit_before="$1" 95 | commit_after="$2" 96 | else 97 | print_usage 98 | exit_failure 99 | fi 100 | 101 | cd_to_root 102 | 103 | echo -n "Measuring commit $commit_before..." 104 | prepare "$commit_before" 105 | speed1=$(measure_speed) 106 | size1=$(measure_size) 107 | echo " OK" 108 | 109 | echo -n "Measuring commit $commit_after..." 110 | prepare "$commit_after" 111 | speed2=$(measure_speed) 112 | size2=$(measure_size) 113 | echo " OK" 114 | 115 | print_results $speed1 $speed2 $size1 $size2 116 | -------------------------------------------------------------------------------- /bower_components/react/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "version": "0.11.1", 4 | "main": "react.js", 5 | "homepage": "https://github.com/facebook/react-bower", 6 | "_release": "0.11.1", 7 | "_resolution": { 8 | "type": "version", 9 | "tag": "v0.11.1", 10 | "commit": "b40055e1733ce3fca762744456ecf7a6c6263406" 11 | }, 12 | "_source": "git://github.com/facebook/react-bower.git", 13 | "_target": "~0.11.1", 14 | "_originalSource": "react" 15 | } -------------------------------------------------------------------------------- /bower_components/react/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "version": "0.11.1", 4 | "main": "react.js" 5 | } -------------------------------------------------------------------------------- /bower_components/underscore/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore", 3 | "version": "1.6.0", 4 | "main": "underscore.js", 5 | "keywords": [ 6 | "util", 7 | "functional", 8 | "server", 9 | "client", 10 | "browser" 11 | ], 12 | "ignore": [ 13 | "underscore-min.js", 14 | "docs", 15 | "test", 16 | "*.yml", 17 | "*.map", 18 | "CNAME", 19 | "index.html", 20 | "favicon.ico", 21 | "CONTRIBUTING.md" 22 | ], 23 | "homepage": "https://github.com/jashkenas/underscore", 24 | "_release": "1.6.0", 25 | "_resolution": { 26 | "type": "version", 27 | "tag": "1.6.0", 28 | "commit": "1f4bf626f23a99f7a676f5076dc1b1475554c8f7" 29 | }, 30 | "_source": "git://github.com/jashkenas/underscore.git", 31 | "_target": "~1.6.0", 32 | "_originalSource": "underscore", 33 | "_direct": true 34 | } -------------------------------------------------------------------------------- /bower_components/underscore/.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [**.{js,json,html}] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /bower_components/underscore/.gitignore: -------------------------------------------------------------------------------- 1 | raw 2 | node_modules 3 | -------------------------------------------------------------------------------- /bower_components/underscore/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative 2 | Reporters & Editors 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /bower_components/underscore/README.md: -------------------------------------------------------------------------------- 1 | __ 2 | /\ \ __ 3 | __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____ 4 | /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\ 5 | \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\ 6 | \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/ 7 | \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/ 8 | \ \____/ 9 | \/___/ 10 | 11 | Underscore.js is a utility-belt library for JavaScript that provides 12 | support for the usual functional suspects (each, map, reduce, filter...) 13 | without extending any core JavaScript objects. 14 | 15 | For Docs, License, Tests, and pre-packed downloads, see: 16 | http://underscorejs.org 17 | 18 | Underscore is an open-sourced component of DocumentCloud: 19 | https://github.com/documentcloud 20 | 21 | Many thanks to our contributors: 22 | https://github.com/jashkenas/underscore/contributors 23 | -------------------------------------------------------------------------------- /bower_components/underscore/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore", 3 | "version": "1.6.0", 4 | "main": "underscore.js", 5 | "keywords": ["util", "functional", "server", "client", "browser"], 6 | "ignore" : ["underscore-min.js", "docs", "test", "*.yml", "*.map", 7 | "CNAME", "index.html", "favicon.ico", "CONTRIBUTING.md"] 8 | } 9 | -------------------------------------------------------------------------------- /bower_components/underscore/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "underscore", 3 | "description" : "JavaScript's functional programming helper library.", 4 | "keywords" : ["util", "functional", "server", "client", "browser"], 5 | "repo" : "jashkenas/underscore", 6 | "main" : "underscore.js", 7 | "scripts" : ["underscore.js"], 8 | "version" : "1.6.0", 9 | "license" : "MIT" 10 | } 11 | -------------------------------------------------------------------------------- /bower_components/underscore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "underscore", 3 | "description" : "JavaScript's functional programming helper library.", 4 | "homepage" : "http://underscorejs.org", 5 | "keywords" : ["util", "functional", "server", "client", "browser"], 6 | "author" : "Jeremy Ashkenas ", 7 | "repository" : {"type": "git", "url": "git://github.com/jashkenas/underscore.git"}, 8 | "main" : "underscore.js", 9 | "version" : "1.6.0", 10 | "devDependencies": { 11 | "docco": "0.6.x", 12 | "phantomjs": "1.9.0-1", 13 | "uglify-js": "2.4.x" 14 | }, 15 | "scripts": { 16 | "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true", 17 | "build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js", 18 | "doc": "docco underscore.js" 19 | }, 20 | "licenses": [ 21 | { 22 | "type": "MIT", 23 | "url": "https://raw.github.com/jashkenas/underscore/master/LICENSE" 24 | } 25 | ], 26 | "files" : ["underscore.js", "underscore-min.js", "LICENSE"] 27 | } 28 | -------------------------------------------------------------------------------- /components/ApplicationComponent.js: -------------------------------------------------------------------------------- 1 | var Application = React.createClass({displayName: 'Application', 2 | mixins: [NodeMixins], 3 | isApplicable: function() { 4 | return this.props.lineState.index === this.props.lineState.lastIndex && 5 | ASTTransformations.isApplicable(this.currentAST()); 6 | }, 7 | apply: function(event) { 8 | if (this.isApplicable()) { 9 | this.props.lineState.program.addLineByApplying(this.currentAST().id); 10 | event.stopPropagation(); 11 | } 12 | }, 13 | highlight: function(e) { 14 | e.stopPropagation(); 15 | if (this.isApplicable() && this.currentAST().id !== this.props.lineState.applicationHighlightId) { 16 | this.previousHighlightApplicationId = this.props.lineState.applicationHighlightId; 17 | this.props.lineState.program.highlightApplicationId(this.currentAST().id); 18 | } 19 | }, 20 | unhighlight: function() { 21 | if (this.currentAST().id === this.props.lineState.applicationHighlightId) { 22 | this.props.lineState.program.highlightApplicationId(this.previousHighlightApplicationId); 23 | } 24 | }, 25 | render: function() { 26 | var currentAST = this.currentAST(); 27 | 28 | var funcAndArgs = _.flatten(currentAST.arguments.map((function(arg){ 29 | return [Node({lineState: this.props.lineState, id: arg.id, key: arg.id}), (currentAST.functionName.infix ? '' : ' ')]; 30 | }).bind(this))); 31 | funcAndArgs.pop(); // remove last whitespace 32 | 33 | if (currentAST.functionName.infix) { 34 | funcAndArgs.splice(1, 0, FunctionName({lineState: this.props.lineState, id: currentAST.functionName.id, key: currentAST.functionName.id})); 35 | funcAndArgs.splice(1, 0, ' '); 36 | funcAndArgs.splice(3, 0, ' '); 37 | } else { 38 | funcAndArgs.unshift(' '); 39 | funcAndArgs.unshift(FunctionName({lineState: this.props.lineState, id: currentAST.functionName.id, key: currentAST.functionName.id})); 40 | } 41 | 42 | funcAndArgs.unshift(''); 43 | funcAndArgs.push(''); 44 | 45 | var className = 'application'; 46 | if (this.isApplicable() && this.currentAST().id === this.props.lineState.applicationHighlightId) { 47 | className += ' application-applicable'; 48 | } 49 | if (this.props.lineState.highlightedLineIndex == this.props.lineState.index && this.currentAST().id === this.props.lineState.clickedComputationId) { 50 | className += ' application-highlight-clicked-computation'; 51 | } 52 | 53 | return React.DOM.span({ 54 | className: className, 55 | onClick: this.apply, 56 | onTouchStart: this.apply, 57 | onMouseEnter: this.highlight, 58 | onMouseMove: this.highlight, 59 | onMouseLeave: this.unhighlight, 60 | key: currentAST.id 61 | },[React.addons.CSSTransitionGroup({transitionName: 'bubble-animation', key: 'bubble-animation'}, 62 | funcAndArgs)] 63 | ); 64 | } 65 | }); 66 | -------------------------------------------------------------------------------- /components/FunctionEditorComponent.js: -------------------------------------------------------------------------------- 1 | var FunctionEditor = React.createClass({displayName: 'FunctionEditor', 2 | getInitialState: function() { 3 | return {editing: true, error: false, functionDefinitions: this.props.defaultFunctionDefinitions}; 4 | }, 5 | onClick: function() { 6 | this.setState({editing: !this.state.editing}); 7 | }, 8 | onChange: function(e) { 9 | try { 10 | this.updateFunctionDefinitions(e.target.value); 11 | this.setState({error: false}); 12 | } catch (e) { 13 | this.setState({error: e}); 14 | } 15 | }, 16 | render: function() { 17 | if (this.state.editing) { 18 | var errorDiv; 19 | if (this.state.error) { 20 | var textAreaScrollTop = this.refs.textarea ? this.refs.textarea.getDOMNode().scrollTop : 0; 21 | 22 | errorDiv = React.DOM.div({ 23 | className: 'function-editor-error-message', 24 | style: {top: 15*(this.state.error.line-1) - textAreaScrollTop}, 25 | key: 3 26 | }, this.state.error.message); 27 | } 28 | 29 | return React.DOM.div({className: 'function-editor-container'}, [ 30 | React.DOM.textarea({ 31 | spellCheck: 'false', 32 | className: "function-editor" + (this.state.error ? ' function-editor-error' : ''), 33 | value: this.state.functionDefinitions, 34 | onChange: this.onChange, 35 | onKeyUp: this.onChange, 36 | onScroll: function() { this.forceUpdate(); }.bind(this), 37 | key: 1, 38 | ref: 'textarea' 39 | }), 40 | React.DOM.div({ 41 | className: "function-editor-top", 42 | key: 2 43 | }, [ 44 | React.DOM.span({className: "function-editor-title function-editor-title-big", key: 1}, 'Function Editor'), 45 | // React.DOM.span({className: "function-editor-link", onClick: this.onClick}, '(close)') 46 | ] 47 | ), 48 | errorDiv 49 | ]); 50 | } else { 51 | return ( 52 | React.DOM.div({ 53 | className: "function-editor-top", 54 | }, [ 55 | React.DOM.span({className: "function-editor-title function-editor-title-big", key: 1}, 'Function Editor'), 56 | // React.DOM.span({className: "function-editor-link", onClick: this.onClick}, '(open)') 57 | ] 58 | ) 59 | ); 60 | } 61 | }, 62 | componentWillMount: function() { 63 | this.updateFunctionDefinitions(this.state.functionDefinitions); 64 | }, 65 | updateFunctionDefinitions: function(text) { 66 | this.setState({functionDefinitions: text}); 67 | 68 | window.functions = { 69 | ':': window.functions[':'], 70 | '+': window.functions['+'], 71 | '-': window.functions['-'] 72 | }; 73 | 74 | var newFunctions = HaskellParser.parse(text + "\n\n", {startRule: 'functionDefinitionList'}); 75 | newFunctions.forEach(function(func) { 76 | if ([':', '+', '-'].indexOf(func.name) < 0) { 77 | window.functions[func.name] = func; 78 | } 79 | }); 80 | } 81 | }); 82 | -------------------------------------------------------------------------------- /components/FunctionNameComponent.js: -------------------------------------------------------------------------------- 1 | var FunctionName = React.createClass({displayName: 'FunctionName', 2 | mixins: [NodeMixins], 3 | render: function() { 4 | var functionName = this.currentAST().name; 5 | var func = window.functions[functionName]; 6 | 7 | 8 | if (functionName === "map"){ 9 | var color = 'red'; 10 | } else if (functionName === "foldl"){ 11 | var color = 'green'; 12 | } else if (functionName === "foldr"){ 13 | var color = 'rgb(255, 100, 224)'; 14 | } 15 | else { 16 | var color = func ? func.color : 'gray'; 17 | } 18 | 19 | return React.DOM.span({className: "functionName", style: {color: color}, key: this.currentAST().id}, 20 | functionName 21 | ); 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /components/IntComponent.js: -------------------------------------------------------------------------------- 1 | var Int = React.createClass({displayName: 'Int', 2 | mixins: [NodeMixins], 3 | render: function() { 4 | return React.DOM.span({className: 'int'}, [React.addons.CSSTransitionGroup({transitionName: 'bubble-animation', key: 'bubble-animation'}, this.currentAST().value)]); 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /components/LineComponent.js: -------------------------------------------------------------------------------- 1 | var LineContext = React.createClass({displayName: 'LineContext', 2 | render: function() { 3 | var contextId = this.props.lineState.clickedComputationId || this.props.lineState.applicationHighlightId; 4 | return React.DOM.div({className: 'line-context', dangerouslySetInnerHTML: {__html: ASTTransformations.getContextHTML(this.props.lineState.ast, contextId)}}); 5 | } 6 | }); 7 | 8 | 9 | var Line = React.createClass({displayName: 'Line', 10 | getInitialState: function() { 11 | return {editingError: false, textLength: null}; 12 | }, 13 | onTextChange: function(event) { 14 | this.setState({textLength: event.target.value.length}); 15 | try { 16 | HaskellParser.parse(event.target.value); 17 | this.setState({editingError: false}); 18 | } catch (e) { 19 | this.setState({editingError: e}); 20 | } 21 | }, 22 | componentDidUpdate: function(){ 23 | if (this.getDOMNode().tagName === "INPUT"){ 24 | this.getDOMNode().focus(); 25 | } 26 | }, 27 | saveText: function(event) { 28 | try { 29 | event.preventDefault(); 30 | this.props.lineState.program.updateInitialAST(this.props.lineState.ast.id, HaskellParser.parse(event.target.value)); 31 | this.setState({editingError: false}); 32 | } catch (e) { 33 | this.setState({editingError: e}); 34 | } 35 | }, 36 | onKeyDown: function(event) { 37 | if (event.keyCode === 13) { 38 | this.saveText(event); 39 | } 40 | }, 41 | listText: function() { 42 | return window.ASTTransformations.astToString(this.props.lineState.ast); 43 | }, 44 | highlight: function() { 45 | this.props.lineState.program.highlightLine(this.props.lineState.index); 46 | }, 47 | unhighlight: function() { 48 | if (this.props.lineState.highlightedLineIndex == this.props.lineState.index) { 49 | this.props.lineState.program.highlightLine(null); 50 | } 51 | }, 52 | render: function() { 53 | var className = "line"; 54 | var lineContext, lineEditButton, lineClearButton; 55 | if (this.props.lineState.highlightedLineIndex == this.props.lineState.index) { 56 | className += " line-highlight"; 57 | lineContext = LineContext({lineState: this.props.lineState, key: 2}); 58 | } 59 | if (this.props.lineState.index === 0 && !this.props.lineState.editing) { 60 | lineEditButton = React.DOM.span({ 61 | className: 'lines-edit', 62 | onClick: this.props.lineState.program.editFirstLine, 63 | key: 3 64 | }, '(edit)'); 65 | lineClearButton = React.DOM.span({ 66 | className: 'lines-edit', 67 | onClick: this.props.lineState.program.clearProgram, 68 | key: 4 69 | }, '(clear)'); 70 | } 71 | 72 | var errorDiv; 73 | if (this.state.editingError) { 74 | errorDiv = React.DOM.div({ 75 | className: 'line-editing-error', 76 | style: {left: 8*this.state.editingError.offset}, 77 | key: 1 78 | }, "\u2191 " + this.state.editingError.message); 79 | } 80 | 81 | if (this.props.lineState.editing) { 82 | return React.DOM.div({className: 'line-editing-container'}, [ 83 | React.DOM.input({ 84 | defaultValue: this.listText(), 85 | onBlur: this.saveText, 86 | onClick: function(event){event.stopPropagation();}, 87 | onChange: this.onTextChange, 88 | onKeyDown: this.onKeyDown, 89 | className: (this.state.editingError ? 'input-error' : ''), 90 | style: {width: Math.max(100, (this.state.textLength || this.listText().length)*10)}, 91 | key: 0 92 | }), 93 | errorDiv 94 | ]); 95 | } else { 96 | return React.DOM.div({ 97 | className: className, 98 | onTouchStart: this.highlight, 99 | onMouseEnter: this.highlight, 100 | onMouseLeave: this.unhighlight 101 | }, 102 | React.DOM.div({className: 'line-inner'}, 103 | [ React.addons.CSSTransitionGroup({transitionName: 'bubble-animation', key: 'bubble-animation'}, 104 | Node({lineState: this.props.lineState, id: this.props.lineState.ast.id, key: 1})), 105 | lineContext, 106 | lineEditButton, 107 | lineClearButton 108 | ] 109 | ) 110 | ); 111 | } 112 | } 113 | }); 114 | -------------------------------------------------------------------------------- /components/LinesComponent.js: -------------------------------------------------------------------------------- 1 | var Lines = React.createClass({displayName: 'Lines', 2 | render: function() { 3 | return ( 4 | React.DOM.div({className: "lines"}, [ 5 | React.addons.CSSTransitionGroup({transitionName: 'bubble-animation', key: 'bubble-animation'}, 6 | this.props.lines.map((function(line, index) { 7 | return Line({lineState: { 8 | ast: line.ast, 9 | index: index, 10 | lastIndex: this.props.lines.length-1, 11 | clickedComputationId: line.clickedComputationId, 12 | justComputedId: line.justComputedId, 13 | applicationHighlightId: this.props.applicationHighlightId, 14 | highlightedLineIndex: this.props.highlightedLineIndex, 15 | editing: this.props.editingFirstLine && index === 0, 16 | program: this.props.program 17 | }, key: index}); 18 | }).bind(this)) 19 | ), 20 | (this.props.showHelpText ? React.DOM.div({className: 'help-text', key: 'help-text'}, "\u2191 click to expand execution") : undefined) 21 | ]) 22 | ); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /components/ListComponent.js: -------------------------------------------------------------------------------- 1 | var List = React.createClass({displayName: 'List', 2 | mixins: [NodeMixins], 3 | getInitialState: function() { 4 | return {editingError: false, textLength: null}; 5 | }, 6 | onTextChange: function(event) { 7 | this.setState({textLength: event.target.value.length}); 8 | try { 9 | HaskellParser.parse(event.target.value); 10 | this.setState({editingError: false}); 11 | } catch (e) { 12 | this.setState({editingError: true}); 13 | } 14 | }, 15 | componentDidUpdate: function(){ 16 | if (this.getDOMNode().tagName === "INPUT"){ 17 | this.getDOMNode().focus(); 18 | var length = this.getDOMNode().value.length; 19 | this.getDOMNode().setSelectionRange(length - 1, length - 1); 20 | } 21 | }, 22 | onKeyDown: function(event) { 23 | if (event.keyCode === 13) { 24 | try { 25 | event.preventDefault(); 26 | this.props.lineState.program.updateInitialAST(this.currentAST().id, HaskellParser.parse(event.target.value)); 27 | this.setState({editingError: false}); 28 | } catch (e) { 29 | this.setState({editingError: true}); 30 | } 31 | } 32 | }, 33 | listText: function() { 34 | return window.ASTTransformations.astToString(this.currentAST()); 35 | }, 36 | render: function() { 37 | if (this.props.lineState.editing) { 38 | return React.DOM.input({ 39 | defaultValue: this.listText(), 40 | onClick: function(event){event.stopPropagation();}, 41 | onChange: this.onTextChange, 42 | onKeyDown: this.onKeyDown, 43 | className: (this.state.editingError ? 'input-error' : ''), 44 | style: {width: Math.max(100, (this.state.textLength || this.listText().length)*8)} 45 | }); 46 | } else { 47 | var listItems = this.currentAST().items; 48 | var items = []; 49 | items.push('['); 50 | for (var i=0; i [a] -> [a]', 7 | isValidApplication: function(arguments) { 8 | // TODO paramaterize list time 9 | return arguments.length === 2 && 10 | arguments[1].type === 'list'; 11 | }, 12 | astToString: function(arguments) { 13 | return ":"; 14 | }, 15 | patterns: [ 16 | { 17 | definitionLine: null, 18 | doesMatch: function(arguments){ 19 | return true; 20 | }, 21 | apply: function(arguments){ 22 | var items = arguments[1].items; 23 | items.unshift(arguments[0]); 24 | 25 | return { 26 | id: uuid.v4(), 27 | type: 'list', 28 | items: items 29 | }; 30 | } 31 | } 32 | ] 33 | }; 34 | -------------------------------------------------------------------------------- /functions/minus.js: -------------------------------------------------------------------------------- 1 | window.functions['-'] = { 2 | name: '-', 3 | englishName: 'minus', 4 | color: 'purple', 5 | infix: true, 6 | typeSignature: 'Int -> Int -> Int', 7 | isValidApplication: function(arguments) { 8 | return arguments.length === 2 && 9 | arguments[0].type === 'int' && 10 | arguments[1].type === 'int'; 11 | }, 12 | patterns: [ 13 | { 14 | definitionLine: null, 15 | doesMatch: function(arguments){ 16 | return true; 17 | }, 18 | apply: function(arguments){ 19 | return { 20 | id: uuid.v4(), 21 | type: 'int', 22 | value: arguments[0].value - arguments[1].value 23 | }; 24 | } 25 | } 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /functions/plus.js: -------------------------------------------------------------------------------- 1 | window.functions['+'] = { 2 | name: '+', 3 | englishName: 'plus', 4 | color: 'purple', 5 | infix: true, 6 | typeSignature: 'Int -> Int -> Int', 7 | isValidApplication: function(arguments) { 8 | return arguments.length === 2 && 9 | arguments[0].type === 'int' && 10 | arguments[1].type === 'int'; 11 | }, 12 | patterns: [ 13 | { 14 | definitionLine: null, 15 | doesMatch: function(arguments){ 16 | return true; 17 | }, 18 | apply: function(arguments){ 19 | return { 20 | id: uuid.v4(), 21 | type: 'int', 22 | value: arguments[0].value + arguments[1].value 23 | }; 24 | } 25 | } 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /haskell.pegjs: -------------------------------------------------------------------------------- 1 | { 2 | function randomId() { return (window.uuid ? uuid.v4() : 'placeholder'); } 3 | } 4 | 5 | start 6 | = expressionWithFunction 7 | 8 | functionDefinitionList 9 | = functionDefinitionPlusWhitespace* 10 | 11 | functionDefinitionPlusWhitespace 12 | = functionDefinition:functionDefinition whitespace_newline { return functionDefinition; } 13 | 14 | functionDefinition 15 | = functionName:functionName typeSignature:functionDefinitionTypeSignature patterns:functionDefinitionPatternLine+ { return { 16 | name: functionName.name, 17 | englishName: functionName.name, 18 | typeSignature: typeSignature, 19 | patterns: patterns, 20 | isValidApplication: function(functionArguments) { return functionArguments.length === patterns[0].numberOfArguments; 21 | }}; } 22 | 23 | functionDefinitionTypeSignature 24 | = whitespace "::" whitespace typesig:[ \(\)\[\]A-Za-z>-]+ { return typesig.join(""); } 25 | 26 | functionDefinitionPatternLine 27 | = whitespace_newline functionName part:functionDefinitionPatternPartOfLine { return part; } 28 | 29 | functionDefinitionPatternPartOfLine 30 | = patternArguments:patternWithWhitespace* whitespace? "=" whitespace exp:expressionWithFunction { return { 31 | definitionLine: text(), 32 | numberOfArguments: patternArguments.length, 33 | doesMatch: function(args) { 34 | for (var i=0; i 0 } }; } 48 | / functionName 49 | / integer:integer { integer.doesMatch = function(arg) { return arg.type === "int" && arg.value === integer.value; }; return integer; } 50 | 51 | expression 52 | = "(" whitespace? exp:expressionWithFunction whitespace? ")" { return exp; } 53 | / list 54 | / integer 55 | / functionName 56 | 57 | expressionWithFunction 58 | = infixFunctionApplication 59 | / functionApplication 60 | / expression 61 | 62 | functionApplication 63 | = f:functionName whitespace args:expression_list {return {functionName: f, type: 'application', id: randomId(), arguments: args}}; 64 | 65 | infixFunctionApplication 66 | = left:expression whitespace? f:infixFunctionName whitespace? right:expressionWithFunction { return {id: randomId(), functionName: f, type: "application", arguments: [left, right]}} 67 | 68 | expression_list 69 | = exp1:expression list:(whitespace_expression)* { list.unshift(exp1); return list; } 70 | 71 | whitespace_expression 72 | = whitespace exp:expression { return exp; } 73 | 74 | list 75 | = "[" whitespace? list:comma_expression_list? whitespace? "]" { return { id: randomId(), type: "list", items: list || [] }; } 76 | 77 | comma_expression_list 78 | = exp1:expression list:(comma_expression)* { list.unshift(exp1); return list; } 79 | 80 | comma_expression 81 | = whitespace? "," whitespace? exp:expression { return exp; } 82 | 83 | 84 | functionName 85 | = letters:[A-Za-z]+ { return {id: randomId(), type: 'functionName', name: letters.join(""), infix: false}; } 86 | 87 | infixFunctionName 88 | = "+" { return {id: randomId(), type: 'functionName', name: '+', infix: true}; } 89 | / "-" { return {id: randomId(), type: 'functionName', name: '-', infix: true}; } 90 | / ":" { return {id: randomId(), type: 'functionName', name: ':', infix: true}; } 91 | 92 | integer 93 | = digits:[0-9]+ { return { id: randomId(), type: "int", value: parseInt(digits.join(""), 10)} ; } 94 | 95 | whitespace 96 | = " "+ 97 | 98 | whitespace_newline 99 | = [ \n]+ 100 | -------------------------------------------------------------------------------- /initial_ast.js: -------------------------------------------------------------------------------- 1 | window.initialFunctionDefinitions = "map :: (a -> b) -> [a] -> [b]" + "\n" + 2 | "map f [] = []" + "\n" + 3 | "map f (x:xs) = (f x) : map f xs" + "\n" + 4 | "" + "\n" + 5 | "foldr :: (a -> b -> b) -> b -> [a] -> b" + "\n" + 6 | "foldr f i [] = i" + "\n" + 7 | "foldr f i (x:xs) = f x (foldr f i xs)" + "\n" + 8 | "" + "\n" + 9 | "foldl :: (a -> b -> a) -> a -> [b] -> a" + "\n" + 10 | "foldl f i [] = i" + "\n" + 11 | "foldl f i (x:xs) = foldl f (f i x) xs" + "\n" + 12 | "" + "\n" + 13 | "cons :: Int -> [Int] -> [Int]" + "\n" + 14 | "cons x xs = x : xs" + "\n" + 15 | "" + "\n" + 16 | "reverseCons :: [Int] -> Int -> [Int]" + "\n" + 17 | "reverseCons xs x = x : xs" + "\n" + 18 | "" + "\n" + 19 | "plus :: Int -> Int -> Int" + "\n" + 20 | "plus x y = x + y" + "\n" + 21 | "" + "\n" + 22 | "addOne :: Int -> Int" + "\n" + 23 | "addOne x = x + 1" + "\n" + 24 | "" + "\n" + 25 | "double :: Int -> Int" + "\n" + 26 | "double x = x + x" + "\n" + 27 | "" + "\n" + 28 | "take :: Int -> [a] -> [a]" + "\n" + 29 | "take 0 xs = []" + "\n" + 30 | "take n [] = []" + "\n" + 31 | "take n (x:xs) = (x : (take (n - 1) xs))" + "\n"; 32 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function(config) { 2 | config.set({ 3 | frameworks: ['mocha', 'chai'], 4 | files: [ 5 | 'bower_components/lodash/dist/lodash.js', 6 | 'bower_components/node-uuid/uuid.js', 7 | 'ast_transformations.js', 8 | 'initial_ast.js', 9 | 'haskell-parser.js', 10 | 'functions/*.js', 11 | '*_spec.js' 12 | ], 13 | reporters: ['progress'], 14 | port: 9876, 15 | colors: true, 16 | logLevel: config.LOG_INFO, // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 17 | autoWatch: true, 18 | browsers: ['Chrome'] 19 | }); 20 | }; 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hs.js", 3 | "version": "0.0.0", 4 | "description": "hs.js =====", 5 | "main": "index.html", 6 | "scripts": { 7 | "pegjs": "pegjs -e HaskellParser --allowed-start-rules start,functionDefinitionList haskell.pegjs haskell-parser.js", 8 | "test": "karam start --single-run" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/stevekrouse/hs.js.git" 13 | }, 14 | "author": "", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/stevekrouse/hs.js/issues" 18 | }, 19 | "homepage": "https://github.com/stevekrouse/hs.js", 20 | "dependencies": { 21 | "chai": "^1.9.1", 22 | "karma": "^0.12.19", 23 | "karma-chai": "^0.1.0", 24 | "karma-chrome-launcher": "^0.1.4", 25 | "karma-cli": "0.0.4", 26 | "karma-mocha": "^0.1.6", 27 | "mocha": "^1.21.3", 28 | "pegjs": "^0.8.0" 29 | } 30 | } 31 | --------------------------------------------------------------------------------