@wener/common 1.0.5 → 2.0.2

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 (222) hide show
  1. package/lib/cn/ChineseResidentIdNo.js +41 -0
  2. package/lib/cn/ChineseResidentIdNo.mod.js +1 -0
  3. package/lib/cn/ChineseResidentIdNo.test.js +22 -0
  4. package/lib/cn/DivisionCode.js +214 -280
  5. package/lib/cn/DivisionCode.mod.js +1 -0
  6. package/lib/cn/DivisionCode.test.js +134 -0
  7. package/lib/cn/Mod11.js +86 -0
  8. package/lib/cn/Mod31.js +98 -0
  9. package/lib/cn/UnifiedSocialCreditCode.js +130 -109
  10. package/lib/cn/UnifiedSocialCreditCode.mod.js +1 -0
  11. package/lib/cn/UnifiedSocialCreditCode.test.js +16 -0
  12. package/lib/cn/index.js +1 -4
  13. package/lib/cn/mod.js +6 -0
  14. package/lib/cn/types.d.js +0 -2
  15. package/lib/consola/createStandardConsolaReporter.js +6 -6
  16. package/lib/consola/formatLogObject.js +147 -34
  17. package/lib/consola/index.js +0 -1
  18. package/lib/data/formatSort.js +5 -6
  19. package/lib/data/formatSort.test.js +34 -0
  20. package/lib/data/index.js +0 -1
  21. package/lib/data/maybeNumber.js +11 -5
  22. package/lib/data/parseSort.js +28 -22
  23. package/lib/data/parseSort.test.js +188 -0
  24. package/lib/data/resolvePagination.js +27 -16
  25. package/lib/data/resolvePagination.test.js +232 -0
  26. package/lib/data/types.d.js +0 -2
  27. package/lib/dayjs/dayjs.js +38 -0
  28. package/lib/dayjs/formatDuration.js +58 -0
  29. package/lib/dayjs/formatDuration.test.js +90 -0
  30. package/lib/dayjs/index.js +3 -0
  31. package/lib/dayjs/parseDuration.js +32 -0
  32. package/lib/decimal/index.js +1 -0
  33. package/lib/decimal/parseDecimal.js +13 -0
  34. package/lib/foundation/schema/SexType.js +14 -0
  35. package/lib/foundation/schema/index.js +1 -0
  36. package/lib/foundation/schema/parseSexType.js +18 -0
  37. package/lib/foundation/schema/types.js +5 -0
  38. package/lib/index.js +0 -1
  39. package/lib/jsonschema/JsonSchema.js +78 -52
  40. package/lib/jsonschema/JsonSchema.test.js +137 -0
  41. package/lib/jsonschema/index.js +0 -1
  42. package/lib/jsonschema/types.d.js +5 -3
  43. package/lib/meta/defineFileType.js +103 -20
  44. package/lib/meta/defineInit.js +250 -31
  45. package/lib/meta/defineMetadata.js +140 -24
  46. package/lib/meta/defineMetadata.test.js +13 -0
  47. package/lib/meta/index.js +0 -1
  48. package/lib/password/PHC.js +87 -63
  49. package/lib/password/PHC.test.js +539 -0
  50. package/lib/password/Password.js +295 -30
  51. package/lib/password/Password.test.js +362 -0
  52. package/lib/password/createArgon2PasswordAlgorithm.js +191 -35
  53. package/lib/password/createBase64PasswordAlgorithm.js +141 -8
  54. package/lib/password/createBcryptPasswordAlgorithm.js +168 -13
  55. package/lib/password/createPBKDF2PasswordAlgorithm.js +228 -46
  56. package/lib/password/createScryptPasswordAlgorithm.js +211 -55
  57. package/lib/password/index.js +0 -1
  58. package/lib/password/server/index.js +0 -1
  59. package/lib/resource/Identifiable.js +1 -0
  60. package/lib/resource/ListQuery.js +119 -0
  61. package/lib/resource/getTitleOfResource.js +10 -0
  62. package/lib/resource/index.js +2 -0
  63. package/lib/resource/schema/AnyResourceSchema.js +89 -0
  64. package/lib/resource/schema/BaseResourceSchema.js +29 -0
  65. package/lib/resource/schema/ResourceActionType.js +118 -0
  66. package/lib/resource/schema/ResourceStatus.js +93 -0
  67. package/lib/resource/schema/ResourceType.js +24 -0
  68. package/lib/resource/schema/index.js +5 -0
  69. package/lib/resource/schema/types.js +89 -0
  70. package/lib/resource/schema/types.test.js +14 -0
  71. package/lib/schema/SchemaRegistry.js +45 -0
  72. package/lib/schema/SchemaRegistry.mod.js +2 -0
  73. package/lib/schema/TypeSchema.d.js +1 -0
  74. package/lib/schema/createSchemaData.js +173 -0
  75. package/lib/schema/findJsonSchemaByPath.js +49 -0
  76. package/lib/schema/getSchemaCache.js +11 -0
  77. package/lib/schema/getSchemaOptions.js +24 -0
  78. package/lib/schema/index.js +6 -0
  79. package/lib/schema/toJsonSchema.js +441 -0
  80. package/lib/schema/toJsonSchema.test.js +27 -0
  81. package/lib/schema/validate.js +124 -0
  82. package/lib/tools/generateSchema.js +197 -39
  83. package/lib/tools/renderJsonSchemaToMarkdownDoc.js +143 -55
  84. package/lib/utils/getEstimateProcessTime.js +20 -0
  85. package/lib/utils/index.js +1 -0
  86. package/package.json +38 -17
  87. package/src/cn/ChineseResidentIdNo.mod.ts +7 -0
  88. package/src/cn/ChineseResidentIdNo.test.ts +18 -0
  89. package/src/cn/ChineseResidentIdNo.ts +66 -0
  90. package/src/cn/DivisionCode.mod.ts +7 -0
  91. package/src/cn/DivisionCode.test.ts +3 -13
  92. package/src/cn/DivisionCode.ts +132 -195
  93. package/src/cn/{Mod11Checksum.ts → Mod11.ts} +3 -1
  94. package/src/cn/{Mod31Checksum.ts → Mod31.ts} +2 -0
  95. package/src/cn/UnifiedSocialCreditCode.mod.ts +7 -0
  96. package/src/cn/UnifiedSocialCreditCode.test.ts +2 -2
  97. package/src/cn/UnifiedSocialCreditCode.ts +105 -125
  98. package/src/cn/__snapshots__/ChineseResidentIdNo.test.ts.snap +14 -0
  99. package/src/cn/__snapshots__/UnifiedSocialCreditCode.test.ts.snap +18 -12
  100. package/src/cn/index.ts +1 -3
  101. package/src/cn/mod.ts +3 -0
  102. package/src/consola/formatLogObject.ts +12 -4
  103. package/src/data/maybeNumber.ts +5 -1
  104. package/src/data/resolvePagination.test.ts +1 -1
  105. package/src/data/resolvePagination.ts +18 -7
  106. package/src/data/types.d.ts +12 -0
  107. package/src/dayjs/dayjs.ts +40 -0
  108. package/src/dayjs/formatDuration.test.ts +14 -0
  109. package/src/dayjs/formatDuration.ts +86 -0
  110. package/src/dayjs/index.ts +3 -0
  111. package/src/dayjs/parseDuration.ts +40 -0
  112. package/src/decimal/index.ts +1 -0
  113. package/src/decimal/parseDecimal.ts +16 -0
  114. package/src/foundation/schema/SexType.ts +21 -0
  115. package/src/foundation/schema/index.ts +1 -0
  116. package/src/foundation/schema/parseSexType.ts +19 -0
  117. package/src/foundation/schema/types.ts +8 -0
  118. package/src/jsonschema/JsonSchema.test.ts +17 -0
  119. package/src/jsonschema/JsonSchema.ts +2 -2
  120. package/src/jsonschema/types.d.ts +63 -12
  121. package/src/password/Password.ts +2 -2
  122. package/src/resource/Identifiable.ts +3 -0
  123. package/src/resource/ListQuery.ts +53 -0
  124. package/src/resource/getTitleOfResource.tsx +6 -0
  125. package/src/resource/index.ts +4 -0
  126. package/src/resource/schema/AnyResourceSchema.ts +113 -0
  127. package/src/resource/schema/BaseResourceSchema.ts +32 -0
  128. package/src/resource/schema/ResourceActionType.ts +123 -0
  129. package/src/resource/schema/ResourceStatus.ts +94 -0
  130. package/src/resource/schema/ResourceType.ts +25 -0
  131. package/src/resource/schema/index.ts +5 -0
  132. package/src/resource/schema/types.test.ts +18 -0
  133. package/src/resource/schema/types.ts +105 -0
  134. package/src/schema/SchemaRegistry.mod.ts +1 -0
  135. package/src/schema/SchemaRegistry.ts +46 -0
  136. package/src/schema/TypeSchema.d.ts +32 -0
  137. package/src/schema/createSchemaData.ts +81 -0
  138. package/src/schema/findJsonSchemaByPath.ts +37 -0
  139. package/src/schema/getSchemaCache.ts +21 -0
  140. package/src/schema/getSchemaOptions.ts +24 -0
  141. package/src/schema/index.ts +7 -0
  142. package/src/schema/toJsonSchema.test.ts +37 -0
  143. package/src/schema/toJsonSchema.ts +200 -0
  144. package/src/schema/validate.ts +135 -0
  145. package/src/tools/generateSchema.ts +28 -28
  146. package/src/utils/getEstimateProcessTime.ts +36 -0
  147. package/src/utils/index.ts +1 -0
  148. package/lib/cn/DivisionCode.js.map +0 -1
  149. package/lib/cn/Mod11Checksum.js +0 -42
  150. package/lib/cn/Mod11Checksum.js.map +0 -1
  151. package/lib/cn/Mod31Checksum.js +0 -48
  152. package/lib/cn/Mod31Checksum.js.map +0 -1
  153. package/lib/cn/ResidentIdentityCardNumber.js +0 -50
  154. package/lib/cn/ResidentIdentityCardNumber.js.map +0 -1
  155. package/lib/cn/UnifiedSocialCreditCode.js.map +0 -1
  156. package/lib/cn/formatDate.js +0 -15
  157. package/lib/cn/formatDate.js.map +0 -1
  158. package/lib/cn/index.js.map +0 -1
  159. package/lib/cn/parseSex.js +0 -22
  160. package/lib/cn/parseSex.js.map +0 -1
  161. package/lib/cn/types.d.js.map +0 -1
  162. package/lib/consola/createStandardConsolaReporter.js.map +0 -1
  163. package/lib/consola/formatLogObject.js.map +0 -1
  164. package/lib/consola/index.js.map +0 -1
  165. package/lib/data/formatSort.js.map +0 -1
  166. package/lib/data/index.js.map +0 -1
  167. package/lib/data/maybeNumber.js.map +0 -1
  168. package/lib/data/parseSort.js.map +0 -1
  169. package/lib/data/resolvePagination.js.map +0 -1
  170. package/lib/data/types.d.js.map +0 -1
  171. package/lib/index.js.map +0 -1
  172. package/lib/jsonschema/JsonSchema.js.map +0 -1
  173. package/lib/jsonschema/index.js.map +0 -1
  174. package/lib/jsonschema/types.d.js.map +0 -1
  175. package/lib/meta/defineFileType.js.map +0 -1
  176. package/lib/meta/defineInit.js.map +0 -1
  177. package/lib/meta/defineMetadata.js.map +0 -1
  178. package/lib/meta/index.js.map +0 -1
  179. package/lib/password/PHC.js.map +0 -1
  180. package/lib/password/Password.js.map +0 -1
  181. package/lib/password/createArgon2PasswordAlgorithm.js.map +0 -1
  182. package/lib/password/createBase64PasswordAlgorithm.js.map +0 -1
  183. package/lib/password/createBcryptPasswordAlgorithm.js.map +0 -1
  184. package/lib/password/createPBKDF2PasswordAlgorithm.js.map +0 -1
  185. package/lib/password/createScryptPasswordAlgorithm.js.map +0 -1
  186. package/lib/password/index.js.map +0 -1
  187. package/lib/password/server/index.js.map +0 -1
  188. package/lib/search/AdvanceSearch.js +0 -10
  189. package/lib/search/AdvanceSearch.js.map +0 -1
  190. package/lib/search/formatAdvanceSearch.js +0 -64
  191. package/lib/search/formatAdvanceSearch.js.map +0 -1
  192. package/lib/search/index.js +0 -2
  193. package/lib/search/index.js.map +0 -1
  194. package/lib/search/optimizeAdvanceSearch.js +0 -89
  195. package/lib/search/optimizeAdvanceSearch.js.map +0 -1
  196. package/lib/search/parseAdvanceSearch.js +0 -20
  197. package/lib/search/parseAdvanceSearch.js.map +0 -1
  198. package/lib/search/parser.d.js +0 -3
  199. package/lib/search/parser.d.js.map +0 -1
  200. package/lib/search/parser.js +0 -3065
  201. package/lib/search/parser.js.map +0 -1
  202. package/lib/search/types.d.js +0 -3
  203. package/lib/search/types.d.js.map +0 -1
  204. package/lib/tools/generateSchema.js.map +0 -1
  205. package/lib/tools/renderJsonSchemaToMarkdownDoc.js.map +0 -1
  206. package/src/cn/ResidentIdentityCardNumber.test.ts +0 -17
  207. package/src/cn/ResidentIdentityCardNumber.ts +0 -96
  208. package/src/cn/__snapshots__/ResidentIdentityCardNumber.test.ts.snap +0 -15
  209. package/src/cn/formatDate.ts +0 -12
  210. package/src/cn/parseSex.ts +0 -13
  211. package/src/search/AdvanceSearch.test.ts +0 -149
  212. package/src/search/AdvanceSearch.ts +0 -14
  213. package/src/search/Makefile +0 -2
  214. package/src/search/__snapshots__/AdvanceSearch.test.ts.snap +0 -675
  215. package/src/search/formatAdvanceSearch.ts +0 -52
  216. package/src/search/index.ts +0 -1
  217. package/src/search/optimizeAdvanceSearch.ts +0 -77
  218. package/src/search/parseAdvanceSearch.ts +0 -23
  219. package/src/search/parser.d.ts +0 -8
  220. package/src/search/parser.js +0 -2794
  221. package/src/search/parser.peggy +0 -237
  222. package/src/search/types.d.ts +0 -45
