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