# lexing while token_type is not eof if(token_type)=begincomment inbegincomment = true if(token_type=endcomment if incomment inbegincomment = false if incomment style = commentstyle else style = stylemap.getstyle drawlines with the style # lexing is done if still in begincomment lexer the rest of the document until the ending comment is found applying the comment style if was in endcomment with no matching begincomment lexer the document until the beginning until a begincomment is found applying an error style or a comment style