On Windows & Linux
gcc -o validator C/validator.c
On Windows
./validator.exe
(this will default to opening file.html)
./validator.exe <filepath>
On Linux
./validator
(this will default to opening file.html)
./validator <filepath>
void tokenize(char* stringPtr)
It may not be much but im proud of this little function It cleans out attributes and field contents while still lexing the html susbet. While it does clear out field contents, it can pick up on mistakes caused by angle brackets
<
's and >
's will be errored up
....<...>...
, which is incorrect
will cause <...>, can be identified</p
will be tokenized verbatim,
thus can identify this mistakep>
will be erroredCalling exit implicitly free's all pointers and memory allocations, thus we do not need to explicitly call free, in fact when testing on ubuntu the terminal does not like that we use free().
The code always terminates using exit(), whether it be exit(ON_FAILURE) or exit(ON_SUCESS). And thus, all free's were taken out. The code has to hold onto the token array and token stack whilst it is in use, and will always terminate thus deallocating using free seems intuitive to use.
This code has been tested on a windows machine and a portable install of linux, access to mac is limited and an install of some linux distro may not be possible given the current timeframe.
runhaskell .\validator.hs