branch : pmacs2
This commit is contained in:
moculus 2008-10-15 04:49:39 +00:00
parent eda2cd274f
commit 607495107e
3 changed files with 12 additions and 4 deletions

View File

@ -89,6 +89,8 @@ class Fundamental(Handler):
context = None context = None
colors = {} colors = {}
config = {} config = {}
lconfig = {}
dconfig = {}
actions = [] actions = []
completers = {} completers = {}
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s" format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s"

View File

@ -3,10 +3,16 @@ import color, completer, default, mode, method, regex, tab
from point import Point from point import Point
from lex import Grammar, PatternRule, RegionRule, OverridePatternRule, NocasePatternRule from lex import Grammar, PatternRule, RegionRule, OverridePatternRule, NocasePatternRule
class AtomGrammar(Grammar):
rules = [
NocasePatternRule(r'escaped', r'\\(?:[bdefnrstv\\"\']|\^[a-z]|\d{1,3})'),
NocasePatternRule(r'data', r"[^\\']+"),
]
class StringGrammar(Grammar): class StringGrammar(Grammar):
rules = [ rules = [
NocasePatternRule(r'escaped', r'\\(?:[bdefnrstv\\"\']|\^[a-z]|\d{1,3})'), NocasePatternRule(r'escaped', r'\\(?:[bdefnrstv\\"\']|\^[a-z]|\d{1,3})'),
NocasePatternRule(r'data', r'[^\\]+'), NocasePatternRule(r'data', r'[^\\"]+'),
] ]
class ErlangGrammar(Grammar): class ErlangGrammar(Grammar):
@ -19,8 +25,8 @@ class ErlangGrammar(Grammar):
PatternRule(r'erl_function', r'[a-z][a-zA-Z0-9_@]*(?= *\()'), PatternRule(r'erl_function', r'[a-z][a-zA-Z0-9_@]*(?= *\()'),
PatternRule(r'erl_namespace', r'[a-z][a-zA-Z0-9_@]*(?=:)'), PatternRule(r'erl_namespace', r'[a-z][a-zA-Z0-9_@]*(?=:)'),
PatternRule(r'erl_builtin', r"whereis|unregister|unlink|tuple_to_list|tuple_size|trunc|tl|time|throw|term_to_binary|term_to_binary|statistics|split_binary|spawn_opt|spawn_opt|spawn_opt|spawn_opt|spawn_monitor|spawn_monitor|spawn_link|spawn_link|spawn_link|spawn_link|spawn|spawn|spawn|spawn|size|setelement|self|round|registered|register|put|purge_module|process_info|process_info|process_flag|process_flag|processes|pre_loaded|port_control|port_connect|port_command|port_close|pid_to_list|open_port|now|nodes|nodes|node|node|monitor_node|module_loaded|make_ref|load_module|list_to_tuple|list_to_pid|list_to_integer|list_to_float|list_to_existing_atom|list_to_bitstring|list_to_binary|list_to_atom|link|length|is_tuple|is_reference|is_record|is_record|is_process_alive|is_port|is_pid|is_number|is_list|is_integer|is_function|is_function|is_float|is_boolean|is_bitstring|is_binary|is_atom|is_alive|iolist_to_binary|iolist_size|iolist|iodata|integer_to_list|hd|halt|halt|group_leader|group_leader|get_keys|get|get|garbage_collect|garbage_collect|float_to_list|float|ext_binary|exit|exit|erase|erase|ence|element|disconnect_node|delete_module|date|concat_binary|check_process_code|byte_size|bitstring_to_list|bit_size|binary_to_term|binary_to_list|binary_to_list|atom_to_list|atom_to_list|apply|apply|apply|abs"), PatternRule(r'erl_builtin', r"whereis|unregister|unlink|tuple_to_list|tuple_size|trunc|tl|time|throw|term_to_binary|term_to_binary|statistics|split_binary|spawn_opt|spawn_opt|spawn_opt|spawn_opt|spawn_monitor|spawn_monitor|spawn_link|spawn_link|spawn_link|spawn_link|spawn|spawn|spawn|spawn|size|setelement|self|round|registered|register|put|purge_module|process_info|process_info|process_flag|process_flag|processes|pre_loaded|port_control|port_connect|port_command|port_close|pid_to_list|open_port|now|nodes|nodes|node|node|monitor_node|module_loaded|make_ref|load_module|list_to_tuple|list_to_pid|list_to_integer|list_to_float|list_to_existing_atom|list_to_bitstring|list_to_binary|list_to_atom|link|length|is_tuple|is_reference|is_record|is_record|is_process_alive|is_port|is_pid|is_number|is_list|is_integer|is_function|is_function|is_float|is_boolean|is_bitstring|is_binary|is_atom|is_alive|iolist_to_binary|iolist_size|iolist|iodata|integer_to_list|hd|halt|halt|group_leader|group_leader|get_keys|get|get|garbage_collect|garbage_collect|float_to_list|float|ext_binary|exit|exit|erase|erase|ence|element|disconnect_node|delete_module|date|concat_binary|check_process_code|byte_size|bitstring_to_list|bit_size|binary_to_term|binary_to_list|binary_to_list|atom_to_list|atom_to_list|apply|apply|apply|abs"),
RegionRule(r'erl_atom', r"'", AtomGrammar, r"'"),
RegionRule(r'string', r'"', StringGrammar, r'"'), RegionRule(r'string', r'"', StringGrammar, r'"'),
RegionRule(r'erl_atom', r"'", StringGrammar, r"'"),
PatternRule(r'erl_atom', r"[a-z][a-zA-Z0-9_@]*"), PatternRule(r'erl_atom', r"[a-z][a-zA-Z0-9_@]*"),
PatternRule(r'erl_variable', r"[A-Z_][a-zA-Z0-9_@]*"), PatternRule(r'erl_variable', r"[A-Z_][a-zA-Z0-9_@]*"),
PatternRule(r'delimiter', r'->|<<|>>|\(|\)|{|}|\[|\]|\.|;|,|\|'), PatternRule(r'delimiter', r'->|<<|>>|\(|\)|{|}|\[|\]|\.|;|,|\|'),

