/** * Name: eiffel * Description: Eiffel programming language. * Author: Julien Lemoine */ eiffel_types = /* Types */ /\b(INTEGER|BOOLEAN|REAL|STRING|DOUBLE|CHARACTER|ARRAY2|ARRAY3\ |ARRAYED_COLLECTION|COLLECTION2|COLLECTION3|COUNTER\ |DICTIONARY|FIXED_ARRAY|FIXED_ARRAY2|FIXED_ARRAY3|HASH_TABLE_SIZE\ |LINK|LINK2|LINK_COLLECTION|LINKED_LIST|MEMO|SET|SET_NODE\ |TWO_WAY_LINKED_LIST)\b/; eiffel_keywords = /* Keywords */ /\b(agent|alias|all|and|as|assign|check|class|convert|create|Current|debug\ |deferred|do|else|elseif|end|ensure|expanded|export|external|False\ |feature|from|frozen|if|implies|indexing|infix|inherit|inspect|invariant\ |is|like|local|loop|not|pbsolete|old|once|or|prefix|Precursor|pure\ |redefine|reference|rename|require|rescue|Result|retry|separate|then|True\ |TUPLE|undefine|creation)\b/; /* The super state of all C highlightings. */ state EiffelHighlight extends Highlight { BEGIN { if (verbose_highlighting) verbose_re = /(:=|<=|>=|=|!=|\/=|!)/; else verbose_re = 0; } verbose_re { match = $0; if (strcmp (match, ":=") == 0) str = "assign"; else if (strcmp (match, "<=") == 0) str = "le"; else if (strcmp (match, ">=") == 0) str = "ge"; else if (strcmp (match, "==") == 0) str = "equiv"; else if (strcmp (match, "!") == 0) str = "lnot"; else str = 0; if (!str || !language_symbol (str)) language_print ($0); } } state eiffel extends EiffelHighlight { /* One line comments. */ /\-\-/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* Keywords. */ eiffel_keywords { keyword_face (true); language_print ($0); keyword_face (false); } /* Types. */ eiffel_types { type_face (true); language_print ($0); type_face (false); } /* String constants. */ /\"/ { string_face (true); language_print ($0); call (c_string); string_face (false); } /* Character constants. */ /'.'|'\\\\.'/ { string_face (true); language_print ($0); string_face (false); } /[\t]/ { language_print(" "); } /* Remove trailing whitespace */ /[ \t]*$/ { } /* * Function definitions, with args * fct_name (args...) is */ /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*)([ \t]*)(\([^)]*\)[ \t]*)(is)[ \t]*$/ { function_name_face (true); language_print ($1); function_name_face (false); language_print(" "); language_print ($3); keyword_face (true); language_print ($4); keyword_face (false); } /* * Function definitions, without args * fct_name is */ /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*)([ \t]*)(is)[ \t]*$/ { function_name_face (true); language_print ($1); function_name_face (false); language_print(" "); keyword_face (true); language_print ($3); keyword_face (false); } } /* Local variables: mode: c End: */