cddl 0.9.0 → 0.10.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 +34 -0
- 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;IAmb5B,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;IAiD1B,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB,KAAK;IAaL,OAAO,CAAC,WAAW;CAKtB"}
|
package/build/parser.js
CHANGED
|
@@ -315,6 +315,18 @@ export default class Parser {
|
|
|
315
315
|
*/
|
|
316
316
|
const props = this.parseAssignmentValue();
|
|
317
317
|
const operator = this.isOperator() ? this.parseOperator() : undefined;
|
|
318
|
+
if (!isChoice && this.curToken.Type === Tokens.SLASH) {
|
|
319
|
+
this.nextToken();
|
|
320
|
+
const nextType = this.parsePropertyType();
|
|
321
|
+
if (Array.isArray(props)) {
|
|
322
|
+
/**
|
|
323
|
+
* property has not yet been flagged as a choice, but is part
|
|
324
|
+
* of one, e.g. `(float .ge 1.0) / null`
|
|
325
|
+
*/
|
|
326
|
+
props.push(nextType);
|
|
327
|
+
this.nextToken();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
318
330
|
if (Array.isArray(props)) {
|
|
319
331
|
/**
|
|
320
332
|
* property has multiple types (e.g. `float / tstr / int`)
|
|
@@ -609,6 +621,28 @@ export default class Parser {
|
|
|
609
621
|
},
|
|
610
622
|
Unwrapped: isUnwrapped
|
|
611
623
|
};
|
|
624
|
+
if (!isGroupedRange && this.peekToken.Literal === Tokens.RPAREN) {
|
|
625
|
+
/**
|
|
626
|
+
* If we are at the end of a grouped range, and this was called
|
|
627
|
+
* on the first item of the range as opposed to the opening
|
|
628
|
+
* parenthesis, isGroupedRange will not be set to true at this
|
|
629
|
+
* point. We need to advance to the closing parenthesis, and if
|
|
630
|
+
* the next token is an operator, we need to advance to the dot
|
|
631
|
+
* so that parseOperator will work properly.
|
|
632
|
+
* e.g.
|
|
633
|
+
*
|
|
634
|
+
* ```
|
|
635
|
+
* (1.0..2.0) .default 1.5
|
|
636
|
+
* ```
|
|
637
|
+
*
|
|
638
|
+
* This will be called on the `1.0` and then the `2.0` will be parsed
|
|
639
|
+
* as a grouped range.
|
|
640
|
+
*/
|
|
641
|
+
this.nextToken();
|
|
642
|
+
if (this.peekToken.Type === Tokens.DOT) {
|
|
643
|
+
isGroupedRange = true;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
612
646
|
if (isGroupedRange) {
|
|
613
647
|
this.nextToken(); // eat ")"
|
|
614
648
|
}
|
package/package.json
CHANGED