comment and keyword handling in treetop
May 8th, 2008 • Uncategorized
# whitespace rule white [ \r\t\n]+ end # mandatory space rule SPACE (white / comment)+ end # optional space rule space SPACE? end # anything but not white rule non_white_char !white . end # typical keyword rule rule var_keyword 'var' !non_white_char end rule comment comment_to_eol / multiline_comment end rule multiline_comment '/*' (!'*/' . )* '*/' end rule comment_to_eol # TODO find out why this doesn't work in specs #'#' (!"\n" .)+ "\n" '#' (!"\n" .)* end