I'm trying to parse some messages using an ANTLR grammar. Messages carry the structure:
:20:REF123456
:72:Some narrative text which
may contain new lines and
occassionally other : characters
:80A:Another field
The target output is a table containing the text between the colons as a 'key' and the text until the next key as the value of that key. For example:
Key | Values
--------------------------------------
20 | REF123456
72 | Some narrative text which
may contain new lines and
occassionally other : characters
80 | Another field
I'm able to write a grammar to do this, as long as colons are not allowed in the value field based on the following reference http://danielveselka.blogspot.fr/2011/02/antlr-swift-fields-parser.html
Can anyone offer guidance on how to approach this problem?