import commands import time from tab import StackTabber from method import Method from mode import Fundamental from lex import Grammar, PatternRule, RegionRule, PatternMatchRule from mode.python import StringGrammar1, StringGrammar2 from mode.pipe import Pipe from method.shell import Interact chr1 = '[a-zA-Z_]' chr2 = '[a-zA-Z_0-9]' word = chr1 + chr2 + '*' class LuaGrammar(Grammar): rules = [ PatternRule('comment', r'--.*$'), PatternRule('spaces', r' +'), PatternRule('eol', r'\n'), RegionRule('lua.string', r"'", StringGrammar1, r"'"), RegionRule('lua.string', r'"', StringGrammar2, r'"'), PatternMatchRule('x', '(function)( +)('+word+')', 'lua.keyword', 'spaces', 'lua.function'), PatternRule('lua.keyword', '(?:while|until|true|then|return|repeat|or|not|nil|local|in|if|function|for|false|end|elseif|else|done|do|break|and)(?!'+chr2+')'), PatternRule('lua.internal', '_[A-Z]+'), PatternRule('lua.identifier', word), PatternRule('delimiter', r'(?:[=(){}\[\];:,.])'), PatternRule('lua.operator', r'(?:\.\.\.|\.\.|==|~=|<=|>=|<|>)'), PatternRule('lua.operator', r'(?:\+|-|/|\*|%|\^)'), PatternRule('lua.integer', r"(?