From e8e81d86330c2e4d9c0adf99abdd0fb014e13417 Mon Sep 17 00:00:00 2001 From: moculus Date: Wed, 12 Nov 2008 06:40:31 +0000 Subject: [PATCH] some small stuff --HG-- branch : pmacs2 --- application.py | 4 +--- mode/c.py | 24 +----------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/application.py b/application.py index 0c3718c..0109300 100755 --- a/application.py +++ b/application.py @@ -285,7 +285,6 @@ class Application(object): return locals() def add_slot(self): - # XYZ b = self.bufferlist.slots[self.active_slot].window.buffer n = self.bufferlist.add_slot() self.bufferlist.set_slot(n, b) @@ -295,7 +294,7 @@ class Application(object): "invalid slot: %r (%r)" % (n, len(self.bufferlist.slots)) self.bufferlist.remove_slot(n) if self.active_slot > n: - self.active_slot = max(0, self.active_slot - 1) #XYZ + self.active_slot = max(0, self.active_slot - 1) def single_slot(self): while len(self.bufferlist.slots) > 1: if self.active_slot == 0: @@ -489,7 +488,6 @@ class Application(object): self.bufferlist.set_slot(self.active_slot, b) def add_window_to_buffer(self, b, slotname): - # XYZ if not b.has_window(slotname): slot = self.bufferlist.slots[slotname] window.Window(b, self, height=slot.height, width=slot.width) diff --git a/mode/c.py b/mode/c.py index e36b592..52f8593 100644 --- a/mode/c.py +++ b/mode/c.py @@ -12,10 +12,8 @@ class CommentGrammar(Grammar): class MacroGrammar(Grammar): rules = [ PatternRule(r'spaces', r' +'), - RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'), PatternRule(r'comment', r'//.*$'), - PatternRule('name', r'(?:(?<=#define )) *[a-zA-Z_][a-zA-Z0-9_]*'), PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="), PatternRule(r'binop', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), @@ -31,43 +29,30 @@ class MacroGrammar(Grammar): class CGrammar(Grammar): rules = [ PatternRule(r'spaces', r' +'), - PatternRule(r"delimiter", r"\.|\(|\)|\[|\]|{|}|@|,|:|`|;|=(?!=)|\?|->"), PatternRule(r'eol', r"\n$"), - - PatternGroupRule(r'structgroup', r'keyword', r'struct', r'spaces', + PatternGroupRule(r'structgroup', r'keyword', r'struct', r'spaces', r' +', r'structname', r'[a-zA-Z_][a-zA-Z0-9_]*'), PatternGroupRule(r'enumgroup', r'keyword', r'enum', r'spaces', r' +', r'enumname', r'[a-zA-Z_][a-zA-Z0-9_]*'), PatternRule(r'keyword', r"(?:auto|break|case|char|const|continue|default|double|do|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)(?![a-zA-Z_])"), - PatternRule(r'function', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'), - PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)"), PatternRule(r'label', r'[a-zA-Z_][a-zA-Z0-9_]*(?=:)'), - RegionRule(r'macro', r'# *(?:assert|cpu|define|elif|else|endif|error|ident|ifdef|ifndef|if|import|include_next|line|machine|pragma_once|pragma|system|unassert|undef|warning)(?!=[a-zA-Z0-9_])', MacroGrammar, r'\n$'), - RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'), PatternRule(r'comment', r'//.*$'), - RegionRule(r'string', '"', StringGrammar2, '"'), - PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="), PatternRule(r'binop', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), PatternRule(r"integer", r"(?:0(?![x0-9])|[1-9][0-9]*|0[0-7]+|0[xX][0-9a-fA-F]+)[lL]?"), PatternRule(r"float", r"[0-9]+\.[0-9]*|\.[0-9]+|(?:[0-9]|[0-9]+\.[0-9]*|\.[0-9]+)[eE][\+-]?[0-9]+"), - RegionRule(r'macrocomment', r'#if +(?:0|NULL|FALSE)', Grammar, r'#endif'), - PatternRule(r'char', r"'.'|'\\.'|'\\[0-7]{3}'"), - PatternGroupRule(r'includegrp', r'macro.start', r'# *include', r'spaces', r' +', r'header', r'< *[-A-Za-z/0-9_.]+ *>|" *[-A-Za-z/0-9_.]+ *"', 'macro.end', r'\n$'), - PatternRule(r'identifier', r"[a-zA-Z_][a-zA-Z0-9_]*"), - OverridePatternRule(r'comment', r'/\* *@@:(?P[.a-zA-Z0-9_]+):(?P[.a-zA-Z0-9_]+) *\*/$'), OverridePatternRule(r'comment', r'// *@@:(?P[.a-zA-Z0-9_]+):(?P[.a-zA-Z0-9_]+) *$'), ] @@ -146,7 +131,6 @@ class CMake(method.shell.Exec): class C(mode.Fundamental): modename = 'C' extensions = ['.c', '.h', '.cpp'] - #tabbercls = CTabber tabbercls = CTabber2 grammar = CGrammar opentokens = ('delimiter',) @@ -176,9 +160,6 @@ class C(mode.Fundamental): 'macro.end': ('magenta', 'default', 'bold'), 'include': ('blue', 'default', 'bold'), 'header': ('green', 'default', 'bold'), - #'structname': ('yellow', 'default', 'bold'), - #'enumname': ('yellow', 'default', 'bold'), - #'c_type': ('green', 'default', 'bold'), } config = { 'c.syntax-cmd': "gcc -x c -fsyntax-only %(path)s", @@ -208,13 +189,10 @@ class C(mode.Fundamental): self.add_bindings('c-make', ('C-c C-c',)) def get_functions(self): - #return self.context.get_names() return {} def get_function_names(self): - #return self.context.get_name_list() return [] def get_line_function(self, y): - #return self.context.get_line_name(y) return None install = C.install