b009a9c4ec
Handle things separated by things differently
...
I noticed that programs like '{} would parse correctly while '{ } would
expect an inner element. This was because the leading space was actually
part of the element parser, which is a violation of the (as of yet
unspoken) rule that parsers should not parse surrounding whitespace.
Because whitespace whas treated differently from everywhere else and
because this implementation was wrong, I decided to reimplement it,
abstracting the concept of things separated by other things with
optional trailing things. I did this in such a way that surrounding
whitespace is not touched.
2022-11-20 20:25:41 +01:00
407786b98c
Add "pretty" subcommand
2022-11-20 18:27:25 +01:00
43d5b6d5ae
Forbid underscores in unicode escapes
2022-11-20 18:17:19 +01:00
dfaa878820
Forbid escapable characters in string literals
2022-11-20 18:10:15 +01:00
3130736057
Parse program
2022-11-20 18:10:15 +01:00
2be47871da
Add "module" program variant
2022-11-20 18:10:15 +01:00
9658907d76
Make string literal Debug more compact
2022-11-20 17:36:28 +01:00
82e5b589e1
Parse string literals
2022-11-20 17:36:16 +01:00
867595b5b9
Remove multiline string literals from ast
2022-11-20 17:14:43 +01:00
ea7518b183
Create each main parser only once
2022-11-19 20:56:10 +01:00
b291619d10
Remove unnecessary Clone bounds
2022-11-19 19:36:10 +01:00
0099277644
Parse named function definitions
2022-11-19 19:24:23 +01:00
ff3edf17e5
Parse anonymous function definitions
2022-11-19 19:13:30 +01:00
9a1bb92dfe
Prepare parser for function definitions
2022-11-19 18:58:39 +01:00
86006933d7
Add local function definitions
2022-11-19 18:58:21 +01:00
b590f640f4
Parse logic operators right associative
2022-11-19 13:26:09 +01:00
5e26d9550c
Remove unused import
2022-11-19 13:05:40 +01:00
9c8d09e3cb
Box pub parsers and adjust visibility
2022-11-19 13:00:43 +01:00
408219073a
Parse binary operators
...
For now, they're all left associative.
2022-11-19 12:40:52 +01:00
63f8026007
Parse arithmetic and logical negation
2022-11-19 11:58:52 +01:00
4be5283204
Make Expr Debug more compact and less ambiguous
2022-11-19 11:38:11 +01:00
94198d126f
Parse suffixes
2022-11-19 11:22:49 +01:00
3e2f118e2e
Move program ast into separate file
2022-11-19 11:02:36 +01:00
e2bb847577
Simplify imports
2022-11-19 11:01:09 +01:00
36e40d254d
Add function definitions to ast
2022-11-19 10:58:34 +01:00
5466f7afbf
Turn strs into chars where possible
2022-11-18 22:07:42 +01:00
73e32252c4
Parse table destructuring
2022-11-18 21:44:25 +01:00
a82b625631
Add builtins to ast and parse them
2022-11-18 21:17:05 +01:00
4fdce864d3
Forbid using keywords as identifiers
2022-11-18 21:05:57 +01:00
41723eb4ca
Parse comments in whitespace
2022-11-18 20:59:51 +01:00
a559966c1d
Split up parser
...
The structure mostly follows the ast structure, with some slight
changes. Each parser submodule documents which ast submodule it
corresponds to.
This parser is not yet complete, and I have yet to go through its
modules one-by-one to fix and complete them.
2022-11-18 20:20:37 +01:00
037a0f69a3
Split up and expand ast
2022-11-18 19:37:51 +01:00
4e94c13351
Add todo
2022-11-18 18:59:22 +01:00
53928bdeb5
Desugar destructuring via builtin
2022-11-18 18:59:06 +01:00
64c9ca08d9
Document syntactic sugar
2022-11-18 17:59:11 +01:00
63a33b47a1
Parse field access suffix
2022-11-18 14:59:21 +01:00
23a126cbfd
Parse parenthesized expressions
2022-11-18 14:33:15 +01:00
b3ddc793d0
Add parenthesized expression to ast
2022-11-18 14:26:36 +01:00
629eca7409
Parse variable identifier assignment expressions
2022-11-18 14:23:31 +01:00
621a829d1d
Parse variable assignment expressions
2022-11-18 14:20:29 +01:00
fb2d1c14b1
Parse variable identifier expressions
2022-11-18 14:15:50 +01:00
27bc69806a
Parse variable expressions
2022-11-18 14:12:10 +01:00
13413702ed
Parse basic expressions
2022-11-18 14:11:50 +01:00
274ed8b3ca
Parse table constructors
2022-11-18 14:00:48 +01:00
6bf1c8f7d1
Parse literals
2022-11-18 13:49:49 +01:00
1d02ff4480
Parse table literals
2022-11-18 13:25:07 +01:00
ee832588ac
Parse numeric literals
2022-11-18 12:55:02 +01:00
932af88c84
Parse ident
2022-11-18 12:24:01 +01:00
e9d2602cd6
Parse space without comments
2022-11-18 12:20:00 +01:00
d64a971ed4
Create Stream using custom Span
2022-11-18 12:19:45 +01:00