@formique/semantq 1.0.9 → 1.0.11

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.
package/LowCodeParser.js CHANGED
@@ -172,20 +172,21 @@ function peg$parse(input, options) {
172
172
  const peg$c5 = "-";
173
173
  const peg$c6 = ",";
174
174
 
175
- const peg$r0 = /^[^s:\r\n]/;
175
+ const peg$r0 = /^[^,\r\n]/;
176
176
  const peg$r1 = /^[^"]/;
177
177
  const peg$r2 = /^[0-9]/;
178
178
  const peg$r3 = /^[a-zA-Z0-9_\-]/;
179
179
  const peg$r4 = /^[!*]/;
180
180
  const peg$r5 = /^[a-zA-Z]/;
181
- const peg$r6 = /^[^,\r\n]/;
181
+ const peg$r6 = /^[a-zA-Z0-9_ \-]/;
182
182
  const peg$r7 = /^[ \t\n\r]/;
183
183
  const peg$r8 = /^[a-zA-Z_]/;
184
+ const peg$r9 = /^[a-zA-Z0-9_.\/:\-?&=()@#%+![\] ]/;
184
185
 
185
186
  const peg$e0 = peg$otherExpectation("form directive must be in this format: @form: form-name");
186
187
  const peg$e1 = peg$literalExpectation("@form:", false);
187
188
  const peg$e2 = peg$literalExpectation(":", false);
188
- const peg$e3 = peg$classExpectation(["s", ":", "\r", "\n"], true, false, false);
189
+ const peg$e3 = peg$classExpectation([",", "\r", "\n"], true, false, false);
189
190
  const peg$e4 = peg$literalExpectation("\"", false);
190
191
  const peg$e5 = peg$classExpectation(["\""], true, false, false);
191
192
  const peg$e6 = peg$literalExpectation("true", false);
@@ -194,115 +195,135 @@ function peg$parse(input, options) {
194
195
  const peg$e9 = peg$literalExpectation("-", false);
195
196
  const peg$e10 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
196
197
  const peg$e11 = peg$classExpectation(["!", "*"], false, false, false);
197
- const peg$e12 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
198
- const peg$e13 = peg$literalExpectation(",", false);
199
- const peg$e14 = peg$classExpectation([",", "\r", "\n"], true, false, false);
198
+ const peg$e12 = peg$literalExpectation(",", false);
199
+ const peg$e13 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
200
+ const peg$e14 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", " ", "-"], false, false, false);
200
201
  const peg$e15 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false, false);
201
202
  const peg$e16 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
203
+ const peg$e17 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", ".", "/", ":", "-", "?", "&", "=", "(", ")", "@", "#", "%", "+", "!", "[", "]", " "], false, false, false);
202
204
 
203
- function peg$f0(name, properties) {
204
- return createNode('FormDirective', location().start, location().end, {
205
- name: name,
206
- properties: properties
207
- })
205
+ function peg$f0(definition) {
206
+ // definition is already a filtered array from the rule below.
207
+ return definition;
208
+ }
209
+ function peg$f1(directive, fields) {
210
+ // 1. Start with the mandatory FormDirective node.
211
+ const result = [directive];
212
+
213
+ // 2. Conditionally add the optional FormFields node.
214
+ if (fields) {
215
+ result.push(fields);
216
+ }
217
+
218
+ // 3. Return only the array of meaningful nodes, filtering out the '_' match.
219
+ return result;
208
220
  }
209
- function peg$f1(props) {
210
- const properties = [];
211
- for (const prop of props) {
212
- if (prop[0] && prop[0].type) properties.push(prop[0]);
213
- }
214
- return createNode('FormProperties', location().start, location().end, {
215
- properties: properties
216
- })
221
+ function peg$f2(name, properties) {
222
+ // No change needed here, as it returns a single, well-formed object.
223
+ return createNode('FormDirective', location().start, location().end, {
224
+ name: name,
225
+ properties: properties
226
+ })
217
227
  }
218
- function peg$f2(key, value) {
228
+ function peg$f3(props) {
229
+ const properties = [];
230
+ for (const prop of props) {
231
+ if (prop[0] && prop[0].type) properties.push(prop[0]);
232
+ }
233
+ return createNode('FormProperties', location().start, location().end, {
234
+ properties: properties
235
+ })
236
+ }
237
+ function peg$f4(key, value) {
219
238
  return createNode('FormProperty', location().start, location().end, {
220
- key: key,
221
- value: value
239
+ key: key,
240
+ value: value
222
241
  })
223
242
  }
224
- function peg$f3() { // Now allows @ symbols
225
- return createNode('StringLiteral', location().start, location().end, {
226
- value: text()
227
- })
243
+ function peg$f5() { // 💡 FIX: Match one or more characters until a comma or newline is found.
244
+ // We also trim to ensure leading/trailing spaces aren't included in the value
245
+ return createNode('StringLiteral', location().start, location().end, {
246
+ value: text().trim()
247
+ })
228
248
  }
229
- function peg$f4() {
249
+ function peg$f6() {
230
250
  return createNode('StringLiteral', location().start, location().end, {
231
- value: text().slice(1, -1)
251
+ value: text().slice(1, -1)
232
252
  })
233
253
  }
234
- function peg$f5() {
254
+ function peg$f7() {
235
255
  return createNode('BooleanLiteral', location().start, location().end, {
236
- value: text() === "true"
256
+ value: text() === "true"
237
257
  })
238
258
  }
239
- function peg$f6() {
259
+ function peg$f8() {
240
260
  return createNode('NumberLiteral', location().start, location().end, {
241
- value: parseInt(text(), 10)
261
+ value: parseInt(text(), 10)
242
262
  })
243
263
  }
244
- function peg$f7(fields) {
264
+ function peg$f9(fields) {
245
265
  return createNode('FormFields', location().start, location().end, {
246
- fields: fields
266
+ fields: fields
247
267
  })
248
268
  }
249
- function peg$f8(name, attributes) {
269
+ function peg$f10(name, attributes) {
250
270
  return createNode('FormField', location().start, location().end, {
251
- name: name,
252
- attributes: attributes || []
271
+ name: name,
272
+ attributes: attributes || []
253
273
  })
254
274
  }
255
- function peg$f9(markers, name, markers2) {
275
+ function peg$f11(markers, name, markers2) {
256
276
  return (markers || '') + name + (markers2 || '')
257
277
  }
258
- function peg$f10(name, namePart, name2, type) {
278
+ function peg$f12(name, namePart, name2, type) {
259
279
  return (name || '') + namePart.join('') + ':' + type.join('')
260
280
  }
261
- function peg$f11() { return text() }
262
- function peg$f12() { return text() }
263
- function peg$f13(attrs) {
264
- return attrs.map(attr => attr[1])
281
+ function peg$f13() { return text() }
282
+ function peg$f14() { return text() }
283
+ function peg$f15(attrs) {
284
+ return attrs.map(attr => attr[1])
265
285
  }
266
- function peg$f14(key, value) {
286
+ function peg$f16(key, value) { // Consumes trailing spaces/newlines
267
287
  return createNode('FieldAttribute', location().start, location().end, {
268
- key: key,
269
- value: value
288
+ key: key, // 💡 FIX: Removed .value, since AttributeKey returns a string
289
+ value: value
270
290
  })
271
291
  }
272
- function peg$f15(flag) {
292
+ function peg$f17(flag) {
273
293
  return createNode('FieldAttribute', location().start, location().end, {
274
- key: flag,
275
- value: true
294
+ key: flag,
295
+ value: createNode('BooleanLiteral', location().start, location().end, { value: true })
276
296
  })
277
297
  }
278
- function peg$f16() { return text() }
279
- function peg$f17() { return text() }
280
298
  function peg$f18(key, values) {
281
299
  return createNode('OptionsAttribute', location().start, location().end, {
282
- values: values
300
+ key: key, // 💡 FIX: Removed .value, since AttributeKey returns a string
301
+ values: values
283
302
  })
284
303
  }
285
304
  function peg$f19(head, tail) {
286
- const options = [head];
287
- for (const item of tail) {
288
- options.push(item[3]); // Get the Option from the tail items
289
- }
290
- return options;
305
+ const options = [head];
306
+ // The tail is an array of [whitespace, comma, whitespace, Option] tuples.
307
+ for (const item of tail) {
308
+ options.push(item[3]); // item[3] is the Option node
309
+ }
310
+ return options;
291
311
  }
292
312
  function peg$f20(value) {
293
313
  return createNode('Option', location().start, location().end, {
294
- value: value.join(''),
295
- quoted: true
314
+ value: value.value, // Extract the value from the AttributeValue node
315
+ quoted: value.type === 'StringLiteral' // Check if it was a quoted string
296
316
  })
297
317
  }
298
- function peg$f21(value) {
299
- return createNode('Option', location().start, location().end, {
300
- value: text().trim(),
301
- quoted: false
302
- })
318
+ function peg$f21() { return text() }
319
+ function peg$f22() { return text() }
320
+ function peg$f23() {
321
+ return createNode('Identifier', location().start, location().end, { value: text() })
303
322
  }
304
- function peg$f22() {
305
- return createNode('Identifier', location().start, location().end, { value: text() })
323
+ function peg$f24(head, tail) { // 💡 FIX: Added space ' '
324
+ return createNode('StringLiteral', location().start, location().end, {
325
+ value: text() // Returns the entire matched text
326
+ })
306
327
  }
307
328
  let peg$currPos = options.peg$currPos | 0;
308
329
  let peg$savedPos = peg$currPos;
@@ -475,9 +496,18 @@ function peg$parse(input, options) {
475
496
  }
476
497
 
477
498
  function peg$parsestart() {
478
- let s0;
499
+ let s0, s1, s2;
479
500
 
480
- s0 = peg$parseformDefinition();
501
+ s0 = peg$currPos;
502
+ s1 = peg$parse_();
503
+ s2 = peg$parseformDefinition();
504
+ if (s2 !== peg$FAILED) {
505
+ peg$savedPos = s0;
506
+ s0 = peg$f0(s2);
507
+ } else {
508
+ peg$currPos = s0;
509
+ s0 = peg$FAILED;
510
+ }
481
511
 
482
512
  return s0;
483
513
  }
@@ -493,8 +523,8 @@ function peg$parse(input, options) {
493
523
  if (s3 === peg$FAILED) {
494
524
  s3 = null;
495
525
  }
496
- s1 = [s1, s2, s3];
497
- s0 = s1;
526
+ peg$savedPos = s0;
527
+ s0 = peg$f1(s1, s3);
498
528
  } else {
499
529
  peg$currPos = s0;
500
530
  s0 = peg$FAILED;
@@ -522,7 +552,7 @@ function peg$parse(input, options) {
522
552
  s4 = peg$parse_();
523
553
  s5 = peg$parseformProperties();
524
554
  peg$savedPos = s0;
525
- s0 = peg$f0(s3, s5);
555
+ s0 = peg$f2(s3, s5);
526
556
  } else {
527
557
  peg$currPos = s0;
528
558
  s0 = peg$FAILED;
@@ -569,7 +599,7 @@ function peg$parse(input, options) {
569
599
  }
570
600
  }
571
601
  peg$savedPos = s0;
572
- s1 = peg$f1(s1);
602
+ s1 = peg$f3(s1);
573
603
  s0 = s1;
574
604
 
575
605
  return s0;
@@ -593,7 +623,7 @@ function peg$parse(input, options) {
593
623
  s4 = peg$parsePropertyValue();
594
624
  if (s4 !== peg$FAILED) {
595
625
  peg$savedPos = s0;
596
- s0 = peg$f2(s1, s4);
626
+ s0 = peg$f4(s1, s4);
597
627
  } else {
598
628
  peg$currPos = s0;
599
629
  s0 = peg$FAILED;
@@ -613,7 +643,7 @@ function peg$parse(input, options) {
613
643
  function peg$parsePropertyValue() {
614
644
  let s0;
615
645
 
616
- s0 = peg$parseUnquotedString();
646
+ s0 = peg$parseUnquotedAttributeString();
617
647
  if (s0 === peg$FAILED) {
618
648
  s0 = peg$parseStringLiteral();
619
649
  if (s0 === peg$FAILED) {
@@ -630,7 +660,7 @@ function peg$parse(input, options) {
630
660
  return s0;
631
661
  }
632
662
 
633
- function peg$parseUnquotedString() {
663
+ function peg$parseUnquotedAttributeString() {
634
664
  let s0, s1, s2;
635
665
 
636
666
  s0 = peg$currPos;
@@ -658,7 +688,7 @@ function peg$parse(input, options) {
658
688
  }
659
689
  if (s1 !== peg$FAILED) {
660
690
  peg$savedPos = s0;
661
- s1 = peg$f3();
691
+ s1 = peg$f5();
662
692
  }
663
693
  s0 = s1;
664
694
 
@@ -704,7 +734,7 @@ function peg$parse(input, options) {
704
734
  }
705
735
  if (s3 !== peg$FAILED) {
706
736
  peg$savedPos = s0;
707
- s0 = peg$f4();
737
+ s0 = peg$f6();
708
738
  } else {
709
739
  peg$currPos = s0;
710
740
  s0 = peg$FAILED;
@@ -739,7 +769,7 @@ function peg$parse(input, options) {
739
769
  }
740
770
  if (s1 !== peg$FAILED) {
741
771
  peg$savedPos = s0;
742
- s1 = peg$f5();
772
+ s1 = peg$f7();
743
773
  }
744
774
  s0 = s1;
745
775
 
@@ -774,7 +804,7 @@ function peg$parse(input, options) {
774
804
  }
775
805
  if (s1 !== peg$FAILED) {
776
806
  peg$savedPos = s0;
777
- s1 = peg$f6();
807
+ s1 = peg$f8();
778
808
  }
779
809
  s0 = s1;
780
810
 
@@ -798,7 +828,7 @@ function peg$parse(input, options) {
798
828
  }
799
829
  if (s2 !== peg$FAILED) {
800
830
  peg$savedPos = s0;
801
- s0 = peg$f7(s2);
831
+ s0 = peg$f9(s2);
802
832
  } else {
803
833
  peg$currPos = s0;
804
834
  s0 = peg$FAILED;
@@ -825,7 +855,7 @@ function peg$parse(input, options) {
825
855
  s4 = peg$parseFieldAttributes();
826
856
  s5 = peg$parse_();
827
857
  peg$savedPos = s0;
828
- s0 = peg$f8(s3, s4);
858
+ s0 = peg$f10(s3, s4);
829
859
  } else {
830
860
  peg$currPos = s0;
831
861
  s0 = peg$FAILED;
@@ -857,7 +887,7 @@ function peg$parse(input, options) {
857
887
  }
858
888
  s7 = peg$parse_();
859
889
  peg$savedPos = s0;
860
- s0 = peg$f9(s2, s4, s6);
890
+ s0 = peg$f11(s2, s4, s6);
861
891
  } else {
862
892
  peg$currPos = s0;
863
893
  s0 = peg$FAILED;
@@ -878,7 +908,7 @@ function peg$parse(input, options) {
878
908
  }
879
909
 
880
910
  function peg$parseNameWithType() {
881
- let s0, s1, s2, s3, s4, s5, s6, s7;
911
+ let s0, s1, s2, s3, s4, s5, s6;
882
912
 
883
913
  s0 = peg$currPos;
884
914
  s1 = peg$parseFieldMarkers();
@@ -920,32 +950,31 @@ function peg$parse(input, options) {
920
950
  if (peg$silentFails === 0) { peg$fail(peg$e2); }
921
951
  }
922
952
  if (s4 !== peg$FAILED) {
923
- s5 = peg$parse_();
924
- s6 = [];
925
- s7 = input.charAt(peg$currPos);
926
- if (peg$r3.test(s7)) {
953
+ s5 = [];
954
+ s6 = input.charAt(peg$currPos);
955
+ if (peg$r3.test(s6)) {
927
956
  peg$currPos++;
928
957
  } else {
929
- s7 = peg$FAILED;
958
+ s6 = peg$FAILED;
930
959
  if (peg$silentFails === 0) { peg$fail(peg$e10); }
931
960
  }
932
- if (s7 !== peg$FAILED) {
933
- while (s7 !== peg$FAILED) {
934
- s6.push(s7);
935
- s7 = input.charAt(peg$currPos);
936
- if (peg$r3.test(s7)) {
961
+ if (s6 !== peg$FAILED) {
962
+ while (s6 !== peg$FAILED) {
963
+ s5.push(s6);
964
+ s6 = input.charAt(peg$currPos);
965
+ if (peg$r3.test(s6)) {
937
966
  peg$currPos++;
938
967
  } else {
939
- s7 = peg$FAILED;
968
+ s6 = peg$FAILED;
940
969
  if (peg$silentFails === 0) { peg$fail(peg$e10); }
941
970
  }
942
971
  }
943
972
  } else {
944
- s6 = peg$FAILED;
973
+ s5 = peg$FAILED;
945
974
  }
946
- if (s6 !== peg$FAILED) {
975
+ if (s5 !== peg$FAILED) {
947
976
  peg$savedPos = s0;
948
- s0 = peg$f10(s1, s2, s3, s6);
977
+ s0 = peg$f12(s1, s2, s3, s5);
949
978
  } else {
950
979
  peg$currPos = s0;
951
980
  s0 = peg$FAILED;
@@ -990,7 +1019,7 @@ function peg$parse(input, options) {
990
1019
  }
991
1020
  if (s1 !== peg$FAILED) {
992
1021
  peg$savedPos = s0;
993
- s1 = peg$f11();
1022
+ s1 = peg$f13();
994
1023
  }
995
1024
  s0 = s1;
996
1025
 
@@ -1025,7 +1054,7 @@ function peg$parse(input, options) {
1025
1054
  }
1026
1055
  if (s1 !== peg$FAILED) {
1027
1056
  peg$savedPos = s0;
1028
- s1 = peg$f12();
1057
+ s1 = peg$f14();
1029
1058
  }
1030
1059
  s0 = s1;
1031
1060
 
@@ -1061,7 +1090,7 @@ function peg$parse(input, options) {
1061
1090
  }
1062
1091
  }
1063
1092
  peg$savedPos = s0;
1064
- s1 = peg$f13(s1);
1093
+ s1 = peg$f15(s1);
1065
1094
  s0 = s1;
1066
1095
 
1067
1096
  return s0;
@@ -1079,7 +1108,7 @@ function peg$parse(input, options) {
1079
1108
  }
1080
1109
 
1081
1110
  function peg$parseRegularAttribute() {
1082
- let s0, s1, s2, s3, s4;
1111
+ let s0, s1, s2, s3, s4, s5;
1083
1112
 
1084
1113
  s0 = peg$currPos;
1085
1114
  s1 = peg$parseAttributeKey();
@@ -1095,8 +1124,9 @@ function peg$parse(input, options) {
1095
1124
  s3 = peg$parse_();
1096
1125
  s4 = peg$parseAttributeValue();
1097
1126
  if (s4 !== peg$FAILED) {
1127
+ s5 = peg$parse_();
1098
1128
  peg$savedPos = s0;
1099
- s0 = peg$f14(s1, s4);
1129
+ s0 = peg$f16(s1, s4);
1100
1130
  } else {
1101
1131
  peg$currPos = s0;
1102
1132
  s0 = peg$FAILED;
@@ -1113,110 +1143,13 @@ function peg$parse(input, options) {
1113
1143
  s0 = peg$currPos;
1114
1144
  s1 = peg$parseAttributeFlag();
1115
1145
  if (s1 !== peg$FAILED) {
1146
+ s2 = peg$parse_();
1116
1147
  peg$savedPos = s0;
1117
- s1 = peg$f15(s1);
1118
- }
1119
- s0 = s1;
1120
- }
1121
-
1122
- return s0;
1123
- }
1124
-
1125
- function peg$parseAttributeKey() {
1126
- let s0, s1, s2, s3;
1127
-
1128
- s0 = peg$currPos;
1129
- s1 = input.charAt(peg$currPos);
1130
- if (peg$r5.test(s1)) {
1131
- peg$currPos++;
1132
- } else {
1133
- s1 = peg$FAILED;
1134
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1135
- }
1136
- if (s1 !== peg$FAILED) {
1137
- s2 = [];
1138
- s3 = input.charAt(peg$currPos);
1139
- if (peg$r3.test(s3)) {
1140
- peg$currPos++;
1148
+ s0 = peg$f17(s1);
1141
1149
  } else {
1142
- s3 = peg$FAILED;
1143
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
1144
- }
1145
- while (s3 !== peg$FAILED) {
1146
- s2.push(s3);
1147
- s3 = input.charAt(peg$currPos);
1148
- if (peg$r3.test(s3)) {
1149
- peg$currPos++;
1150
- } else {
1151
- s3 = peg$FAILED;
1152
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
1153
- }
1154
- }
1155
- peg$savedPos = s0;
1156
- s0 = peg$f16();
1157
- } else {
1158
- peg$currPos = s0;
1159
- s0 = peg$FAILED;
1160
- }
1161
-
1162
- return s0;
1163
- }
1164
-
1165
- function peg$parseAttributeValue() {
1166
- let s0;
1167
-
1168
- s0 = peg$parseStringLiteral();
1169
- if (s0 === peg$FAILED) {
1170
- s0 = peg$parseBooleanLiteral();
1171
- if (s0 === peg$FAILED) {
1172
- s0 = peg$parseNumberLiteral();
1173
- if (s0 === peg$FAILED) {
1174
- s0 = peg$parseIdentifier();
1175
- if (s0 === peg$FAILED) {
1176
- s0 = peg$parseUnquotedString();
1177
- }
1178
- }
1179
- }
1180
- }
1181
-
1182
- return s0;
1183
- }
1184
-
1185
- function peg$parseAttributeFlag() {
1186
- let s0, s1, s2, s3;
1187
-
1188
- s0 = peg$currPos;
1189
- s1 = input.charAt(peg$currPos);
1190
- if (peg$r5.test(s1)) {
1191
- peg$currPos++;
1192
- } else {
1193
- s1 = peg$FAILED;
1194
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1195
- }
1196
- if (s1 !== peg$FAILED) {
1197
- s2 = [];
1198
- s3 = input.charAt(peg$currPos);
1199
- if (peg$r3.test(s3)) {
1200
- peg$currPos++;
1201
- } else {
1202
- s3 = peg$FAILED;
1203
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
1204
- }
1205
- while (s3 !== peg$FAILED) {
1206
- s2.push(s3);
1207
- s3 = input.charAt(peg$currPos);
1208
- if (peg$r3.test(s3)) {
1209
- peg$currPos++;
1210
- } else {
1211
- s3 = peg$FAILED;
1212
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
1213
- }
1150
+ peg$currPos = s0;
1151
+ s0 = peg$FAILED;
1214
1152
  }
1215
- peg$savedPos = s0;
1216
- s0 = peg$f17();
1217
- } else {
1218
- peg$currPos = s0;
1219
- s0 = peg$FAILED;
1220
1153
  }
1221
1154
 
1222
1155
  return s0;
@@ -1226,7 +1159,7 @@ function peg$parse(input, options) {
1226
1159
  let s0, s1, s2, s3, s4;
1227
1160
 
1228
1161
  s0 = peg$currPos;
1229
- s1 = peg$parseIdentifier();
1162
+ s1 = peg$parseAttributeKey();
1230
1163
  if (s1 !== peg$FAILED) {
1231
1164
  if (input.charCodeAt(peg$currPos) === 58) {
1232
1165
  s2 = peg$c1;
@@ -1271,7 +1204,7 @@ function peg$parse(input, options) {
1271
1204
  peg$currPos++;
1272
1205
  } else {
1273
1206
  s5 = peg$FAILED;
1274
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1207
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1275
1208
  }
1276
1209
  if (s5 !== peg$FAILED) {
1277
1210
  s6 = peg$parse_();
@@ -1287,34 +1220,43 @@ function peg$parse(input, options) {
1287
1220
  peg$currPos = s3;
1288
1221
  s3 = peg$FAILED;
1289
1222
  }
1290
- while (s3 !== peg$FAILED) {
1291
- s2.push(s3);
1292
- s3 = peg$currPos;
1293
- s4 = peg$parse_();
1294
- if (input.charCodeAt(peg$currPos) === 44) {
1295
- s5 = peg$c6;
1296
- peg$currPos++;
1297
- } else {
1298
- s5 = peg$FAILED;
1299
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1300
- }
1301
- if (s5 !== peg$FAILED) {
1302
- s6 = peg$parse_();
1303
- s7 = peg$parseOption();
1304
- if (s7 !== peg$FAILED) {
1305
- s4 = [s4, s5, s6, s7];
1306
- s3 = s4;
1223
+ if (s3 !== peg$FAILED) {
1224
+ while (s3 !== peg$FAILED) {
1225
+ s2.push(s3);
1226
+ s3 = peg$currPos;
1227
+ s4 = peg$parse_();
1228
+ if (input.charCodeAt(peg$currPos) === 44) {
1229
+ s5 = peg$c6;
1230
+ peg$currPos++;
1231
+ } else {
1232
+ s5 = peg$FAILED;
1233
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1234
+ }
1235
+ if (s5 !== peg$FAILED) {
1236
+ s6 = peg$parse_();
1237
+ s7 = peg$parseOption();
1238
+ if (s7 !== peg$FAILED) {
1239
+ s4 = [s4, s5, s6, s7];
1240
+ s3 = s4;
1241
+ } else {
1242
+ peg$currPos = s3;
1243
+ s3 = peg$FAILED;
1244
+ }
1307
1245
  } else {
1308
1246
  peg$currPos = s3;
1309
1247
  s3 = peg$FAILED;
1310
1248
  }
1311
- } else {
1312
- peg$currPos = s3;
1313
- s3 = peg$FAILED;
1314
1249
  }
1250
+ } else {
1251
+ s2 = peg$FAILED;
1252
+ }
1253
+ if (s2 !== peg$FAILED) {
1254
+ peg$savedPos = s0;
1255
+ s0 = peg$f19(s1, s2);
1256
+ } else {
1257
+ peg$currPos = s0;
1258
+ s0 = peg$FAILED;
1315
1259
  }
1316
- peg$savedPos = s0;
1317
- s0 = peg$f19(s1, s2);
1318
1260
  } else {
1319
1261
  peg$currPos = s0;
1320
1262
  s0 = peg$FAILED;
@@ -1323,70 +1265,66 @@ function peg$parse(input, options) {
1323
1265
  return s0;
1324
1266
  }
1325
1267
 
1326
- function peg$parseOption() {
1268
+ function peg$parseAttributeValue() {
1327
1269
  let s0;
1328
1270
 
1329
- s0 = peg$parseQuotedOption();
1271
+ s0 = peg$parseExtendedIdentifier();
1330
1272
  if (s0 === peg$FAILED) {
1331
- s0 = peg$parseUnquotedOption();
1273
+ s0 = peg$parseStringLiteral();
1274
+ if (s0 === peg$FAILED) {
1275
+ s0 = peg$parseUnquotedAttributeString();
1276
+ }
1277
+ }
1278
+
1279
+ return s0;
1280
+ }
1281
+
1282
+ function peg$parseOption() {
1283
+ let s0, s1;
1284
+
1285
+ s0 = peg$currPos;
1286
+ s1 = peg$parseAttributeValue();
1287
+ if (s1 !== peg$FAILED) {
1288
+ peg$savedPos = s0;
1289
+ s1 = peg$f20(s1);
1332
1290
  }
1291
+ s0 = s1;
1333
1292
 
1334
1293
  return s0;
1335
1294
  }
1336
1295
 
1337
- function peg$parseQuotedOption() {
1296
+ function peg$parseAttributeKey() {
1338
1297
  let s0, s1, s2, s3;
1339
1298
 
1340
1299
  s0 = peg$currPos;
1341
- if (input.charCodeAt(peg$currPos) === 34) {
1342
- s1 = peg$c2;
1300
+ s1 = input.charAt(peg$currPos);
1301
+ if (peg$r5.test(s1)) {
1343
1302
  peg$currPos++;
1344
1303
  } else {
1345
1304
  s1 = peg$FAILED;
1346
- if (peg$silentFails === 0) { peg$fail(peg$e4); }
1305
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1347
1306
  }
1348
1307
  if (s1 !== peg$FAILED) {
1349
1308
  s2 = [];
1350
1309
  s3 = input.charAt(peg$currPos);
1351
- if (peg$r1.test(s3)) {
1310
+ if (peg$r6.test(s3)) {
1352
1311
  peg$currPos++;
1353
1312
  } else {
1354
1313
  s3 = peg$FAILED;
1355
- if (peg$silentFails === 0) { peg$fail(peg$e5); }
1356
- }
1357
- if (s3 !== peg$FAILED) {
1358
- while (s3 !== peg$FAILED) {
1359
- s2.push(s3);
1360
- s3 = input.charAt(peg$currPos);
1361
- if (peg$r1.test(s3)) {
1362
- peg$currPos++;
1363
- } else {
1364
- s3 = peg$FAILED;
1365
- if (peg$silentFails === 0) { peg$fail(peg$e5); }
1366
- }
1367
- }
1368
- } else {
1369
- s2 = peg$FAILED;
1314
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1370
1315
  }
1371
- if (s2 !== peg$FAILED) {
1372
- if (input.charCodeAt(peg$currPos) === 34) {
1373
- s3 = peg$c2;
1316
+ while (s3 !== peg$FAILED) {
1317
+ s2.push(s3);
1318
+ s3 = input.charAt(peg$currPos);
1319
+ if (peg$r6.test(s3)) {
1374
1320
  peg$currPos++;
1375
1321
  } else {
1376
1322
  s3 = peg$FAILED;
1377
- if (peg$silentFails === 0) { peg$fail(peg$e4); }
1378
- }
1379
- if (s3 !== peg$FAILED) {
1380
- peg$savedPos = s0;
1381
- s0 = peg$f20(s2);
1382
- } else {
1383
- peg$currPos = s0;
1384
- s0 = peg$FAILED;
1323
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1385
1324
  }
1386
- } else {
1387
- peg$currPos = s0;
1388
- s0 = peg$FAILED;
1389
1325
  }
1326
+ peg$savedPos = s0;
1327
+ s0 = peg$f21();
1390
1328
  } else {
1391
1329
  peg$currPos = s0;
1392
1330
  s0 = peg$FAILED;
@@ -1395,37 +1333,42 @@ function peg$parse(input, options) {
1395
1333
  return s0;
1396
1334
  }
1397
1335
 
1398
- function peg$parseUnquotedOption() {
1399
- let s0, s1, s2;
1336
+ function peg$parseAttributeFlag() {
1337
+ let s0, s1, s2, s3;
1400
1338
 
1401
1339
  s0 = peg$currPos;
1402
- s1 = [];
1403
- s2 = input.charAt(peg$currPos);
1404
- if (peg$r6.test(s2)) {
1340
+ s1 = input.charAt(peg$currPos);
1341
+ if (peg$r5.test(s1)) {
1405
1342
  peg$currPos++;
1406
1343
  } else {
1407
- s2 = peg$FAILED;
1408
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1344
+ s1 = peg$FAILED;
1345
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1409
1346
  }
1410
- if (s2 !== peg$FAILED) {
1411
- while (s2 !== peg$FAILED) {
1412
- s1.push(s2);
1413
- s2 = input.charAt(peg$currPos);
1414
- if (peg$r6.test(s2)) {
1347
+ if (s1 !== peg$FAILED) {
1348
+ s2 = [];
1349
+ s3 = input.charAt(peg$currPos);
1350
+ if (peg$r3.test(s3)) {
1351
+ peg$currPos++;
1352
+ } else {
1353
+ s3 = peg$FAILED;
1354
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1355
+ }
1356
+ while (s3 !== peg$FAILED) {
1357
+ s2.push(s3);
1358
+ s3 = input.charAt(peg$currPos);
1359
+ if (peg$r3.test(s3)) {
1415
1360
  peg$currPos++;
1416
1361
  } else {
1417
- s2 = peg$FAILED;
1418
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1362
+ s3 = peg$FAILED;
1363
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1419
1364
  }
1420
1365
  }
1421
- } else {
1422
- s1 = peg$FAILED;
1423
- }
1424
- if (s1 !== peg$FAILED) {
1425
1366
  peg$savedPos = s0;
1426
- s1 = peg$f21(s1);
1367
+ s0 = peg$f22();
1368
+ } else {
1369
+ peg$currPos = s0;
1370
+ s0 = peg$FAILED;
1427
1371
  }
1428
- s0 = s1;
1429
1372
 
1430
1373
  return s0;
1431
1374
  }
@@ -1486,7 +1429,7 @@ function peg$parse(input, options) {
1486
1429
  }
1487
1430
  }
1488
1431
  peg$savedPos = s0;
1489
- s0 = peg$f22();
1432
+ s0 = peg$f23();
1490
1433
  } else {
1491
1434
  peg$currPos = s0;
1492
1435
  s0 = peg$FAILED;
@@ -1495,32 +1438,72 @@ function peg$parse(input, options) {
1495
1438
  return s0;
1496
1439
  }
1497
1440
 
1441
+ function peg$parseExtendedIdentifier() {
1442
+ let s0, s1, s2, s3;
1498
1443
 
1499
- function createNode(type, start, end, additionalProps) {
1500
- const node = {
1501
- type: type,
1502
- start: start,
1503
- end: end,
1504
- ...additionalProps
1505
- };
1506
- if (additionalProps.expression) {
1507
- node.expression = createNode('Identifier', additionalProps.expression.start, additionalProps.expression.end, {
1508
- name: additionalProps.expression.value,
1509
- loc: {
1510
- start: {
1511
- line: 1,
1512
- column: additionalProps.expression.start + 1
1513
- },
1514
- end: {
1515
- line: 1,
1516
- column: additionalProps.expression.start + 2
1517
- }
1444
+ s0 = peg$currPos;
1445
+ s1 = input.charAt(peg$currPos);
1446
+ if (peg$r8.test(s1)) {
1447
+ peg$currPos++;
1448
+ } else {
1449
+ s1 = peg$FAILED;
1450
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1451
+ }
1452
+ if (s1 !== peg$FAILED) {
1453
+ s2 = [];
1454
+ s3 = input.charAt(peg$currPos);
1455
+ if (peg$r9.test(s3)) {
1456
+ peg$currPos++;
1457
+ } else {
1458
+ s3 = peg$FAILED;
1459
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1460
+ }
1461
+ while (s3 !== peg$FAILED) {
1462
+ s2.push(s3);
1463
+ s3 = input.charAt(peg$currPos);
1464
+ if (peg$r9.test(s3)) {
1465
+ peg$currPos++;
1466
+ } else {
1467
+ s3 = peg$FAILED;
1468
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1518
1469
  }
1519
- });
1470
+ }
1471
+ peg$savedPos = s0;
1472
+ s0 = peg$f24(s1, s2);
1473
+ } else {
1474
+ peg$currPos = s0;
1475
+ s0 = peg$FAILED;
1520
1476
  }
1521
- return node;
1477
+
1478
+ return s0;
1522
1479
  }
1523
1480
 
1481
+
1482
+ function createNode(type, start, end, additionalProps) {
1483
+ const node = {
1484
+ type: type,
1485
+ start: start,
1486
+ end: end,
1487
+ ...additionalProps
1488
+ };
1489
+ if (additionalProps.expression) {
1490
+ node.expression = createNode('Identifier', additionalProps.expression.start, additionalProps.expression.end, {
1491
+ name: additionalProps.expression.value,
1492
+ loc: {
1493
+ start: {
1494
+ line: 1,
1495
+ column: additionalProps.expression.start + 1
1496
+ },
1497
+ end: {
1498
+ line: 1,
1499
+ column: additionalProps.expression.start + 2
1500
+ }
1501
+ }
1502
+ });
1503
+ }
1504
+ return node;
1505
+ }
1506
+
1524
1507
  peg$result = peg$startRuleFunction();
1525
1508
 
1526
1509
  const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
@@ -1559,18 +1542,10 @@ const peg$allowedStartRules = [
1559
1542
  "start"
1560
1543
  ];
1561
1544
 
1562
- /*
1563
- export {
1564
- peg$allowedStartRules as StartRules,
1565
- peg$SyntaxError as SyntaxError,
1566
- peg$parse as parse
1567
- };
1568
-
1569
- */
1570
-
1571
1545
  export default {
1572
1546
  StartRules: ["start"],
1573
1547
  SyntaxError: peg$SyntaxError,
1574
1548
  parse: peg$parse
1575
1549
  };
1576
1550
 
1551
+