I want to parse a textfile in Pharo Smalltalk, that has the structure outlined below into a Smalltalk object called TestResults, that has instance variables for all the data elements:
Properties:
Name: Value
Name: Value
...
Settings:
Category
SubCategory
Name=Value
SubCategory
Name=Value
Name=Value
...
Column1 Column2 Column3 ...
Value Value Value...
...
I thought about using NeoCSV for the tab-separated-value part at the end of the file, but i do not know how to parse the beginning of the file and how to combine this (if this approach is possible) with NeoCSV.
I advise you to have a look at PetitParser. See http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.pdf and http://www.themoosebook.org/book/internals/petit-parser. Don't hesitate to create more questions on stackoverflow about this if you need help writing your parser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With