branch : pmacs2
This commit is contained in:
moculus 2009-04-01 19:07:28 +00:00
parent fc016f1716
commit 1e7e2d9db9
1 changed files with 25 additions and 2 deletions

View File

@ -1,4 +1,8 @@
import color, mode, tab
import os.path
import time
import tab
from mode import Fundamental
from method.shell import Interact
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
from point import Point
@ -83,7 +87,24 @@ class JavascriptTabber2(tab.StackTabber2):
return t.fqname() in ('spaces', 'eol', 'comment', 'comment.start',
'comment.data', 'comment.null', 'comment.end')
class Javascript(mode.Fundamental):
class RhinoStart(Interact):
args = []
def _execute(self, w, **vargs):
cmd = w.application.config.get('rhino.cmd', 'rhino')
Interact._execute(self, w, bname='*Rhino*', cmd=cmd)
class RhinoLoadFile(RhinoStart):
args = []
def _execute(self, w, **vargs):
RhinoStart._execute(self, w, **vargs)
b = w.application.get_buffer_by_name('*Rhino*')
path = os.path.realpath(w.buffer.path)
time.sleep(0.5)
b.pipe_write('load("env.js");\n')
time.sleep(0.5)
b.pipe_write('load("%s");\n' % path)
class Javascript(Fundamental):
name = 'Javascript'
extensions = ['.js']
grammar = JavascriptGrammar
@ -104,6 +125,8 @@ class Javascript(mode.Fundamental):
'js_regex.escaped': ('magenta', 'default', 'bold'),
'js_regex.end': ('cyan', 'default', 'bold'),
}
config = {'rhino.cmd': 'rhino'}
actions = [RhinoStart, RhinoLoadFile]
_bindings = {
'close-paren': (')',),
'close-brace': ('}',),