commit
2ff9e017e4
20
mode/tal.py
20
mode/tal.py
|
@ -68,6 +68,23 @@ hi_cyan = ('cyan155', 'default')
|
||||||
lo_blue = ('blue113', 'default')
|
lo_blue = ('blue113', 'default')
|
||||||
hi_blue = ('blue225', 'default')
|
hi_blue = ('blue225', 'default')
|
||||||
|
|
||||||
|
class Talasm(Method):
|
||||||
|
'''Assemble the given .tal file'''
|
||||||
|
bname = '*Talasm*'
|
||||||
|
def run_pipe(self, w, args, switch, mname=None):
|
||||||
|
return w.application.run_pipe(args, w.buffer, self.bname, switch, mname)
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
path = w.buffer.path
|
||||||
|
if path.endswith('.tal'):
|
||||||
|
dest = path[:-4] + '.rom'
|
||||||
|
else:
|
||||||
|
raise Exception('invalid path: %s' % path)
|
||||||
|
args = ['uxnasm', path, dest]
|
||||||
|
r = self.run_pipe(w, args, lambda x: x != 0, 'error')
|
||||||
|
b = w.application.get_buffer_by_name(self.bname)
|
||||||
|
b.orig_path = w.buffer.path
|
||||||
|
if r == 0: w.set_error(b.lines[-2])
|
||||||
|
|
||||||
class Taldoc(Method):
|
class Taldoc(Method):
|
||||||
'''View documentation'''
|
'''View documentation'''
|
||||||
ops = {
|
ops = {
|
||||||
|
@ -220,7 +237,7 @@ class Tal(Fundamental):
|
||||||
name = 'tal'
|
name = 'tal'
|
||||||
extensions = ['.tal']
|
extensions = ['.tal']
|
||||||
grammar = TalGrammar
|
grammar = TalGrammar
|
||||||
actions = [Taldoc]
|
actions = [Taldoc, Talasm]
|
||||||
colors = {
|
colors = {
|
||||||
'tal.addr': hi_cyan,
|
'tal.addr': hi_cyan,
|
||||||
'tal.defmacro': hi_blue,
|
'tal.defmacro': hi_blue,
|
||||||
|
@ -239,6 +256,7 @@ class Tal(Fundamental):
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
_bindings = {
|
_bindings = {
|
||||||
|
'talasm': ('C-c c', 'C-c C-c'),
|
||||||
'taldoc': ('C-c p',),
|
'taldoc': ('C-c p',),
|
||||||
'close-paren': (')',),
|
'close-paren': (')',),
|
||||||
'close-brace': ('}',),
|
'close-brace': ('}',),
|
||||||
|
|
Loading…
Reference in New Issue