Permalink
Browse files

Remove trailing whitespace.

  • Loading branch information...
1 parent cb4f79a commit fd5195714e8ec969d312a2c8d32d0dc1cd7d036f @jcoglan committed Dec 28, 2012
Showing with 811 additions and 811 deletions.
  1. +3 −3 bin/canopy
  2. +16 −16 examples/canopy/lisp.js
  3. +16 −16 examples/canopy/peg.js
  4. +24 −24 examples/canopy/peg.peg
  5. +78 −78 examples/pegjs/lisp.js
  6. +130 −130 examples/pegjs/peg.js
  7. +23 −23 examples/pegjs/peg.peg
  8. +4 −4 site/config/site.rb
  9. +5 −5 site/src/layouts/default.haml
  10. +10 −10 site/src/pages/chars.haml
  11. +7 −7 site/src/pages/choices.haml
  12. +3 −3 site/src/pages/download.haml
  13. +15 −15 site/src/pages/grammars.haml
  14. +5 −5 site/src/pages/index.haml
  15. +31 −31 site/src/pages/introduction.haml
  16. +6 −6 site/src/pages/lookaheads.haml
  17. +9 −9 site/src/pages/maybe.haml
  18. +12 −12 site/src/pages/references.haml
  19. +6 −6 site/src/pages/repetition.haml
  20. +18 −18 site/src/pages/sequences.haml
  21. +10 −10 site/src/pages/strings.haml
  22. +29 −29 site/src/pages/types.haml
  23. +1 −1 source/bindings.js
  24. +8 −8 source/canopy.js
  25. +31 −31 source/canopy/builder.js
  26. +4 −4 source/canopy/compiler.js
  27. +2 −2 source/canopy/compiler/any_char.js
  28. +2 −2 source/canopy/compiler/char_class.js
  29. +5 −5 source/canopy/compiler/choice.js
  30. +2 −2 source/canopy/compiler/choice_part.js
  31. +3 −3 source/canopy/compiler/ci_string.js
  32. +12 −12 source/canopy/compiler/grammar.js
  33. +7 −7 source/canopy/compiler/grammar_rule.js
  34. +5 −5 source/canopy/compiler/predicate.js
  35. +2 −2 source/canopy/compiler/reference.js
  36. +11 −11 source/canopy/compiler/repeat.js
  37. +10 −10 source/canopy/compiler/sequence.js
  38. +7 −7 source/canopy/compiler/sequence_part.js
  39. +2 −2 source/canopy/compiler/string.js
  40. +4 −4 source/canopy/meta_grammar.js
  41. +24 −24 source/canopy/meta_grammar.peg
  42. +3 −3 spec/canopy/compiler/any_char_spec.js
  43. +13 −13 spec/canopy/compiler/char_class_spec.js
  44. +20 −20 spec/canopy/compiler/choice_part_spec.js
  45. +17 −17 spec/canopy/compiler/choice_spec.js
  46. +13 −13 spec/canopy/compiler/predicate_spec.js
  47. +12 −12 spec/canopy/compiler/reference_spec.js
  48. +22 −22 spec/canopy/compiler/repeat_spec.js
  49. +20 −20 spec/canopy/compiler/sequence_spec.js
  50. +7 −7 spec/canopy/compiler/string_spec.js
  51. +76 −76 spec/canopy/meta_grammar_parser_spec.js
  52. +1 −1 spec/canopy_spec.js
  53. +5 −5 spec/runner.js
