@bablr/language-en-json 0.5.4 → 0.6.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.
@@ -26,64 +26,64 @@ export const grammar = triviaEnhancer(
26
26
  triviaIsAllowed: (s) => s.span === 'Bare',
27
27
  *eatMatchTrivia() {
28
28
  if (yield i`match(/[ \n\r\t]/)`) {
29
- yield i`eat(<#*Space:Space>)`;
29
+ yield i`eat(<#*Space:Space />)`;
30
30
  }
31
31
  },
32
32
  },
33
33
  class JSONGrammar {
34
34
  *[Symbol.for('@bablr/fragment')]() {
35
- yield i`eat(<> 'root')`;
35
+ yield i`eat(< /> 'root')`;
36
36
  }
37
37
 
38
38
  @CoveredBy('Element')
39
39
  *Expression() {
40
- yield i`eat(<Any> null [
41
- <Array '['>
42
- <Object '{'>
43
- <String '"'>
44
- <Number /-?\d/ span='Number'>
45
- <Null 'null'>
46
- <Boolean /true|false/>
40
+ yield i`eat(<Any /> null [
41
+ <Array '[' />
42
+ <Object '{' />
43
+ <String '"' />
44
+ <Number /-?\d/ span='Number' />
45
+ <Null 'null' />
46
+ <Boolean /true|false/ />
47
47
  ])`;
48
48
  }
49
49
 
50
50
  @CoveredBy('Expression')
51
51
  @Node
52
52
  *Array() {
53
- yield i`eat(<~*Punctuator '[' balanced=']'> 'openToken')`;
54
- yield i`eat(<List> 'elements[]' {
55
- element: <Expression>
56
- separator: <~*Punctuator ','>
53
+ yield i`eat(<~*Punctuator '[' balanced=']' /> 'openToken')`;
54
+ yield i`eat(<List /> 'elements[]' {
55
+ element: <Expression />
56
+ separator: <~*Punctuator ',' />
57
57
  allowTrailingSeparator: false
58
58
  })`;
59
- yield i`eat(<~*Punctuator ']' balancer> 'closeToken')`;
59
+ yield i`eat(<~*Punctuator ']' balancer /> 'closeToken')`;
60
60
  }
61
61
 
62
62
  @CoveredBy('Expression')
63
63
  @Node
64
64
  *Object() {
65
- yield i`eat(<~*Punctuator '{' balanced='}'> 'openToken')`;
66
- yield i`eat(<List> 'properties[]' {
67
- element: <Property>
68
- separator: <~*Punctuator ','>
65
+ yield i`eat(<~*Punctuator '{' balanced='}' /> 'openToken')`;
66
+ yield i`eat(<List /> 'properties[]' {
67
+ element: <Property />
68
+ separator: <~*Punctuator ',' />
69
69
  allowTrailingSeparator: false
70
70
  })`;
71
- yield i`eat(<~*Punctuator '}' balancer> 'closeToken')`;
71
+ yield i`eat(<~*Punctuator '}' balancer /> 'closeToken')`;
72
72
  }
73
73
 
74
74
  @Node
75
75
  *Property() {
76
- yield i`eat(<String> 'key')`;
77
- yield i`eat(<~*Punctuator ':'> 'sigilToken')`;
78
- yield i`eat(<Expression> 'value')`;
76
+ yield i`eat(<String /> 'key')`;
77
+ yield i`eat(<~*Punctuator ':' /> 'sigilToken')`;
78
+ yield i`eat(<Expression /> 'value')`;
79
79
  }
80
80
 
81
81
  @CoveredBy('Language')
82
82
  @Node
83
83
  *String() {
84
- yield i`eat(<~*Punctuator '"' balanced='"' balancedSpan='String'> 'openToken')`;
85
- yield i`eat(<*StringContent> 'content')`;
86
- yield i`eat(<~*Punctuator '"' balancer> 'closeToken')`;
84
+ yield i`eat(<~*Punctuator '"' balanced='"' balancedSpan='String' /> 'openToken')`;
85
+ yield i`eat(<*StringContent /> 'content')`;
86
+ yield i`eat(<~*Punctuator '"' balancer /> 'closeToken')`;
87
87
  }
88
88
 
89
89
  @AllowEmpty
@@ -91,7 +91,7 @@ export const grammar = triviaEnhancer(
91
91
  *StringContent() {
92
92
  let esc, lit;
93
93
  do {
94
- esc = (yield i`match('\\')`) && (yield i`eat(<@EscapeSequence>)`);
94
+ esc = (yield i`match('\\')`) && (yield i`eat(<@EscapeSequence />)`);
95
95
  lit = yield i`eatMatch(/[^\r\n\\"]+/)`;
96
96
  } while (esc || lit);
97
97
  }
@@ -103,16 +103,16 @@ export const grammar = triviaEnhancer(
103
103
  yield i`fail()`;
104
104
  }
105
105
 
106
- yield i`eat(<~*Punctuator '\\' openSpan='Escape'> 'sigilToken')`;
106
+ yield i`eat(<~*Punctuator '\\' openSpan='Escape' /> 'sigilToken')`;
107
107
 
108
108
  let match, cooked;
109
109
 
110
110
  if ((match = yield i`match(/[\\/bfnrt"]/)`)) {
111
111
  const match_ = ctx.sourceTextFor(match);
112
- yield i`eat(<~*Keyword ${buildString(match_)} closeSpan='Escape'> 'value')`;
112
+ yield i`eat(<~*Keyword ${buildString(match_)} closeSpan='Escape' /> 'value')`;
113
113
  cooked = escapables.get(match_) || match_;
114
114
  } else if (yield i`match('u')`) {
115
- const codeNode = yield i`eat(<EscapeCode closeSpan='Escape'> 'value')`;
115
+ const codeNode = yield i`eat(<EscapeCode closeSpan='Escape' /> 'value')`;
116
116
  cooked = parseInt(
117
117
  codeNode.properties.digits.map((digit) => ctx.sourceTextFor(digit)).join(''),
118
118
  16,
@@ -126,27 +126,27 @@ export const grammar = triviaEnhancer(
126
126
 
127
127
  @Node
128
128
  *EscapeCode() {
129
- yield i`eat(<~*Keyword 'u'> 'typeToken')`;
130
- yield i`eat(<Digits> 'digits[]')`;
129
+ yield i`eat(<~*Keyword 'u' /> 'typeToken')`;
130
+ yield i`eat(<Digits /> 'digits[]')`;
131
131
  }
132
132
 
133
133
  @CoveredBy('Expression')
134
134
  @Node
135
135
  *Number() {
136
- yield i`eat(<Integer> 'wholePart' { noDoubleZero: true matchSign: '-' })`;
136
+ yield i`eat(<Integer /> 'wholePart' { noDoubleZero: true matchSign: '-' })`;
137
137
 
138
- let fs = yield i`eatMatch(<~*Punctuator '.'> 'fractionalSeparatorToken')`;
138
+ let fs = yield i`eatMatch(<~*Punctuator '.' /> 'fractionalSeparatorToken')`;
139
139
 
140
140
  if (fs) {
141
- yield i`eat(<Integer> 'fractionalPart')`;
141
+ yield i`eat(<Integer /> 'fractionalPart')`;
142
142
  } else {
143
143
  yield i`eat(null 'fractionalPart')`;
144
144
  }
145
145
 
146
- let es = yield i`eatMatch(<~*Punctuator /[eE]/> 'exponentSeparatorToken')`;
146
+ let es = yield i`eatMatch(<~*Punctuator /[eE]/ /> 'exponentSeparatorToken')`;
147
147
 
148
148
  if (es) {
149
- yield i`eat(<Integer> 'exponentPart' { matchSign: /[+-]/ })`;
149
+ yield i`eat(<Integer /> 'exponentPart' { matchSign: /[+-]/ })`;
150
150
  } else {
151
151
  yield i`eat(null 'exponentPart')`;
152
152
  }
@@ -157,19 +157,19 @@ export const grammar = triviaEnhancer(
157
157
  const { matchSign = null, noDoubleZero = false } = (props && ctx.unbox(props)) || {};
158
158
 
159
159
  if (matchSign) {
160
- yield i`eatMatch(<~*Punctuator ${matchSign}> 'signToken')`;
160
+ yield i`eatMatch(<~*Punctuator ${matchSign} /> 'signToken')`;
161
161
  } else {
162
162
  yield i`eat(null 'signToken')`;
163
163
  }
164
164
 
165
- yield i`eat(<*UnsignedInteger noDoubleZero=${buildBoolean(noDoubleZero)}> 'value')`;
165
+ yield i`eat(<*UnsignedInteger noDoubleZero=${buildBoolean(noDoubleZero)} /> 'value')`;
166
166
  }
167
167
 
168
168
  @Node
169
169
  *UnsignedInteger({ value: props, ctx }) {
170
170
  const { noDoubleZero = false } = (props && ctx.unbox(props)) || {};
171
171
 
172
- let [firstDigit] = ctx.allTerminalsFor(yield i`eat(/\d/)`);
172
+ let [firstDigit] = ctx.allTagsFor(yield i`eat(/\d/)`);
173
173
 
174
174
  if (!noDoubleZero || firstDigit.value !== '0') {
175
175
  yield i`eatMatch(/\d+/)`;
@@ -179,13 +179,13 @@ export const grammar = triviaEnhancer(
179
179
  @CoveredBy('Expression')
180
180
  @Node
181
181
  *Boolean() {
182
- yield i`eat(<~*Keyword /true|false/> 'sigilToken')`;
182
+ yield i`eat(<~*Keyword /true|false/ /> 'sigilToken')`;
183
183
  }
184
184
 
185
185
  @CoveredBy('Expression')
186
186
  @Node
187
187
  *Null() {
188
- yield i`eat(<~*Keyword 'null'> 'sigilToken')`;
188
+ yield i`eat(<~*Keyword 'null' /> 'sigilToken')`;
189
189
  }
190
190
 
191
191
  @Node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bablr/language-en-json",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "A BABLR language for JSON",
5
5
  "engines": {
6
6
  "node": ">=12.0.0"
@@ -21,19 +21,19 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@bablr/agast-helpers": "0.3.2",
25
- "@bablr/agast-vm-helpers": "0.3.2",
26
- "@bablr/boot": "0.4.0",
27
- "@bablr/helpers": "0.18.2",
28
- "@bablr/language-en-blank-space": "0.3.1",
24
+ "@bablr/agast-helpers": "0.4.0",
25
+ "@bablr/agast-vm-helpers": "0.4.0",
26
+ "@bablr/boot": "0.5.0",
27
+ "@bablr/helpers": "0.19.0",
28
+ "@bablr/language-en-blank-space": "0.4.0",
29
29
  "@babel/runtime": "^7.22.15"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#49f5952efed27f94ee9b94340eb1563c440bf64e",
33
33
  "@bablr/macrome": "0.1.3",
34
- "@bablr/macrome-generator-bablr": "0.3.1",
34
+ "@bablr/macrome-generator-bablr": "0.3.2",
35
35
  "@qnighy/dedent": "0.1.1",
36
- "bablr": "0.4.1",
36
+ "bablr": "^0.5.0",
37
37
  "enhanced-resolve": "^5.12.0",
38
38
  "eslint": "^7.32.0",
39
39
  "eslint-import-resolver-enhanced-resolve": "^1.0.5",