cddl 0.20.0 → 0.20.1
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 +14 -5
- 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;IAC7B,cAAc,EAAE,KAAK,CAAa;gBAErB,QAAQ,EAAE,MAAM;IAS7B,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,gBAAgB;IA8CxB,OAAO,CAAC,oBAAoB;IA0e5B,OAAO,CAAC,wBAAwB;IAahC;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;IAqKzB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;
|
|
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;IAC7B,cAAc,EAAE,KAAK,CAAa;gBAErB,QAAQ,EAAE,MAAM;IAS7B,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,gBAAgB;IA8CxB,OAAO,CAAC,oBAAoB;IA0e5B,OAAO,CAAC,wBAAwB;IAahC;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;IAqKzB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;IAsF1B,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB,KAAK;IAaL,OAAO,CAAC,WAAW;CAKtB"}
|
package/build/parser.js
CHANGED
|
@@ -96,7 +96,7 @@ export default class Parser {
|
|
|
96
96
|
Type: 'variable',
|
|
97
97
|
Name: groupName,
|
|
98
98
|
IsChoiceAddition: isChoiceAddition,
|
|
99
|
-
PropertyType: this.parsePropertyTypes(),
|
|
99
|
+
PropertyType: this.parsePropertyTypes(true),
|
|
100
100
|
Comments: []
|
|
101
101
|
};
|
|
102
102
|
return variable;
|
|
@@ -122,7 +122,7 @@ export default class Parser {
|
|
|
122
122
|
!(this.curToken.Type === Tokens.SLASH && this.peekToken.Type === Tokens.SLASH)) {
|
|
123
123
|
const propertyType = [];
|
|
124
124
|
while (!closingTokens.includes(this.curToken.Type)) {
|
|
125
|
-
propertyType.push(...this.parsePropertyTypes());
|
|
125
|
+
propertyType.push(...this.parsePropertyTypes(true));
|
|
126
126
|
if (closingTokens.includes(this.curToken.Type)) {
|
|
127
127
|
this.nextToken();
|
|
128
128
|
break;
|
|
@@ -732,7 +732,7 @@ export default class Parser {
|
|
|
732
732
|
isOperator() {
|
|
733
733
|
return this.curToken.Literal === Tokens.DOT && OPERATORS.includes(this.peekToken.Literal);
|
|
734
734
|
}
|
|
735
|
-
parsePropertyTypes() {
|
|
735
|
+
parsePropertyTypes(attachChoiceOperators = false) {
|
|
736
736
|
const propertyTypes = [];
|
|
737
737
|
let prop = this.parsePropertyType();
|
|
738
738
|
if (this.isOperator()) {
|
|
@@ -778,14 +778,23 @@ export default class Parser {
|
|
|
778
778
|
while ([Tokens.COMMENT].includes(this.curToken.Type)) {
|
|
779
779
|
this.parseComment();
|
|
780
780
|
}
|
|
781
|
-
|
|
782
|
-
if (
|
|
781
|
+
let nextProp = this.parsePropertyType();
|
|
782
|
+
if (this.isOperator()) {
|
|
783
|
+
if (attachChoiceOperators) {
|
|
784
|
+
nextProp = {
|
|
785
|
+
Type: nextProp,
|
|
786
|
+
Operator: this.parseOperator()
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
else if (this.curToken.Type !== Tokens.SLASH) {
|
|
783
791
|
/**
|
|
784
792
|
* If we are not parsing an operator, we need to eat the next token;
|
|
785
793
|
* otherwise, the operator will be parsed by the caller
|
|
786
794
|
*/
|
|
787
795
|
this.nextToken();
|
|
788
796
|
}
|
|
797
|
+
propertyTypes.push(nextProp);
|
|
789
798
|
while ([Tokens.COMMENT].includes(this.curToken.Type) && this.peekToken.Type === Tokens.SLASH) {
|
|
790
799
|
this.parseComment();
|
|
791
800
|
}
|
package/package.json
CHANGED