/** * Name: refal * Description: Refal programming language (http://refal.org/index_e.htm). * Author: Anton Orlov * $LastChangedDate$ * $Revision$ * * Bugs: * - Any word in the begining of a line is treated as a function name. * - Function name should be on the same line as $func or $func? keyword. * - Only one (first) constant name in $const declaration is highlighted and * only in the case it goes on the same line as $const keyword. */ state refal extends HighlightEntry { /* Comments. */ /\/\*/ { comment_face (true); language_print ($0); call (c_comment); comment_face (false); } /(\/\/)|\*/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* Function calls and references. */ /([<&])((\w|[!?_-])+|(\"[^\"]*\"))/ { language_print ($1); function_name_face (true); language_print ($2); function_name_face (false); } /* Function defenitions. */ /^([[:upper:]?!](\w|[!?_-])*|(\"[^\"]*\"))/ { function_name_face (true); language_print ($0); function_name_face (false); } /* Declarations for functions and constants. */ /(\$(func\??|const))([ \t]+)((\w|[!?_-])+|(\"[^\"]*\"))/ { builtin_face (true); language_print ($1); builtin_face (false); language_print ($3); function_name_face (true); language_print ($4); function_name_face (false); } /* Objects. */ /\$(traceall|trace|extern|box|table|vector|string|channel)/ { builtin_face (true); language_print ($0); builtin_face (false); call (refal_object_names); } /* Operators. */ /\$([rl]|(fail)|(iter)|(error)|(trap)|(with))\b/ { keyword_face (true); language_print ($0); keyword_face (false); } /* Other keywords. */ /\$\w+/ { builtin_face (true); language_print ($0); builtin_face (false); } /* Words. */ /\"/ { string_face (true); language_print ($0); call (c_string); string_face (false); } /[[:upper:]?!](\w|[!?_-])*/ { string_face (true); language_print ($0); string_face (false); } /* Characters. */ /[\']/ { string_face (true); language_print ($0); call (refal_letters); string_face (false); } /* Types. */ /\b[estv]\b/ { type_face (true); language_print ($0); type_face (false); } /* Variables. */ /\b([estv])(\.?)((\w|[!?_-])+|(\"[^\"]*\"))/ { type_face (true); language_print ($1); type_face (false); language_print ($2); variable_name_face (true); language_print ($3); variable_name_face (false); } } state refal_letters extends Highlight { /\\\\./ { language_print ($0); } /[\']/ { language_print ($0); return; } } state refal_object_names extends Highlight { /(\w|[!?_-])+|(\"[^\"]*\")/ { function_name_face (true); language_print ($0); function_name_face (false); } /;/ { language_print ($0); return; } } /* Local variables: mode: c End: */