add initial tag support to some other languages as well
--HG-- branch : pmacs2
This commit is contained in:
parent
7cd3b7dda7
commit
d95e7d3dda
|
@ -102,7 +102,9 @@ class InitTags(Method):
|
|||
if not b.path:
|
||||
raise Exception('Buffer %r has no path' % b.name())
|
||||
|
||||
t = b.settings['C'].get('tag-base')
|
||||
mname = w.mode.name
|
||||
|
||||
t = b.settings[mname].get('tag-base')
|
||||
if t and t in a.state['tags']:
|
||||
m = a.state['tags'][t]
|
||||
if m.is_outdated():
|
||||
|
@ -115,7 +117,7 @@ class InitTags(Method):
|
|||
return
|
||||
|
||||
base = b.path
|
||||
while 'tag-base' not in b.settings['C']:
|
||||
while 'tag-base' not in b.settings[mname]:
|
||||
base, tail = os.path.split(base)
|
||||
if not tail:
|
||||
break
|
||||
|
@ -125,7 +127,7 @@ class InitTags(Method):
|
|||
elif os.path.exists(os.path.join(base, 'TAGS')):
|
||||
return self._save_manager(w, base)
|
||||
|
||||
if 'tag-base' not in b.settings['C']:
|
||||
if 'tag-base' not in b.settings[mname]:
|
||||
self._old_window = w
|
||||
self._prompt = "Enter source directory: "
|
||||
c = completer.get_completer('path')
|
||||
|
|
|
@ -4,6 +4,7 @@ from point import Point
|
|||
from lex import Grammar, PatternRule, RegionRule, OverridePatternRule
|
||||
from lex import NocasePatternRule, PatternMatchRule
|
||||
from method.shell import Interact
|
||||
from etags import TagManager
|
||||
|
||||
class AtomGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -89,11 +90,16 @@ class ErlStart(Interact):
|
|||
def _execute(self, w, **vargs):
|
||||
Interact._execute(self, w, bname='*Erl*', cmd='erl')
|
||||
|
||||
class ErlangTagManager(TagManager):
|
||||
lang = 'Erlang'
|
||||
exts = set(('.erl',))
|
||||
|
||||
class Erlang(mode.Fundamental):
|
||||
name = 'Erlang'
|
||||
extensions = ['.erl']
|
||||
tabwidth = 4
|
||||
tabbercls = ErlangTabber
|
||||
tagcls = ErlangTagManager
|
||||
grammar = ErlangGrammar
|
||||
commentc = '%'
|
||||
opentokens = ('delimiter',)
|
||||
|
|
|
@ -3,6 +3,7 @@ import context
|
|||
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
||||
from mode.python import StringGrammar2
|
||||
from parse import Any, And, Or, Optional, Name, Match, Matchs
|
||||
from etags import TagManager
|
||||
|
||||
class CommentGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -125,10 +126,17 @@ class JavaContext(context.Context):
|
|||
if curr: self.namelines[i] = (curr, tuple(stack))
|
||||
i += 1
|
||||
|
||||
|
||||
class JavaTagManager(TagManager):
|
||||
lang = 'Java'
|
||||
exts = set(('.java',))
|
||||
|
||||
|
||||
class Java(mode.Fundamental):
|
||||
name = 'Java'
|
||||
extensions = ['.java']
|
||||
tabbercls = JavaTabber2
|
||||
tagcls = JavaTagManager
|
||||
grammar = JavaGrammar
|
||||
commentc = '//'
|
||||
opentokens = ('delimiter',)
|
||||
|
|
|
@ -5,6 +5,7 @@ from mode import Fundamental
|
|||
from method.shell import Interact
|
||||
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
||||
from point import Point
|
||||
from etags import TagManager
|
||||
|
||||
class StringGrammar1(Grammar):
|
||||
rules = [
|
||||
|
@ -110,11 +111,16 @@ class RhinoLoadFile(RhinoStart):
|
|||
time.sleep(0.5)
|
||||
b.pipe_write('load("%s");\n' % path)
|
||||
|
||||
class JavascriptTagManager(TagManager):
|
||||
lang = 'Javascript'
|
||||
exts = set(('.js',))
|
||||
|
||||
class Javascript(Fundamental):
|
||||
name = 'Javascript'
|
||||
extensions = ['.js']
|
||||
grammar = JavascriptGrammar
|
||||
tabbercls = JavascriptTabber2
|
||||
tagcls = JavascriptTagManager
|
||||
commentc = '//'
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
|
|
|
@ -15,6 +15,7 @@ from method.introspect import TokenComplete
|
|||
from tab import StackTabber2
|
||||
from parse import Any, And, Or, Optional, Name, Match, Matchs
|
||||
import term
|
||||
from etags import TagManager
|
||||
|
||||
strg1 = r"'(?:\\.|[^'\\])*'"
|
||||
strg2 = r'"(?:\\.|[^"\\])*"'
|
||||
|
@ -764,6 +765,10 @@ class PerlContext(context.Context):
|
|||
if curr: self.namelines[i] = (curr, tuple(stack))
|
||||
i += 1
|
||||
|
||||
class PerlTagManager(TagManager):
|
||||
lang = 'Perl'
|
||||
exts = set(('.pl', '.pm'))
|
||||
|
||||
# white is for delimiters, operators, numbers
|
||||
c_default = ('default', 'default')
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ from lex import Grammar, PatternRule, RegionRule, OverridePatternRule
|
|||
from parse import Any, And, Or, Optional, Name, Match, Matchs
|
||||
from method import Method, arg, Argument
|
||||
from method.shell import Exec
|
||||
from etags import TagManager
|
||||
|
||||
class StringGrammar1(Grammar):
|
||||
rules = [
|
||||
|
@ -552,6 +553,10 @@ class PythonContext(context.Context):
|
|||
for k in xrange(last, y2):
|
||||
self.namelines[k] = (curr, None)
|
||||
|
||||
class PythonTagManager(TagManager):
|
||||
lang = 'Python'
|
||||
exts = set(('.py',))
|
||||
|
||||
# white is for delimiters, operators, numbers
|
||||
default = ('default', 'default')
|
||||
|
||||
|
@ -596,6 +601,7 @@ class Python(mode.Fundamental):
|
|||
extensions = ['.py']
|
||||
detection = [re.compile('^#!(?:.+[/ ])python')]
|
||||
tabbercls = PythonTabber
|
||||
tagcls = PythonTagManager
|
||||
grammar = PythonGrammar
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
|
|
|
@ -4,6 +4,7 @@ from point import Point
|
|||
from lex import Grammar, PatternRule, RegionRule, OverridePatternRule
|
||||
from lex import PatternMatchRule
|
||||
from mode.lisp import StringGrammar2, Lisp, LispTabber
|
||||
from etags import TagManager
|
||||
|
||||
class SchemeGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -53,10 +54,15 @@ class GuileLoadFile(Interact):
|
|||
path = os.path.realpath(w.buffer.path)
|
||||
b.pipe_write('(load "%s")\n' % path)
|
||||
|
||||
class SchemeTagManager(TagManager):
|
||||
lang = 'Scheme'
|
||||
exts = set(('.scm',))
|
||||
|
||||
class Scheme(Lisp):
|
||||
name = 'Scheme'
|
||||
extensions = ['.scm']
|
||||
grammar = SchemeGrammar
|
||||
tagcls = SchemeTagManager
|
||||
colors = {
|
||||
'scheme_keyword': ('cyan', 'default', 'bold'),
|
||||
'scheme_char': ('green', 'default', 'bold'),
|
||||
|
|
Loading…
Reference in New Issue