42 lines
564 B
Plaintext
42 lines
564 B
Plaintext
TOKENS
|
|
Symbols
|
|
Array notation
|
|
[
|
|
]
|
|
Object notation
|
|
{
|
|
}
|
|
:
|
|
Separator
|
|
,
|
|
String
|
|
"
|
|
\ (for escape sequences)
|
|
Numerical
|
|
-
|
|
.
|
|
eE (exponents only)
|
|
+ (exponents only)
|
|
Keywords
|
|
true
|
|
false
|
|
null
|
|
Key
|
|
strings only
|
|
|
|
Implement stack data structure for pushing and pulling states when necessary
|
|
|
|
LEXER STATES
|
|
START
|
|
ERROR
|
|
END
|
|
VALUE
|
|
OBJECT_KEY
|
|
---------
|
|
OBJECT |
|
|
ARRAY |
|
|
PRIMITIVES |------> Can be values
|
|
STRING--------|------> Only one that can be an object key
|
|
NUMBER |
|
|
---------
|