wikipeg 4.0.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/HISTORY.md +556 -0
  2. package/README.md +230 -12
  3. package/VERSION +1 -1
  4. package/bin/wikipeg +8 -4
  5. package/examples/css.pegphp +9 -8
  6. package/lib/compiler/asts.js +30 -10
  7. package/lib/compiler/charsets.js +306 -0
  8. package/lib/compiler/language/javascript.js +107 -33
  9. package/lib/compiler/language/php.js +193 -55
  10. package/lib/compiler/passes/analyze-always-match.js +141 -0
  11. package/lib/compiler/passes/analyze-first.js +245 -0
  12. package/lib/compiler/passes/ast-to-code.js +316 -100
  13. package/lib/compiler/passes/inline-simple-rules.js +96 -0
  14. package/lib/compiler/passes/optimize-character-class.js +147 -0
  15. package/lib/compiler/passes/optimize-failure-reporting.js +65 -0
  16. package/lib/compiler/passes/remove-proxy-rules.js +7 -5
  17. package/lib/compiler/passes/report-infinite-loops.js +4 -1
  18. package/lib/compiler/passes/report-left-recursion.js +3 -4
  19. package/lib/compiler/passes/report-unknown-attributes.js +39 -0
  20. package/lib/compiler/passes/transform-common-lang.js +1 -1
  21. package/lib/compiler/traverser.js +1 -2
  22. package/lib/compiler/visitor.js +5 -7
  23. package/lib/compiler.js +24 -10
  24. package/lib/parser.js +2784 -3088
  25. package/lib/peg.js +7 -15
  26. package/lib/runtime/template.js +9 -1
  27. package/lib/utils/CaseFolding.txt +1654 -0
  28. package/lib/utils/arrays.js +0 -72
  29. package/lib/utils/casefold.js +697 -0
  30. package/lib/utils/objects.js +9 -39
  31. package/lib/utils/unicode.js +34 -0
  32. package/package.json +6 -4
  33. package/src/DefaultTracer.php +18 -18
  34. package/src/PEGParserBase.php +53 -28
  35. package/src/SyntaxError.php +4 -4
  36. package/src/Tracer.php +1 -1
  37. package/lib/compiler/opcodes.js +0 -54
@@ -31,78 +31,6 @@ var arrays = {
31
31
  }
32
32
  }
33
33
  },
34
-
35
- indexOf: function(array, valueOrPredicate) {
36
- var length = array.length, i;
37
-
38
- if (typeof valueOrPredicate === "function") {
39
- for (i = 0; i < length; i++) {
40
- if (valueOrPredicate(array[i])) {
41
- return i;
42
- }
43
- }
44
- } else {
45
- for (i = 0; i < length; i++) {
46
- if (array[i] === valueOrPredicate) {
47
- return i;
48
- }
49
- }
50
- }
51
-
52
- return -1;
53
- },
54
-
55
- contains: function(array, valueOrPredicate) {
56
- return arrays.indexOf(array, valueOrPredicate) !== -1;
57
- },
58
-
59
- each: function(array, iterator) {
60
- var length = array.length, i;
61
-
62
- for (i = 0; i < length; i++) {
63
- iterator(array[i], i);
64
- }
65
- },
66
-
67
- map: function(array, iterator) {
68
- var length = array.length,
69
- result = new Array(length),
70
- i;
71
-
72
- for (i = 0; i < length; i++) {
73
- result[i] = iterator(array[i], i);
74
- }
75
-
76
- return result;
77
- },
78
-
79
- pluck: function(array, key) {
80
- return arrays.map(array, function (e) { return e[key]; });
81
- },
82
-
83
- every: function(array, predicate) {
84
- var length = array.length, i;
85
-
86
- for (i = 0; i < length; i++) {
87
- if (!predicate(array[i])) {
88
- return false;
89
- }
90
- }
91
-
92
- return true;
93
- },
94
-
95
- some: function(array, predicate) {
96
- var length = array.length, i;
97
-
98
- for (i = 0; i < length; i++) {
99
- if (predicate(array[i])) {
100
- return true;
101
- }
102
- }
103
-
104
- return false;
105
- }
106
34
  };
107
35
 
108
36
  module.exports = arrays;