On Tuesday, November 30, 2010 at 15:49:39 (-0800) Jim Idle writes: >REST_OF_LINE allows an empty token which will immediately match nothing and >continue to do so forever. You want + not *. I think you might be doing >this wrong to be honest. I would probably not use ANTLR for this.
Maybe, but Antlr is so cool ... I did try replacing * with + and I got the same error. Blech. I really didn't want to write a parser by hand for all of this. I've got significantly more to do than what I've got here, the rest of which should be easy to handle for antlr. So, there is really no viable way to have Antlr read the rest of the line of input? I would be happy to just write the Java code for that one line: shell -timeout 30 find /var/log -name .... If I could just get hold of the input stream, read to end of line, I could hand-parse the '-timeout N' part, etc., and then let the lexer continue reading on the next line. Is there no way to "cut out" a part of the input like this to process separately? Actually, I think I have a sick idea: Since this is line-based stuff, and small files, I can read this all in to memory. I can hand-parse the shell command lines, and replace them with an empty line (to preserve line numbers in case of error) in the input, noting which lines I modified. Then, I can give the massaged input to Antlr. The parser is going to produce one instance of a Command class for each line, and return a list of them, in order. I can just put the shell Command instances back in the list where they belong and be on my merry way.. As I said though, it would be really cool if I could just do this all in Antlr. Bill List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
