cddl 0.3.0 → 0.5.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.
@@ -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;AAKjB,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;IA8BxB,OAAO,CAAC,oBAAoB;IA2R5B,OAAO,CAAC,wBAAwB;IAahC;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;IA8GzB,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB,KAAK;IAuBL,OAAO,CAAC,WAAW;CAKtB"}
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;AAKjB,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;IA8BxB,OAAO,CAAC,oBAAoB;IAyU5B,OAAO,CAAC,wBAAwB;IAahC;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,iBAAiB;IA8GzB,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB,KAAK;IAuBL,OAAO,CAAC,WAAW;CAKtB"}
package/build/parser.js CHANGED
@@ -121,6 +121,41 @@ export default class Parser {
121
121
  isUnwrapped = true;
122
122
  this.nextToken(); // eat ~
123
123
  }
124
+ /**
125
+ * parse assignment within array, e.g.
126
+ * ```
127
+ * ActionsPerformActionsParameters = [1* {
128
+ * type: "key",
129
+ * id: text,
130
+ * actions: ActionItems,
131
+ * *text => any
132
+ * }]
133
+ * ```
134
+ * or
135
+ * ```
136
+ * script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];
137
+ * ```
138
+ */
139
+ if (this.curToken.Literal === Tokens.LBRACE ||
140
+ this.curToken.Literal === Tokens.LBRACK ||
141
+ this.curToken.Literal === Tokens.LPAREN) {
142
+ const innerGroup = this.parseAssignmentValue();
143
+ valuesOrProperties.push({
144
+ HasCut: false,
145
+ Occurrence: occurrence,
146
+ Name: '',
147
+ Type: innerGroup,
148
+ Comment: ''
149
+ });
150
+ continue;
151
+ }
152
+ /**
153
+ * check if we are in an array and a new item is indicated
154
+ */
155
+ if (this.curToken.Literal === Tokens.COMMA && closingTokens[0] === Tokens.RBRACK) {
156
+ this.nextToken();
157
+ continue;
158
+ }
124
159
  propertyName = this.parsePropertyName();
125
160
  /**
126
161
  * if `,` is found we have a group reference and jump to the next line
@@ -149,6 +184,12 @@ export default class Parser {
149
184
  }],
150
185
  Comment: comment
151
186
  });
187
+ if (this.curToken.Literal === Tokens.COMMA || this.curToken.Literal === closingTokens[0]) {
188
+ if (this.curToken.Literal === Tokens.COMMA) {
189
+ this.nextToken();
190
+ }
191
+ continue;
192
+ }
152
193
  if (!parsedComments) {
153
194
  this.nextToken();
154
195
  }
@@ -441,7 +441,7 @@ script.DateLocalValue = {
441
441
  value: text
442
442
  }
443
443
 
444
- ; script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];
444
+ script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];
445
445
 
446
446
  script.MapLocalValue = {
447
447
  type: "map",
@@ -601,7 +601,7 @@ script.InternalId = js-uint;
601
601
 
602
602
  script.ListRemoteValue = [*script.RemoteValue];
603
603
 
604
- ; script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];
604
+ script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];
605
605
 
606
606
  script.SymbolRemoteValue = {
607
607
  type: "symbol",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cddl",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Concise data definition language (RFC 8610) implementation and JSON validator in Node.js",
5
5
  "author": "Christian Bromann <christian@saucelabs.com>",
6
6
  "license": "MIT",