<Context> <Can_Indent>True</Can_Indent> <Syntax_Highlighting>False</Syntax_Highlighting> <Case_Sensitive>True</Case_Sensitive> </Context> </Language> """ GPS.parse_xml(XML) register_highlighter( language="matlab", spec=( # Match keywords words([ "break", "case", "catch", "continue", "else", "elseif", "end", "for", "function", "global", "if", "otherwise", "persistent", "return", "switch", "try", "while", "classdef", "methods" ], tag=tag_keyword), # Match comments lines region(r"%", "\n", tag=tag_comment, highlighter=(hl_comment_notes, )), # Match strings region(r"'", r"'|$", tag=tag_string, highlighter=(hl_inside_strings, )), # Match number literals simple(r"\b[0-9]*\.?[0-9]+\b", tag=tag_number), ))
from highlighter.common import words, simple, tag_number, tag_keyword, region,\ tag_comment, register_highlighter, tag_string, tag_type number_literal = simple(r"\b[0-9]*\.?[0-9]+\b", tag=tag_number) keywords = "|".join(["theory", "type", "constant", "function", "predicate", "inductive", "axiom", "lemma", "goal", "use", "clone", "prop", "meta", "scope", "import", "export", "end", "forall", "exists", "not", "true", "false", "if", "then", "else", "let", "in", "match", "with", "as", "epsilon"]) comment_region = region(r"\(\*", "\*\)", tag=tag_comment) ada_keywords = "|".join(["True", "False"]) task_specific = "|".join(["Local Context", "Goal"]) register_highlighter( language="why", spec=( number_literal, # Match comments lines comment_region, # Match keywords words(keywords, tag=tag_keyword), words(ada_keywords, tag=tag_string), words(task_specific, tag=tag_type) ) )
string_literal = hl.region(r'"', r'"', matchall=False, tag=hl.tag_string) hl.register_highlighter( language="recordflux", spec=( hl.simple(r"--[^\n]*", tag=hl.tag_comment), type_region, hl.simple(r"\b'First", tag=tag_aspect), hl.simple(r"\b'Last", tag=tag_aspect), hl.simple(r"\b'Length", tag=tag_aspect), hl.simple(r"\b'Size", tag=tag_aspect), hl.simple(r"\bFirst\s+=>", tag=tag_aspect), hl.simple(r"\bLast\s+=>", tag=tag_aspect), hl.simple(r"\bLength\s+=>", tag=tag_aspect), hl.simple(r"\bSize\s+=>", tag=tag_aspect), hl.words(recordflux_keywords, tag=hl.tag_keyword), hl.words(recordflux_literals, tag=hl.tag_keyword), hl.simple(r"16#[_A-Fa-f0-9]+#", tag=hl.tag_number), hl.simple(r"\b[_0-9]+\b", tag=hl.tag_number), hl.words(("Always_Valid"), tag=tag_aspect), string_literal, ), ) @hook("gps_started") def __on_gps_started(): GPS.FileTemplate.register( alias_name="rflx_package", label="RecordFlux specification", unit_param="name",
# Match multiline strings string_hl(r'"""', r'"""', name="multiline_string_sq"), string_hl(r"'''", r"'''", name="multiline_string_dq"), # Match string literals string_hl(r"'", r"'|$"), string_hl(r'"', r'"|$'), # Match comments lines region(r"#", "\n", tag=tag_comment, highlighter=(hl_comment_notes, )), # Match number literals simple(r"\b[0-9]*\.?[0-9]+\b", tag=tag_number), # Match keywords words(kwlist, tag=tag_keyword), # Match self simple("self", tag=tag_comment_notes), # Match important constants and builtins words([ "True", "False", "None", "int", "str", "buffer", "unicode", "list", "tuple", "bytearray", "xrange", "dict", "Ellipsis", "NotImplemented", "__debug__", "__doc__", "__file__", "__name__", "__package__" ], tag=tag_type), words([ "__import__", "abs", "all", "any", "apply", "bin", "callable", "classmethod", "cmp", "coerce", "compile", "delattr", "dir",
r"\*/", tag=tag_comment, highlighter=(hl_comment_notes, )) number_literals = simple(r"\b[0-9]*\.?[0-9]+\b", tag=tag_number) colors = simple(r"#[0-9-a-f-A-F]{3}(?:[0-9-a-f-A-F]{3})?\b", tag=tag_number) length_units = simple(r"{0}".format(length_units_list), tag=tag_keyword) length_values = region(r"\b[0-9]", r"\b", tag=tag_number, highlighter=(length_units, )) properties = words(properties_list, tag=tag_type) html_elements = words(html_elements_list, tag=tag_keyword) color_names = words(color_names_list, tag=tag_string) border_types = words(border_types_list, tag=tag_type) class_or_id_identifiers = simple(r"(?:\.|#)(?:\w|-)+", tag=tag_type) gtk_variables = simple(r"@(?:\w|-)+", tag=tag_default) property_assignment = region( r":", r";", tag=tag_default,