Commit Graph

12 Commits

Author SHA1 Message Date
Zorchenhimer abc99b02e6 Updated readme.md
Made it more clear what is currently implemented and what is planned.
2023-11-26 12:55:35 -05:00
Zorchenhimer b952ac99ac Fix a lot of memory leaks
Added a bunch of code to free created objects.  One notable change was
to return the next token from FreeToken() to cut down on boiler plate
code that kept track of a "consumed" token.  Now all that just happens
in FreeToken() and I don't have to worry about that anywhere else.

Also added FreeNode() to free all nodes.  This wasn't done before at
all.  Like FreeToken(), it will return the next node in the list to
avoid having to track that stuff in the calling context.
2023-11-15 21:43:03 -05:00
Zorchenhimer c17eaf1ec4 Implement the paragraph node
This node handles both plain paragraphs as well as block quotes. Single
newlines are turned into spaces, double newlines terminate the block.
Care is taken to not have repeated whitespace tokens in the content,
while keeping the number of spaces.
2023-10-22 22:29:38 -04:00
Zorchenhimer 3d0bba21e1 Remove some old debugging printf()'s 2023-10-22 17:11:02 -04:00
Zorchenhimer c5a0fbd93e Tweak makefile CFLAGS
Move -fsanitize=address to a proper line so it can be commented out
easier.
2023-10-22 16:53:51 -04:00
Zorchenhimer 7d8ed24eaf Remove the TokenList structure
This struct was just a container for two pointers and just made things
painful.  This structure has been removed and the next pointer has been
moved to the Token struct.

Also, add a null check to the calling context after NewLexer().
2023-10-22 16:50:18 -04:00
Zorchenhimer 9c172c5216 Combine repeated whitespace tokens
Whitespace tokens now contain all equal contiguous whitespace
characters.  The token list will no longer contain, eg, three
TT_WHITESPACE tokens for three spaces and will instead have one
TT_WHITESPACE token that has a length of three.
2023-10-20 20:22:11 -04:00
Zorchenhimer da1ad03661 Remove NodeList
Removed the NodeList struct as it only had a "first" field and didn't
really serve any purpose outside of that.  ParseNodes() now just returns
a pointer to the first Node.
2023-10-20 20:19:34 -04:00
Zorchenhimer d855df380b Add codeblocks; Fix some stuff
- Parse code blocks that are wrapped sets of three backticks.
- Added a TT_TRIPLEBACKTICK token.
- Added a length field to the Token struct.
- Added an error node.
- Cleaned up some file read code.
- Fixed the header raw text (don't reuse the same buffer for each node).
2023-10-15 20:55:12 -04:00
Zorchenhimer ca6bdca7ab Fix basic parse issues
Fixed parsing the tokens so it actually worked.  Only headers are
currently implemented, but header nodes are now properly parsed and
everything else is properly ignored.

- Get the input filename from the command line
- Added in a bunch of checks to avoid segfaults
- Added some more debug info in places
2023-10-15 18:30:59 -04:00
Zorchenhimer dd2655db0c Fix Makefile for use on Unix
The GCC version installed on Unix does not support `-Wpedantic`, so this
has been replaced with `-pedantic`.  The version installed on Unix is
4.0.0.

`.PHONY` has been removed as this has no special meaning on Unix.
Instead, make thought it was a target which made it build, run, then
immediately delete the executable.  This is obviously not desired.

Unix make also doesn't support the `$^` automatic variable.  This has
been replaced with the object list variable instead.
2021-07-14 11:32:46 -04:00
Zorchenhimer 5e1d6ae207 Initial commit 2021-07-14 11:15:46 -04:00