Commit graph

16 commits

Author SHA1 Message Date
3469623fee Add first parser test cases 2021-12-16 23:42:37 +01:00
10a99d0b1e expr: Fix silly bug in equality check 2021-12-16 23:42:11 +01:00
84f127bfec Move must_alloc into test.h 2021-12-16 22:50:14 +01:00
025fd61abd Add apfl_string_source_reader
A useful source reader implementation to pass in a source saved as an
in-memory string into the tokenizer.

This replaces the string_src_reader in the tokenizer_test and is even a bit
more flexible, by allowing any aplf_string_view as the source.
2021-12-16 22:49:41 +01:00
e79945a398 Continue work on parser
- Simplify return types: Many functions that returned
  `enum parse_fragment_result` only ever returned PF_OK or PF_ERROR.
  Changing these functions to return bool simplifies things a lot. This
  also helped in identifying some places where I didn't handle all
  parse_fragment_result values properly.
- More cleaning up
- Allow linebreaks inside parenthesis
2021-12-16 22:09:59 +01:00
d853ba40ad parser: Fix parsing assignments 2021-12-16 22:09:59 +01:00
86e1c1339d strings: Also reset length when moving a string 2021-12-16 22:09:59 +01:00
c0e47b14e6 Add tokenizer test case
During development on the parser I got a "malloc(): corrupted top size"
error in the tokenizer when parsing `a=a`. I wrote this test to see if it
was really a problem with the tokenizer. It wasn't, lets keep the test
nontheless.
2021-12-16 22:09:59 +01:00
808219f9c7 expr: Fix printing assignments 2021-12-15 23:11:54 +01:00
c288c333ca Continue work on parser
Seems that we can parse most things now :). Assignments don't work yet,
thoug. Also we're currently leaking memory pretty badly.
2021-12-15 21:47:17 +01:00
af33887131 internal: Fix list deinitialization 2021-12-15 21:47:17 +01:00
fd3c5702ca expr: More consistent and easier to read printing 2021-12-15 21:47:17 +01:00
ade0972d67 expr: Fix moving listlike structures 2021-12-15 21:47:17 +01:00
f907461b90 resizable: Fix capacity growing 2021-12-15 21:47:17 +01:00
09d51b9080 Parser: Make the parser object own the token
This simplifies the code a bit, since the methods now don't have to deinit
the token themselves any more.
2021-12-15 21:47:17 +01:00
d094ed7bd5 Initial commit 2021-12-15 21:47:17 +01:00