cddl 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/parser.d.ts.map +1 -1
- package/build/parser.js +19 -6
- package/package.json +1 -1
package/build/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,KAAK,EAAU,MAAM,aAAa,CAAC;AAG5C,OAAO,EAE2C,UAAU,EAE3D,MAAM,UAAU,CAAA;AAoBjB,MAAM,CAAC,OAAO,OAAO,MAAM;;IAEvB,CAAC,EAAE,KAAK,CAAC;IAET,QAAQ,EAAE,KAAK,CAAa;IAC5B,SAAS,EAAE,KAAK,CAAa;gBAEhB,QAAQ,EAAE,MAAM;IAQ7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,KAAK,EAAU,MAAM,aAAa,CAAC;AAG5C,OAAO,EAE2C,UAAU,EAE3D,MAAM,UAAU,CAAA;AAoBjB,MAAM,CAAC,OAAO,OAAO,MAAM;;IAEvB,CAAC,EAAE,KAAK,CAAC;IAET,QAAQ,EAAE,KAAK,CAAa;IAC5B,SAAS,EAAE,KAAK,CAAa;gBAEhB,QAAQ,EAAE,MAAM;IAQ7B,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,oBAAoB;IA0b5B,OAAO,CAAC,wBAAwB;IAahC;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;IAqJzB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;IAuD1B,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB,KAAK;IAaL,OAAO,CAAC,WAAW;CAKtB"}
|
package/build/parser.js
CHANGED
|
@@ -142,9 +142,11 @@ export default class Parser {
|
|
|
142
142
|
* parse operator assignments, e.g. `ip4 = (float .ge 0.0) .default 1.0`
|
|
143
143
|
*/
|
|
144
144
|
if (closingTokens.length === 1 && this.peekToken.Type === Tokens.DOT) {
|
|
145
|
+
const propertyType = this.parsePropertyType();
|
|
146
|
+
const operator = this.isOperator() ? this.parseOperator() : undefined;
|
|
145
147
|
const prop = {
|
|
146
|
-
Type:
|
|
147
|
-
Operator:
|
|
148
|
+
Type: propertyType,
|
|
149
|
+
...(operator ? { Operator: operator } : {})
|
|
148
150
|
};
|
|
149
151
|
this.nextToken(); // eat closing token
|
|
150
152
|
if (groupName) {
|
|
@@ -314,7 +316,7 @@ export default class Parser {
|
|
|
314
316
|
* parse property value
|
|
315
317
|
*/
|
|
316
318
|
const props = this.parseAssignmentValue();
|
|
317
|
-
|
|
319
|
+
let operator = this.isOperator() ? this.parseOperator() : undefined;
|
|
318
320
|
if (!isChoice && this.curToken.Type === Tokens.SLASH) {
|
|
319
321
|
this.nextToken();
|
|
320
322
|
const nextType = this.parsePropertyType();
|
|
@@ -324,9 +326,14 @@ export default class Parser {
|
|
|
324
326
|
* of one, e.g. `(float .ge 1.0) / null`
|
|
325
327
|
*/
|
|
326
328
|
props.push(nextType);
|
|
327
|
-
this.
|
|
329
|
+
if (!this.isOperator()) {
|
|
330
|
+
this.nextToken();
|
|
331
|
+
}
|
|
328
332
|
}
|
|
329
333
|
}
|
|
334
|
+
if (this.isOperator()) {
|
|
335
|
+
operator = this.parseOperator();
|
|
336
|
+
}
|
|
330
337
|
if (Array.isArray(props)) {
|
|
331
338
|
/**
|
|
332
339
|
* property has multiple types (e.g. `float / tstr / int`)
|
|
@@ -639,7 +646,7 @@ export default class Parser {
|
|
|
639
646
|
* as a grouped range.
|
|
640
647
|
*/
|
|
641
648
|
this.nextToken();
|
|
642
|
-
if (this.
|
|
649
|
+
if (this.isOperator()) {
|
|
643
650
|
isGroupedRange = true;
|
|
644
651
|
}
|
|
645
652
|
}
|
|
@@ -695,7 +702,13 @@ export default class Parser {
|
|
|
695
702
|
while (this.curToken.Type === Tokens.SLASH) {
|
|
696
703
|
this.nextToken(); // eat `/`
|
|
697
704
|
propertyTypes.push(this.parsePropertyType());
|
|
698
|
-
this.
|
|
705
|
+
if (!this.isOperator()) {
|
|
706
|
+
/**
|
|
707
|
+
* If we are not parsing an operator, we need to eat the next token;
|
|
708
|
+
* otherwise, the operator will be parsed by the caller
|
|
709
|
+
*/
|
|
710
|
+
this.nextToken();
|
|
711
|
+
}
|
|
699
712
|
/**
|
|
700
713
|
* ensure we don't go into the next choice, e.g.:
|
|
701
714
|
* ```
|
package/package.json
CHANGED