/** * Name: r * Description: R programming language. * Author: Rafael Laboissiere */ r_keyword_re = /\b(break|else|f(unction|or)|i(f|felse|n)|next|repeat|switch|while)\b/; r_type_re = /\b(FALSE|Inf|N(aN|A|ULL)|TRUE)\b/; state r_string_single_quotes extends Highlight { /\\\\./ { language_print ($0); } /[\']/ { language_print ($0); return; } } state r_string_double_quotes extends Highlight { /\\\\./ { language_print ($0); } /"/ { language_print ($0); return; } } state r extends HighlightEntry { /* Comments. */ /#/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } r_type_re { type_face (true); language_print ($0); type_face (false); } r_keyword_re { keyword_face (true); language_print($0); keyword_face (false); } /* Strings. */ /* 'any number of characters' */ /[\']/ { string_face (true); language_print ($0); call (r_string_single_quotes); string_face (false); } /* "any number of characters" */ /["]/ { string_face (true); language_print ($0); call (r_string_double_quotes); string_face (false); } } /* Local variables: mode: c End: */