From fc62fd9c5e4124b975459621cffaee248fd0bad2 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Mon, 24 May 2010 22:54:52 -0400 Subject: [PATCH] added block commenting and some cleanup --HG-- branch : pmacs2 --- mode/lua.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mode/lua.py b/mode/lua.py index 8972451..93df2e5 100644 --- a/mode/lua.py +++ b/mode/lua.py @@ -14,16 +14,18 @@ word = chr1 + chr2 + '*' class LuaGrammar(Grammar): rules = [ - PatternRule('comment', r'--.*$'), - PatternRule('spaces', r' +'), + RegionRule('comment', r'--\[(?P=*)\[', Grammar, r'\]%(level)s\]'), + #RegionRule('comment', r'--\[\[', Grammar, r'\]\]'), + PatternRule('comment', '--.*$'), + PatternRule('spaces', ' +'), PatternRule('eol', r'\n'), - RegionRule('lua.string', r"'", StringGrammar1, r"'"), - RegionRule('lua.string', r'"', StringGrammar2, r'"'), + RegionRule('lua.string', "'", StringGrammar1, "'"), + RegionRule('lua.string', '"', StringGrammar2, '"'), - PatternMatchRule('x', '(function)( +)('+word+')', + 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.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),