--▽▽UTF-8▽▽ --[[ indentation for SciTE version 1.1 - copyleft by Prim, Andras : do with this code whatever you want Handled languages: HTML, PHP, C, CPP, JavaScript, embedded JavaScript, XML This script uses the syntax highlight info, so it works correctly, when the correct lexer is used. Put something like this in your User options file (SciTEUser.properties) ext.lua.startup.script= /home/bandi/scite/indent.lua command.name.1.*=indent command.1.*=do_indent command.subsystem.1.*=3 command.mode.1.*=savebefore:no This will make a menu item in your "Tools" menu, that can be used with Control+1 shortcut ]] --[[ just a helper for me ]] scite_Command { 'indent|do_all|Ctrl+3', } local t_langdecide = {} local t_langrules = {} local not_intent = {} local c_context local function do_first() local s, e = editor:findtext('\\S\\s\\s+\\S', SCFIND_REGEXP, 0) while s do local style = editor.StyleAt[s] if style == SCE_C_IDENTIFIER or style == SCE_C_OPERATOR then local sel = editor:textrange(s, e) --print(sel) sel = string.gsub(sel, "(%S)%s+(%S)", "%1 %2") editor:SetSel(s, e) editor:ReplaceSel(sel) end s, e = editor:findtext('\\S\\s\\s+\\S', SCFIND_REGEXP, e) end end local function do_test() --[[ local s,e = editor:findtext('=',0,0) while s do local style = editor.StyleAt[s] print(char_at(s)) print(style) style = editor.StyleAt[s-1] print(style) style = editor.StyleAt[s+1] print(style) s,e = editor:findtext('=',0,e) end ]] local textLength = editor.TextLength for i = 0, textLength, 1 do local style = editor.StyleAt[i] local ch = char_at(i) if nil ~= ch then print(ch) end print(style) end --editor:GotoPos(9) --editor:AddText("bbb") --editor:StartStyling(9, 0) --editor:SetStyling(3, 6) --editor:StyleClearAll() --textLength=editor.TextLength --for i = 0, textLength, 1 do -- local style = editor.StyleAt[i] -- --print(char_at(s)) -- print(style) --end end local function do_labelIndent() -- print( 'SCLEX_CPP:' .. SCLEX_CPP ) -- print( 'editor.Lexer:' .. editor.Lexer ) if editor.Lexer == SCLEX_CPP then local s, e = editor:findtext('^\\s*\\w+\\s*:\\s*$', SCFIND_REGEXP, 0) while s do local sel = editor:textrange(s, e) -- print('[' .. sel .. ']') local sel_new = string.gsub(sel, "^%s*([%w_]+)%s*:%s*$", "%1:") -- print('[' .. sel_new .. ']') if sel_new ~= "default:" then editor:SetSel(s, e) editor:ReplaceSel(sel_new) end s, e = editor:findtext('^\\s*\\w+\\s*:\\s*$', SCFIND_REGEXP, e) end s, e = editor:findtext('^\\s*#.+$', SCFIND_REGEXP, 0) while s do local sel = editor:textrange(s, e) --print(sel) sel = string.gsub(sel, "^%s*(#.*%S)%s*$", "%1") editor:SetSel(s, e) editor:ReplaceSel(sel) s, e = editor:findtext('^\\s*#.+$', SCFIND_REGEXP, e) end end end local function get_match(t) local pos = 0 local get_flg = function(judg_ch, pos) local flg = 0 if pos == 0 then return 1 end local ch = char_at(pos) if judg_ch then if type(judg_ch) == 'function' then flg = judg_ch(ch) elseif type(judg_ch) == 'table' then for k, v in ipairs(judg_ch)do if table.contains(v, ch)then flg = k break end end end else -- end flg 1: lf or cr, 0: not if ch == '\r' or ch == '\n' then flg = 1 end end return flg end return function() local s, e -- print( t.find .. ':pos:'.. pos .. '=' ) local loop_flg=0 repeat s, e = editor:findtext(t.find, SCFIND_REGEXP, pos) if not s then break end pos = e local sty=editor.StyleAt[e-1] -- print('editor:textrange(s, e):' .. editor:textrange(s, e)) if type(t.sty) == 'number' then -- print( 't.sty:' .. t.sty .. ':editor.StyleAt[e-1]:'.. editor.StyleAt[e-1] ) if t.sty == sty then loop_flg = 1 end elseif type(t.sty) == 'table' then -- print( 't.sty:' .. table.concat(t.sty," ") .. ':editor.StyleAt[e-1]:'.. editor.StyleAt[e-1] ) if table.contains(t.sty, sty)then loop_flg = 1 end end until loop_flg==1 -- print( t.find .. ':pos:'.. pos .. '=' ) local st,en, con, mat, e_flg, s_flg if s then con = editor:textrange(s, e) --print('con:' .. con) if t.to then if type(t.to) == 'string' then mat = con:gsub(t.from, t.to) -- print( 'con:[' .. con .. '] t.from:[' .. t.from .. '] t.to:[' .. t.to .. '] mat:[' .. mat .. ']') elseif type(t.to) == 'table' then mat = {} for k, v in ipairs(t.to)do local tmp = con:gsub(t.from, v) table.insert(mat, tmp) end end end en = e-1 repeat en = en+1 until char_at(en)~= ' ' and char_at(en)~= '\t' e_flg = get_flg( t.RightCahr, en) st = s repeat st = st-1 until st==0 or ( char_at(st)~= ' ' and char_at(st)~= '\t' ) s_flg = get_flg( t.LeftCahr, st) pos = en end return s, { s=s, e=en, s1 = s, e1 = e, s2 = st, e2 = en, s_f = s_flg, e_f = e_flg, m = mat, move_pos = function(d) if d ~= 0 then --print(d) end pos = pos+d end, get_before_flg = function(p) repeat p = p-1 until p==0 or ( char_at(p)~= ' ' and char_at(p)~= '\t' ) local flg = get_flg( t.LeftCahr, p) return p,flg end, get_after_flg = function(p) repeat p = p+1 until p==0 or ( char_at(p)~= ' ' and char_at(p)~= '\t' ) local flg = get_flg( t.RightCahr, p) return p,flg end, } end end local parameter_format_tbl = { { find = '\\w+\\s*(' , from = "^([%w_]+)%s*%($" , to = "%1" , sty = SCE_C_OPERATOR , RightCahr = { [1] = { '\r', '\n' } } , Replace = function(f) local ret local flg = 0 -- print('====[' .. f.m .. ']') for pat, stru in pairs(t_langrules['cpp'])do --print('----------[' .. pat .. ']') if f.m == pat then ret = f.m .. " (" flg = 1 break end end if flg == 0 then ret = f.m .. "(" end return ret end }, { find = '\\s*)' , from = "(%))" , to = "%1" , sty = SCE_C_OPERATOR , LeftCahr = { [1] = { '\r', '\n' }, [2] = { ')'}, } , RightCahr = { [1] = { '\r', '\n' }, [2] = { ')',']'}, } , Replace = function(f) local ret='' -- if f.s_f ~=2 then -- ret = ' ' -- end ret = ret .. ')' if f.e_f ~=2 then ret = ret .. ' ' end return ret end }, { find = '\\s*\\([{}]\\)' , sty = SCE_C_OPERATOR , from = "^%s*([{}])$" , to = "%1" , Replace = function(f) f.s=f.s2+1 local ret = ' ' .. f.m --print( f.m .. '[' .. f.e_f .. ']' ) if f.e_f == 0 then ret = ret .. ' ' end return ret end }, { find = '\\s*[<>]' , from = "^%s*([<>])$" , to = "%1" , sty = SCE_C_OPERATOR , LeftCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>', '!', '~', '+', '/', '*' }, [3] = { ']', ')' , '}'}, [4] = { '-' }, } , RightCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>' }, [3] = { '[', '(', '{' }, } , Replace = function(f) local ret='' -- print( f.m .. '[' .. f.s_f .. ']' .. char_at(f.s2) .. '[' .. f.e_f .. ']' .. char_at(f.e2) ) -- if f.s_f ==1 or f.s_f ==3 then --( f.s_f ~=2 and f.s_f ~=0) if f.s_f ~=2 or f.e_f ==2 then ret = ' ' end if f.e_f ==1 or f.e_f ==3 then ret =ret .. f.m .. ' ' else if f.m == '>' and f.s_f == 4 then local _,flg=f.get_before_flg(f.s2) if flg == 4 then -- x-- > ret = f.m .. ' ' else -- -> ret = f.m end else -- f.m == '>' and if f.e_f == 0 then ret =ret .. f.m .. ' ' else ret =ret .. f.m end end end -- print( 'ret=[' .. ret .. ']' ) return ret end }, { find = '<[^<>]+>' , sty = SCE_C_OPERATOR , from = "%<%s*([^%>]*%S)%s*%>$" , to = "%1" , Replace = function(f) local ret = f.m -- print( f.m .. '[' .. f.e_f .. ']' ) if f.e_f == 0 then ret ='<' .. f.m .. '>' end -- print( 'ret=[' .. ret .. ']' ) return ret end }, { find = 'std::[^<:]+<' , sty = SCE_C_OPERATOR , from = "(std::[%w_]+)%s*(<)" , to = "%1%2" , Replace = function(f) local ret = f.m -- print( 'ret=[' .. ret .. ']' ) return ret end }, { find = '\\s*[=]' , from = "^%s*([=])$" , to = "%1" , sty = SCE_C_OPERATOR , LeftCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>', '!'}, [3] = { ']'}, [4] = { '^', '~', '-', '+', '/', '*', '&', '|' }, } , RightCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>' }, [3] = { '[', '!' }, } , Replace = function(f) local ret='' -- print( f.m .. '[' .. f.s_f .. ']' .. '[' .. f.e_f .. ']' ) if f.s_f ==3 or f.s_f ==0 then ret = ' ' end local _,flg=f.get_before_flg(f.s2) -- print( f.m .. '[' .. f.s_f .. ']' .. char_at(f.s2) .. '[' .. f.e_f .. ']' .. char_at(f.e2) .. '[' .. flg.. ']' .. char_at(f.s2-1) ) if flg==4 and f.s_f ==4 then -- rc->count--_=_= 0) [ -- == ] ret = ' ' end if f.e_f == 3 or f.e_f ==0 then ret =ret .. f.m .. ' ' else ret =ret .. f.m end -- print( 'ret=[' .. ret .. ']' ) return ret end }, { find = '\\s*[!]' , from = "^%s*([!])$" , to = "%1" , sty = SCE_C_OPERATOR , LeftCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>', '!', '~', '-', '+', '/', '*' }, [3] = { ']'}, } , RightCahr = { [1] = { '\r', '\n' }, [2] = { '=', '<' , '>' }, [3] = { '[', '!' }, } , Replace = function(f) local ret='' --print( f.m .. '[' .. f.s_f .. ']' .. '[' .. f.e_f .. ']' ) if f.s_f ==3 or f.s_f ==0 then ret = ' ' end ret =ret .. f.m return ret end }, { find = '\\s*[|&=]+' , sty = SCE_C_OPERATOR , from = "^%s*([|&=]+)$" , to = "%1" , Replace = function(f) local ret = false -- print( f.m .. '[' .. f.e_f .. ']' ) if f.e_f == 0 then if f.m == '&' or f.m == '|' then ret=' ' .. f.m -- print('ret1[' .. ret .. ']' ) else if string.len(f.m) == 2 or f.m == '|' then -- ret =' ' .. f.m .. ' ' -- print( 'ret2[' .. ret .. ']' ) end end end return ret end }, { find = '\\s*[+-]' , from = "^%s*([%+-])$" , to = "%1" , sty = SCE_C_OPERATOR , LeftCahr = { [1] = { '*'}, [2] = { '<' , '>', '!', '~', '-', '+', '/'}, [3] = { '{',']','('}, [4] = { '='}, [5] = { '0','1','2','3','4','5','6','7','8','9'}, [6] = { ',',';'}, [7] = { '\r', '\n' }, } , RightCahr = { [1] = { '*'}, [2] = { '<' , '>', '!', '~', '-', '+', '/'}, [3] = { '[', '!' }, [4] = { '='}, [5] = { '0','1','2','3','4','5','6','7','8','9'}, [6] = { ',',';'}, [7] = { '\r', '\n' }, } , Replace = function(f) local ret='' --print( f.m .. '[' .. f.s_f .. ']' .. char_at(f.s2) .. '[' .. f.e_f .. ']' .. char_at(f.e2) ) -- =_-1 -- 2_- 1 if f.s_f ==3 or f.s_f ==4 or f.s_f ==5 then ret = ' ' end -- if f.m == '+' and f.s_f ==0 then if f.s_f ==0 and f.e_f ~=2 then -- if f.e_f ~=0 then ret = ' ' -- end end -- len_+= if f.e_f ==4 and f.s_f ~=2 then -- and ( f.s_f ==0 or f.s_f ==5 ) ret = ' ' end -- local _,flg=f.get_before_flg(f.s2) -- print( f.m .. '[' .. f.s_f .. ']' .. char_at(f.s2) .. '[' .. f.e_f .. ']' .. char_at(f.e2) ) if (f.e_f == 3 or f.e_f ==0) and f.s_f ~=2 then ret =ret .. f.m .. ' ' else if f.s_f ==2 then if f.e_f ==4 or f.e_f == 2 then -- *dst++_= -- k-- > 0 ret =ret .. f.m .. ' ' else -- ++ argv ret =ret .. f.m end else if f.s_f ==6 or f.e_f ==2 then -- , -1 -> ret =ret .. f.m else if f.e_f ==4 then -- len -= ret =ret .. f.m else if (f.s_f ==4 or f.s_f ==3) and f.e_f ==5 then -- = -1 if ( -2 ret =ret .. f.m else -- ) + 4 ret =ret .. f.m .. ' ' end end end end end -- print( 'ret=[' .. ret .. ']' ) return ret end }, { find = '\\s+return\\s+.+;' , sty = SCE_C_OPERATOR , from = "^(%s*)return(.+)$" , to = "%1@%2" , Replace = function(f) -- print( f.m .. '[' .. f.e_f .. ']' ) local sp,value = f.m:match('^(.+)@(.+)$') value = value:gsub("%s+", " ") local ret=sp .. "return " .. value return ret end }, { find = '\\s*\\([,;]\\)' , sty = SCE_C_OPERATOR , from = "^%s*([,;])$" , to = "%1" , Replace = function(f) local ret = f.m --print( f.m .. '[' .. f.e_f .. ']' ) if f.e_f == 0 then ret = f.m .. ' ' end return ret end }, { find = ')\\s*\\.\\s*\\w+' , sty = { SCE_C_WORD2, SCE_C_IDENTIFIER } , from = "^(%))%s*(%.)%s*(%w+)" , to = "%1%2%3" , Replace = function(f) local ret = f.m -- print( ret .. '[' .. ret .. ']' ) return ret end }, } local function do_fromat_parameter(t) local tt=0 -- print( 'find:' .. t.find) for s, f in get_match(t)do -- s, e1, e2, flg, c, ma, mov_pos tt= tt+1 -- print( tt .. ':--------------------------') local r if type(t.Replace) == 'string' then r = t.Replace elseif type(t.Replace) == 'table' then r = t.Replace[f.e_f] elseif type(t.Replace) == 'function' then r = t.Replace(f) end --print('[' .. con .. ']=[' .. m .. ']') if r then -- con = editor:textrange(f.s, f.e) -- print( 'find:[' .. t.find .. ']' .. 'con:[' .. con .. '] => [' .. r .. ']') editor:SetSel(f.s, f.e) editor:ReplaceSel(r) f.move_pos(#r -(f.e-f.s)) end end collectgarbage() editor:Colourise(0, -1) end local function do_parameterIndent() local langrules = t_langrules['cpp'] local textLength = editor.TextLength for k, v in ipairs(parameter_format_tbl)do do_fromat_parameter(v) end end local function do_enterKey() if editor.Lexer == SCLEX_XML then local s, e = editor:findtext('\n', SCFIND_MATCHCASE, 0) while e do local ch = char_at(s-1) if ch == '\r' then s = s-1 end editor:SetSel(s, e) editor:ReplaceSel('') s, e = editor:findtext('\n', SCFIND_MATCHCASE, s) end editor:Colourise(0, -1) s, e = editor:findtext('>\\s*\\S', SCFIND_MATCHCASE+SCFIND_REGEXP, 0) while s do local style_s = editor.StyleAt[s] --print("===="..style_s) if style_s == SCE_H_TAG then editor:SetSel(s, e-1) editor:ReplaceSel('>') end s, e = editor:findtext('>\\s*\\S', SCFIND_MATCHCASE+SCFIND_REGEXP, s+1) end editor:Colourise(0, -1) s, e = editor:findtext('>\\s*<', SCFIND_MATCHCASE+SCFIND_REGEXP, 0) while s do local style_s = editor.StyleAt[s] local style_e = editor.StyleAt[e] if style_e == SCE_H_TAG then editor:SetSel(s, e) editor:ReplaceSel('>\n<') end if style_e == SCE_H_COMMENT and style_s~= SCE_H_COMMENT then editor:SetSel(s, e) editor:ReplaceSel('>\n<') end s, e = editor:findtext('>\\s*<', SCFIND_MATCHCASE+SCFIND_REGEXP, e) end end end function showstyle() print('lexer: ' .. editor.Lexer .. ' style: ' .. editor.StyleAt[editor.CurrentPos]) end local function indent_init() -- initialize context for all known languages local context = {} for lang in pairs(t_langrules)do context[lang] = {['indent'] = 0, ['nextindent'] = 0, ['pstack'] = {} } end context['html'].tagstack = {} context['cpp'].forstack = {} context['php'].forstack = {} context['perl'].forstack = {} return context end local function do_indent() local langdecide = t_langdecide[editor.Lexer] if nil == langdecide then print 'unknown language' return end local not_indent_tbl = not_intent[editor.Lexer] editor:Colourise(0, -1) --editor:BeginUndoAction() local context = indent_init() for i = 0, editor.LineCount, 1 do -- local iline = i+1 -- global for linenum --~ print (iline) local startpos = editor.LineIndentPosition[i] -- $lang: language of current line, according to the style of the first character local lang if 'string' == type(langdecide)then lang = langdecide elseif 'table' == type(langdecide)then lang = langdecide[editor.StyleAt[startpos]] elseif 'function' == type(langdecide)then lang = langdecide() end -- indent only if the language is known if (lang)then c_context = context[lang] -- current context local indent = c_context.indent local nextindent = c_context.nextindent local pstack = c_context.pstack local langrules = t_langrules[lang] editor.LineIndentation[i] = 0 -- this is needed to uniformize the space/tabs in indentation startpos = editor.LineIndentPosition[i] local line = editor:GetLine(i) local indent_flag = true if (line)then if not_indent_tbl then for pattern, struct in pairs(not_indent_tbl)do local bp, ep = string.find(line, pattern, 1) if bp then local stylepos = bp - 1 if struct.begin then stylepos = bp - 1+ struct.begin end -- put in $beginpos only if it starts with correct Scintilla style if struct.beginstyle[editor.StyleAt[startpos + stylepos]] then indent_flag = false break end end end end if indent_flag then --[[ $beginpos holds the beginning of found patterns i.e. beginpos[10]='if' means there is an 'if' beginning at 10 in the line ]] local linelength = string.len(line) local beginpos = {} for j = 1, linelength, 1 do beginpos[j] = false end for pattern, struct in pairs(langrules)do local bp, ep = string.find(line, pattern, 1) while bp do local match = string.sub(line, bp, ep) local stylepos = bp - 1 if struct.begin then stylepos = bp - 1+ struct.begin end -- put in $beginpos only if it starts with correct Scintilla style local style = editor.StyleAt[startpos + stylepos] if struct.beginstyle[editor.StyleAt[startpos + stylepos]] then beginpos[bp] = {pattern, match} end bp, ep = string.find(line, pattern, bp + 1) end end -- now we found all the positions, let's count indentation for k = 1, linelength, 1 do if beginpos[k] then local pattern = beginpos[k][1] local match = beginpos[k][2] local go = true -- unindent things in the stack local last_stack = pstack[#pstack] while go and #pstack> 0 do local uni = langrules[pattern].unindent[pstack[#pstack]] if 'function' == type(uni)then uni = uni(match)end if uni then if k == 1 then indent = indent - 1 end nextindent = nextindent - 1 if 0 ~= uni then go = false; end pstack[ #pstack] = nil -- removes last if not go and langrules[pattern].finish then local fin = langrules[pattern].finish[pstack[#pstack]] if 'function' == type(fin)then fin = fin(match)end if fin then nextindent = nextindent - 1 pstack[ #pstack] = nil end end else go = false end end -- count the indentation local sti = langrules[pattern].indent if 'function' == type(sti)then sti = sti(match) elseif 'table' == type(sti)then local tbl = sti if last_stack then sti = tbl[last_stack] if not sti then sti = tbl['*'] end else sti = tbl['*'] end end if 0 ~= sti then nextindent = nextindent + sti pstack[#pstack+ 1] = pattern end end -- if beginpos[k] end -- for k = 1, linelength, 1 end end -- if line if indent_flag then local mat = string.match(line or '' , "^%s*$") if mat then editor.LineIndentation[i] =0 else editor.LineIndentation[i] = editor.Indent * indent end end indent = nextindent -- save non-reference type members of context c_context.indent = nextindent c_context.nextindent = nextindent end -- if (indentstyles[editor.StyleAt[startpos]]) end -- for i = 1 to linenum --editor:EndUndoAction() end --[[Here goes stuff, that must be done before each indentation run]] function do_all() local topline = editor.FirstVisibleLine editor:BeginUndoAction() output:BeginUndoAction() --do_first() -- print('lexer: ' .. editor.Lexer .. ' style: ' ) local langdecide = t_langdecide[editor.Lexer] print('langdecide: ' .. langdecide) local lang if 'string' == type(langdecide)then lang = langdecide elseif 'table' == type(langdecide)then lang = langdecide[editor.StyleAt[startpos]] elseif 'function' == type(langdecide)then lang = langdecide() end if lang== "cpp" then do_enterKey() do_parameterIndent() end do_indent() --print("============================") if lang== "cpp" then do_labelIndent() end --do_test() editor:EndUndoAction() output:EndUndoAction() editor.FirstVisibleLine = topline end --[[Rules and rule functions]] --[[ semantics of *rules[]: (where * is the name of the language) is a lua string.find pattern where this pattern is found in the indented source code, the followings should be done: 1. It must be checked whether the SciTE style at the beginning of the found pattern is a key in *rules[].beginstyle, and it's value evaluates to true. If not, this match should not be handled. 2. If the innermost pattern, that still has indentation effect is , and there is a key value pair: *rules[].unindent[] = then the indentation effect of ends in this line. If ==0 then the next innermost pattern is also checked. (And so on, while the for that pattern is still 0.) (This way we can unindent nested one-line conrulesions at the innermost statement like if(a) if(b) echo 'a and b'; ) If is a function, it should be called and the return value is to be used. When the return value is nil, it is treated as if there was no key in the table. 3. The next line should be indented additional *rules[].indent levels. If this field is a function, it is called and the return value is used. (currently only 0 and 1 are treated well) ]] --[[functions to handle C-style for]] -- functions for handling for (; ;) in which the two semicolons does not unindent the for function cstyle_for_indent() local forstack = c_context.forstack forstack[#(forstack)+ 1] = 2 return 1 -- it always increments indentation level end function cstyle_sc_for_unindent() local forstack = c_context.forstack if 0 == #(forstack)then -- it's some syntax error return nil -- no unindentation end local i = forstack[#(forstack)] if i == 0 then -- this semicolon is the third after the 'for' forstack[#(forstack)] = nil return 0 -- unindentation else forstack[#(forstack)] = i-1 return nil -- no unindentation end end function cstyle_ob_for_unindent() local forstack = c_context.forstack if 0 == #(forstack)then -- it's some syntax error return nil -- no unindentation end forstack[#(forstack)] = nil return 1 -- unindentation end --[[PHP rules]] local phprules = {} phprules['if'] = {beginstyle = {[SCE_HPHP_WORD] = true}, -- SCITE styles that are acceptable at the beginning of the pattern indent = 1, -- how much it indents unindent = {['else'] = 1}} -- which patterns does this end --[[ 'elseif' can be parsed the same way as 'else if', but we have to put unindent = {['else'] = 1} in phprules['if'] to avoid double indentation ]] phprules['else'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {}} phprules['while'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {['do'] = 1}} phprules['do'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {}} phprules['for'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = cstyle_for_indent, unindent = {}} --[[ TODO if 'foreach' gets inserted later in phprules than 'for', it will be checked later in the script, therefore it will overwrite the match result of 'for'. That is fine, since we don't want to handle a 'for' where a 'foreach' appears in the source, but I don't know whether we can trust in this behaviour, or we should do something more to assure this order of 'for' and 'foreach' ]] phprules['foreach'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {}} phprules['declare'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {}} phprules['case'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} phprules['default'] = {beginstyle = {[SCE_HPHP_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} phprules['{'] = {beginstyle = {[SCE_HPHP_OPERATOR] = true}, indent = 1, unindent = {['if'] = 1, ['else'] = 1, ['while'] = 1, ['do'] = 1, ['for'] = cstyle_ob_for_unindent, ['foreach'] = 1, ['declare'] = 1}} phprules['}'] = {beginstyle = {[SCE_HPHP_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1, ['case'] = 0, ['default'] = 0}} phprules[';'] = {beginstyle = {[SCE_HPHP_OPERATOR] = true}, indent = 0, unindent = {['if'] = 0, ['else'] = 0, ['while'] = 0, ['for'] = cstyle_sc_for_unindent, ['foreach'] = 0, ['declare'] = 0}} phprules['%('] = {beginstyle = {[SCE_HPHP_OPERATOR] = true}, indent = 1, unindent = {['%('] = 1}} phprules['%)'] = {beginstyle = {[SCE_HPHP_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} --[[perl rules]] local perlrules = {} perlrules['if'] = {beginstyle = {[SCE_PL_WORD] = true}, -- SCITE styles that are acceptable at the beginning of the pattern indent = 1, -- how much it indents unindent = {['else'] = 1}} -- which patterns does this end --[[ 'elseif' can be parsed the same way as 'else if', but we have to put unindent = {['else'] = 1} in perlrules['if'] to avoid double indentation ]] perlrules['else'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {}} perlrules['while'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {['do'] = 1}} perlrules['do'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {}} perlrules['for'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = cstyle_for_indent, unindent = {}} --[[ TODO if 'foreach' gets inserted later in perlrules than 'for', it will be checked later in the script, therefore it will overwrite the match result of 'for'. That is fine, since we don't want to handle a 'for' where a 'foreach' appears in the source, but I don't know whether we can trust in this behaviour, or we should do something more to assure this order of 'for' and 'foreach' ]] perlrules['foreach'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {}} perlrules['declare'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {}} perlrules['case'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} perlrules['default'] = {beginstyle = {[SCE_PL_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} perlrules['{'] = {beginstyle = {[SCE_PL_OPERATOR] = true}, indent = 1, unindent = {['if'] = 1, ['else'] = 1, ['while'] = 1, ['do'] = 1, ['for'] = cstyle_ob_for_unindent, ['foreach'] = 1, ['declare'] = 1}} perlrules['}'] = {beginstyle = {[SCE_PL_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1, ['case'] = 0, ['default'] = 0}} perlrules[';'] = {beginstyle = {[SCE_PL_OPERATOR] = true}, indent = 0, unindent = {['if'] = 0, ['else'] = 0, ['while'] = 0, ['for'] = cstyle_sc_for_unindent, ['foreach'] = 0, ['declare'] = 0}} perlrules['%('] = {beginstyle = {[SCE_PL_OPERATOR] = true}, indent = 1, unindent = {['%('] = 1}} perlrules['%)'] = {beginstyle = {[SCE_PL_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} --[[TEXT rules]] local txtrules = {} txtrules['{'] = {beginstyle = {[SCE_TXT_BRACES] = true}, indent = 1, unindent = {}} txtrules['}'] = {beginstyle = {[SCE_TXT_BRACES] = true}, indent = 0, unindent = {['{'] = 1}} txtrules['%('] = {beginstyle = {[SCE_TXT_BRACES] = true}, indent = 1, unindent = {}} txtrules['%)'] = {beginstyle = {[SCE_TXT_BRACES] = true}, indent = 0, unindent = {['%('] = 1}} --[[TERATERM rules]] local ttlrules = {} ttlrules['^if'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, begin = 1, indent = 1, unindent = {}} ttlrules['else%A'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {['then'] = 1}} ttlrules['elseif'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {['then'] = 1}} ttlrules['then'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {['^if'] = 1, ['elseif'] = 1, }} ttlrules['else%A'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {['then'] = 1}} ttlrules['endif'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 0, unindent = {['then'] = 1, ['else%A'] = 1}} -- 'do%A' to avoid match of "double" ttlrules['do%A'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {}} ttlrules['loop'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = {['do%A'] = 1, ['%Awhile'] = 0, ['%Auntil'] = 0, ['*'] = 0}, unindent = {['do%A'] = 1, ['%Awhile'] = 1, ['%Auntil'] = 1}} ttlrules['^while'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {}} ttlrules['^until'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {}} ttlrules['enduntil'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 0, unindent = {['^until'] = 1}} ttlrules['endwhile'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 0, unindent = {['^while'] = 1}} ttlrules['%Awhile'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, begin = 1, indent = {['do%A'] = 1, ['loop'] = 0, ['*'] = 1}, unindent = { ['do%A'] = 1, ['loop'] = 1}} ttlrules['%Auntil'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, begin = 1, indent = {['do%A'] = 1, ['loop'] = 0, ['*'] = 1}, unindent = { ['do%A'] = 1, ['loop'] = 1}} ttlrules['for'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 1, unindent = {}} ttlrules['next'] = {beginstyle = {[SCE_TTL_KEYWORD] = true}, indent = 0, unindent = {['for'] = 1}} ttlrules['{'] = {beginstyle = {[SCE_TTL_OPERATOR] = true}, indent = 1, unindent = {}} ttlrules['}'] = {beginstyle = {[SCE_TTL_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1}} ttlrules['%('] = {beginstyle = {[SCE_TTL_OPERATOR] = true}, indent = 1, unindent = {}} ttlrules['%)'] = {beginstyle = {[SCE_TTL_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} ttl_not_indent = {} ttl_not_indent['^:%a'] = {beginstyle = {[SCE_TTL_SYMBOL] = true}} ttl_not_indent['^return'] = {beginstyle = {[SCE_TTL_KEYWORD2] = true}} ttl_not_indent['^exit'] = {beginstyle = {[SCE_TTL_KEYWORD2] = true}} --[[SHELL rules]] local bashrules = {} bashrules['function'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {}} bashrules['^if'] = {beginstyle = {[SCE_SH_WORD] = true}, beginpos = 1, indent = 1, unindent = {}} bashrules['elif'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {['then'] = 1, }} bashrules['then'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {['^if'] = 1, ['elif'] = 1, }} bashrules['else'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {['then'] = 1}} bashrules['fi'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 0, unindent = {['then'] = 1, ['else'] = 1}} bashrules['while'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {}} bashrules['for'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {}} bashrules['done'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 0, unindent = {['do%A'] = 1}} -- 'do%A' to avoid match of "double" bashrules['do%A'] = {beginstyle = {[SCE_SH_WORD] = true}, indent = 1, unindent = {['while'] = 1, ['for'] = 1}} bashrules['{'] = {beginstyle = {[SCE_SH_OPERATOR] = true}, indent = 1, unindent = {['function'] = 1}} bashrules['}'] = {beginstyle = {[SCE_SH_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1}} bashrules['%('] = {beginstyle = {[SCE_SH_OPERATOR] = true}, indent = 1, unindent = {}} bashrules['%)'] = {beginstyle = {[SCE_SH_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} --[[LUA rules]] local luarules = {} luarules['function'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {}} luarules['^if'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {}} luarules['then'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {['^if'] = 1, ['elseif'] = 1, }} luarules['else%A'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {['then'] = 1}} luarules['elseif'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {['then'] = 1}} luarules['while'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {}} luarules['for'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {}} luarules['repeat'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {}} luarules['until'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 0, unindent = {['repeat'] = 1}} -- 'do%A' to avoid match of "double" luarules['end'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 0, unindent = {['function'] = 1, ['then'] = 1, ['else%A'] = 1, ['^if'] = 1, ['while'] = 1, ['do%A'] = 1, ['for'] = 1}} luarules['do%A'] = {beginstyle = {[SCE_LUA_WORD] = true}, indent = 1, unindent = {['while'] = 1, ['for'] = 1}} luarules['{'] = {beginstyle = {[SCE_LUA_OPERATOR] = true}, indent = 1, unindent = {}} luarules['}'] = {beginstyle = {[SCE_LUA_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1}} luarules['%('] = {beginstyle = {[SCE_LUA_OPERATOR] = true}, indent = 1, unindent = {}} luarules['%)'] = {beginstyle = {[SCE_LUA_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} --[[CPP rules]] local cpprules = {} cpprules['if'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {['else'] = 1}} cpprules['else'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {}} cpprules['while'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {['do%A'] = 1}} -- 'do%A' to avoid match of "double" cpprules['do%A'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {}} cpprules['for'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {}} cpprules['case'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} cpprules['default'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {['case'] = 1, ['default'] = 1}} cpprules['{'] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 1, unindent = {['if'] = 1, ['else'] = 1, ['while'] = 1, ['do%A'] = 1, ['for'] = 1}} cpprules['}'] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 0, unindent = {['{'] = 1, ['case'] = 0, ['default'] = 0}, finish = {['if'] = 0, ['else'] = 0, ['while'] = 0, ['for'] = 0}} cpprules[';'] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 0, unindent = {['if'] = 0, ['else'] = 0, ['while'] = 0, ['for'] = 0, ['return'] = 0}} cpprules['%('] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 1, unindent = {}} cpprules['%)'] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 0, unindent = {['%('] = 1}} cpprules['%['] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 1, unindent = {}} cpprules['%]'] = {beginstyle = {[SCE_C_OPERATOR] = true}, indent = 0, unindent = {['%['] = 1}} cpprules['return'] = {beginstyle = {[SCE_C_WORD] = true}, indent = 1, unindent = {}} local cpp_not_indent = {} --cpp_not_indent['^%w+%s*:'] = {beginstyle = {[SCE_C_WORD] = true, [SCE_C_IDENTIFIER] = true}} cpp_not_indent['^public%s*:'] = {beginstyle = {[SCE_C_WORD] = true, [SCE_C_IDENTIFIER] = true}} cpp_not_indent['^protected%s*:'] = {beginstyle = {[SCE_C_WORD] = true, [SCE_C_IDENTIFIER] = true}} cpp_not_indent['^private%s*:'] = {beginstyle = {[SCE_C_WORD] = true, [SCE_C_IDENTIFIER] = true}} cpp_not_indent['^#'] = {beginstyle = {[SCE_C_PREPROCESSOR] = true}} --[[ add embedded JavaScript styles to cpprules ]] for k, v in pairs(cpprules)do if v.beginstyle[SCE_C_OPERATOR] then v.beginstyle[SCE_HJ_SYMBOLS] = true end if v.beginstyle[SCE_C_WORD] then v.beginstyle[SCE_HJ_KEYWORD] = true end end --[[HTML rule functions]] --[[ $html_indentable keys like this mean that the content between and should be indented ['body'] = true This line means, that content between and should be indented, and 1. the first table tells, what should be done, when parsing the tag 1.a. ['td'] = 0, ['th'] = 0 means, that if the last unended tag is a or then that tag must be implicite ended (and unindented) and the next unended tag must be checked too (and so on) 1.b. ['tr'] = 1 means, that if the last unended tag is a , that must be ended, and other unended tags should not be checked 2. The second table tells what should be done, when parsing the tag ['tr'] = {{['td'] = 0, ['th'] = 0, ['tr'] = 1}, {['td'] = 0, ['td'] = 0, ['tr'] = 1} } ]] html_indentable = {['address'] = true, ['blockquote'] = true, ['body'] = true, ['center'] = true, ['dir'] = true, ['div'] = true, ['dd'] = {{['dd'] = 1, ['dt'] = 1}, {['dd'] = 1} }, ['dl'] = true, ['dt'] = {{['dd'] = 1, ['dt'] = 1}, {['dt'] = 1} }, ['fieldset'] = true, ['form'] = true, ['frameset'] = true, ['h1'] = true, ['h2'] = true, ['h3'] = true, ['h4'] = true, ['h5'] = true, ['h6'] = true, ['head'] = true, ['isindex'] = true, ['li'] = true, ['menu'] = true, ['noframes'] = true, ['noscript'] = true, ['ol'] = true, --

behaves oddly, so I don't indent it --~ ['p'] = {{['p'] = 1}, {['p'] = 1} }, ['pre'] = true, ['table'] = {false, {['td'] = 0, ['th'] = 0, ['tr'] = 0, ['table'] = 1} }, ['ul'] = true, ['tbody'] = true, ['td'] = {{['td'] = 1, ['th'] = 1}, {['td'] = 1} }, ['tfoot'] = true, ['th'] = {{['th'] = 1, ['td'] = 1}, {['th'] = 1} }, ['thead'] = true, ['tr'] = {{['td'] = 0, ['th'] = 0, ['tr'] = 1}, {['td'] = 0, ['td'] = 0, ['tr'] = 1} } } function html_bt_indent(match) local tagstack = c_context.tagstack local tag = string.lower(string.sub(match, 2)) if html_indentable[tag] then c_context.tagstack[#(c_context.tagstack)+ 1] = tag return 1 end return 0 end function html_bt_unindent(match) local tagstack = c_context.tagstack local tag = string.lower(string.sub(match, 2)) if 'table' ~= type(html_indentable[tag])then return nil end local stable = html_indentable[tag][1] if 'table' ~= type(stable)then return nil end local htl = #(c_context.tagstack) local retval retval = stable[c_context.tagstack[htl]] if retval then c_context.tagstack[htl] = nil end return retval end function html_et_unindent(match) local tagstack = c_context.tagstack local tag = string.lower(string.sub(match, 3)) if not html_indentable[tag] then return nil end local htl = #(c_context.tagstack) local retval if 'table' == type(html_indentable[tag])then local stable = html_indentable[tag][2] retval = stable[c_context.tagstack[htl]] else if tag == c_context.tagstack[htl] then retval = 1 else retval = 0 end end c_context.tagstack[htl] = nil return retval end -- returns the character at position p as a string --[[ --function char_at(p) local asc=editor.CharAt[p] if asc >0 and asc < 128 then return string.char(asc) else return nil end end ]]-- --[[HTML rules]] local htmlrules = {} htmlrules['<%a+'] = {beginstyle = {[SCE_H_TAG] = true}, indent = html_bt_indent, unindent = {['<%a+'] = html_bt_unindent}} htmlrules[''] = {beginstyle = {[SCE_H_TAGEND] = true}, indent = 0, unindent = {['<%a+'] = 1}} --[[information for deciding what language does the document contain ]] local htmldecide = {} -- PHP styles: only lines that begin with one of these styles are treated as PHP htmldecide[SCE_HPHP_COMPLEX_VARIABLE] = 'php' htmldecide[SCE_HPHP_DEFAULT] = 'php' htmldecide[SCE_HPHP_HSTRING] = 'php' htmldecide[SCE_HPHP_SIMPLESTRING] = 'php' htmldecide[SCE_HPHP_WORD] = 'php' htmldecide[SCE_HPHP_NUMBER] = 'php' htmldecide[SCE_HPHP_VARIABLE] = 'php' htmldecide[SCE_HPHP_COMMENT] = 'php' htmldecide[SCE_HPHP_COMMENTLINE] = 'php' htmldecide[SCE_HPHP_HSTRING_VARIABLE] = 'php' htmldecide[SCE_HPHP_OPERATOR] = 'php' -- HTML styles htmldecide[SCE_H_DEFAULT] = 'html' htmldecide[SCE_H_TAG] = 'html' htmldecide[SCE_H_TAGUNKNOWN] = 'html' htmldecide[SCE_H_ATTRIBUTE] = 'html' htmldecide[SCE_H_ATTRIBUTEUNKNOWN] = 'html' htmldecide[SCE_H_NUMBER] = 'html' htmldecide[SCE_H_DOUBLESTRING] = 'html' htmldecide[SCE_H_SINGLESTRING] = 'html' htmldecide[SCE_H_OTHER] = 'html' htmldecide[SCE_H_COMMENT] = 'html' htmldecide[SCE_H_ENTITY] = 'html' htmldecide[SCE_H_TAGEND] = 'html' -- embedded JavaScript styles htmldecide[SCE_HJ_START] = 'cpp' htmldecide[SCE_HJ_DEFAULT] = 'cpp' htmldecide[SCE_HJ_COMMENT] = 'cpp' htmldecide[SCE_HJ_COMMENTLINE] = 'cpp' htmldecide[SCE_HJ_COMMENTDOC] = 'cpp' htmldecide[SCE_HJ_NUMBER] = 'cpp' htmldecide[SCE_HJ_WORD] = 'cpp' htmldecide[SCE_HJ_KEYWORD] = 'cpp' htmldecide[SCE_HJ_DOUBLESTRING] = 'cpp' htmldecide[SCE_HJ_SINGLESTRING] = 'cpp' htmldecide[SCE_HJ_SYMBOLS] = 'cpp' htmldecide[SCE_HJ_STRINGEOL] = 'cpp' htmldecide[SCE_HJ_REGEX] = 'cpp' -- TEXT styles local txtdecide = 'txt' -- TERATERM styles local ttldecide = 'ttl' -- SHELL styles local bashdecide = 'bash' -- LUA styles local luadecide = 'lua' -- CPP styles local cppdecide = 'cpp' --[[ cppdecide[SCE_C_DEFAULT]='cpp' cppdecide[SCE_C_COMMENT]='cpp' cppdecide[SCE_C_COMMENTLINE]='cpp' cppdecide[SCE_C_COMMENTDOC]='cpp' cppdecide[SCE_C_NUMBER]='cpp' cppdecide[SCE_C_WORD]='cpp' cppdecide[SCE_C_STRING]='cpp' cppdecide[SCE_C_CHARACTER]='cpp' cppdecide[SCE_C_UUID]='cpp' cppdecide[SCE_C_PREPROCESSOR]='cpp' cppdecide[SCE_C_OPERATOR]='cpp' cppdecide[SCE_C_IDENTIFIER]='cpp' cppdecide[SCE_C_STRINGEOL]='cpp' cppdecide[SCE_C_VERBATIM]='cpp' cppdecide[SCE_C_REGEX]='cpp' cppdecide[SCE_C_COMMENTLINEDOC]='cpp' cppdecide[SCE_C_WORD2]='cpp' cppdecide[SCE_C_COMMENTDOCKEYWORD]='cpp' cppdecide[SCE_C_COMMENTDOCKEYWORDERROR]='cpp' cppdecide[SCE_C_GLOBALCLASS]='cpp' ]]-- -- XML styles xmldecide = 'xml' --[[ xmldecide[SCE_H_DEFAULT]='xml' xmldecide[SCE_H_TAG]='xml' xmldecide[SCE_H_TAGUNKNOWN]='xml' xmldecide[SCE_H_ATTRIBUTE]='xml' xmldecide[SCE_H_ATTRIBUTEUNKNOWN]='xml' xmldecide[SCE_H_NUMBER]='xml' xmldecide[SCE_H_DOUBLESTRING]='xml' xmldecide[SCE_H_SINGLESTRING]='xml' xmldecide[SCE_H_OTHER]='xml' xmldecide[SCE_H_COMMENT]='xml' xmldecide[SCE_H_ENTITY]='xml' xmldecide[SCE_H_TAGEND]='xml' ]]-- -- Perl styles local perldecide = 'perl' -- t_langdecide[][]='' t_langdecide[SCLEX_HTML] = htmldecide t_langdecide[SCLEX_TXT] = txtdecide t_langdecide[SCLEX_TTL] = ttldecide t_langdecide[SCLEX_BASH] = bashdecide t_langdecide[SCLEX_LUA] = luadecide t_langdecide[SCLEX_CPP] = cppdecide t_langdecide[SCLEX_XML] = xmldecide t_langdecide[SCLEX_PERL] = perldecide t_langrules['php'] = phprules t_langrules['html'] = htmlrules t_langrules['txt'] = txtrules t_langrules['ttl'] = ttlrules t_langrules['bash'] = bashrules t_langrules['lua'] = luarules t_langrules['cpp'] = cpprules t_langrules['xml'] = xmlrules t_langrules['perl'] = perlrules not_intent[SCLEX_TTL] = ttl_not_indent not_intent[SCLEX_CPP] = cpp_not_indent