parent
a22a9843fb
commit
e8e81d8633
|
@ -285,7 +285,6 @@ class Application(object):
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
def add_slot(self):
|
def add_slot(self):
|
||||||
# XYZ
|
|
||||||
b = self.bufferlist.slots[self.active_slot].window.buffer
|
b = self.bufferlist.slots[self.active_slot].window.buffer
|
||||||
n = self.bufferlist.add_slot()
|
n = self.bufferlist.add_slot()
|
||||||
self.bufferlist.set_slot(n, b)
|
self.bufferlist.set_slot(n, b)
|
||||||
|
@ -295,7 +294,7 @@ class Application(object):
|
||||||
"invalid slot: %r (%r)" % (n, len(self.bufferlist.slots))
|
"invalid slot: %r (%r)" % (n, len(self.bufferlist.slots))
|
||||||
self.bufferlist.remove_slot(n)
|
self.bufferlist.remove_slot(n)
|
||||||
if self.active_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):
|
def single_slot(self):
|
||||||
while len(self.bufferlist.slots) > 1:
|
while len(self.bufferlist.slots) > 1:
|
||||||
if self.active_slot == 0:
|
if self.active_slot == 0:
|
||||||
|
@ -489,7 +488,6 @@ class Application(object):
|
||||||
self.bufferlist.set_slot(self.active_slot, b)
|
self.bufferlist.set_slot(self.active_slot, b)
|
||||||
|
|
||||||
def add_window_to_buffer(self, b, slotname):
|
def add_window_to_buffer(self, b, slotname):
|
||||||
# XYZ
|
|
||||||
if not b.has_window(slotname):
|
if not b.has_window(slotname):
|
||||||
slot = self.bufferlist.slots[slotname]
|
slot = self.bufferlist.slots[slotname]
|
||||||
window.Window(b, self, height=slot.height, width=slot.width)
|
window.Window(b, self, height=slot.height, width=slot.width)
|
||||||
|
|
22
mode/c.py
22
mode/c.py
|
@ -12,10 +12,8 @@ class CommentGrammar(Grammar):
|
||||||
class MacroGrammar(Grammar):
|
class MacroGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
PatternRule(r'spaces', r' +'),
|
PatternRule(r'spaces', r' +'),
|
||||||
|
|
||||||
RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'),
|
RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'),
|
||||||
PatternRule(r'comment', r'//.*$'),
|
PatternRule(r'comment', r'//.*$'),
|
||||||
|
|
||||||
PatternRule('name', r'(?:(?<=#define )) *[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule('name', r'(?:(?<=#define )) *[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="),
|
PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="),
|
||||||
PatternRule(r'binop', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"),
|
PatternRule(r'binop', r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"),
|
||||||
|
@ -31,43 +29,30 @@ class MacroGrammar(Grammar):
|
||||||
class CGrammar(Grammar):
|
class CGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
PatternRule(r'spaces', r' +'),
|
PatternRule(r'spaces', r' +'),
|
||||||
|
|
||||||
PatternRule(r"delimiter", r"\.|\(|\)|\[|\]|{|}|@|,|:|`|;|=(?!=)|\?|->"),
|
PatternRule(r"delimiter", r"\.|\(|\)|\[|\]|{|}|@|,|:|`|;|=(?!=)|\?|->"),
|
||||||
PatternRule(r'eol', r"\n$"),
|
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_]*'),
|
r' +', r'structname', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
PatternGroupRule(r'enumgroup', r'keyword', r'enum', r'spaces',
|
PatternGroupRule(r'enumgroup', r'keyword', r'enum', r'spaces',
|
||||||
r' +', r'enumname', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
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'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'function', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\()'),
|
||||||
|
|
||||||
PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)"),
|
PatternRule(r'builtin', r"(?:NULL|TRUE|FALSE)"),
|
||||||
PatternRule(r'label', r'[a-zA-Z_][a-zA-Z0-9_]*(?=:)'),
|
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'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'\*/'),
|
RegionRule(r'comment', r'/\*', CommentGrammar, r'\*/'),
|
||||||
PatternRule(r'comment', r'//.*$'),
|
PatternRule(r'comment', r'//.*$'),
|
||||||
|
|
||||||
RegionRule(r'string', '"', StringGrammar2, '"'),
|
RegionRule(r'string', '"', StringGrammar2, '"'),
|
||||||
|
|
||||||
PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="),
|
PatternRule(r"unop", r"!(?!=)|\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*="),
|
||||||
PatternRule(r'binop', 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"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]+"),
|
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'),
|
RegionRule(r'macrocomment', r'#if +(?:0|NULL|FALSE)', Grammar, r'#endif'),
|
||||||
|
|
||||||
PatternRule(r'char', r"'.'|'\\.'|'\\[0-7]{3}'"),
|
PatternRule(r'char', r"'.'|'\\.'|'\\[0-7]{3}'"),
|
||||||
|
|
||||||
PatternGroupRule(r'includegrp', r'macro.start', r'# *include', r'spaces',
|
PatternGroupRule(r'includegrp', r'macro.start', r'# *include', r'spaces',
|
||||||
r' +', r'header', r'< *[-A-Za-z/0-9_.]+ *>|" *[-A-Za-z/0-9_.]+ *"',
|
r' +', r'header', r'< *[-A-Za-z/0-9_.]+ *>|" *[-A-Za-z/0-9_.]+ *"',
|
||||||
'macro.end', r'\n$'),
|
'macro.end', r'\n$'),
|
||||||
|
|
||||||
PatternRule(r'identifier', r"[a-zA-Z_][a-zA-Z0-9_]*"),
|
PatternRule(r'identifier', r"[a-zA-Z_][a-zA-Z0-9_]*"),
|
||||||
|
|
||||||
OverridePatternRule(r'comment', r'/\* *@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *\*/$'),
|
OverridePatternRule(r'comment', r'/\* *@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *\*/$'),
|
||||||
OverridePatternRule(r'comment', r'// *@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
|
OverridePatternRule(r'comment', r'// *@@:(?P<token>[.a-zA-Z0-9_]+):(?P<mode>[.a-zA-Z0-9_]+) *$'),
|
||||||
]
|
]
|
||||||
|
@ -146,7 +131,6 @@ class CMake(method.shell.Exec):
|
||||||
class C(mode.Fundamental):
|
class C(mode.Fundamental):
|
||||||
modename = 'C'
|
modename = 'C'
|
||||||
extensions = ['.c', '.h', '.cpp']
|
extensions = ['.c', '.h', '.cpp']
|
||||||
#tabbercls = CTabber
|
|
||||||
tabbercls = CTabber2
|
tabbercls = CTabber2
|
||||||
grammar = CGrammar
|
grammar = CGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
|
@ -176,9 +160,6 @@ class C(mode.Fundamental):
|
||||||
'macro.end': ('magenta', 'default', 'bold'),
|
'macro.end': ('magenta', 'default', 'bold'),
|
||||||
'include': ('blue', 'default', 'bold'),
|
'include': ('blue', 'default', 'bold'),
|
||||||
'header': ('green', 'default', 'bold'),
|
'header': ('green', 'default', 'bold'),
|
||||||
#'structname': ('yellow', 'default', 'bold'),
|
|
||||||
#'enumname': ('yellow', 'default', 'bold'),
|
|
||||||
#'c_type': ('green', 'default', 'bold'),
|
|
||||||
}
|
}
|
||||||
config = {
|
config = {
|
||||||
'c.syntax-cmd': "gcc -x c -fsyntax-only %(path)s",
|
'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',))
|
self.add_bindings('c-make', ('C-c C-c',))
|
||||||
|
|
||||||
def get_functions(self):
|
def get_functions(self):
|
||||||
#return self.context.get_names()
|
|
||||||
return {}
|
return {}
|
||||||
def get_function_names(self):
|
def get_function_names(self):
|
||||||
#return self.context.get_name_list()
|
|
||||||
return []
|
return []
|
||||||
def get_line_function(self, y):
|
def get_line_function(self, y):
|
||||||
#return self.context.get_line_name(y)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
install = C.install
|
install = C.install
|
||||||
|
|
Loading…
Reference in New Issue