View File

@ -6,7 +6,7 @@ from lex import Grammar, PatternRule, RegionRule, OverridePatternRule, NocasePat
class CommentGrammar(Grammar): class CommentGrammar(Grammar):
rules = [ rules = [
RegionRule(r'comment', r'{-', None, r'-}'), RegionRule(r'comment', r'{-', None, r'-}'),
PatternRule(r'data', r'(?:[^{]|{(?!-))+'), PatternRule(r'data', r'(?:[^{-]|{(?!-)|-(?!}))+'),
] ]
class StringGrammar(Grammar): class StringGrammar(Grammar):
@ -25,7 +25,7 @@ class HaskellGrammar(Grammar):
PatternRule(r'hs_declaration', r"^[a-z_][a-zA-Z0-9_']*"), PatternRule(r'hs_declaration', r"^[a-z_][a-zA-Z0-9_']*"),
PatternRule(r'hs_variable', r"[a-z_][a-zA-Z0-9_']*"), PatternRule(r'hs_variable', r"[a-z_][a-zA-Z0-9_']*"),
PatternRule(r'hs_constructor', r"[A-Z][a-zA-Z0-9_']*"), PatternRule(r'hs_constructor', r"[A-Z][a-zA-Z0-9_']*"),
PatternRule(r'hs_operator', r'@|!|>@>|>>=|>>|=>|::|->|;|<-|\\\\|\.\.|!!|:|\+\+|\||\.|\\|>=|>|/=|==|<=|<|\|\||&&|\^\^|\*\*|\^|/|\*|-|\+|='), PatternRule(r'hs_operator', r'@|!|>@>|>>=|>>|=>|::|->|;|<-|\\\\|\.\.|!!|:|\+\+|\||\.|\\|>=|>|/=|==|<=|<|\|\||&&|\^\^|\*\*|##|\^|/|\*|-|\+|='),
] ]
class Haskell(mode.Fundamental): class Haskell(mode.Fundamental):