The Matcher-based tokenizer implementation for JSON.
-
Contextual Definitions —
json-definitions.js
Structured definitions for keywords, goals, symbols… etc, used by the tokenization process.
-
JSONGoal
(…)
Special subset of ECMAScriptGoal grammar specific to the PrimaryExpression production further restricted to derivatives of NullLiteral, BooleanLiteral, NumericLiteral, StringLiteral, ObjectLiteral, and ArrayLiteral.
- JSONStringGoal
"…"
- Loose
- Strict
- JSONArrayGoal
[…]
- Loose
- Strict
- JSONObjectGoal
{…}
- Loose
- Strict
- JSONStringGoal
-
-
Matcher Ranges —
json-ranges.js
Special regular expressions instances of
RegExpRange
that take the range or class form (ie/[…]/
) reflecting ones found in actual specifications to be used as the building blocks of the matcher.- ControlCharacter
\0-\x1F
- NullCharacter
\0
- NullCharacter
- DecimalDigit
0-9
- HexDigit
0-9 a-f A-F
- HexLetter
a-f A-F
- HexLetter
- ControlCharacter
We needed to use this:
- [x] ControlCharacter `\0-\x1F`
- [x] NullCharacter `\0`
- [x] DecimalDigit `0-9`
- [x] HexDigit `0-9 a-f A-F`
- [x] HexLetter `a-f A-F`
Which renders the following HTML:
<ul style="list-style: square">
<li type="checkbox" checked=""><p> ControlCharacter <code token-type="sequence" token-hint="markdown" class="markdown fenced-code code">\0-\x1F</code>
</p><ul style="list-style: square">
<li type="checkbox" checked=""><p> NullCharacter <code token-type="sequence" token-hint="markdown" class="markdown fenced-code code">\0</code> </p></li>
</ul></li>
<li type="checkbox" checked=""><p> DecimalDigit <code token-type="sequence" token-hint="markdown" class="markdown fenced-code code">0-9</code> </p></li>
<li type="checkbox" checked=""><p> HexDigit <code token-type="sequence" token-hint="markdown" class="markdown fenced-code code">0-9 a-f A-F</code>
</p><ul style="list-style: square">
<li type="checkbox" checked=""><p> HexLetter <code token-type="sequence" token-hint="markdown" class="markdown fenced-code code">a-f A-F</code> </p></li>
</ul></li>
</ul>
For some reason we get "Error composing block page" with:
- [x] ControlCharacter `\0-\x1F`
- [x] NullCharacter `\0`
- [x] DecimalDigit `0-9`
- [x] HexDigit `0-9a-fA-F`
- [x] HexLetter `a-fA-F`
And with:
- [x] ControlCharacter `\0-\x1F`
- [x] NullCharacter `\0`
- [x] DecimalDigit `0-9`
- [x] HexDigit `a-fA-F0-9`
- [x] HexLetter `a-fA-F`
But not with:
- [x] ControlCharacter `\0-\x1F`
- [x] NullCharacter `\0`
- [x] DecimalDigit `0-9`
- [x] HexDigit `a-f A-F 0-9`
- [x] HexLetter `a-fA-F`
Or just with:
- [x] ControlCharacter `\0-\x1F`
- [x] NullCharacter `\0`
- [x] DecimalDigit `0-9`
- [x] HexDigit `0-9a-fA-F`