You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This allows for a shorthand representation of numbers with a higher precision or
292
291
greater range than JSON numbers.
293
292
294
293
```json example
295
294
"3.14159265358979323846264338327950288419716"
296
-
"+Infinity"
295
+
"-1.7976931348623157e+308"
296
+
"5.7(317)e-2"
297
297
```
298
298
299
299
##Strings
@@ -303,7 +303,16 @@ A MathJSON **string** is either:
303
303
- an object literal with a`"str"` key
304
304
- a[JSON string](https://tools.ietf.org/html/rfc7159#section-7) that starts and
305
305
ends with**U+0027`'` APOSTROPHE**.
306
-
- a JSON string that is not an identifier shorthand or a number, that is a
306
+
- a JSON string that is not a symbol shorthand or a number shorthand.
307
+
308
+
That is:
309
+
310
+
-`"Hello World"` is a string (it includes a space character which is not allowed in symbols)
311
+
-`"HelloWorld"` is a symbol (it does not include a space character)
312
+
-`"3.14"` is a number (it is a valid JSON number)
313
+
-`"'3.14'"` is a string (it is wrapped with single quotes)
314
+
-`"🍎"` is a string
315
+
-``"`🍎`"`` is a symbol shorthand (it is wrapped with backticks)
307
316
308
317
MathJSON strings must be[well formed JSON strings](https://tc39.es/proposal-well-formed-stringify/), which means they must escape surrogate codepoints`U+D800` to`U+DFFF`, control characters`U+0000` to`U+001F`, and the characters**U+0022`'` QUOTATION MARK** and**U+005C`\` REVERSE SOLIDUS** (backslash).
309
318
@@ -450,20 +459,25 @@ A MathJSON **symbol** is either:
450
459
Symbols are JSON strings that represent the names of symbols, variables,
451
460
constants, wildcards and functions.
452
461
462
+
For a JSON string literal to be interpreted as a symbol, it must either
463
+
begin and start with a`` ``` (`U+0060` GRAVE ACCENT) or be a
464
+
string matching the Regex pattern`/^[a-zA-Z_][a-zA-Z0-9_]*$/`.
465
+
466
+
453
467
Before they are used, JSON escape sequences (such as`\u` sequences,`\\`, etc.)
454
468
are decoded.
455
469
456
470
The symbols are then normalized to the
457
471
[Unicode Normalization Form C (NFC)](https://unicode.org/reports/tr15/). They
458
472
are stored internally and compared using the Unicode NFC.
459
473
460
-
For example, these fourJSON strings represent the same symbol:
474
+
For example, these fourobject literals represent the same symbol:
461
475
462
-
-`"Å"`
463
-
-`"A\u030a"`**U+0041`A` LATIN CAPITAL LETTER** +**U+030A` ̊` COMBINING RING
476
+
-`{ "sym": "Å" }`
477
+
-`{ "sym": "A\u030a" }`**U+0041`A` LATIN CAPITAL LETTER** +**U+030A` ̊` COMBINING RING
464
478
ABOVE**
465
-
-`"\u00c5"`**U+00C5`Å` LATIN CAPITAL LETTER A WITH RING ABOVE**
466
-
-`"\u0041\u030a"`**U+0041`A` LATIN CAPITAL LETTER A** +**U+030A` ̊` COMBINING RING
479
+
-`{ "sym": "\u00c5" }`**U+00C5`Å` LATIN CAPITAL LETTER A WITH RING ABOVE**
480
+
-`{ "sym": "\u0041\u030a" }`**U+0041`A` LATIN CAPITAL LETTER A** +**U+030A` ̊` COMBINING RING