Age | Commit message (Collapse) | Author |
|
List item regex can be replaced with a simple algorithm to check the
first character of the line to see if it's a bullet character.
I must check the bold before the italic code, as the regex may greedily
eat up the double asterisks if I don't use it.
squash! -list item regex, +nitems variable
|
|
implementation file for compiler.hpp. Currently I have regexes and
replacement strings that use the Type enum to access the correct
ones (Italic (the first enum item) has its regex and replacement at 0).
|
|
|
|
Decision: to increase productivity as well as make implementing new
features a bit easier, I've decided to move to C++, which has a
standard (and fast) implementation of a regex system. Furthermore, it
has a ton of good features that make working with this system easier.
|
|
|
|
|
|
This means that the pointer that I allocate can actually be used.
|
|
Using new file algorithm to generate html files from markdown file,
supports repl and testing as usual.
|
|
I've redid the compiler to use a FILE object pointer, which means that
we can leave error checking for FILES on the main program.
Furthermore, I've removed the use of the array_t type with a two pass
system. One pass is done for the number of lines (along with potentially
other diagnostics), another is done for the actual compilation. This
means at runtime we have an understanding about the size of the file and
can optimize for it. Also, we have a single memory block to assign to,
where we know the size of the array.
|
|
Uses the dynamic array to alleviate the burdens of computing specific
memory sizes. Terminates lines for parsing.
|
|
Very basic, and only for dynamic content
|
|
|
|
Prefix 'test_' is useless and bloat
|
|
Doesn't work very well
|
|
Set compiled token recipes in the compiler.h file (easier to manage) and
let code handle the rest.
|
|
Similar to previous commit, make it more general and easier to adapt
through generalizing state and algorithms.
|
|
Make it a bit cleaner, uses a switch to setup general variables (tag
strings, lengths, etc) then a general algorithm that is guaranteed to
work for any single character markdown syntax if those variables are set.
|
|
|
|
|
|
|
|
|
|
This will check if a given character is a valid plain text token (*, _).
This will allow me to abstract away and assess if some plain text needs
to be further processed
|
|
This algorithm looks for substrings in a big string, attempting to find
the index of the first occurence.
|
|
|
|
When using fgets(), the returned string doesn't have a null terminator
but rather a newline (you use a RET to end input). So I made a little
script portion dedicate to finding the first newline and wholly removing it.
|
|
On converting, I would sometimes get the other tag missing. This was
both on the repl and the tests, and was quite annoying.
Each c-string should end in a null terminator, which I forgot about. So
this commit fixes that by setting the last character pointer on each
branch to the null terminator.
|
|
|
|
|
|
This checks if the first item is a hyphen, then generates a <li> tag
surrounding the content
|
|
This was because it wrote to the null character and thus was
inaccessible (I think).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This routine will handle asterisks and bullet points.
Works by checking characters at each step.
Also has diagnostics by checking for matching characters. If a matching
asterisk, for example, isn't found then present an error and quit.
|
|
|
|
If argc is greater than 1 and the second argument is --test then run tests.
|
|
|
|
Very elementary, doesn't use some massive framework, should just use
asserts and C-lang constructs. Currently one method is present in the
header, test_header_depths.
|
|
compiler.h holds definitions necessary for compiling markdown,
compiler.c the implementations.
Moved implementation of compile_line to compiler.h and compiler.c respectively.
|
|
To make clang format happy, I put continue on the for loop so that it
will have at least one statement.
|
|
Makes more sense as a variable name.
|
|
untag_size, tag_size, etc. These represent the proper sizes and are
easier to mutate.
|
|
This adds the functionality for arbitrary levels of header depth which
will be translated to depth based header tags.
\## -> <h2>
\### -> <h3>
etc
This also introduces a variable 'size_of_content' which presents the
size of the raw string without the header tags as added size.
|
|
|
|
compile_line is the main function which compiles a single line in C.
Similar to the stage of compilation in the python program.
Currently supports header tags
|
|
Looks nice in my editor and is nice to use when writing code. Will be
removed via some simple grepping later if I'm asked lol.
|
|
|