Parsing multiline literals

Sep 9, 2010 at 2:48 PM

Hi, 

I am newbie to Irony. I am looking to build a grammar for parsing log files produced by a log server. Following is a sample file:

Logger started
Logclient connected
15:10:17:684,[t:0x708] : SETUP trigger received 
15:10:17:684,[t:0x708] : transition 
15:10:17:734,[t:0x708] :  
 
 encoded data AP///////wAebaLDAQEBARsSAQOARid4Ctmwo1dJnCURSUshCAABAUVAYUABAYGAAQHRwAEBAjqAGHE4LU
15:10:17:734,[t:0x708] : 
 Len 259 Decoded data. 
15:10:17:734,[t:0x708] : 00ffffffffffff001e6da2c3010101011b120103804627780ad9b0a357499c2511494b21080001
Logclient disconnected
15:10:17:734,[t:0x708] : transition2
15:10:17:736,[t:0x708] : transition3
15:10:17:936,[t:0x708] : transition4
15:10:17:936,[t:0x708] : SETUP 
Logger stopped

Every log line could be a log statement from one of the log clients or a msg from the log server. Log client messages are prefixed with a time stamp, while the log server messages are not. 

In the above sample, green lines are log server messages, rest are from different log clients that are connected to this server. 

I am not sure how to extract the message from the log client in to its own LogLine NonTerminal, while cleanly separating the LogServer message in to its own NonTerminal. Since LogClient messages can be multiline, I need to capture all the content till the start of next LogClientMsg (prefixed with a timestamp) or till one of the LogServerMessages is encountered (LogServerMessages is a fixed set -- it is not arbitrary content. So I thought of making this in to a Terminal). 

Would appreciate any help in forming the grammar for the above format. Thanks. 

Sep 15, 2010 at 3:41 PM

Hey kannanmr,

Please provide some examples of what you currently have; I'm sure someone in the community here will be happy to help if you give a starting point.

-MindCore