Functional Programming EnthusiastOver
XML
SDL
FLOAT
INTEGER
SNodeType
Pelican / ✨
SNode
No matching tags
No matching tags
No matching tags
No matching tags
No matching tags
In the end I really wanted to see my data structured more like this.So I figured I'd stretch my mind and build an s-expression parser. Below is the basic structure.In my program a parsed s-expression is a linked list consisting of SNode. wanted to introduce the FLOAT and INTEGER data types as these currently just get tagged as SYMBOL.For basic number support I added FLOAT and INTEGER to the SNodeType enumeration.Next I created a couple functions for determining whether a string is a float or an integer.I then updated the parse function to try and determine the type before falling back to a SYMBOL.After that the parser was able to successfully tag number types. empty string, there's nothing in between the quotes for it to capture so it winds up parsing the rest of expression incorrectly.The solution I came up with in the end is a little longer but it probably performs better than fscanf.To stay consistent with this means of parsing I also updated the logic for parsing numbers and symbols.
As said here by