@@ -1,3065 +0,0 @@
1
- // @generated by Peggy 4.2.0.
2
- //
3
- // https://peggyjs.org/
4
- function peg$subclass(child, parent) {
5
- function C() {
6
- this.constructor = child;
7
- }
8
- C.prototype = parent.prototype;
9
- child.prototype = new C();
10
- }
11
- function peg$SyntaxError(message, expected, found, location) {
12
- var self = Error.call(this, message);
13
- // istanbul ignore next Check is a necessary evil to support older environments
14
- if (Object.setPrototypeOf) {
15
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
16
- }
17
- self.expected = expected;
18
- self.found = found;
19
- self.location = location;
20
- self.name = "SyntaxError";
21
- return self;
22
- }
23
- peg$subclass(peg$SyntaxError, Error);
24
- function peg$padEnd(str, targetLength, padString) {
25
- padString = padString || " ";
26
- if (str.length > targetLength) {
27
- return str;
28
- }
29
- targetLength -= str.length;
30
- padString += padString.repeat(targetLength);
31
- return str + padString.slice(0, targetLength);
32
- }
33
- peg$SyntaxError.prototype.format = function(sources) {
34
- var str = "Error: " + this.message;
35
- if (this.location) {
36
- var src = null;
37
- var k;
38
- for(k = 0; k < sources.length; k++){
39
- if (sources[k].source === this.location.source) {
40
- src = sources[k].text.split(/\r\n|\n|\r/g);
41
- break;
42
- }
43
- }
44
- var s = this.location.start;
45
- var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
46
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
47
- if (src) {
48
- var e = this.location.end;
49
- var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
50
- var line = src[s.line - 1];
51
- var last = s.line === e.line ? e.column : line.length + 1;
52
- var hatLen = last - s.column || 1;
53
- str += "\n --> " + loc + "\n" + filler + " |\n" + offset_s.line + " | " + line + "\n" + filler + " | " + peg$padEnd("", s.column - 1, ' ') + peg$padEnd("", hatLen, "^");
54
- } else {
55
- str += "\n at " + loc;
56
- }
57
- }
58
- return str;
59
- };
60
- peg$SyntaxError.buildMessage = function(expected, found) {
61
- var DESCRIBE_EXPECTATION_FNS = {
62
- literal: function(expectation) {
63
- return "\"" + literalEscape(expectation.text) + "\"";
64
- },
65
- class: function(expectation) {
66
- var escapedParts = expectation.parts.map(function(part) {
67
- return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
68
- });
69
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
70
- },
71
- any: function() {
72
- return "any character";
73
- },
74
- end: function() {
75
- return "end of input";
76
- },
77
- other: function(expectation) {
78
- return expectation.description;
79
- }
80
- };
81
- function hex(ch) {
82
- return ch.charCodeAt(0).toString(16).toUpperCase();
83
- }
84
- function literalEscape(s) {
85
- return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
86
- return "\\x0" + hex(ch);
87
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
88
- return "\\x" + hex(ch);
89
- });
90
- }
91
- function classEscape(s) {
92
- return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
93
- return "\\x0" + hex(ch);
94
- }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
95
- return "\\x" + hex(ch);
96
- });
97
- }
98
- function describeExpectation(expectation) {
99
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
100
- }
101
- function describeExpected(expected) {
102
- var descriptions = expected.map(describeExpectation);
103
- var i, j;
104
- descriptions.sort();
105
- if (descriptions.length > 0) {
106
- for(i = 1, j = 1; i < descriptions.length; i++){
107
- if (descriptions[i - 1] !== descriptions[i]) {
108
- descriptions[j] = descriptions[i];
109
- j++;
110
- }
111
- }
112
- descriptions.length = j;
113
- }
114
- switch(descriptions.length){
115
- case 1:
116
- return descriptions[0];
117
- case 2:
118
- return descriptions[0] + " or " + descriptions[1];
119
- default:
120
- return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
121
- }
122
- }
123
- function describeFound(found) {
124
- return found ? "\"" + literalEscape(found) + "\"" : "end of input";
125
- }
126
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
127
- };
128
- function peg$parse(input, options) {
129
- options = options !== undefined ? options : {};
130
- var peg$FAILED = {};
131
- var peg$source = options.grammarSource;
132
- var peg$startRuleFunctions = {
133
- Main: peg$parseMain
134
- };
135
- var peg$startRuleFunction = peg$parseMain;
136
- var peg$c0 = "/*";
137
- var peg$c1 = "*/";
138
- var peg$c2 = "(";
139
- var peg$c3 = ")";
140
- var peg$c4 = "-";
141
- var peg$c5 = "+";
142
- var peg$c6 = ":";
143
- var peg$c7 = ":=";
144
- var peg$c8 = ":!=";
145
- var peg$c9 = ":>";
146
- var peg$c10 = ":<";
147
- var peg$c11 = ":>=";
148
- var peg$c12 = ":<=";
149
- var peg$c13 = "@";
150
- var peg$c14 = ".";
151
- var peg$c15 = "*";
152
- var peg$c16 = "..";
153
- var peg$c17 = ",";
154
- var peg$c18 = "T";
155
- var peg$c19 = "Z";
156
- var peg$c20 = "\"";
157
- var peg$c21 = "\\'";
158
- var peg$c22 = "\\\"";
159
- var peg$c23 = "\\\\";
160
- var peg$c24 = "\\/";
161
- var peg$c25 = "\\b";
162
- var peg$c26 = "\\f";
163
- var peg$c27 = "\\n";
164
- var peg$c28 = "\\r";
165
- var peg$c29 = "\\t";
166
- var peg$c30 = "''";
167
- var peg$c31 = "\\u";
168
- var peg$c32 = "true";
169
- var peg$c33 = "false";
170
- var peg$c34 = "null";
171
- var peg$c35 = "OR";
172
- var peg$c36 = "AND";
173
- var peg$c37 = "NOT";
174
- var peg$r0 = /^[^*]/;
175
- var peg$r1 = /^[^\-+,'" \r\n\t()]/;
176
- var peg$r2 = /^[^ \r\n\t)]/;
177
- var peg$r3 = /^[[(]/;
178
- var peg$r4 = /^[)\]]/;
179
- var peg$r5 = /^[1-9]/;
180
- var peg$r6 = /^[0-9]/;
181
- var peg$r7 = /^[a-zA-Z]/;
182
- var peg$r8 = /^[_a-zA-Z0-9]/;
183
- var peg$r9 = /^[^"\\\0-\x1F\x7F]/;
184
- var peg$r10 = /^[0-9a-fA-F]/;
185
- var peg$r11 = /^[A-Za-z_]/;
186
- var peg$r12 = /^[ \t\n\r]/;
187
- var peg$e0 = peg$literalExpectation("/*", false);
188
- var peg$e1 = peg$classExpectation([
189
- "*"
190
- ], true, false);
191
- var peg$e2 = peg$literalExpectation("*/", false);
192
- var peg$e3 = peg$literalExpectation("(", false);
193
- var peg$e4 = peg$literalExpectation(")", false);
194
- var peg$e5 = peg$literalExpectation("-", false);
195
- var peg$e6 = peg$literalExpectation("+", false);
196
- var peg$e7 = peg$literalExpectation(":", false);
197
- var peg$e8 = peg$literalExpectation(":=", false);
198
- var peg$e9 = peg$literalExpectation(":!=", false);
199
- var peg$e10 = peg$literalExpectation(":>", false);
200
- var peg$e11 = peg$literalExpectation(":<", false);
201
- var peg$e12 = peg$literalExpectation(":>=", false);
202
- var peg$e13 = peg$literalExpectation(":<=", false);
203
- var peg$e14 = peg$literalExpectation("@", false);
204
- var peg$e15 = peg$classExpectation([
205
- "-",
206
- "+",
207
- ",",
208
- "'",
209
- "\"",
210
- " ",
211
- "\r",
212
- "\n",
213
- "\t",
214
- "(",
215
- ")"
216
- ], true, false);
217
- var peg$e16 = peg$classExpectation([
218
- " ",
219
- "\r",
220
- "\n",
221
- "\t",
222
- ")"
223
- ], true, false);
224
- var peg$e17 = peg$literalExpectation(".", false);
225
- var peg$e18 = peg$literalExpectation("*", false);
226
- var peg$e19 = peg$literalExpectation("..", false);
227
- var peg$e20 = peg$classExpectation([
228
- "[",
229
- "("
230
- ], false, false);
231
- var peg$e21 = peg$literalExpectation(",", false);
232
- var peg$e22 = peg$classExpectation([
233
- ")",
234
- "]"
235
- ], false, false);
236
- var peg$e23 = peg$classExpectation([
237
- [
238
- "1",
239
- "9"
240
- ]
241
- ], false, false);
242
- var peg$e24 = peg$classExpectation([
243
- [
244
- "0",
245
- "9"
246
- ]
247
- ], false, false);
248
- var peg$e25 = peg$literalExpectation("T", false);
249
- var peg$e26 = peg$literalExpectation("Z", false);
250
- var peg$e27 = peg$classExpectation([
251
- [
252
- "a",
253
- "z"
254
- ],
255
- [
256
- "A",
257
- "Z"
258
- ]
259
- ], false, false);
260
- var peg$e28 = peg$classExpectation([
261
- "_",
262
- [
263
- "a",
264
- "z"
265
- ],
266
- [
267
- "A",
268
- "Z"
269
- ],
270
- [
271
- "0",
272
- "9"
273
- ]
274
- ], false, false);
275
- var peg$e29 = peg$literalExpectation("\"", false);
276
- var peg$e30 = peg$classExpectation([
277
- "\"",
278
- "\\",
279
- [
280
- "\0",
281
- "\x1F"
282
- ],
283
- "\x7F"
284
- ], true, false);
285
- var peg$e31 = peg$literalExpectation("\\'", false);
286
- var peg$e32 = peg$literalExpectation("\\\"", false);
287
- var peg$e33 = peg$literalExpectation("\\\\", false);
288
- var peg$e34 = peg$literalExpectation("\\/", false);
289
- var peg$e35 = peg$literalExpectation("\\b", false);
290
- var peg$e36 = peg$literalExpectation("\\f", false);
291
- var peg$e37 = peg$literalExpectation("\\n", false);
292
- var peg$e38 = peg$literalExpectation("\\r", false);
293
- var peg$e39 = peg$literalExpectation("\\t", false);
294
- var peg$e40 = peg$literalExpectation("''", false);
295
- var peg$e41 = peg$literalExpectation("\\u", false);
296
- var peg$e42 = peg$classExpectation([
297
- [
298
- "0",
299
- "9"
300
- ],
301
- [
302
- "a",
303
- "f"
304
- ],
305
- [
306
- "A",
307
- "F"
308
- ]
309
- ], false, false);
310
- var peg$e43 = peg$literalExpectation("true", false);
311
- var peg$e44 = peg$literalExpectation("false", false);
312
- var peg$e45 = peg$literalExpectation("null", false);
313
- var peg$e46 = peg$classExpectation([
314
- [
315
- "A",
316
- "Z"
317
- ],
318
- [
319
- "a",
320
- "z"
321
- ],
322
- "_"
323
- ], false, false);
324
- var peg$e47 = peg$literalExpectation("OR", false);
325
- var peg$e48 = peg$literalExpectation("AND", false);
326
- var peg$e49 = peg$literalExpectation("NOT", false);
327
- var peg$e50 = peg$otherExpectation("whitespace");
328
- var peg$e51 = peg$classExpectation([
329
- " ",
330
- "\t",
331
- "\n",
332
- "\r"
333
- ], false, false);
334
- var peg$e52 = peg$anyExpectation();
335
- var peg$f0 = function(value) {
336
- return {
337
- type: "comment",
338
- value: value.trim()
339
- };
340
- };
341
- var peg$f1 = function(head, tail) {
342
- return !tail.length ? head : {
343
- type: "logical",
344
- operator: "or",
345
- value: [
346
- head
347
- ].concat(tail)
348
- };
349
- };
350
- var peg$f2 = function(head, tail) {
351
- return !tail.length ? head : {
352
- type: "logical",
353
- operator: "and",
354
- value: [
355
- head
356
- ].concat(tail)
357
- };
358
- };
359
- var peg$f3 = function(value) {
360
- return {
361
- type: "not",
362
- value
363
- };
364
- };
365
- var peg$f4 = function(value) {
366
- return {
367
- type: "parentheses",
368
- value
369
- };
370
- };
371
- var peg$f5 = function(negative) {
372
- return {
373
- negative: true
374
- };
375
- };
376
- var peg$f6 = function() {
377
- return {};
378
- };
379
- var peg$f7 = function(modifier, field, operator, value) {
380
- return {
381
- type: "compare",
382
- field,
383
- operator: "range",
384
- value
385
- };
386
- };
387
- var peg$f8 = function(modifier, field, operator, value) {
388
- return {
389
- type: "compare",
390
- field,
391
- operator: operator === ":!=" ? "ne" : "eq",
392
- value
393
- };
394
- };
395
- var peg$f9 = function(modifier, field, operator, value) {
396
- return {
397
- type: "compare",
398
- field,
399
- operator: OPERATORS[operator],
400
- value
401
- };
402
- };
403
- var peg$f10 = function(modifier, expr) {
404
- return {
405
- ...expr,
406
- ...modifier
407
- };
408
- };
409
- var peg$f11 = function(field, value) {
410
- return {
411
- type: "compare",
412
- field,
413
- operator: "match",
414
- value: {
415
- value
416
- },
417
- mention: true
418
- };
419
- };
420
- var peg$f12 = function(negative, value) {
421
- return {
422
- type: "keyword",
423
- negative: Boolean(negative),
424
- value,
425
- exact: true
426
- };
427
- };
428
- var peg$f13 = function(negative, value) {
429
- return {
430
- type: "keyword",
431
- negative: Boolean(negative),
432
- value
433
- };
434
- };
435
- var peg$f14 = function() {
436
- return text();
437
- };
438
- var peg$f15 = function(minimum, maximum) {
439
- return {
440
- type: "range",
441
- minimum: minimum === "*" ? undefined : minimum,
442
- maximum: maximum === "*" ? undefined : maximum
443
- };
444
- };
445
- var peg$f16 = function(minimumBoundary, minimum, maximum, maximumBoundary) {
446
- return {
447
- type: "range",
448
- minimum,
449
- maximum,
450
- minimumExclusive: minimumBoundary === "(",
451
- maximumExclusive: maximumBoundary === ")"
452
- };
453
- };
454
- var peg$f17 = function(value) {
455
- return {
456
- format: "mention",
457
- value
458
- };
459
- };
460
- var peg$f18 = function(value) {
461
- return {
462
- type: "literal",
463
- value
464
- };
465
- };
466
- var peg$f19 = function(time) {
467
- return {
468
- format: time ? "date-time" : "date",
469
- value: text()
470
- };
471
- };
472
- var peg$f20 = function() {
473
- return text();
474
- };
475
- var peg$f21 = function() {
476
- return parseFloat(text());
477
- };
478
- var peg$f22 = function(v) {
479
- return v.join("");
480
- };
481
- var peg$f23 = function() {
482
- return "'";
483
- };
484
- var peg$f24 = function() {
485
- return '"';
486
- };
487
- var peg$f25 = function() {
488
- return "\\";
489
- };
490
- var peg$f26 = function() {
491
- return "/";
492
- };
493
- var peg$f27 = function() {
494
- return "\b";
495
- };
496
- var peg$f28 = function() {
497
- return "\f";
498
- };
499
- var peg$f29 = function() {
500
- return "\n";
501
- };
502
- var peg$f30 = function() {
503
- return "\r";
504
- };
505
- var peg$f31 = function() {
506
- return "\t";
507
- };
508
- var peg$f32 = function() {
509
- return "'";
510
- };
511
- var peg$f33 = function(h1, h2, h3, h4) {
512
- return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4));
513
- };
514
- var peg$f34 = function() {
515
- return text().toLowerCase() === "true";
516
- };
517
- var peg$f35 = function() {
518
- return parseInt(text());
519
- };
520
- var peg$f36 = function() {
521
- return parseFloat(text());
522
- };
523
- var peg$f37 = function() {
524
- return null;
525
- };
526
- var peg$f38 = function() {
527
- return "";
528
- };
529
- var peg$f39 = function() {
530
- return " ";
531
- };
532
- var peg$currPos = options.peg$currPos | 0;
533
- var peg$savedPos = peg$currPos;
534
- var peg$posDetailsCache = [
535
- {
536
- line: 1,
537
- column: 1
538
- }
539
- ];
540
- var peg$maxFailPos = peg$currPos;
541
- var peg$maxFailExpected = options.peg$maxFailExpected || [];
542
- var peg$silentFails = options.peg$silentFails | 0;
543
- var peg$result;
544
- if (options.startRule) {
545
- if (!(options.startRule in peg$startRuleFunctions)) {
546
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
547
- }
548
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
549
- }
550
- function text() {
551
- return input.substring(peg$savedPos, peg$currPos);
552
- }
553
- function offset() {
554
- return peg$savedPos;
555
- }
556
- function range() {
557
- return {
558
- source: peg$source,
559
- start: peg$savedPos,
560
- end: peg$currPos
561
- };
562
- }
563
- function location() {
564
- return peg$computeLocation(peg$savedPos, peg$currPos);
565
- }
566
- function expected(description, location) {
567
- location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
568
- throw peg$buildStructuredError([
569
- peg$otherExpectation(description)
570
- ], input.substring(peg$savedPos, peg$currPos), location);
571
- }
572
- function error(message, location) {
573
- location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
574
- throw peg$buildSimpleError(message, location);
575
- }
576
- function peg$literalExpectation(text, ignoreCase) {
577
- return {
578
- type: "literal",
579
- text: text,
580
- ignoreCase: ignoreCase
581
- };
582
- }
583
- function peg$classExpectation(parts, inverted, ignoreCase) {
584
- return {
585
- type: "class",
586
- parts: parts,
587
- inverted: inverted,
588
- ignoreCase: ignoreCase
589
- };
590
- }
591
- function peg$anyExpectation() {
592
- return {
593
- type: "any"
594
- };
595
- }
596
- function peg$endExpectation() {
597
- return {
598
- type: "end"
599
- };
600
- }
601
- function peg$otherExpectation(description) {
602
- return {
603
- type: "other",
604
- description: description
605
- };
606
- }
607
- function peg$computePosDetails(pos) {
608
- var details = peg$posDetailsCache[pos];
609
- var p;
610
- if (details) {
611
- return details;
612
- } else {
613
- if (pos >= peg$posDetailsCache.length) {
614
- p = peg$posDetailsCache.length - 1;
615
- } else {
616
- p = pos;
617
- while(!peg$posDetailsCache[--p]){}
618
- }
619
- details = peg$posDetailsCache[p];
620
- details = {
621
- line: details.line,
622
- column: details.column
623
- };
624
- while(p < pos){
625
- if (input.charCodeAt(p) === 10) {
626
- details.line++;
627
- details.column = 1;
628
- } else {
629
- details.column++;
630
- }
631
- p++;
632
- }
633
- peg$posDetailsCache[pos] = details;
634
- return details;
635
- }
636
- }
637
- function peg$computeLocation(startPos, endPos, offset) {
638
- var startPosDetails = peg$computePosDetails(startPos);
639
- var endPosDetails = peg$computePosDetails(endPos);
640
- var res = {
641
- source: peg$source,
642
- start: {
643
- offset: startPos,
644
- line: startPosDetails.line,
645
- column: startPosDetails.column
646
- },
647
- end: {
648
- offset: endPos,
649
- line: endPosDetails.line,
650
- column: endPosDetails.column
651
- }
652
- };
653
- if (offset && peg$source && typeof peg$source.offset === "function") {
654
- res.start = peg$source.offset(res.start);
655
- res.end = peg$source.offset(res.end);
656
- }
657
- return res;
658
- }
659
- function peg$fail(expected) {
660
- if (peg$currPos < peg$maxFailPos) {
661
- return;
662
- }
663
- if (peg$currPos > peg$maxFailPos) {
664
- peg$maxFailPos = peg$currPos;
665
- peg$maxFailExpected = [];
666
- }
667
- peg$maxFailExpected.push(expected);
668
- }
669
- function peg$buildSimpleError(message, location) {
670
- return new peg$SyntaxError(message, null, null, location);
671
- }
672
- function peg$buildStructuredError(expected, found, location) {
673
- return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
674
- }
675
- function peg$parseMain() {
676
- var s0, s1, s2;
677
- s0 = peg$currPos;
678
- s1 = peg$parseExprs();
679
- if (s1 !== peg$FAILED) {
680
- s2 = peg$parseEOF();
681
- if (s2 !== peg$FAILED) {
682
- s0 = s1;
683
- } else {
684
- peg$currPos = s0;
685
- s0 = peg$FAILED;
686
- }
687
- } else {
688
- peg$currPos = s0;
689
- s0 = peg$FAILED;
690
- }
691
- return s0;
692
- }
693
- function peg$parseExprs() {
694
- var s0, s1, s2, s3, s4, s5;
695
- s0 = peg$currPos;
696
- s1 = peg$parse_();
697
- s2 = peg$currPos;
698
- s3 = [];
699
- s4 = peg$parseExpr();
700
- while(s4 !== peg$FAILED){
701
- s3.push(s4);
702
- s4 = peg$currPos;
703
- s5 = peg$parse__();
704
- if (s5 !== peg$FAILED) {
705
- s5 = peg$parseExpr();
706
- if (s5 === peg$FAILED) {
707
- peg$currPos = s4;
708
- s4 = peg$FAILED;
709
- } else {
710
- s4 = s5;
711
- }
712
- } else {
713
- s4 = s5;
714
- }
715
- }
716
- if (s3.length < 1) {
717
- peg$currPos = s2;
718
- s2 = peg$FAILED;
719
- } else {
720
- s2 = s3;
721
- }
722
- if (s2 !== peg$FAILED) {
723
- s3 = peg$parse_();
724
- s0 = s2;
725
- } else {
726
- peg$currPos = s0;
727
- s0 = peg$FAILED;
728
- }
729
- return s0;
730
- }
731
- function peg$parseExpr() {
732
- var s0;
733
- s0 = peg$parseComment();
734
- if (s0 === peg$FAILED) {
735
- s0 = peg$parseOrExpr();
736
- }
737
- return s0;
738
- }
739
- function peg$parseComment() {
740
- var s0, s1, s2, s3, s4;
741
- s0 = peg$currPos;
742
- if (input.substr(peg$currPos, 2) === peg$c0) {
743
- s1 = peg$c0;
744
- peg$currPos += 2;
745
- } else {
746
- s1 = peg$FAILED;
747
- if (peg$silentFails === 0) {
748
- peg$fail(peg$e0);
749
- }
750
- }
751
- if (s1 !== peg$FAILED) {
752
- s2 = peg$currPos;
753
- s3 = [];
754
- s4 = input.charAt(peg$currPos);
755
- if (peg$r0.test(s4)) {
756
- peg$currPos++;
757
- } else {
758
- s4 = peg$FAILED;
759
- if (peg$silentFails === 0) {
760
- peg$fail(peg$e1);
761
- }
762
- }
763
- while(s4 !== peg$FAILED){
764
- s3.push(s4);
765
- s4 = input.charAt(peg$currPos);
766
- if (peg$r0.test(s4)) {
767
- peg$currPos++;
768
- } else {
769
- s4 = peg$FAILED;
770
- if (peg$silentFails === 0) {
771
- peg$fail(peg$e1);
772
- }
773
- }
774
- }
775
- s2 = input.substring(s2, peg$currPos);
776
- if (input.substr(peg$currPos, 2) === peg$c1) {
777
- s3 = peg$c1;
778
- peg$currPos += 2;
779
- } else {
780
- s3 = peg$FAILED;
781
- if (peg$silentFails === 0) {
782
- peg$fail(peg$e2);
783
- }
784
- }
785
- if (s3 !== peg$FAILED) {
786
- peg$savedPos = s0;
787
- s0 = peg$f0(s2);
788
- } else {
789
- peg$currPos = s0;
790
- s0 = peg$FAILED;
791
- }
792
- } else {
793
- peg$currPos = s0;
794
- s0 = peg$FAILED;
795
- }
796
- return s0;
797
- }
798
- function peg$parseOrExpr() {
799
- var s0, s1, s2, s3, s4, s5, s6, s7;
800
- s0 = peg$currPos;
801
- s1 = peg$parseAndExpr();
802
- if (s1 !== peg$FAILED) {
803
- s2 = [];
804
- s3 = peg$currPos;
805
- s4 = peg$parse__();
806
- if (s4 !== peg$FAILED) {
807
- s5 = peg$parseKW_OR();
808
- if (s5 !== peg$FAILED) {
809
- s6 = peg$parse__();
810
- if (s6 !== peg$FAILED) {
811
- s7 = peg$parseAndExpr();
812
- if (s7 !== peg$FAILED) {
813
- s3 = s7;
814
- } else {
815
- peg$currPos = s3;
816
- s3 = peg$FAILED;
817
- }
818
- } else {
819
- peg$currPos = s3;
820
- s3 = peg$FAILED;
821
- }
822
- } else {
823
- peg$currPos = s3;
824
- s3 = peg$FAILED;
825
- }
826
- } else {
827
- peg$currPos = s3;
828
- s3 = peg$FAILED;
829
- }
830
- while(s3 !== peg$FAILED){
831
- s2.push(s3);
832
- s3 = peg$currPos;
833
- s4 = peg$parse__();
834
- if (s4 !== peg$FAILED) {
835
- s5 = peg$parseKW_OR();
836
- if (s5 !== peg$FAILED) {
837
- s6 = peg$parse__();
838
- if (s6 !== peg$FAILED) {
839
- s7 = peg$parseAndExpr();
840
- if (s7 !== peg$FAILED) {
841
- s3 = s7;
842
- } else {
843
- peg$currPos = s3;
844
- s3 = peg$FAILED;
845
- }
846
- } else {
847
- peg$currPos = s3;
848
- s3 = peg$FAILED;
849
- }
850
- } else {
851
- peg$currPos = s3;
852
- s3 = peg$FAILED;
853
- }
854
- } else {
855
- peg$currPos = s3;
856
- s3 = peg$FAILED;
857
- }
858
- }
859
- peg$savedPos = s0;
860
- s0 = peg$f1(s1, s2);
861
- } else {
862
- peg$currPos = s0;
863
- s0 = peg$FAILED;
864
- }
865
- return s0;
866
- }
867
- function peg$parseAndExpr() {
868
- var s0, s1, s2, s3, s4, s5, s6, s7;
869
- s0 = peg$currPos;
870
- s1 = peg$parseNotExpr();
871
- if (s1 !== peg$FAILED) {
872
- s2 = [];
873
- s3 = peg$currPos;
874
- s4 = peg$parse__();
875
- if (s4 !== peg$FAILED) {
876
- s5 = peg$parseKW_AND();
877
- if (s5 !== peg$FAILED) {
878
- s6 = peg$parse__();
879
- if (s6 !== peg$FAILED) {
880
- s7 = peg$parseNotExpr();
881
- if (s7 !== peg$FAILED) {
882
- s3 = s7;
883
- } else {
884
- peg$currPos = s3;
885
- s3 = peg$FAILED;
886
- }
887
- } else {
888
- peg$currPos = s3;
889
- s3 = peg$FAILED;
890
- }
891
- } else {
892
- peg$currPos = s3;
893
- s3 = peg$FAILED;
894
- }
895
- } else {
896
- peg$currPos = s3;
897
- s3 = peg$FAILED;
898
- }
899
- while(s3 !== peg$FAILED){
900
- s2.push(s3);
901
- s3 = peg$currPos;
902
- s4 = peg$parse__();
903
- if (s4 !== peg$FAILED) {
904
- s5 = peg$parseKW_AND();
905
- if (s5 !== peg$FAILED) {
906
- s6 = peg$parse__();
907
- if (s6 !== peg$FAILED) {
908
- s7 = peg$parseNotExpr();
909
- if (s7 !== peg$FAILED) {
910
- s3 = s7;
911
- } else {
912
- peg$currPos = s3;
913
- s3 = peg$FAILED;
914
- }
915
- } else {
916
- peg$currPos = s3;
917
- s3 = peg$FAILED;
918
- }
919
- } else {
920
- peg$currPos = s3;
921
- s3 = peg$FAILED;
922
- }
923
- } else {
924
- peg$currPos = s3;
925
- s3 = peg$FAILED;
926
- }
927
- }
928
- peg$savedPos = s0;
929
- s0 = peg$f2(s1, s2);
930
- } else {
931
- peg$currPos = s0;
932
- s0 = peg$FAILED;
933
- }
934
- return s0;
935
- }
936
- function peg$parseNotExpr() {
937
- var s0, s1, s2, s3;
938
- s0 = peg$currPos;
939
- s1 = peg$parseKW_NOT();
940
- if (s1 !== peg$FAILED) {
941
- s2 = peg$parse__();
942
- if (s2 !== peg$FAILED) {
943
- s3 = peg$parseNotExpr();
944
- if (s3 !== peg$FAILED) {
945
- peg$savedPos = s0;
946
- s0 = peg$f3(s3);
947
- } else {
948
- peg$currPos = s0;
949
- s0 = peg$FAILED;
950
- }
951
- } else {
952
- peg$currPos = s0;
953
- s0 = peg$FAILED;
954
- }
955
- } else {
956
- peg$currPos = s0;
957
- s0 = peg$FAILED;
958
- }
959
- if (s0 === peg$FAILED) {
960
- s0 = peg$currPos;
961
- s1 = peg$parseParenthesesExpr();
962
- if (s1 !== peg$FAILED) {
963
- s0 = s1;
964
- } else {
965
- peg$currPos = s0;
966
- s0 = peg$FAILED;
967
- }
968
- }
969
- return s0;
970
- }
971
- function peg$parseParenthesesExpr() {
972
- var s0, s1, s2, s3, s4, s5;
973
- s0 = peg$currPos;
974
- if (input.charCodeAt(peg$currPos) === 40) {
975
- s1 = peg$c2;
976
- peg$currPos++;
977
- } else {
978
- s1 = peg$FAILED;
979
- if (peg$silentFails === 0) {
980
- peg$fail(peg$e3);
981
- }
982
- }
983
- if (s1 !== peg$FAILED) {
984
- s2 = peg$parse_();
985
- s3 = peg$parseExprs();
986
- if (s3 !== peg$FAILED) {
987
- s4 = peg$parse_();
988
- if (input.charCodeAt(peg$currPos) === 41) {
989
- s5 = peg$c3;
990
- peg$currPos++;
991
- } else {
992
- s5 = peg$FAILED;
993
- if (peg$silentFails === 0) {
994
- peg$fail(peg$e4);
995
- }
996
- }
997
- if (s5 !== peg$FAILED) {
998
- peg$savedPos = s0;
999
- s0 = peg$f4(s3);
1000
- } else {
1001
- peg$currPos = s0;
1002
- s0 = peg$FAILED;
1003
- }
1004
- } else {
1005
- peg$currPos = s0;
1006
- s0 = peg$FAILED;
1007
- }
1008
- } else {
1009
- peg$currPos = s0;
1010
- s0 = peg$FAILED;
1011
- }
1012
- if (s0 === peg$FAILED) {
1013
- s0 = peg$currPos;
1014
- s1 = peg$parseComparisonExpr();
1015
- if (s1 !== peg$FAILED) {
1016
- s0 = s1;
1017
- } else {
1018
- peg$currPos = s0;
1019
- s0 = peg$FAILED;
1020
- }
1021
- }
1022
- return s0;
1023
- }
1024
- function peg$parseComparisonExpr() {
1025
- var s0, s1, s2, s3, s4, s5;
1026
- s0 = peg$currPos;
1027
- s1 = peg$currPos;
1028
- if (input.charCodeAt(peg$currPos) === 45) {
1029
- s2 = peg$c4;
1030
- peg$currPos++;
1031
- } else {
1032
- s2 = peg$FAILED;
1033
- if (peg$silentFails === 0) {
1034
- peg$fail(peg$e5);
1035
- }
1036
- }
1037
- if (s2 !== peg$FAILED) {
1038
- peg$savedPos = s1;
1039
- s2 = peg$f5(s2);
1040
- }
1041
- s1 = s2;
1042
- if (s1 === peg$FAILED) {
1043
- s1 = peg$currPos;
1044
- if (input.charCodeAt(peg$currPos) === 43) {
1045
- s2 = peg$c5;
1046
- peg$currPos++;
1047
- } else {
1048
- s2 = peg$FAILED;
1049
- if (peg$silentFails === 0) {
1050
- peg$fail(peg$e6);
1051
- }
1052
- }
1053
- if (s2 !== peg$FAILED) {
1054
- peg$savedPos = s1;
1055
- s2 = peg$f6();
1056
- }
1057
- s1 = s2;
1058
- }
1059
- if (s1 === peg$FAILED) {
1060
- s1 = null;
1061
- }
1062
- s2 = peg$currPos;
1063
- s3 = peg$parsefield();
1064
- if (s3 !== peg$FAILED) {
1065
- if (input.charCodeAt(peg$currPos) === 58) {
1066
- s4 = peg$c6;
1067
- peg$currPos++;
1068
- } else {
1069
- s4 = peg$FAILED;
1070
- if (peg$silentFails === 0) {
1071
- peg$fail(peg$e7);
1072
- }
1073
- }
1074
- if (s4 !== peg$FAILED) {
1075
- s5 = peg$parserange();
1076
- if (s5 !== peg$FAILED) {
1077
- peg$savedPos = s2;
1078
- s2 = peg$f7(s1, s3, s4, s5);
1079
- } else {
1080
- peg$currPos = s2;
1081
- s2 = peg$FAILED;
1082
- }
1083
- } else {
1084
- peg$currPos = s2;
1085
- s2 = peg$FAILED;
1086
- }
1087
- } else {
1088
- peg$currPos = s2;
1089
- s2 = peg$FAILED;
1090
- }
1091
- if (s2 === peg$FAILED) {
1092
- s2 = peg$currPos;
1093
- s3 = peg$parsefield();
1094
- if (s3 !== peg$FAILED) {
1095
- if (input.substr(peg$currPos, 2) === peg$c7) {
1096
- s4 = peg$c7;
1097
- peg$currPos += 2;
1098
- } else {
1099
- s4 = peg$FAILED;
1100
- if (peg$silentFails === 0) {
1101
- peg$fail(peg$e8);
1102
- }
1103
- }
1104
- if (s4 === peg$FAILED) {
1105
- if (input.substr(peg$currPos, 3) === peg$c8) {
1106
- s4 = peg$c8;
1107
- peg$currPos += 3;
1108
- } else {
1109
- s4 = peg$FAILED;
1110
- if (peg$silentFails === 0) {
1111
- peg$fail(peg$e9);
1112
- }
1113
- }
1114
- if (s4 === peg$FAILED) {
1115
- if (input.charCodeAt(peg$currPos) === 58) {
1116
- s4 = peg$c6;
1117
- peg$currPos++;
1118
- } else {
1119
- s4 = peg$FAILED;
1120
- if (peg$silentFails === 0) {
1121
- peg$fail(peg$e7);
1122
- }
1123
- }
1124
- }
1125
- }
1126
- if (s4 !== peg$FAILED) {
1127
- s5 = peg$parsemention();
1128
- if (s5 !== peg$FAILED) {
1129
- peg$savedPos = s2;
1130
- s2 = peg$f8(s1, s3, s4, s5);
1131
- } else {
1132
- peg$currPos = s2;
1133
- s2 = peg$FAILED;
1134
- }
1135
- } else {
1136
- peg$currPos = s2;
1137
- s2 = peg$FAILED;
1138
- }
1139
- } else {
1140
- peg$currPos = s2;
1141
- s2 = peg$FAILED;
1142
- }
1143
- if (s2 === peg$FAILED) {
1144
- s2 = peg$currPos;
1145
- s3 = peg$parsefield();
1146
- if (s3 !== peg$FAILED) {
1147
- if (input.substr(peg$currPos, 2) === peg$c7) {
1148
- s4 = peg$c7;
1149
- peg$currPos += 2;
1150
- } else {
1151
- s4 = peg$FAILED;
1152
- if (peg$silentFails === 0) {
1153
- peg$fail(peg$e8);
1154
- }
1155
- }
1156
- if (s4 === peg$FAILED) {
1157
- if (input.substr(peg$currPos, 2) === peg$c9) {
1158
- s4 = peg$c9;
1159
- peg$currPos += 2;
1160
- } else {
1161
- s4 = peg$FAILED;
1162
- if (peg$silentFails === 0) {
1163
- peg$fail(peg$e10);
1164
- }
1165
- }
1166
- if (s4 === peg$FAILED) {
1167
- if (input.substr(peg$currPos, 2) === peg$c10) {
1168
- s4 = peg$c10;
1169
- peg$currPos += 2;
1170
- } else {
1171
- s4 = peg$FAILED;
1172
- if (peg$silentFails === 0) {
1173
- peg$fail(peg$e11);
1174
- }
1175
- }
1176
- if (s4 === peg$FAILED) {
1177
- if (input.substr(peg$currPos, 3) === peg$c11) {
1178
- s4 = peg$c11;
1179
- peg$currPos += 3;
1180
- } else {
1181
- s4 = peg$FAILED;
1182
- if (peg$silentFails === 0) {
1183
- peg$fail(peg$e12);
1184
- }
1185
- }
1186
- if (s4 === peg$FAILED) {
1187
- if (input.substr(peg$currPos, 3) === peg$c12) {
1188
- s4 = peg$c12;
1189
- peg$currPos += 3;
1190
- } else {
1191
- s4 = peg$FAILED;
1192
- if (peg$silentFails === 0) {
1193
- peg$fail(peg$e13);
1194
- }
1195
- }
1196
- if (s4 === peg$FAILED) {
1197
- if (input.substr(peg$currPos, 3) === peg$c8) {
1198
- s4 = peg$c8;
1199
- peg$currPos += 3;
1200
- } else {
1201
- s4 = peg$FAILED;
1202
- if (peg$silentFails === 0) {
1203
- peg$fail(peg$e9);
1204
- }
1205
- }
1206
- if (s4 === peg$FAILED) {
1207
- if (input.charCodeAt(peg$currPos) === 58) {
1208
- s4 = peg$c6;
1209
- peg$currPos++;
1210
- } else {
1211
- s4 = peg$FAILED;
1212
- if (peg$silentFails === 0) {
1213
- peg$fail(peg$e7);
1214
- }
1215
- }
1216
- }
1217
- }
1218
- }
1219
- }
1220
- }
1221
- }
1222
- if (s4 !== peg$FAILED) {
1223
- s5 = peg$parsevalue();
1224
- if (s5 !== peg$FAILED) {
1225
- peg$savedPos = s2;
1226
- s2 = peg$f9(s1, s3, s4, s5);
1227
- } else {
1228
- peg$currPos = s2;
1229
- s2 = peg$FAILED;
1230
- }
1231
- } else {
1232
- peg$currPos = s2;
1233
- s2 = peg$FAILED;
1234
- }
1235
- } else {
1236
- peg$currPos = s2;
1237
- s2 = peg$FAILED;
1238
- }
1239
- }
1240
- }
1241
- if (s2 !== peg$FAILED) {
1242
- peg$savedPos = s0;
1243
- s0 = peg$f10(s1, s2);
1244
- } else {
1245
- peg$currPos = s0;
1246
- s0 = peg$FAILED;
1247
- }
1248
- if (s0 === peg$FAILED) {
1249
- s0 = peg$currPos;
1250
- if (input.charCodeAt(peg$currPos) === 64) {
1251
- s1 = peg$c13;
1252
- peg$currPos++;
1253
- } else {
1254
- s1 = peg$FAILED;
1255
- if (peg$silentFails === 0) {
1256
- peg$fail(peg$e14);
1257
- }
1258
- }
1259
- if (s1 !== peg$FAILED) {
1260
- s2 = peg$parsefield();
1261
- if (s2 !== peg$FAILED) {
1262
- if (input.charCodeAt(peg$currPos) === 58) {
1263
- s3 = peg$c6;
1264
- peg$currPos++;
1265
- } else {
1266
- s3 = peg$FAILED;
1267
- if (peg$silentFails === 0) {
1268
- peg$fail(peg$e7);
1269
- }
1270
- }
1271
- if (s3 !== peg$FAILED) {
1272
- s4 = peg$parsestring();
1273
- if (s4 !== peg$FAILED) {
1274
- peg$savedPos = s0;
1275
- s0 = peg$f11(s2, s4);
1276
- } else {
1277
- peg$currPos = s0;
1278
- s0 = peg$FAILED;
1279
- }
1280
- } else {
1281
- peg$currPos = s0;
1282
- s0 = peg$FAILED;
1283
- }
1284
- } else {
1285
- peg$currPos = s0;
1286
- s0 = peg$FAILED;
1287
- }
1288
- } else {
1289
- peg$currPos = s0;
1290
- s0 = peg$FAILED;
1291
- }
1292
- if (s0 === peg$FAILED) {
1293
- s0 = peg$parseKeywordExpr();
1294
- }
1295
- }
1296
- return s0;
1297
- }
1298
- function peg$parseKeywordExpr() {
1299
- var s0, s1, s2;
1300
- s0 = peg$currPos;
1301
- if (input.charCodeAt(peg$currPos) === 45) {
1302
- s1 = peg$c4;
1303
- peg$currPos++;
1304
- } else {
1305
- s1 = peg$FAILED;
1306
- if (peg$silentFails === 0) {
1307
- peg$fail(peg$e5);
1308
- }
1309
- }
1310
- if (s1 === peg$FAILED) {
1311
- s1 = null;
1312
- }
1313
- s2 = peg$parsestring();
1314
- if (s2 !== peg$FAILED) {
1315
- peg$savedPos = s0;
1316
- s0 = peg$f12(s1, s2);
1317
- } else {
1318
- peg$currPos = s0;
1319
- s0 = peg$FAILED;
1320
- }
1321
- if (s0 === peg$FAILED) {
1322
- s0 = peg$currPos;
1323
- if (input.charCodeAt(peg$currPos) === 45) {
1324
- s1 = peg$c4;
1325
- peg$currPos++;
1326
- } else {
1327
- s1 = peg$FAILED;
1328
- if (peg$silentFails === 0) {
1329
- peg$fail(peg$e5);
1330
- }
1331
- }
1332
- if (s1 === peg$FAILED) {
1333
- s1 = null;
1334
- }
1335
- s2 = peg$parsekeyword();
1336
- if (s2 !== peg$FAILED) {
1337
- peg$savedPos = s0;
1338
- s0 = peg$f13(s1, s2);
1339
- } else {
1340
- peg$currPos = s0;
1341
- s0 = peg$FAILED;
1342
- }
1343
- }
1344
- return s0;
1345
- }
1346
- function peg$parsekeyword() {
1347
- var s0, s1, s2, s3;
1348
- s0 = peg$currPos;
1349
- s1 = input.charAt(peg$currPos);
1350
- if (peg$r1.test(s1)) {
1351
- peg$currPos++;
1352
- } else {
1353
- s1 = peg$FAILED;
1354
- if (peg$silentFails === 0) {
1355
- peg$fail(peg$e15);
1356
- }
1357
- }
1358
- if (s1 !== peg$FAILED) {
1359
- s2 = [];
1360
- s3 = input.charAt(peg$currPos);
1361
- if (peg$r2.test(s3)) {
1362
- peg$currPos++;
1363
- } else {
1364
- s3 = peg$FAILED;
1365
- if (peg$silentFails === 0) {
1366
- peg$fail(peg$e16);
1367
- }
1368
- }
1369
- while(s3 !== peg$FAILED){
1370
- s2.push(s3);
1371
- s3 = input.charAt(peg$currPos);
1372
- if (peg$r2.test(s3)) {
1373
- peg$currPos++;
1374
- } else {
1375
- s3 = peg$FAILED;
1376
- if (peg$silentFails === 0) {
1377
- peg$fail(peg$e16);
1378
- }
1379
- }
1380
- }
1381
- peg$savedPos = s0;
1382
- s0 = peg$f14();
1383
- } else {
1384
- peg$currPos = s0;
1385
- s0 = peg$FAILED;
1386
- }
1387
- return s0;
1388
- }
1389
- function peg$parsefield() {
1390
- var s0, s1, s2, s3, s4;
1391
- s0 = peg$currPos;
1392
- s1 = peg$currPos;
1393
- s2 = [];
1394
- s3 = peg$parseident();
1395
- while(s3 !== peg$FAILED){
1396
- s2.push(s3);
1397
- s3 = peg$currPos;
1398
- if (input.charCodeAt(peg$currPos) === 46) {
1399
- s4 = peg$c14;
1400
- peg$currPos++;
1401
- } else {
1402
- s4 = peg$FAILED;
1403
- if (peg$silentFails === 0) {
1404
- peg$fail(peg$e17);
1405
- }
1406
- }
1407
- if (s4 !== peg$FAILED) {
1408
- s4 = peg$parseident();
1409
- if (s4 === peg$FAILED) {
1410
- peg$currPos = s3;
1411
- s3 = peg$FAILED;
1412
- } else {
1413
- s3 = s4;
1414
- }
1415
- } else {
1416
- s3 = s4;
1417
- }
1418
- }
1419
- if (s2.length < 1) {
1420
- peg$currPos = s1;
1421
- s1 = peg$FAILED;
1422
- } else {
1423
- s1 = s2;
1424
- }
1425
- if (s1 !== peg$FAILED) {
1426
- s0 = input.substring(s0, peg$currPos);
1427
- } else {
1428
- s0 = s1;
1429
- }
1430
- return s0;
1431
- }
1432
- function peg$parserange() {
1433
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
1434
- s0 = peg$currPos;
1435
- s1 = peg$parsevalue();
1436
- if (s1 === peg$FAILED) {
1437
- if (input.charCodeAt(peg$currPos) === 42) {
1438
- s1 = peg$c15;
1439
- peg$currPos++;
1440
- } else {
1441
- s1 = peg$FAILED;
1442
- if (peg$silentFails === 0) {
1443
- peg$fail(peg$e18);
1444
- }
1445
- }
1446
- }
1447
- if (s1 !== peg$FAILED) {
1448
- if (input.substr(peg$currPos, 2) === peg$c16) {
1449
- s2 = peg$c16;
1450
- peg$currPos += 2;
1451
- } else {
1452
- s2 = peg$FAILED;
1453
- if (peg$silentFails === 0) {
1454
- peg$fail(peg$e19);
1455
- }
1456
- }
1457
- if (s2 !== peg$FAILED) {
1458
- s3 = peg$parsevalue();
1459
- if (s3 === peg$FAILED) {
1460
- if (input.charCodeAt(peg$currPos) === 42) {
1461
- s3 = peg$c15;
1462
- peg$currPos++;
1463
- } else {
1464
- s3 = peg$FAILED;
1465
- if (peg$silentFails === 0) {
1466
- peg$fail(peg$e18);
1467
- }
1468
- }
1469
- }
1470
- if (s3 !== peg$FAILED) {
1471
- peg$savedPos = s0;
1472
- s0 = peg$f15(s1, s3);
1473
- } else {
1474
- peg$currPos = s0;
1475
- s0 = peg$FAILED;
1476
- }
1477
- } else {
1478
- peg$currPos = s0;
1479
- s0 = peg$FAILED;
1480
- }
1481
- } else {
1482
- peg$currPos = s0;
1483
- s0 = peg$FAILED;
1484
- }
1485
- if (s0 === peg$FAILED) {
1486
- s0 = peg$currPos;
1487
- s1 = input.charAt(peg$currPos);
1488
- if (peg$r3.test(s1)) {
1489
- peg$currPos++;
1490
- } else {
1491
- s1 = peg$FAILED;
1492
- if (peg$silentFails === 0) {
1493
- peg$fail(peg$e20);
1494
- }
1495
- }
1496
- if (s1 !== peg$FAILED) {
1497
- s2 = peg$parse_();
1498
- s3 = peg$parsevalue();
1499
- if (s3 === peg$FAILED) {
1500
- s3 = null;
1501
- }
1502
- s4 = peg$parse_();
1503
- if (input.charCodeAt(peg$currPos) === 44) {
1504
- s5 = peg$c17;
1505
- peg$currPos++;
1506
- } else {
1507
- s5 = peg$FAILED;
1508
- if (peg$silentFails === 0) {
1509
- peg$fail(peg$e21);
1510
- }
1511
- }
1512
- if (s5 !== peg$FAILED) {
1513
- s6 = peg$parse_();
1514
- s7 = peg$parsevalue();
1515
- if (s7 === peg$FAILED) {
1516
- s7 = null;
1517
- }
1518
- s8 = peg$parse_();
1519
- s9 = input.charAt(peg$currPos);
1520
- if (peg$r4.test(s9)) {
1521
- peg$currPos++;
1522
- } else {
1523
- s9 = peg$FAILED;
1524
- if (peg$silentFails === 0) {
1525
- peg$fail(peg$e22);
1526
- }
1527
- }
1528
- if (s9 !== peg$FAILED) {
1529
- peg$savedPos = s0;
1530
- s0 = peg$f16(s1, s3, s7, s9);
1531
- } else {
1532
- peg$currPos = s0;
1533
- s0 = peg$FAILED;
1534
- }
1535
- } else {
1536
- peg$currPos = s0;
1537
- s0 = peg$FAILED;
1538
- }
1539
- } else {
1540
- peg$currPos = s0;
1541
- s0 = peg$FAILED;
1542
- }
1543
- }
1544
- return s0;
1545
- }
1546
- function peg$parsemention() {
1547
- var s0, s1, s2;
1548
- s0 = peg$currPos;
1549
- if (input.charCodeAt(peg$currPos) === 64) {
1550
- s1 = peg$c13;
1551
- peg$currPos++;
1552
- } else {
1553
- s1 = peg$FAILED;
1554
- if (peg$silentFails === 0) {
1555
- peg$fail(peg$e14);
1556
- }
1557
- }
1558
- if (s1 !== peg$FAILED) {
1559
- s2 = peg$parseident();
1560
- if (s2 !== peg$FAILED) {
1561
- peg$savedPos = s0;
1562
- s0 = peg$f17(s2);
1563
- } else {
1564
- peg$currPos = s0;
1565
- s0 = peg$FAILED;
1566
- }
1567
- } else {
1568
- peg$currPos = s0;
1569
- s0 = peg$FAILED;
1570
- }
1571
- return s0;
1572
- }
1573
- function peg$parsevalue() {
1574
- var s0, s1;
1575
- s0 = peg$currPos;
1576
- s1 = peg$parsedate();
1577
- if (s1 !== peg$FAILED) {
1578
- s0 = s1;
1579
- } else {
1580
- peg$currPos = s0;
1581
- s0 = peg$FAILED;
1582
- }
1583
- if (s0 === peg$FAILED) {
1584
- s0 = peg$currPos;
1585
- s1 = peg$parseident();
1586
- if (s1 === peg$FAILED) {
1587
- s1 = peg$parseliteral();
1588
- }
1589
- if (s1 !== peg$FAILED) {
1590
- peg$savedPos = s0;
1591
- s1 = peg$f18(s1);
1592
- }
1593
- s0 = s1;
1594
- }
1595
- return s0;
1596
- }
1597
- function peg$parsedate() {
1598
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
1599
- s0 = peg$currPos;
1600
- s1 = peg$currPos;
1601
- s2 = input.charAt(peg$currPos);
1602
- if (peg$r5.test(s2)) {
1603
- peg$currPos++;
1604
- } else {
1605
- s2 = peg$FAILED;
1606
- if (peg$silentFails === 0) {
1607
- peg$fail(peg$e23);
1608
- }
1609
- }
1610
- if (s2 !== peg$FAILED) {
1611
- s3 = peg$currPos;
1612
- s4 = [];
1613
- s5 = input.charAt(peg$currPos);
1614
- if (peg$r6.test(s5)) {
1615
- peg$currPos++;
1616
- } else {
1617
- s5 = peg$FAILED;
1618
- if (peg$silentFails === 0) {
1619
- peg$fail(peg$e24);
1620
- }
1621
- }
1622
- while(s5 !== peg$FAILED){
1623
- s4.push(s5);
1624
- if (s4.length >= 3) {
1625
- s5 = peg$FAILED;
1626
- } else {
1627
- s5 = input.charAt(peg$currPos);
1628
- if (peg$r6.test(s5)) {
1629
- peg$currPos++;
1630
- } else {
1631
- s5 = peg$FAILED;
1632
- if (peg$silentFails === 0) {
1633
- peg$fail(peg$e24);
1634
- }
1635
- }
1636
- }
1637
- }
1638
- if (s4.length < 3) {
1639
- peg$currPos = s3;
1640
- s3 = peg$FAILED;
1641
- } else {
1642
- s3 = s4;
1643
- }
1644
- if (s3 !== peg$FAILED) {
1645
- if (input.charCodeAt(peg$currPos) === 45) {
1646
- s4 = peg$c4;
1647
- peg$currPos++;
1648
- } else {
1649
- s4 = peg$FAILED;
1650
- if (peg$silentFails === 0) {
1651
- peg$fail(peg$e5);
1652
- }
1653
- }
1654
- if (s4 !== peg$FAILED) {
1655
- s5 = peg$currPos;
1656
- s6 = [];
1657
- s7 = input.charAt(peg$currPos);
1658
- if (peg$r6.test(s7)) {
1659
- peg$currPos++;
1660
- } else {
1661
- s7 = peg$FAILED;
1662
- if (peg$silentFails === 0) {
1663
- peg$fail(peg$e24);
1664
- }
1665
- }
1666
- while(s7 !== peg$FAILED){
1667
- s6.push(s7);
1668
- if (s6.length >= 2) {
1669
- s7 = peg$FAILED;
1670
- } else {
1671
- s7 = input.charAt(peg$currPos);
1672
- if (peg$r6.test(s7)) {
1673
- peg$currPos++;
1674
- } else {
1675
- s7 = peg$FAILED;
1676
- if (peg$silentFails === 0) {
1677
- peg$fail(peg$e24);
1678
- }
1679
- }
1680
- }
1681
- }
1682
- if (s6.length < 1) {
1683
- peg$currPos = s5;
1684
- s5 = peg$FAILED;
1685
- } else {
1686
- s5 = s6;
1687
- }
1688
- if (s5 !== peg$FAILED) {
1689
- if (input.charCodeAt(peg$currPos) === 45) {
1690
- s6 = peg$c4;
1691
- peg$currPos++;
1692
- } else {
1693
- s6 = peg$FAILED;
1694
- if (peg$silentFails === 0) {
1695
- peg$fail(peg$e5);
1696
- }
1697
- }
1698
- if (s6 !== peg$FAILED) {
1699
- s7 = peg$currPos;
1700
- s8 = [];
1701
- s9 = input.charAt(peg$currPos);
1702
- if (peg$r6.test(s9)) {
1703
- peg$currPos++;
1704
- } else {
1705
- s9 = peg$FAILED;
1706
- if (peg$silentFails === 0) {
1707
- peg$fail(peg$e24);
1708
- }
1709
- }
1710
- while(s9 !== peg$FAILED){
1711
- s8.push(s9);
1712
- if (s8.length >= 2) {
1713
- s9 = peg$FAILED;
1714
- } else {
1715
- s9 = input.charAt(peg$currPos);
1716
- if (peg$r6.test(s9)) {
1717
- peg$currPos++;
1718
- } else {
1719
- s9 = peg$FAILED;
1720
- if (peg$silentFails === 0) {
1721
- peg$fail(peg$e24);
1722
- }
1723
- }
1724
- }
1725
- }
1726
- if (s8.length < 1) {
1727
- peg$currPos = s7;
1728
- s7 = peg$FAILED;
1729
- } else {
1730
- s7 = s8;
1731
- }
1732
- if (s7 !== peg$FAILED) {
1733
- s2 = [
1734
- s2,
1735
- s3,
1736
- s4,
1737
- s5,
1738
- s6,
1739
- s7
1740
- ];
1741
- s1 = s2;
1742
- } else {
1743
- peg$currPos = s1;
1744
- s1 = peg$FAILED;
1745
- }
1746
- } else {
1747
- peg$currPos = s1;
1748
- s1 = peg$FAILED;
1749
- }
1750
- } else {
1751
- peg$currPos = s1;
1752
- s1 = peg$FAILED;
1753
- }
1754
- } else {
1755
- peg$currPos = s1;
1756
- s1 = peg$FAILED;
1757
- }
1758
- } else {
1759
- peg$currPos = s1;
1760
- s1 = peg$FAILED;
1761
- }
1762
- } else {
1763
- peg$currPos = s1;
1764
- s1 = peg$FAILED;
1765
- }
1766
- if (s1 !== peg$FAILED) {
1767
- s2 = peg$currPos;
1768
- if (input.charCodeAt(peg$currPos) === 84) {
1769
- s3 = peg$c18;
1770
- peg$currPos++;
1771
- } else {
1772
- s3 = peg$FAILED;
1773
- if (peg$silentFails === 0) {
1774
- peg$fail(peg$e25);
1775
- }
1776
- }
1777
- if (s3 !== peg$FAILED) {
1778
- s4 = peg$currPos;
1779
- s5 = peg$currPos;
1780
- s6 = [];
1781
- s7 = input.charAt(peg$currPos);
1782
- if (peg$r6.test(s7)) {
1783
- peg$currPos++;
1784
- } else {
1785
- s7 = peg$FAILED;
1786
- if (peg$silentFails === 0) {
1787
- peg$fail(peg$e24);
1788
- }
1789
- }
1790
- while(s7 !== peg$FAILED){
1791
- s6.push(s7);
1792
- if (s6.length >= 2) {
1793
- s7 = peg$FAILED;
1794
- } else {
1795
- s7 = input.charAt(peg$currPos);
1796
- if (peg$r6.test(s7)) {
1797
- peg$currPos++;
1798
- } else {
1799
- s7 = peg$FAILED;
1800
- if (peg$silentFails === 0) {
1801
- peg$fail(peg$e24);
1802
- }
1803
- }
1804
- }
1805
- }
1806
- if (s6.length < 1) {
1807
- peg$currPos = s5;
1808
- s5 = peg$FAILED;
1809
- } else {
1810
- s5 = s6;
1811
- }
1812
- if (s5 !== peg$FAILED) {
1813
- if (input.charCodeAt(peg$currPos) === 58) {
1814
- s6 = peg$c6;
1815
- peg$currPos++;
1816
- } else {
1817
- s6 = peg$FAILED;
1818
- if (peg$silentFails === 0) {
1819
- peg$fail(peg$e7);
1820
- }
1821
- }
1822
- if (s6 !== peg$FAILED) {
1823
- s7 = peg$currPos;
1824
- s8 = [];
1825
- s9 = input.charAt(peg$currPos);
1826
- if (peg$r6.test(s9)) {
1827
- peg$currPos++;
1828
- } else {
1829
- s9 = peg$FAILED;
1830
- if (peg$silentFails === 0) {
1831
- peg$fail(peg$e24);
1832
- }
1833
- }
1834
- while(s9 !== peg$FAILED){
1835
- s8.push(s9);
1836
- if (s8.length >= 2) {
1837
- s9 = peg$FAILED;
1838
- } else {
1839
- s9 = input.charAt(peg$currPos);
1840
- if (peg$r6.test(s9)) {
1841
- peg$currPos++;
1842
- } else {
1843
- s9 = peg$FAILED;
1844
- if (peg$silentFails === 0) {
1845
- peg$fail(peg$e24);
1846
- }
1847
- }
1848
- }
1849
- }
1850
- if (s8.length < 1) {
1851
- peg$currPos = s7;
1852
- s7 = peg$FAILED;
1853
- } else {
1854
- s7 = s8;
1855
- }
1856
- if (s7 !== peg$FAILED) {
1857
- if (input.charCodeAt(peg$currPos) === 58) {
1858
- s8 = peg$c6;
1859
- peg$currPos++;
1860
- } else {
1861
- s8 = peg$FAILED;
1862
- if (peg$silentFails === 0) {
1863
- peg$fail(peg$e7);
1864
- }
1865
- }
1866
- if (s8 !== peg$FAILED) {
1867
- s9 = peg$currPos;
1868
- s10 = [];
1869
- s11 = input.charAt(peg$currPos);
1870
- if (peg$r6.test(s11)) {
1871
- peg$currPos++;
1872
- } else {
1873
- s11 = peg$FAILED;
1874
- if (peg$silentFails === 0) {
1875
- peg$fail(peg$e24);
1876
- }
1877
- }
1878
- while(s11 !== peg$FAILED){
1879
- s10.push(s11);
1880
- if (s10.length >= 2) {
1881
- s11 = peg$FAILED;
1882
- } else {
1883
- s11 = input.charAt(peg$currPos);
1884
- if (peg$r6.test(s11)) {
1885
- peg$currPos++;
1886
- } else {
1887
- s11 = peg$FAILED;
1888
- if (peg$silentFails === 0) {
1889
- peg$fail(peg$e24);
1890
- }
1891
- }
1892
- }
1893
- }
1894
- if (s10.length < 1) {
1895
- peg$currPos = s9;
1896
- s9 = peg$FAILED;
1897
- } else {
1898
- s9 = s10;
1899
- }
1900
- if (s9 !== peg$FAILED) {
1901
- s5 = [
1902
- s5,
1903
- s6,
1904
- s7,
1905
- s8,
1906
- s9
1907
- ];
1908
- s4 = s5;
1909
- } else {
1910
- peg$currPos = s4;
1911
- s4 = peg$FAILED;
1912
- }
1913
- } else {
1914
- peg$currPos = s4;
1915
- s4 = peg$FAILED;
1916
- }
1917
- } else {
1918
- peg$currPos = s4;
1919
- s4 = peg$FAILED;
1920
- }
1921
- } else {
1922
- peg$currPos = s4;
1923
- s4 = peg$FAILED;
1924
- }
1925
- } else {
1926
- peg$currPos = s4;
1927
- s4 = peg$FAILED;
1928
- }
1929
- if (s4 !== peg$FAILED) {
1930
- s5 = peg$currPos;
1931
- if (input.charCodeAt(peg$currPos) === 46) {
1932
- s6 = peg$c14;
1933
- peg$currPos++;
1934
- } else {
1935
- s6 = peg$FAILED;
1936
- if (peg$silentFails === 0) {
1937
- peg$fail(peg$e17);
1938
- }
1939
- }
1940
- if (s6 !== peg$FAILED) {
1941
- s7 = peg$currPos;
1942
- s8 = [];
1943
- s9 = input.charAt(peg$currPos);
1944
- if (peg$r6.test(s9)) {
1945
- peg$currPos++;
1946
- } else {
1947
- s9 = peg$FAILED;
1948
- if (peg$silentFails === 0) {
1949
- peg$fail(peg$e24);
1950
- }
1951
- }
1952
- while(s9 !== peg$FAILED){
1953
- s8.push(s9);
1954
- if (s8.length >= 3) {
1955
- s9 = peg$FAILED;
1956
- } else {
1957
- s9 = input.charAt(peg$currPos);
1958
- if (peg$r6.test(s9)) {
1959
- peg$currPos++;
1960
- } else {
1961
- s9 = peg$FAILED;
1962
- if (peg$silentFails === 0) {
1963
- peg$fail(peg$e24);
1964
- }
1965
- }
1966
- }
1967
- }
1968
- if (s8.length < 1) {
1969
- peg$currPos = s7;
1970
- s7 = peg$FAILED;
1971
- } else {
1972
- s7 = s8;
1973
- }
1974
- if (s7 !== peg$FAILED) {
1975
- s6 = [
1976
- s6,
1977
- s7
1978
- ];
1979
- s5 = s6;
1980
- } else {
1981
- peg$currPos = s5;
1982
- s5 = peg$FAILED;
1983
- }
1984
- } else {
1985
- peg$currPos = s5;
1986
- s5 = peg$FAILED;
1987
- }
1988
- if (s5 === peg$FAILED) {
1989
- s5 = null;
1990
- }
1991
- if (input.charCodeAt(peg$currPos) === 90) {
1992
- s6 = peg$c19;
1993
- peg$currPos++;
1994
- } else {
1995
- s6 = peg$FAILED;
1996
- if (peg$silentFails === 0) {
1997
- peg$fail(peg$e26);
1998
- }
1999
- }
2000
- if (s6 === peg$FAILED) {
2001
- s6 = peg$currPos;
2002
- if (input.charCodeAt(peg$currPos) === 43) {
2003
- s7 = peg$c5;
2004
- peg$currPos++;
2005
- } else {
2006
- s7 = peg$FAILED;
2007
- if (peg$silentFails === 0) {
2008
- peg$fail(peg$e6);
2009
- }
2010
- }
2011
- if (s7 !== peg$FAILED) {
2012
- s8 = peg$currPos;
2013
- s9 = [];
2014
- s10 = input.charAt(peg$currPos);
2015
- if (peg$r6.test(s10)) {
2016
- peg$currPos++;
2017
- } else {
2018
- s10 = peg$FAILED;
2019
- if (peg$silentFails === 0) {
2020
- peg$fail(peg$e24);
2021
- }
2022
- }
2023
- while(s10 !== peg$FAILED){
2024
- s9.push(s10);
2025
- if (s9.length >= 2) {
2026
- s10 = peg$FAILED;
2027
- } else {
2028
- s10 = input.charAt(peg$currPos);
2029
- if (peg$r6.test(s10)) {
2030
- peg$currPos++;
2031
- } else {
2032
- s10 = peg$FAILED;
2033
- if (peg$silentFails === 0) {
2034
- peg$fail(peg$e24);
2035
- }
2036
- }
2037
- }
2038
- }
2039
- if (s9.length < 1) {
2040
- peg$currPos = s8;
2041
- s8 = peg$FAILED;
2042
- } else {
2043
- s8 = s9;
2044
- }
2045
- if (s8 !== peg$FAILED) {
2046
- if (input.charCodeAt(peg$currPos) === 58) {
2047
- s9 = peg$c6;
2048
- peg$currPos++;
2049
- } else {
2050
- s9 = peg$FAILED;
2051
- if (peg$silentFails === 0) {
2052
- peg$fail(peg$e7);
2053
- }
2054
- }
2055
- if (s9 !== peg$FAILED) {
2056
- s10 = peg$currPos;
2057
- s11 = [];
2058
- s12 = input.charAt(peg$currPos);
2059
- if (peg$r6.test(s12)) {
2060
- peg$currPos++;
2061
- } else {
2062
- s12 = peg$FAILED;
2063
- if (peg$silentFails === 0) {
2064
- peg$fail(peg$e24);
2065
- }
2066
- }
2067
- while(s12 !== peg$FAILED){
2068
- s11.push(s12);
2069
- if (s11.length >= 2) {
2070
- s12 = peg$FAILED;
2071
- } else {
2072
- s12 = input.charAt(peg$currPos);
2073
- if (peg$r6.test(s12)) {
2074
- peg$currPos++;
2075
- } else {
2076
- s12 = peg$FAILED;
2077
- if (peg$silentFails === 0) {
2078
- peg$fail(peg$e24);
2079
- }
2080
- }
2081
- }
2082
- }
2083
- if (s11.length < 1) {
2084
- peg$currPos = s10;
2085
- s10 = peg$FAILED;
2086
- } else {
2087
- s10 = s11;
2088
- }
2089
- if (s10 !== peg$FAILED) {
2090
- s7 = [
2091
- s7,
2092
- s8,
2093
- s9,
2094
- s10
2095
- ];
2096
- s6 = s7;
2097
- } else {
2098
- peg$currPos = s6;
2099
- s6 = peg$FAILED;
2100
- }
2101
- } else {
2102
- peg$currPos = s6;
2103
- s6 = peg$FAILED;
2104
- }
2105
- } else {
2106
- peg$currPos = s6;
2107
- s6 = peg$FAILED;
2108
- }
2109
- } else {
2110
- peg$currPos = s6;
2111
- s6 = peg$FAILED;
2112
- }
2113
- }
2114
- if (s6 === peg$FAILED) {
2115
- s6 = null;
2116
- }
2117
- s3 = [
2118
- s3,
2119
- s4,
2120
- s5,
2121
- s6
2122
- ];
2123
- s2 = s3;
2124
- } else {
2125
- peg$currPos = s2;
2126
- s2 = peg$FAILED;
2127
- }
2128
- } else {
2129
- peg$currPos = s2;
2130
- s2 = peg$FAILED;
2131
- }
2132
- if (s2 === peg$FAILED) {
2133
- s2 = null;
2134
- }
2135
- peg$savedPos = s0;
2136
- s0 = peg$f19(s2);
2137
- } else {
2138
- peg$currPos = s0;
2139
- s0 = peg$FAILED;
2140
- }
2141
- return s0;
2142
- }
2143
- function peg$parseident() {
2144
- var s0, s1, s2, s3, s4;
2145
- s0 = peg$currPos;
2146
- s1 = peg$currPos;
2147
- s2 = input.charAt(peg$currPos);
2148
- if (peg$r7.test(s2)) {
2149
- peg$currPos++;
2150
- } else {
2151
- s2 = peg$FAILED;
2152
- if (peg$silentFails === 0) {
2153
- peg$fail(peg$e27);
2154
- }
2155
- }
2156
- if (s2 !== peg$FAILED) {
2157
- s3 = [];
2158
- s4 = input.charAt(peg$currPos);
2159
- if (peg$r8.test(s4)) {
2160
- peg$currPos++;
2161
- } else {
2162
- s4 = peg$FAILED;
2163
- if (peg$silentFails === 0) {
2164
- peg$fail(peg$e28);
2165
- }
2166
- }
2167
- while(s4 !== peg$FAILED){
2168
- s3.push(s4);
2169
- s4 = input.charAt(peg$currPos);
2170
- if (peg$r8.test(s4)) {
2171
- peg$currPos++;
2172
- } else {
2173
- s4 = peg$FAILED;
2174
- if (peg$silentFails === 0) {
2175
- peg$fail(peg$e28);
2176
- }
2177
- }
2178
- }
2179
- s2 = [
2180
- s2,
2181
- s3
2182
- ];
2183
- s1 = s2;
2184
- } else {
2185
- peg$currPos = s1;
2186
- s1 = peg$FAILED;
2187
- }
2188
- if (s1 !== peg$FAILED) {
2189
- peg$savedPos = s0;
2190
- s1 = peg$f20();
2191
- }
2192
- s0 = s1;
2193
- return s0;
2194
- }
2195
- function peg$parseliteral() {
2196
- var s0;
2197
- s0 = peg$parsestring();
2198
- if (s0 === peg$FAILED) {
2199
- s0 = peg$parsefloat();
2200
- if (s0 === peg$FAILED) {
2201
- s0 = peg$parseint();
2202
- if (s0 === peg$FAILED) {
2203
- s0 = peg$parsebool();
2204
- if (s0 === peg$FAILED) {
2205
- s0 = peg$parsenull();
2206
- }
2207
- }
2208
- }
2209
- }
2210
- return s0;
2211
- }
2212
- function peg$parsenumber() {
2213
- var s0, s1, s2, s3, s4, s5, s6;
2214
- s0 = peg$currPos;
2215
- s1 = peg$currPos;
2216
- s2 = [];
2217
- s3 = input.charAt(peg$currPos);
2218
- if (peg$r6.test(s3)) {
2219
- peg$currPos++;
2220
- } else {
2221
- s3 = peg$FAILED;
2222
- if (peg$silentFails === 0) {
2223
- peg$fail(peg$e24);
2224
- }
2225
- }
2226
- if (s3 !== peg$FAILED) {
2227
- while(s3 !== peg$FAILED){
2228
- s2.push(s3);
2229
- s3 = input.charAt(peg$currPos);
2230
- if (peg$r6.test(s3)) {
2231
- peg$currPos++;
2232
- } else {
2233
- s3 = peg$FAILED;
2234
- if (peg$silentFails === 0) {
2235
- peg$fail(peg$e24);
2236
- }
2237
- }
2238
- }
2239
- } else {
2240
- s2 = peg$FAILED;
2241
- }
2242
- if (s2 !== peg$FAILED) {
2243
- s3 = peg$currPos;
2244
- if (input.charCodeAt(peg$currPos) === 46) {
2245
- s4 = peg$c14;
2246
- peg$currPos++;
2247
- } else {
2248
- s4 = peg$FAILED;
2249
- if (peg$silentFails === 0) {
2250
- peg$fail(peg$e17);
2251
- }
2252
- }
2253
- if (s4 !== peg$FAILED) {
2254
- s5 = [];
2255
- s6 = input.charAt(peg$currPos);
2256
- if (peg$r6.test(s6)) {
2257
- peg$currPos++;
2258
- } else {
2259
- s6 = peg$FAILED;
2260
- if (peg$silentFails === 0) {
2261
- peg$fail(peg$e24);
2262
- }
2263
- }
2264
- if (s6 !== peg$FAILED) {
2265
- while(s6 !== peg$FAILED){
2266
- s5.push(s6);
2267
- s6 = input.charAt(peg$currPos);
2268
- if (peg$r6.test(s6)) {
2269
- peg$currPos++;
2270
- } else {
2271
- s6 = peg$FAILED;
2272
- if (peg$silentFails === 0) {
2273
- peg$fail(peg$e24);
2274
- }
2275
- }
2276
- }
2277
- } else {
2278
- s5 = peg$FAILED;
2279
- }
2280
- if (s5 !== peg$FAILED) {
2281
- s4 = [
2282
- s4,
2283
- s5
2284
- ];
2285
- s3 = s4;
2286
- } else {
2287
- peg$currPos = s3;
2288
- s3 = peg$FAILED;
2289
- }
2290
- } else {
2291
- peg$currPos = s3;
2292
- s3 = peg$FAILED;
2293
- }
2294
- if (s3 === peg$FAILED) {
2295
- s3 = null;
2296
- }
2297
- s2 = [
2298
- s2,
2299
- s3
2300
- ];
2301
- s1 = s2;
2302
- } else {
2303
- peg$currPos = s1;
2304
- s1 = peg$FAILED;
2305
- }
2306
- if (s1 === peg$FAILED) {
2307
- s1 = peg$currPos;
2308
- if (input.charCodeAt(peg$currPos) === 46) {
2309
- s2 = peg$c14;
2310
- peg$currPos++;
2311
- } else {
2312
- s2 = peg$FAILED;
2313
- if (peg$silentFails === 0) {
2314
- peg$fail(peg$e17);
2315
- }
2316
- }
2317
- if (s2 !== peg$FAILED) {
2318
- s3 = [];
2319
- s4 = input.charAt(peg$currPos);
2320
- if (peg$r6.test(s4)) {
2321
- peg$currPos++;
2322
- } else {
2323
- s4 = peg$FAILED;
2324
- if (peg$silentFails === 0) {
2325
- peg$fail(peg$e24);
2326
- }
2327
- }
2328
- if (s4 !== peg$FAILED) {
2329
- while(s4 !== peg$FAILED){
2330
- s3.push(s4);
2331
- s4 = input.charAt(peg$currPos);
2332
- if (peg$r6.test(s4)) {
2333
- peg$currPos++;
2334
- } else {
2335
- s4 = peg$FAILED;
2336
- if (peg$silentFails === 0) {
2337
- peg$fail(peg$e24);
2338
- }
2339
- }
2340
- }
2341
- } else {
2342
- s3 = peg$FAILED;
2343
- }
2344
- if (s3 !== peg$FAILED) {
2345
- s2 = [
2346
- s2,
2347
- s3
2348
- ];
2349
- s1 = s2;
2350
- } else {
2351
- peg$currPos = s1;
2352
- s1 = peg$FAILED;
2353
- }
2354
- } else {
2355
- peg$currPos = s1;
2356
- s1 = peg$FAILED;
2357
- }
2358
- }
2359
- if (s1 !== peg$FAILED) {
2360
- peg$savedPos = s0;
2361
- s1 = peg$f21();
2362
- }
2363
- s0 = s1;
2364
- return s0;
2365
- }
2366
- function peg$parsestring() {
2367
- var s0, s1, s2, s3;
2368
- s0 = peg$currPos;
2369
- if (input.charCodeAt(peg$currPos) === 34) {
2370
- s1 = peg$c20;
2371
- peg$currPos++;
2372
- } else {
2373
- s1 = peg$FAILED;
2374
- if (peg$silentFails === 0) {
2375
- peg$fail(peg$e29);
2376
- }
2377
- }
2378
- if (s1 !== peg$FAILED) {
2379
- s2 = [];
2380
- s3 = peg$parsesingle_char();
2381
- while(s3 !== peg$FAILED){
2382
- s2.push(s3);
2383
- s3 = peg$parsesingle_char();
2384
- }
2385
- if (input.charCodeAt(peg$currPos) === 34) {
2386
- s3 = peg$c20;
2387
- peg$currPos++;
2388
- } else {
2389
- s3 = peg$FAILED;
2390
- if (peg$silentFails === 0) {
2391
- peg$fail(peg$e29);
2392
- }
2393
- }
2394
- if (s3 !== peg$FAILED) {
2395
- peg$savedPos = s0;
2396
- s0 = peg$f22(s2);
2397
- } else {
2398
- peg$currPos = s0;
2399
- s0 = peg$FAILED;
2400
- }
2401
- } else {
2402
- peg$currPos = s0;
2403
- s0 = peg$FAILED;
2404
- }
2405
- return s0;
2406
- }
2407
- function peg$parsesingle_char() {
2408
- var s0;
2409
- s0 = input.charAt(peg$currPos);
2410
- if (peg$r9.test(s0)) {
2411
- peg$currPos++;
2412
- } else {
2413
- s0 = peg$FAILED;
2414
- if (peg$silentFails === 0) {
2415
- peg$fail(peg$e30);
2416
- }
2417
- }
2418
- if (s0 === peg$FAILED) {
2419
- s0 = peg$parseescape_char();
2420
- }
2421
- return s0;
2422
- }
2423
- function peg$parseescape_char() {
2424
- var s0, s1, s2, s3, s4, s5;
2425
- s0 = peg$currPos;
2426
- if (input.substr(peg$currPos, 2) === peg$c21) {
2427
- s1 = peg$c21;
2428
- peg$currPos += 2;
2429
- } else {
2430
- s1 = peg$FAILED;
2431
- if (peg$silentFails === 0) {
2432
- peg$fail(peg$e31);
2433
- }
2434
- }
2435
- if (s1 !== peg$FAILED) {
2436
- peg$savedPos = s0;
2437
- s1 = peg$f23();
2438
- }
2439
- s0 = s1;
2440
- if (s0 === peg$FAILED) {
2441
- s0 = peg$currPos;
2442
- if (input.substr(peg$currPos, 2) === peg$c22) {
2443
- s1 = peg$c22;
2444
- peg$currPos += 2;
2445
- } else {
2446
- s1 = peg$FAILED;
2447
- if (peg$silentFails === 0) {
2448
- peg$fail(peg$e32);
2449
- }
2450
- }
2451
- if (s1 !== peg$FAILED) {
2452
- peg$savedPos = s0;
2453
- s1 = peg$f24();
2454
- }
2455
- s0 = s1;
2456
- if (s0 === peg$FAILED) {
2457
- s0 = peg$currPos;
2458
- if (input.substr(peg$currPos, 2) === peg$c23) {
2459
- s1 = peg$c23;
2460
- peg$currPos += 2;
2461
- } else {
2462
- s1 = peg$FAILED;
2463
- if (peg$silentFails === 0) {
2464
- peg$fail(peg$e33);
2465
- }
2466
- }
2467
- if (s1 !== peg$FAILED) {
2468
- peg$savedPos = s0;
2469
- s1 = peg$f25();
2470
- }
2471
- s0 = s1;
2472
- if (s0 === peg$FAILED) {
2473
- s0 = peg$currPos;
2474
- if (input.substr(peg$currPos, 2) === peg$c24) {
2475
- s1 = peg$c24;
2476
- peg$currPos += 2;
2477
- } else {
2478
- s1 = peg$FAILED;
2479
- if (peg$silentFails === 0) {
2480
- peg$fail(peg$e34);
2481
- }
2482
- }
2483
- if (s1 !== peg$FAILED) {
2484
- peg$savedPos = s0;
2485
- s1 = peg$f26();
2486
- }
2487
- s0 = s1;
2488
- if (s0 === peg$FAILED) {
2489
- s0 = peg$currPos;
2490
- if (input.substr(peg$currPos, 2) === peg$c25) {
2491
- s1 = peg$c25;
2492
- peg$currPos += 2;
2493
- } else {
2494
- s1 = peg$FAILED;
2495
- if (peg$silentFails === 0) {
2496
- peg$fail(peg$e35);
2497
- }
2498
- }
2499
- if (s1 !== peg$FAILED) {
2500
- peg$savedPos = s0;
2501
- s1 = peg$f27();
2502
- }
2503
- s0 = s1;
2504
- if (s0 === peg$FAILED) {
2505
- s0 = peg$currPos;
2506
- if (input.substr(peg$currPos, 2) === peg$c26) {
2507
- s1 = peg$c26;
2508
- peg$currPos += 2;
2509
- } else {
2510
- s1 = peg$FAILED;
2511
- if (peg$silentFails === 0) {
2512
- peg$fail(peg$e36);
2513
- }
2514
- }
2515
- if (s1 !== peg$FAILED) {
2516
- peg$savedPos = s0;
2517
- s1 = peg$f28();
2518
- }
2519
- s0 = s1;
2520
- if (s0 === peg$FAILED) {
2521
- s0 = peg$currPos;
2522
- if (input.substr(peg$currPos, 2) === peg$c27) {
2523
- s1 = peg$c27;
2524
- peg$currPos += 2;
2525
- } else {
2526
- s1 = peg$FAILED;
2527
- if (peg$silentFails === 0) {
2528
- peg$fail(peg$e37);
2529
- }
2530
- }
2531
- if (s1 !== peg$FAILED) {
2532
- peg$savedPos = s0;
2533
- s1 = peg$f29();
2534
- }
2535
- s0 = s1;
2536
- if (s0 === peg$FAILED) {
2537
- s0 = peg$currPos;
2538
- if (input.substr(peg$currPos, 2) === peg$c28) {
2539
- s1 = peg$c28;
2540
- peg$currPos += 2;
2541
- } else {
2542
- s1 = peg$FAILED;
2543
- if (peg$silentFails === 0) {
2544
- peg$fail(peg$e38);
2545
- }
2546
- }
2547
- if (s1 !== peg$FAILED) {
2548
- peg$savedPos = s0;
2549
- s1 = peg$f30();
2550
- }
2551
- s0 = s1;
2552
- if (s0 === peg$FAILED) {
2553
- s0 = peg$currPos;
2554
- if (input.substr(peg$currPos, 2) === peg$c29) {
2555
- s1 = peg$c29;
2556
- peg$currPos += 2;
2557
- } else {
2558
- s1 = peg$FAILED;
2559
- if (peg$silentFails === 0) {
2560
- peg$fail(peg$e39);
2561
- }
2562
- }
2563
- if (s1 !== peg$FAILED) {
2564
- peg$savedPos = s0;
2565
- s1 = peg$f31();
2566
- }
2567
- s0 = s1;
2568
- if (s0 === peg$FAILED) {
2569
- s0 = peg$currPos;
2570
- if (input.substr(peg$currPos, 2) === peg$c30) {
2571
- s1 = peg$c30;
2572
- peg$currPos += 2;
2573
- } else {
2574
- s1 = peg$FAILED;
2575
- if (peg$silentFails === 0) {
2576
- peg$fail(peg$e40);
2577
- }
2578
- }
2579
- if (s1 !== peg$FAILED) {
2580
- peg$savedPos = s0;
2581
- s1 = peg$f32();
2582
- }
2583
- s0 = s1;
2584
- if (s0 === peg$FAILED) {
2585
- s0 = peg$currPos;
2586
- if (input.substr(peg$currPos, 2) === peg$c31) {
2587
- s1 = peg$c31;
2588
- peg$currPos += 2;
2589
- } else {
2590
- s1 = peg$FAILED;
2591
- if (peg$silentFails === 0) {
2592
- peg$fail(peg$e41);
2593
- }
2594
- }
2595
- if (s1 !== peg$FAILED) {
2596
- s2 = peg$parsehex_digit();
2597
- if (s2 !== peg$FAILED) {
2598
- s3 = peg$parsehex_digit();
2599
- if (s3 !== peg$FAILED) {
2600
- s4 = peg$parsehex_digit();
2601
- if (s4 !== peg$FAILED) {
2602
- s5 = peg$parsehex_digit();
2603
- if (s5 !== peg$FAILED) {
2604
- peg$savedPos = s0;
2605
- s0 = peg$f33(s2, s3, s4, s5);
2606
- } else {
2607
- peg$currPos = s0;
2608
- s0 = peg$FAILED;
2609
- }
2610
- } else {
2611
- peg$currPos = s0;
2612
- s0 = peg$FAILED;
2613
- }
2614
- } else {
2615
- peg$currPos = s0;
2616
- s0 = peg$FAILED;
2617
- }
2618
- } else {
2619
- peg$currPos = s0;
2620
- s0 = peg$FAILED;
2621
- }
2622
- } else {
2623
- peg$currPos = s0;
2624
- s0 = peg$FAILED;
2625
- }
2626
- }
2627
- }
2628
- }
2629
- }
2630
- }
2631
- }
2632
- }
2633
- }
2634
- }
2635
- }
2636
- return s0;
2637
- }
2638
- function peg$parsehex_digit() {
2639
- var s0;
2640
- s0 = input.charAt(peg$currPos);
2641
- if (peg$r10.test(s0)) {
2642
- peg$currPos++;
2643
- } else {
2644
- s0 = peg$FAILED;
2645
- if (peg$silentFails === 0) {
2646
- peg$fail(peg$e42);
2647
- }
2648
- }
2649
- return s0;
2650
- }
2651
- function peg$parsebool() {
2652
- var s0, s1;
2653
- s0 = peg$currPos;
2654
- if (input.substr(peg$currPos, 4) === peg$c32) {
2655
- s1 = peg$c32;
2656
- peg$currPos += 4;
2657
- } else {
2658
- s1 = peg$FAILED;
2659
- if (peg$silentFails === 0) {
2660
- peg$fail(peg$e43);
2661
- }
2662
- }
2663
- if (s1 === peg$FAILED) {
2664
- if (input.substr(peg$currPos, 5) === peg$c33) {
2665
- s1 = peg$c33;
2666
- peg$currPos += 5;
2667
- } else {
2668
- s1 = peg$FAILED;
2669
- if (peg$silentFails === 0) {
2670
- peg$fail(peg$e44);
2671
- }
2672
- }
2673
- }
2674
- if (s1 !== peg$FAILED) {
2675
- peg$savedPos = s0;
2676
- s1 = peg$f34();
2677
- }
2678
- s0 = s1;
2679
- return s0;
2680
- }
2681
- function peg$parseint() {
2682
- var s0, s1, s2;
2683
- s0 = peg$currPos;
2684
- s1 = [];
2685
- s2 = input.charAt(peg$currPos);
2686
- if (peg$r6.test(s2)) {
2687
- peg$currPos++;
2688
- } else {
2689
- s2 = peg$FAILED;
2690
- if (peg$silentFails === 0) {
2691
- peg$fail(peg$e24);
2692
- }
2693
- }
2694
- if (s2 !== peg$FAILED) {
2695
- while(s2 !== peg$FAILED){
2696
- s1.push(s2);
2697
- s2 = input.charAt(peg$currPos);
2698
- if (peg$r6.test(s2)) {
2699
- peg$currPos++;
2700
- } else {
2701
- s2 = peg$FAILED;
2702
- if (peg$silentFails === 0) {
2703
- peg$fail(peg$e24);
2704
- }
2705
- }
2706
- }
2707
- } else {
2708
- s1 = peg$FAILED;
2709
- }
2710
- if (s1 !== peg$FAILED) {
2711
- peg$savedPos = s0;
2712
- s1 = peg$f35();
2713
- }
2714
- s0 = s1;
2715
- return s0;
2716
- }
2717
- function peg$parsefloat() {
2718
- var s0, s1, s2, s3, s4;
2719
- s0 = peg$currPos;
2720
- s1 = [];
2721
- s2 = input.charAt(peg$currPos);
2722
- if (peg$r6.test(s2)) {
2723
- peg$currPos++;
2724
- } else {
2725
- s2 = peg$FAILED;
2726
- if (peg$silentFails === 0) {
2727
- peg$fail(peg$e24);
2728
- }
2729
- }
2730
- if (s2 !== peg$FAILED) {
2731
- while(s2 !== peg$FAILED){
2732
- s1.push(s2);
2733
- s2 = input.charAt(peg$currPos);
2734
- if (peg$r6.test(s2)) {
2735
- peg$currPos++;
2736
- } else {
2737
- s2 = peg$FAILED;
2738
- if (peg$silentFails === 0) {
2739
- peg$fail(peg$e24);
2740
- }
2741
- }
2742
- }
2743
- } else {
2744
- s1 = peg$FAILED;
2745
- }
2746
- if (s1 !== peg$FAILED) {
2747
- if (input.charCodeAt(peg$currPos) === 46) {
2748
- s2 = peg$c14;
2749
- peg$currPos++;
2750
- } else {
2751
- s2 = peg$FAILED;
2752
- if (peg$silentFails === 0) {
2753
- peg$fail(peg$e17);
2754
- }
2755
- }
2756
- if (s2 !== peg$FAILED) {
2757
- s3 = [];
2758
- s4 = input.charAt(peg$currPos);
2759
- if (peg$r6.test(s4)) {
2760
- peg$currPos++;
2761
- } else {
2762
- s4 = peg$FAILED;
2763
- if (peg$silentFails === 0) {
2764
- peg$fail(peg$e24);
2765
- }
2766
- }
2767
- if (s4 !== peg$FAILED) {
2768
- while(s4 !== peg$FAILED){
2769
- s3.push(s4);
2770
- s4 = input.charAt(peg$currPos);
2771
- if (peg$r6.test(s4)) {
2772
- peg$currPos++;
2773
- } else {
2774
- s4 = peg$FAILED;
2775
- if (peg$silentFails === 0) {
2776
- peg$fail(peg$e24);
2777
- }
2778
- }
2779
- }
2780
- } else {
2781
- s3 = peg$FAILED;
2782
- }
2783
- if (s3 !== peg$FAILED) {
2784
- peg$savedPos = s0;
2785
- s0 = peg$f36();
2786
- } else {
2787
- peg$currPos = s0;
2788
- s0 = peg$FAILED;
2789
- }
2790
- } else {
2791
- peg$currPos = s0;
2792
- s0 = peg$FAILED;
2793
- }
2794
- } else {
2795
- peg$currPos = s0;
2796
- s0 = peg$FAILED;
2797
- }
2798
- return s0;
2799
- }
2800
- function peg$parsenull() {
2801
- var s0, s1;
2802
- s0 = peg$currPos;
2803
- if (input.substr(peg$currPos, 4) === peg$c34) {
2804
- s1 = peg$c34;
2805
- peg$currPos += 4;
2806
- } else {
2807
- s1 = peg$FAILED;
2808
- if (peg$silentFails === 0) {
2809
- peg$fail(peg$e45);
2810
- }
2811
- }
2812
- if (s1 !== peg$FAILED) {
2813
- peg$savedPos = s0;
2814
- s1 = peg$f37();
2815
- }
2816
- s0 = s1;
2817
- return s0;
2818
- }
2819
- function peg$parseident_start() {
2820
- var s0;
2821
- s0 = input.charAt(peg$currPos);
2822
- if (peg$r11.test(s0)) {
2823
- peg$currPos++;
2824
- } else {
2825
- s0 = peg$FAILED;
2826
- if (peg$silentFails === 0) {
2827
- peg$fail(peg$e46);
2828
- }
2829
- }
2830
- return s0;
2831
- }
2832
- function peg$parseKW_OR() {
2833
- var s0, s1, s2, s3;
2834
- s0 = peg$currPos;
2835
- if (input.substr(peg$currPos, 2) === peg$c35) {
2836
- s1 = peg$c35;
2837
- peg$currPos += 2;
2838
- } else {
2839
- s1 = peg$FAILED;
2840
- if (peg$silentFails === 0) {
2841
- peg$fail(peg$e47);
2842
- }
2843
- }
2844
- if (s1 !== peg$FAILED) {
2845
- s2 = peg$currPos;
2846
- peg$silentFails++;
2847
- s3 = peg$parseident_start();
2848
- peg$silentFails--;
2849
- if (s3 === peg$FAILED) {
2850
- s2 = undefined;
2851
- } else {
2852
- peg$currPos = s2;
2853
- s2 = peg$FAILED;
2854
- }
2855
- if (s2 !== peg$FAILED) {
2856
- s1 = [
2857
- s1,
2858
- s2
2859
- ];
2860
- s0 = s1;
2861
- } else {
2862
- peg$currPos = s0;
2863
- s0 = peg$FAILED;
2864
- }
2865
- } else {
2866
- peg$currPos = s0;
2867
- s0 = peg$FAILED;
2868
- }
2869
- return s0;
2870
- }
2871
- function peg$parseKW_AND() {
2872
- var s0, s1, s2, s3;
2873
- s0 = peg$currPos;
2874
- if (input.substr(peg$currPos, 3) === peg$c36) {
2875
- s1 = peg$c36;
2876
- peg$currPos += 3;
2877
- } else {
2878
- s1 = peg$FAILED;
2879
- if (peg$silentFails === 0) {
2880
- peg$fail(peg$e48);
2881
- }
2882
- }
2883
- if (s1 !== peg$FAILED) {
2884
- s2 = peg$currPos;
2885
- peg$silentFails++;
2886
- s3 = peg$parseident_start();
2887
- peg$silentFails--;
2888
- if (s3 === peg$FAILED) {
2889
- s2 = undefined;
2890
- } else {
2891
- peg$currPos = s2;
2892
- s2 = peg$FAILED;
2893
- }
2894
- if (s2 !== peg$FAILED) {
2895
- s1 = [
2896
- s1,
2897
- s2
2898
- ];
2899
- s0 = s1;
2900
- } else {
2901
- peg$currPos = s0;
2902
- s0 = peg$FAILED;
2903
- }
2904
- } else {
2905
- peg$currPos = s0;
2906
- s0 = peg$FAILED;
2907
- }
2908
- return s0;
2909
- }
2910
- function peg$parseKW_NOT() {
2911
- var s0, s1, s2, s3;
2912
- s0 = peg$currPos;
2913
- if (input.substr(peg$currPos, 3) === peg$c37) {
2914
- s1 = peg$c37;
2915
- peg$currPos += 3;
2916
- } else {
2917
- s1 = peg$FAILED;
2918
- if (peg$silentFails === 0) {
2919
- peg$fail(peg$e49);
2920
- }
2921
- }
2922
- if (s1 !== peg$FAILED) {
2923
- s2 = peg$currPos;
2924
- peg$silentFails++;
2925
- s3 = peg$parseident_start();
2926
- peg$silentFails--;
2927
- if (s3 === peg$FAILED) {
2928
- s2 = undefined;
2929
- } else {
2930
- peg$currPos = s2;
2931
- s2 = peg$FAILED;
2932
- }
2933
- if (s2 !== peg$FAILED) {
2934
- s1 = [
2935
- s1,
2936
- s2
2937
- ];
2938
- s0 = s1;
2939
- } else {
2940
- peg$currPos = s0;
2941
- s0 = peg$FAILED;
2942
- }
2943
- } else {
2944
- peg$currPos = s0;
2945
- s0 = peg$FAILED;
2946
- }
2947
- return s0;
2948
- }
2949
- function peg$parse_() {
2950
- var s0, s1, s2;
2951
- peg$silentFails++;
2952
- s0 = peg$currPos;
2953
- s1 = [];
2954
- s2 = peg$parsewhite();
2955
- while(s2 !== peg$FAILED){
2956
- s1.push(s2);
2957
- s2 = peg$parsewhite();
2958
- }
2959
- peg$savedPos = s0;
2960
- s1 = peg$f38();
2961
- s0 = s1;
2962
- peg$silentFails--;
2963
- s1 = peg$FAILED;
2964
- if (peg$silentFails === 0) {
2965
- peg$fail(peg$e50);
2966
- }
2967
- return s0;
2968
- }
2969
- function peg$parse__() {
2970
- var s0, s1, s2;
2971
- peg$silentFails++;
2972
- s0 = peg$currPos;
2973
- s1 = [];
2974
- s2 = peg$parsewhite();
2975
- if (s2 !== peg$FAILED) {
2976
- while(s2 !== peg$FAILED){
2977
- s1.push(s2);
2978
- s2 = peg$parsewhite();
2979
- }
2980
- } else {
2981
- s1 = peg$FAILED;
2982
- }
2983
- if (s1 !== peg$FAILED) {
2984
- peg$savedPos = s0;
2985
- s1 = peg$f39();
2986
- }
2987
- s0 = s1;
2988
- peg$silentFails--;
2989
- if (s0 === peg$FAILED) {
2990
- s1 = peg$FAILED;
2991
- if (peg$silentFails === 0) {
2992
- peg$fail(peg$e50);
2993
- }
2994
- }
2995
- return s0;
2996
- }
2997
- function peg$parsewhite() {
2998
- var s0;
2999
- s0 = input.charAt(peg$currPos);
3000
- if (peg$r12.test(s0)) {
3001
- peg$currPos++;
3002
- } else {
3003
- s0 = peg$FAILED;
3004
- if (peg$silentFails === 0) {
3005
- peg$fail(peg$e51);
3006
- }
3007
- }
3008
- return s0;
3009
- }
3010
- function peg$parseEOF() {
3011
- var s0, s1;
3012
- s0 = peg$currPos;
3013
- peg$silentFails++;
3014
- if (input.length > peg$currPos) {
3015
- s1 = input.charAt(peg$currPos);
3016
- peg$currPos++;
3017
- } else {
3018
- s1 = peg$FAILED;
3019
- if (peg$silentFails === 0) {
3020
- peg$fail(peg$e52);
3021
- }
3022
- }
3023
- peg$silentFails--;
3024
- if (s1 === peg$FAILED) {
3025
- s0 = undefined;
3026
- } else {
3027
- peg$currPos = s0;
3028
- s0 = peg$FAILED;
3029
- }
3030
- return s0;
3031
- }
3032
- const OPERATORS = {
3033
- ":": "match",
3034
- ":=": "eq",
3035
- ":!=": "ne",
3036
- ":>": "gt",
3037
- ":>=": "gte",
3038
- ":<": "lt",
3039
- ":<=": "lte"
3040
- };
3041
- peg$result = peg$startRuleFunction();
3042
- if (options.peg$library) {
3043
- return /** @type {any} */ {
3044
- peg$result,
3045
- peg$currPos,
3046
- peg$FAILED,
3047
- peg$maxFailExpected,
3048
- peg$maxFailPos
3049
- };
3050
- }
3051
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
3052
- return peg$result;
3053
- } else {
3054
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
3055
- peg$fail(peg$endExpectation());
3056
- }
3057
- throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
3058
- }
3059
- }
3060
- const peg$allowedStartRules = [
3061
- "Main"
3062
- ];
3063
- export { peg$allowedStartRules as StartRules, peg$SyntaxError as SyntaxError, peg$parse as parse };
3064
-
3065
- //# sourceMappingURL=parser.js.map