[ragel-users] How to check if a list of strings exist?

dinesh rtp mariner_element at hotmail.com
Mon May 19 19:36:51 UTC 2014

I am new to ragel and finding it difficult to solve this problem. 
I need to check if certain headers exists in the input to ragel machine. The easier way is to parse header and check if the header I am looking for is present or not. The problem with this, I need to compare every header that is present in the input to figure if the headers I  am looking for is present. Is there a way in ragel to say "Given a list of headers are these headers present in any order" ?
For example:
Input:Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; xxx
Arrival-Date: Fri, 04 May 2012 15:25:09 +0200

Final-Recipient: rfc822; test-dsn-failure at gmail.com
Status: 5.1.1
Action: failed
Last-Attempt-Date: Fri, 04 May 2012 15:25:09 +0200
Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 t12si10077186weq.36
I just need to check if the headers:Reporting-MTA:Final-Recipient:Status:Action:
are present.
For now I have come with the following:
key = print - [:];action headerName {headerName.append(1,fc);}action onHeader {    if (headerName.compare("Reporting-MTA") == 0) {        cout << "Reporting-MTA header is present" << endl;    } else if ...}header = key+ @headerName ':' @onHeader;
Is there a easier way to check if these headers exist?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20140519/8422b376/attachment-0001.html>
-------------- next part --------------
ragel-users mailing list
ragel-users at complang.org

More information about the ragel-users mailing list