cddl 0.20.1 → 0.21.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;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"}
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;IAyKzB,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
@@ -568,7 +568,11 @@ export default class Parser {
568
568
  isUnwrapped = true;
569
569
  this.nextToken(); // eat ~
570
570
  }
571
- switch (this.curToken.Literal) {
571
+ /**
572
+ * a quoted string is always a literal, even if its text matches a
573
+ * reserved keyword like "null" or "bool"
574
+ */
575
+ switch (this.curToken.Type === Tokens.STRING ? Tokens.STRING : this.curToken.Literal) {
572
576
  case Type.ANY:
573
577
  case Type.BOOL:
574
578
  case Type.INT:
@@ -587,7 +591,14 @@ export default class Parser {
587
591
  type = this.curToken.Literal;
588
592
  break;
589
593
  default: {
590
- if (BOOLEAN_LITERALS.includes(this.curToken.Literal)) {
594
+ if (this.curToken.Type === Tokens.STRING) {
595
+ type = {
596
+ Type: 'literal',
597
+ Value: this.curToken.Literal,
598
+ Unwrapped: isUnwrapped
599
+ };
600
+ }
601
+ else if (BOOLEAN_LITERALS.includes(this.curToken.Literal)) {
591
602
  type = {
592
603
  Type: 'literal',
593
604
  Value: this.curToken.Literal === 'true',
@@ -608,13 +619,6 @@ export default class Parser {
608
619
  Unwrapped: isUnwrapped
609
620
  };
610
621
  }
611
- else if (this.curToken.Type === Tokens.STRING) {
612
- type = {
613
- Type: 'literal',
614
- Value: this.curToken.Literal,
615
- Unwrapped: isUnwrapped
616
- };
617
- }
618
622
  else if (this.curToken.Type === Tokens.NUMBER || this.curToken.Type === Tokens.FLOAT) {
619
623
  type = {
620
624
  Type: 'literal',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cddl",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "Concise data definition language (RFC 8610) implementation and JSON validator in Node.js",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "bin"
27
27
  ],
28
28
  "devDependencies": {
29
- "@types/node": "^25.5.0",
29
+ "@types/node": "^26.0.1",
30
30
  "@types/yargs": "^17.0.35"
31
31
  },
32
32
  "dependencies": {