parent
997be878f2
commit
8ef03ac77a
11
mode/tal.py
11
mode/tal.py
|
@ -6,9 +6,9 @@ import re
|
||||||
class TalGrammar(Grammar):
|
class TalGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
PatternRule('spaces', '[ \t]+'),
|
PatternRule('spaces', '[ \t]+'),
|
||||||
RegionRule('comment', r'\((?:[ \t]|$)', Grammar, '(?:^|[ \t])\)'),
|
RegionRule('comment', r'\((?:[ \t]|$)', Grammar, '\)'),
|
||||||
PatternRule('delimiter', r'[\[\]{}]'),
|
PatternRule('delimiter', r'[\[\]{}]'),
|
||||||
PatternRule('tal.inst', r'(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)2?k?r?'), # instructions
|
PatternRule('tal.inst', r'(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)2?k?r?(?![a-zA-z0-9_])'), # instructions
|
||||||
PatternRule('tal.defmacro', r'%[^ \t\n]+'), # macro-define
|
PatternRule('tal.defmacro', r'%[^ \t\n]+'), # macro-define
|
||||||
PatternRule('tal.pad', r'\|[^ \t\n]+'), # pad (absolute)
|
PatternRule('tal.pad', r'\|[^ \t\n]+'), # pad (absolute)
|
||||||
PatternRule('tal.pad', r'\$[^ \t\n]+'), # pad (relative)
|
PatternRule('tal.pad', r'\$[^ \t\n]+'), # pad (relative)
|
||||||
|
@ -161,7 +161,10 @@ class Taldoc(Method):
|
||||||
if '2' in suffix:
|
if '2' in suffix:
|
||||||
glyph = '*'
|
glyph = '*'
|
||||||
if 'k' in suffix:
|
if 'k' in suffix:
|
||||||
ds = [ds[0], ds[0] + ds[1]]
|
if ds is not None:
|
||||||
|
ds = [ds[0], ds[0] + ds[1]]
|
||||||
|
if rs is not None:
|
||||||
|
rs = [rs[0], rs[0] + rs[1]]
|
||||||
def mark(x):
|
def mark(x):
|
||||||
if x.endswith('^') or x.endswith('*'):
|
if x.endswith('^') or x.endswith('*'):
|
||||||
return x
|
return x
|
||||||
|
@ -172,7 +175,7 @@ class Taldoc(Method):
|
||||||
if rs is None:
|
if rs is None:
|
||||||
msg = '%s (%s) %s: %s' % (word, stk(ds), name, desc)
|
msg = '%s (%s) %s: %s' % (word, stk(ds), name, desc)
|
||||||
elif ds is None:
|
elif ds is None:
|
||||||
msg = '%s {%s} %: %s' % (word, stk(rs), name, desc)
|
msg = '%s {%s} %s: %s' % (word, stk(rs), name, desc)
|
||||||
else:
|
else:
|
||||||
msg = '%s (%s) {%s} %s: %s' % (word, stk(ds), stk(rs), name, desc)
|
msg = '%s (%s) {%s} %s: %s' % (word, stk(ds), stk(rs), name, desc)
|
||||||
w.set_error(msg)
|
w.set_error(msg)
|
||||||
|
|
Loading…
Reference in New Issue