View
@@ -7,15 +7,15 @@ try {
var startTime = new Date().getTime(),
inputFile = process.argv[2],
outputFile = inputFile.replace(/\.peg$/, '.js'),
-
+
grammar = fs.readFileSync(inputFile).toString(),
parser = Canopy.compile(grammar),
endTime = new Date().getTime();
-
+
fs.writeFileSync(outputFile, parser);
console.log('Generated parser in ' + outputFile);
console.log('Completed in ' + ((endTime - startTime) / 1000) + 's');
-
+
} catch (e) {
console.error(e.message);
}
@@ -7,41 +7,41 @@
}
return destination;
};
-
+
var find = function (root, objectName) {
var parts = objectName.split('.'),
part;
-
+
while (part = parts.shift()) {
root = root[part];
if (root === undefined)
throw new Error('Cannot find object named ' + objectName);
}
return root;
};
-
+
var formatError = function (error) {
var lines = error.input.split(/\n/g),
lineNo = 0,
offset = 0;
-
+
while (offset < error.offset + 1) {
offset += lines[lineNo].length + 1;
lineNo += 1;
}
var message = 'Line ' + lineNo + ': expected ' + error.expected + '\n',
line = lines[lineNo - 1];
-
+
message += line + '\n';
offset -= line.length + 1;
-
+
while (offset < error.offset) {
message += ' ';
offset += 1;
}
return message + '^';
};
-
+
var Grammar = {
__consume__program: function(input) {
var address0 = null, index0 = this._offset;
@@ -974,13 +974,13 @@
return this._nodeCache["delimiter"][index0] = address0;
}
};
-
+
var Parser = function(input) {
this._input = input;
this._offset = 0;
this._nodeCache = {};
};
-
+
Parser.prototype.parse = function() {
var result = this.__consume__program();
if (result && this._offset === this._input.length) {
@@ -993,35 +993,35 @@
var error = new Error(message);
throw error;
};
-
+
Parser.parse = function(input) {
var parser = new Parser(input);
return parser.parse();
};
-
+
extend(Parser.prototype, Grammar);
-
+
var SyntaxNode = function(textValue, offset, elements, properties) {
this.textValue = textValue;
this.offset = offset;
this.elements = elements || [];
if (!properties) return;
for (var key in properties) this[key] = properties[key];
};
-
+
SyntaxNode.prototype.forEach = function(block, context) {
for (var i = 0, n = this.elements.length; i < n; i++) {
block.call(context, this.elements[i], i);
}
};
-
+
Parser.SyntaxNode = SyntaxNode;
-
+
if (typeof require === "function" && typeof exports === "object") {
exports.Grammar = Grammar;
exports.Parser = Parser;
exports.parse = Parser.parse;
-
+
} else {
var namespace = this;
CanopyLisp = Grammar;
@@ -7,41 +7,41 @@
}
return destination;
};
-
+
var find = function (root, objectName) {
var parts = objectName.split('.'),
part;
-
+
while (part = parts.shift()) {
root = root[part];
if (root === undefined)
throw new Error('Cannot find object named ' + objectName);
}
return root;
};
-
+
var formatError = function (error) {
var lines = error.input.split(/\n/g),
lineNo = 0,
offset = 0;
-
+
while (offset < error.offset + 1) {
offset += lines[lineNo].length + 1;
lineNo += 1;
}
var message = 'Line ' + lineNo + ': expected ' + error.expected + '\n',
line = lines[lineNo - 1];
-
+
message += line + '\n';
offset -= line.length + 1;
-
+
while (offset < error.offset) {
message += ' ';
offset += 1;
}
return message + '^';
};
-
+
var Grammar = {
__consume__grammar: function(input) {
var address0 = null, index0 = this._offset;
@@ -2671,13 +2671,13 @@
return this._nodeCache["space"][index0] = address0;
}
};
-
+
var Parser = function(input) {
this._input = input;
this._offset = 0;
this._nodeCache = {};
};
-
+
Parser.prototype.parse = function() {
var result = this.__consume__grammar();
if (result && this._offset === this._input.length) {
@@ -2690,35 +2690,35 @@
var error = new Error(message);
throw error;
};
-
+
Parser.parse = function(input) {
var parser = new Parser(input);
return parser.parse();
};
-
+
extend(Parser.prototype, Grammar);
-
+
var SyntaxNode = function(textValue, offset, elements, properties) {
this.textValue = textValue;
this.offset = offset;
this.elements = elements || [];
if (!properties) return;
for (var key in properties) this[key] = properties[key];
};
-
+
SyntaxNode.prototype.forEach = function(block, context) {
for (var i = 0, n = this.elements.length; i < n; i++) {
block.call(context, this.elements[i], i);
}
};
-
+
Parser.SyntaxNode = SyntaxNode;
-
+
if (typeof require === "function" && typeof exports === "object") {
exports.Grammar = Grammar;
exports.Parser = Parser;
exports.parse = Parser.parse;
-
+
if (typeof Canopy !== "undefined") {
Canopy.PEG = Grammar;
Canopy.PEGParser = Parser;
@@ -1,60 +1,60 @@
grammar Canopy.PEG
-
+
grammar <- space* grammar_name
rules:(space* grammar_rule)+ space*
-
+
grammar_name <- "grammar " object_identifier
-
+
grammar_rule <- identifier assignment parsing_expression
-
+
assignment <- space+ "<-" space+
-
+
parsing_expression <- choice_expression / choice_part
-
+
parenthesised_expression <- "(" space* parsing_expression space* ")"
-
+
choice_expression <- first_part:choice_part
rest:(space+ "/" space+ expression:choice_part)+
-
+
choice_part <- (sequence_expression / sequence_part)
(space+ type_expression)?
-
+
type_expression <- "<" object_identifier ">"
-
+
sequence_expression <- first_part:sequence_part
rest:(space+ expression:sequence_part)+
-
+
sequence_part <- label? expression:(quantified_atom / atom)
-
+
quantified_atom <- atom quantifier
-
+
atom <- parenthesised_expression
/ predicated_atom
/ reference_expression
/ string_expression
/ ci_string_expression
/ any_char_expression
/ char_class_expression
-
+
predicated_atom <- predicate:("&" / "!") atom
-
+
reference_expression <- identifier !assignment
-
+
string_expression <- "\"" ("\\" . / [^"])* "\""
-
+
ci_string_expression <- "`" ("\\" . / [^`])* "`"
-
+
any_char_expression <- "."
-
+
char_class_expression <- "[" "^"? ("\\" . / [^\]])+ "]"
-
+
label <- identifier ":"
-
+
object_identifier <- identifier ("." identifier)*
-
+
identifier <- [a-zA-Z_$] [a-zA-Z0-9_$]*
-
+
quantifier <- "?" / "*" / "+"
-
+
space <- [\s\n\r\t]
Oops, something went wrong.

0 comments on commit fd51957

Please sign in to comment.