Hi,<br><br>I am trying to parse internet messages, which is mostly regular besides for comment (which can nest), and I am not sure how to handle comment correctly with lex.<br><br>The code below (lexing internet message comment syntax) results in an infinite loop, so I assume lex can only handle regular expressions, but want to check to see if it can be done (or how the problem can be solved), or if I need to use yacc?<br>
<br>Thanks,<br>yc<br><br>(require parser-tools/lex<br> (prefix-in : parser-tools/lex-sre))<br><br>;; below defines a simpled internet message comment <br>
(define-lex-abbrevs<br> (ctext (:- any-char (:or #\( #\))))<br> (ccontent (:or ctext comment))<br> (comment (:: #\( (:* ccontent) #\))))<br><br>(define comment-lexer<br> (lexer (comment lexeme)))<br>;; inf loop <br>
(comment-lexer (open-input-string "(this is a internet message comment)"))<br><br>