From b134fed9e9cb588560573b631c4f0467b907704e Mon Sep 17 00:00:00 2001 From: moculus Date: Fri, 20 Feb 2009 06:28:57 +0000 Subject: [PATCH] c-context is a work in progress --HG-- branch : pmacs2 --- mode/c.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mode/c.py b/mode/c.py index 001da3d..5350034 100644 --- a/mode/c.py +++ b/mode/c.py @@ -102,6 +102,41 @@ class CTabber2(tab.StackTabber2): return t.fqname() in ('spaces', 'eol', 'comment', 'comment.start', 'comment.data', 'comment.null', 'comment.end') +#class CContext(context.Context): +# def _regen_stack(self, y): +# if y > 0 and self.namelines[y - 1][1]: +# return list(self.namelines[y - 1][1]) +# else: +# return [] +# +# def _build_name_map(self, y1, y2, last, curr, stack): +# highlights = self.mode.window.get_highlighter() +# +# i = y1 +# while i < y2: +# if not stack: curr = None +# tokens = highlights.tokens[i] +# +# result = self.class_match.match(tokens) +# if result: curr = tokens[result[0] - self.class_offset].string +# result = self.method_match.match(tokens) +# if result: curr = tokens[result[0] - self.method_offset].string +# +# if curr is not None: self.names.setdefault(curr, i) +# +# for t in tokens: +# if t.match('delimiter', '{'): +# stack.append(curr) +# elif t.match('delimiter', '}'): +# if stack: stack.pop(-1) +# if stack: +# curr = stack[-1] +# else: +# curr = None +# +# if curr: self.namelines[i] = (curr, tuple(stack)) +# i += 1 + class CCheckSyntax(method.shell.Exec): '''Build this C program (using the mode's make cmd)''' show_success = False