Advertisement
DolphinX

ScintillaNET

Dec 7th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. // Extracted from the Lua Scintilla lexer and SciTE .properties file
  2.  
  3. var alphaChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  4. var numericChars = "0123456789";
  5. var accentedChars = "ŠšŒœŸÿÀàÁáÂâÃãÄäÅåÆæÇçÈèÉéÊêËëÌìÍíÎîÏïÐðÑñÒòÓóÔôÕõÖØøÙùÚúÛûÜüÝýÞþßö";
  6.  
  7. // Configuring the default style with properties
  8. // we have common to every lexer style saves time.
  9. scintilla.StyleResetDefault();
  10. scintilla.Styles[Style.Default].Font = "Consolas";
  11. scintilla.Styles[Style.Default].Size = 10;
  12. scintilla.StyleClearAll();
  13.  
  14. // Configure the Lua lexer styles
  15. scintilla.Styles[Style.Lua.Default].ForeColor = Color.Silver;
  16. scintilla.Styles[Style.Lua.Comment].ForeColor = Color.Green;
  17. scintilla.Styles[Style.Lua.CommentLine].ForeColor = Color.Green;
  18. scintilla.Styles[Style.Lua.Number].ForeColor = Color.Olive;
  19. scintilla.Styles[Style.Lua.Word].ForeColor = Color.Blue;
  20. scintilla.Styles[Style.Lua.Word2].ForeColor = Color.BlueViolet;
  21. scintilla.Styles[Style.Lua.Word3].ForeColor = Color.DarkSlateBlue;
  22. scintilla.Styles[Style.Lua.Word4].ForeColor = Color.DarkSlateBlue;
  23. scintilla.Styles[Style.Lua.String].ForeColor = Color.Red;
  24. scintilla.Styles[Style.Lua.Character].ForeColor = Color.Red;
  25. scintilla.Styles[Style.Lua.LiteralString].ForeColor = Color.Red;
  26. scintilla.Styles[Style.Lua.StringEol].BackColor = Color.Pink;
  27. scintilla.Styles[Style.Lua.Operator].ForeColor = Color.Purple;
  28. scintilla.Styles[Style.Lua.Preprocessor].ForeColor = Color.Maroon;
  29. scintilla.Lexer = Lexer.Lua;
  30. scintilla.WordChars = alphaChars + numericChars + accentedChars;
  31.  
  32. // Console.WriteLine(scintilla.DescribeKeywordSets());
  33.  
  34. // Keywords
  35. scintilla.SetKeywords(0, "and break do else elseif end for function if in local nil not or repeat return then until while" + " false true" + " goto");
  36. // Basic Functions
  37. scintilla.SetKeywords(1, "assert collectgarbage dofile error _G getmetatable ipairs loadfile next pairs pcall print rawequal rawget rawset setmetatable tonumber tostring type _VERSION xpcall string table math coroutine io os debug" + " getfenv gcinfo load loadlib loadstring require select setfenv unpack _LOADED LUA_PATH _REQUIREDNAME package rawlen package bit32 utf8 _ENV");
  38. // String Manipulation & Mathematical
  39. scintilla.SetKeywords(2, "string.byte string.char string.dump string.find string.format string.gsub string.len string.lower string.rep string.sub string.upper table.concat table.insert table.remove table.sort math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos math.deg math.exp math.floor math.frexp math.ldexp math.log math.max math.min math.pi math.pow math.rad math.random math.randomseed math.sin math.sqrt math.tan" + " string.gfind string.gmatch string.match string.reverse string.pack string.packsize string.unpack table.foreach table.foreachi table.getn table.setn table.maxn table.pack table.unpack table.move math.cosh math.fmod math.huge math.log10 math.modf math.mod math.sinh math.tanh math.maxinteger math.mininteger math.tointeger math.type math.ult" + " bit32.arshift bit32.band bit32.bnot bit32.bor bit32.btest bit32.bxor bit32.extract bit32.replace bit32.lrotate bit32.lshift bit32.rrotate bit32.rshift" + " utf8.char utf8.charpattern utf8.codes utf8.codepoint utf8.len utf8.offset");
  40. // Input and Output Facilities and System Facilities
  41. scintilla.SetKeywords(3, "coroutine.create coroutine.resume coroutine.status coroutine.wrap coroutine.yield io.close io.flush io.input io.lines io.open io.output io.read io.tmpfile io.type io.write io.stdin io.stdout io.stderr os.clock os.date os.difftime os.execute os.exit os.getenv os.remove os.rename os.setlocale os.time os.tmpname" + " coroutine.isyieldable coroutine.running io.popen module package.loaders package.seeall package.config package.searchers package.searchpath" + " require package.cpath package.loaded package.loadlib package.path package.preload");
  42.  
  43. // Instruct the lexer to calculate folding
  44. scintilla.SetProperty("fold", "1");
  45. scintilla.SetProperty("fold.compact", "1");
  46.  
  47. // Configure a margin to display folding symbols
  48. scintilla.Margins[2].Type = MarginType.Symbol;
  49. scintilla.Margins[2].Mask = Marker.MaskFolders;
  50. scintilla.Margins[2].Sensitive = true;
  51. scintilla.Margins[2].Width = 20;
  52.  
  53. // Set colors for all folding markers
  54. for (int i = 25; i <= 31; i++)
  55. {
  56. scintilla.Markers[i].SetForeColor(SystemColors.ControlLightLight);
  57. scintilla.Markers[i].SetBackColor(SystemColors.ControlDark);
  58. }
  59.  
  60. // Configure folding markers with respective symbols
  61. scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
  62. scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
  63. scintilla.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected;
  64. scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
  65. scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
  66. scintilla.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
  67. scintilla.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
  68.  
  69. // Enable automatic folding
  70. scintilla.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement