diff --git a/mode/tal.py b/mode/tal.py index 5d9f8b2..c8be73f 100644 --- a/mode/tal.py +++ b/mode/tal.py @@ -6,9 +6,9 @@ import re class TalGrammar(Grammar): rules = [ PatternRule('spaces', '[ \t]+'), - RegionRule('comment', r'\((?:[ \t]|$)', Grammar, '(?:^|[ \t])\)'), + RegionRule('comment', r'\((?:[ \t]|$)', Grammar, '\)'), 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.pad', r'\|[^ \t\n]+'), # pad (absolute) PatternRule('tal.pad', r'\$[^ \t\n]+'), # pad (relative) @@ -161,7 +161,10 @@ class Taldoc(Method): if '2' in suffix: glyph = '*' 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): if x.endswith('^') or x.endswith('*'): return x @@ -172,7 +175,7 @@ class Taldoc(Method): if rs is None: msg = '%s (%s) %s: %s' % (word, stk(ds), name, desc) elif ds is None: - msg = '%s {%s} %: %s' % (word, stk(rs), name, desc) + msg = '%s {%s} %s: %s' % (word, stk(rs), name, desc) else: msg = '%s (%s) {%s} %s: %s' % (word, stk(ds), stk(rs), name, desc) w.set_error(msg)