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 = [ RegionRule('comment', r'--\[(?P=*)\[', Grammar, r'\]%(level)s\]'), #RegionRule('comment', r'--\[\[', Grammar, r'\]\]'), PatternRule('comment', '--.*$'), PatternRule('spaces', ' +'), PatternRule('eol', r'\n'), RegionRule('lua.string', "'", StringGrammar1, "'"), RegionRule('lua.string', '"', StringGrammar2, '"'), RegionRule('lua.string', '\[\[', Grammar, '\]\]'), 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"(?