### 2024-12-20 星期五更新
------ #### SuperDesign V3.0.2412.2001 - *.[新增]新增程序更新日志设置和自动发布功能。 - *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
This commit is contained in:
1 parent
03bcb8c5fd
commit
993f1ca1a9
349 files changed
+81977
-13873
No files matched your search
+93
@@ -0,0 +1,93 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Batch lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerBatch: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the batch script file.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateBatchLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors,bool foldOn)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[Style.Batch.Default].ForeColor = lexerColors[LexerType.Batch, "DefaultFore"];
|
||||
scintilla.Styles[Style.Batch.Default].BackColor = lexerColors[LexerType.Batch, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Batch.Comment].ForeColor = lexerColors[LexerType.Batch, "CommentFore"];
|
||||
scintilla.Styles[Style.Batch.Comment].BackColor = lexerColors[LexerType.Batch, "CommentBack"];
|
||||
|
||||
// KEYWORDS, fontStyle = 1
|
||||
scintilla.Styles[Style.Batch.Word].Bold = true;
|
||||
scintilla.Styles[Style.Batch.Word].ForeColor = lexerColors[LexerType.Batch, "WordFore"];
|
||||
scintilla.Styles[Style.Batch.Word].BackColor = lexerColors[LexerType.Batch, "WordBack"];
|
||||
|
||||
// LABEL, fontStyle = 1
|
||||
scintilla.Styles[Style.Batch.Label].Bold = true;
|
||||
scintilla.Styles[Style.Batch.Label].ForeColor = lexerColors[LexerType.Batch, "LabelFore"];
|
||||
scintilla.Styles[Style.Batch.Label].BackColor = lexerColors[LexerType.Batch, "LabelBack"];
|
||||
|
||||
// HIDE SYBOL, fontStyle = 0
|
||||
scintilla.Styles[Style.Batch.Hide].ForeColor = lexerColors[LexerType.Batch, "HideFore"];
|
||||
scintilla.Styles[Style.Batch.Hide].BackColor = lexerColors[LexerType.Batch, "HideBack"];
|
||||
|
||||
// COMMAND, fontStyle = 0
|
||||
scintilla.Styles[Style.Batch.Command].ForeColor = lexerColors[LexerType.Batch, "CommandFore"];
|
||||
scintilla.Styles[Style.Batch.Command].BackColor = lexerColors[LexerType.Batch, "CommandBack"];
|
||||
|
||||
// VARIABLE, fontStyle = 1
|
||||
scintilla.Styles[Style.Batch.Identifier].Bold = true;
|
||||
scintilla.Styles[Style.Batch.Identifier].ForeColor = lexerColors[LexerType.Batch, "IdentifierFore"];
|
||||
scintilla.Styles[Style.Batch.Identifier].BackColor = lexerColors[LexerType.Batch, "IdentifierBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[Style.Batch.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Batch.Operator].ForeColor = lexerColors[LexerType.Batch, "OperatorFore"];
|
||||
scintilla.Styles[Style.Batch.Operator].BackColor = lexerColors[LexerType.Batch, "OperatorBack"];
|
||||
scintilla.LexerName = "batch";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Batch);
|
||||
if(foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+309
@@ -0,0 +1,309 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
using static VPKSoft.ScintillaLexers.GlobalScintillaFont;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for creating static lexers.
|
||||
/// </summary>
|
||||
public class CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Resets the Scintilla's style to default.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla which style to reset.</param>
|
||||
public static void ClearStyle(Scintilla scintilla)
|
||||
{
|
||||
scintilla.StyleResetDefault();
|
||||
scintilla.Styles[Style.Default].Font = FontFamilyName;
|
||||
scintilla.Styles[Style.Default].Size = FontSize;
|
||||
scintilla.StyleClearAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a "standard" folding to a lexer.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">An instance to a Scintilla class.</param>
|
||||
public static void AddFolding(Scintilla scintilla)
|
||||
{
|
||||
// the default colors as in the example.. (C)::https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding
|
||||
AddFolding(scintilla, SystemColors.ControlLightLight, SystemColors.ControlDark);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a "standard" folding to a lexer with given foreground and background colors.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">An instance to a Scintilla class.</param>
|
||||
/// <param name="foregroundColor">The foreground color to be used.</param>
|
||||
/// <param name="backgroundColor">The background color to be used.</param>
|
||||
public static void AddFolding(Scintilla scintilla, Color foregroundColor, Color backgroundColor)
|
||||
{
|
||||
// the default colors as in the example.. (C)::https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding
|
||||
|
||||
// Instruct the lexer to calculate folding..
|
||||
LexerFoldProperties.FoldDefault(scintilla);
|
||||
|
||||
// Configure a margin to display folding symbols
|
||||
scintilla.Margins[2].Type = MarginType.Symbol;
|
||||
scintilla.Margins[2].Mask = Marker.MaskFolders;
|
||||
scintilla.Margins[2].Sensitive = true;
|
||||
scintilla.Margins[2].Width = 20;
|
||||
|
||||
|
||||
// Set colors for all folding markers
|
||||
for (int i = 25; i <= 31; i++)
|
||||
{
|
||||
scintilla.Markers[i].SetForeColor(foregroundColor);
|
||||
scintilla.Markers[i].SetBackColor(backgroundColor);
|
||||
}
|
||||
|
||||
// Configure folding markers with respective symbols
|
||||
scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
|
||||
scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
|
||||
scintilla.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected;
|
||||
scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
|
||||
scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
|
||||
scintilla.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine;
|
||||
scintilla.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner;
|
||||
|
||||
// Enable automatic folding
|
||||
scintilla.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the HTML styles for a lexer.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
public static void SetHtmlStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
|
||||
{
|
||||
// DEFAULT, fontStyle = 1, styleId = 0
|
||||
scintilla.Styles[Style.Html.Default].Bold = true;
|
||||
scintilla.Styles[Style.Html.Default].ForeColor = lexerColors[LexerType.HTML, "DefaultFore"];
|
||||
scintilla.Styles[Style.Html.Default].BackColor = lexerColors[LexerType.HTML, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 9
|
||||
scintilla.Styles[Style.Html.Comment].ForeColor = lexerColors[LexerType.HTML, "CommentFore"];
|
||||
scintilla.Styles[Style.Html.Comment].BackColor = lexerColors[LexerType.HTML, "CommentBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 5
|
||||
scintilla.Styles[Style.Html.Number].ForeColor = lexerColors[LexerType.HTML, "NumberFore"];
|
||||
scintilla.Styles[Style.Html.Number].BackColor = lexerColors[LexerType.HTML, "NumberBack"];
|
||||
|
||||
// self added, seemed to be missing..
|
||||
scintilla.Styles[Style.Html.Entity].Italic = true;
|
||||
scintilla.Styles[Style.Html.Entity].ForeColor = lexerColors[LexerType.HTML, "EntityFore"];
|
||||
scintilla.Styles[Style.Html.Entity].BackColor = lexerColors[LexerType.HTML, "EntityBack"];
|
||||
|
||||
|
||||
// DOUBLESTRING, fontStyle = 1, styleId = 6
|
||||
scintilla.Styles[Style.Html.DoubleString].Bold = true;
|
||||
scintilla.Styles[Style.Html.DoubleString].ForeColor = lexerColors[LexerType.HTML, "DoubleStringFore"];
|
||||
scintilla.Styles[Style.Html.DoubleString].BackColor = lexerColors[LexerType.HTML, "DoubleStringBack"];
|
||||
|
||||
// SINGLESTRING, fontStyle = 1, styleId = 7
|
||||
scintilla.Styles[Style.Html.SingleString].Bold = true;
|
||||
scintilla.Styles[Style.Html.SingleString].ForeColor = lexerColors[LexerType.HTML, "SingleStringFore"];
|
||||
scintilla.Styles[Style.Html.SingleString].BackColor = lexerColors[LexerType.HTML, "SingleStringBack"];
|
||||
|
||||
// TAG, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Html.Tag].ForeColor = lexerColors[LexerType.HTML, "TagFore"];
|
||||
scintilla.Styles[Style.Html.Tag].BackColor = lexerColors[LexerType.HTML, "TagBack"];
|
||||
|
||||
// TAGEND, fontStyle = 0, styleId = 11
|
||||
scintilla.Styles[Style.Html.TagEnd].ForeColor = lexerColors[LexerType.HTML, "TagEndFore"];
|
||||
scintilla.Styles[Style.Html.TagEnd].BackColor = lexerColors[LexerType.HTML, "TagEndBack"];
|
||||
|
||||
// TAGUNKNOWN, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.Html.TagUnknown].ForeColor = lexerColors[LexerType.HTML, "TagUnknownFore"];
|
||||
scintilla.Styles[Style.Html.TagUnknown].BackColor = lexerColors[LexerType.HTML, "TagUnknownBack"];
|
||||
|
||||
// ATTRIBUTE, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.Html.Attribute].ForeColor = lexerColors[LexerType.HTML, "AttributeFore"];
|
||||
scintilla.Styles[Style.Html.Attribute].BackColor = lexerColors[LexerType.HTML, "AttributeBack"];
|
||||
|
||||
// ATTRIBUTEUNKNOWN, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Html.AttributeUnknown].ForeColor = lexerColors[LexerType.HTML, "AttributeUnknownFore"];
|
||||
scintilla.Styles[Style.Html.AttributeUnknown].BackColor = lexerColors[LexerType.HTML, "AttributeUnknownBack"];
|
||||
|
||||
// SGMLDEFAULT, fontStyle = 0, styleId = 21
|
||||
scintilla.Styles[21].ForeColor = lexerColors[LexerType.HTML, "SGMDefaultFore"];
|
||||
scintilla.Styles[21].BackColor = lexerColors[LexerType.HTML, "SGMDefaultBack"];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the PHP styles for a lexer.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
public static void SetPhpStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
|
||||
{
|
||||
// QUESTION MARK, fontStyle = 0, styleId = 18
|
||||
scintilla.Styles[Style.Html.Question].ForeColor = lexerColors[LexerType.PHP, "HQuestionFore"];
|
||||
scintilla.Styles[Style.Html.Question].BackColor = lexerColors[LexerType.PHP, "HQuestionBack"];
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 118
|
||||
scintilla.Styles[Style.PhpScript.Default].ForeColor = lexerColors[LexerType.PHP, "DefaultFore"];
|
||||
scintilla.Styles[Style.PhpScript.Default].BackColor = lexerColors[LexerType.PHP, "DefaultBack"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 119
|
||||
scintilla.Styles[Style.PhpScript.HString].ForeColor = lexerColors[LexerType.PHP, "HStringFore"];
|
||||
scintilla.Styles[Style.PhpScript.HString].BackColor = lexerColors[LexerType.PHP, "HStringBack"];
|
||||
|
||||
// STRING VARIABLE, fontStyle = 1, styleId = 126
|
||||
scintilla.Styles[Style.PhpScript.HStringVariable].Bold = true;
|
||||
scintilla.Styles[Style.PhpScript.HStringVariable].ForeColor = lexerColors[LexerType.PHP, "HStringVariableFore"];
|
||||
scintilla.Styles[Style.PhpScript.HStringVariable].BackColor = lexerColors[LexerType.PHP, "HStringVariableBack"];
|
||||
|
||||
// SIMPLESTRING, fontStyle = 0, styleId = 120
|
||||
scintilla.Styles[Style.PhpScript.SimpleString].ForeColor = lexerColors[LexerType.PHP, "SimpleStringFore"];
|
||||
scintilla.Styles[Style.PhpScript.SimpleString].BackColor = lexerColors[LexerType.PHP, "SimpleStringBack"];
|
||||
|
||||
// WORD, fontStyle = 1, styleId = 121
|
||||
scintilla.Styles[Style.PhpScript.Word].Bold = true;
|
||||
scintilla.Styles[Style.PhpScript.Word].ForeColor = lexerColors[LexerType.PHP, "WordFore"];
|
||||
scintilla.Styles[Style.PhpScript.Word].BackColor = lexerColors[LexerType.PHP, "WordBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 122
|
||||
scintilla.Styles[Style.PhpScript.Number].ForeColor = lexerColors[LexerType.PHP, "NumberFore"];
|
||||
scintilla.Styles[Style.PhpScript.Number].BackColor = lexerColors[LexerType.PHP, "NumberBack"];
|
||||
|
||||
// VARIABLE, fontStyle = 0, styleId = 123
|
||||
scintilla.Styles[Style.PhpScript.Variable].ForeColor = lexerColors[LexerType.PHP, "VariableFore"];
|
||||
scintilla.Styles[Style.PhpScript.Variable].BackColor = lexerColors[LexerType.PHP, "VariableBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 124
|
||||
scintilla.Styles[Style.PhpScript.Comment].ForeColor = lexerColors[LexerType.PHP, "CommentFore"];
|
||||
scintilla.Styles[Style.PhpScript.Comment].BackColor = lexerColors[LexerType.PHP, "CommentBack"];
|
||||
|
||||
// COMMENTLINE, fontStyle = 0, styleId = 125
|
||||
scintilla.Styles[Style.PhpScript.CommentLine].ForeColor = lexerColors[LexerType.PHP, "CommentLineFore"];
|
||||
scintilla.Styles[Style.PhpScript.CommentLine].BackColor = lexerColors[LexerType.PHP, "CommentLineBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
scintilla.Styles[Style.PhpScript.Operator].ForeColor = lexerColors[LexerType.PHP, "OperatorFore"];
|
||||
scintilla.Styles[Style.PhpScript.Operator].BackColor = lexerColors[LexerType.PHP, "OperatorBack"];
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the JS styles for a lexer.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A <see cref="Scintilla"/> class instance.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
public static void SetJSStyles(Scintilla scintilla, LexerColors.LexerColors lexerColors)
|
||||
{
|
||||
//// DEFAULT, fontStyle = 0, styleId = 118
|
||||
//scintilla.Styles[Style.JavaScript.Default].ForeColor = lexerColors[LexerType.PHP, "DefaultFore"];
|
||||
//scintilla.Styles[Style.JavaScript.Default].BackColor = lexerColors[LexerType.PHP, "DefaultBack"];
|
||||
|
||||
//// WORD, fontStyle = 1, styleId = 121
|
||||
//scintilla.Styles[Style.JavaScript.Word].Bold = true;
|
||||
//scintilla.Styles[Style.JavaScript.Word].ForeColor = lexerColors[LexerType.PHP, "WordFore"];
|
||||
//scintilla.Styles[Style.JavaScript.Word].BackColor = lexerColors[LexerType.PHP, "WordBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 122
|
||||
scintilla.Styles[Style.JavaScript.Number].Bold = true;
|
||||
scintilla.Styles[Style.JavaScript.Number].ForeColor = lexerColors[LexerType.PHP, "NumberFore"];
|
||||
scintilla.Styles[Style.JavaScript.Number].BackColor = lexerColors[LexerType.PHP, "NumberBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 124
|
||||
scintilla.Styles[Style.JavaScript.Comment].ForeColor = lexerColors[LexerType.PHP, "CommentFore"];
|
||||
scintilla.Styles[Style.JavaScript.Comment].BackColor = lexerColors[LexerType.PHP, "CommentBack"];
|
||||
|
||||
// COMMENTLINE, fontStyle = 0, styleId = 125
|
||||
scintilla.Styles[Style.JavaScript.CommentLine].ForeColor = lexerColors[LexerType.PHP, "CommentLineFore"];
|
||||
scintilla.Styles[Style.JavaScript.CommentLine].BackColor = lexerColors[LexerType.PHP, "CommentLineBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
scintilla.Styles[Style.JavaScript.SingleString].ForeColor = lexerColors[LexerType.PHP, "SimpleStringFore"];
|
||||
scintilla.Styles[Style.JavaScript.SingleString].BackColor = lexerColors[LexerType.PHP, "SimpleStringBack"];
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
scintilla.Styles[Style.JavaScript.Keyword].Bold = true;
|
||||
scintilla.Styles[Style.JavaScript.Keyword].ForeColor =Color.Blue;
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
scintilla.Styles[Style.JavaScript.Regex].ForeColor = Color.Gray;
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
scintilla.Styles[Style.JavaScript.DoubleString].ForeColor = Color.FromArgb(172, 62, 145);
|
||||
//scintilla.Styles[Style.JavaScript.Word].ForeColor = Color.Goldenrod;
|
||||
// OPERATOR, fontStyle = 0, styleId = 127
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
|
||||
}
|
||||
/// <summary>
|
||||
/// A helper method to be used with HTML including scripts.
|
||||
/// </summary>
|
||||
/// <param name="lexerType">Type of the lexer to embed into the HTML lexer.</param>
|
||||
/// <param name="scintilla">An instance to a scintilla to which to append the script lexer.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
public static void SetScriptedHtml(LexerType lexerType, Scintilla scintilla, LexerColors.LexerColors lexerColors)
|
||||
{
|
||||
if (lexerType == LexerType.PHP || lexerType == LexerType.HTML)
|
||||
{
|
||||
SetHtmlStyles(scintilla, lexerColors);
|
||||
|
||||
if (lexerType == LexerType.PHP)
|
||||
{
|
||||
var keyWords1 =
|
||||
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.HTML);
|
||||
var keyWords2 =
|
||||
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.PHP);
|
||||
//var keyWords3 =
|
||||
// ScintillaKeyWords.KeyWordList.FindAll(f => f.LexerType == LexerType.JavaScript);
|
||||
//var text = "";
|
||||
//for (int i = 0; i < keyWords3.Count; i++)
|
||||
//{
|
||||
// text += " "+keyWords3[i].KeyWords;
|
||||
//}
|
||||
if (keyWords1 != null && keyWords2 != null)
|
||||
{
|
||||
scintilla.SetKeywords(4, keyWords1.KeyWords+" "+ keyWords2.KeyWords);
|
||||
}
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.JavaScript);
|
||||
}
|
||||
else if (lexerType == LexerType.HTML)
|
||||
{
|
||||
var keyWords =
|
||||
ScintillaKeyWords.KeyWordList.FirstOrDefault(f => f.LexerType == LexerType.PHP);
|
||||
|
||||
if (keyWords != null)
|
||||
{
|
||||
scintilla.SetKeywords(4, keyWords.KeyWords);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.HyperTextFolding);
|
||||
|
||||
SetHtmlStyles(scintilla, lexerColors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the C++ lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerCpp: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the C++ programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateCppLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = lexerColors[LexerType.Cpp, "PreprocessorFore"];
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].BackColor = lexerColors[LexerType.Cpp, "PreprocessorBack"];
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.Cpp, "DefaultFore"];
|
||||
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.Cpp, "DefaultBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Word].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Cpp, "WordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Cpp, "WordBack"];
|
||||
|
||||
// TYPE WORD, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Cpp, "Word2Fore"];
|
||||
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Cpp, "Word2Back"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.Cpp, "NumberFore"];
|
||||
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.Cpp, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.Cpp, "StringFore"];
|
||||
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.Cpp, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.Cpp, "CharacterFore"];
|
||||
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.Cpp, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.Cpp, "OperatorFore"];
|
||||
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.Cpp, "OperatorBack"];
|
||||
|
||||
// VERBATIM, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.Cpp, "VerbatimFore"];
|
||||
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.Cpp, "VerbatimBack"];
|
||||
|
||||
// REGEX, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Regex].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Cpp, "RegexFore"];
|
||||
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Cpp, "RegexBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.Cpp, "CommentFore"];
|
||||
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.Cpp, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.Cpp, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.Cpp, "CommentLineBack"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.Cpp, "CommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.Cpp, "CommentDocBack"];
|
||||
|
||||
// COMMENT LINE DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.Cpp, "CommentLineDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.Cpp, "CommentLineDocBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor =
|
||||
lexerColors[LexerType.Cpp, "CommentDocKeywordFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor =
|
||||
lexerColors[LexerType.Cpp, "CommentDocKeywordBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD ERROR, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor =
|
||||
lexerColors[LexerType.Cpp, "CommentDocKeywordErrorFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor =
|
||||
lexerColors[LexerType.Cpp, "CommentDocKeywordErrorBack"];
|
||||
|
||||
// PREPROCESSOR COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.PreprocessorComment].ForeColor =
|
||||
lexerColors[LexerType.Cpp, "PreprocessorCommentFore"];
|
||||
scintilla.Styles[Style.Cpp.PreprocessorComment].BackColor =
|
||||
lexerColors[LexerType.Cpp, "PreprocessorCommentBack"];
|
||||
|
||||
// PREPROCESSOR COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].ForeColor =
|
||||
lexerColors[LexerType.Cpp, "PreprocessorCommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].BackColor =
|
||||
lexerColors[LexerType.Cpp, "PreprocessorCommentDocBack"];
|
||||
scintilla.LexerName = "cpp";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Cpp);
|
||||
if(foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the C# lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerCs: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the C# programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateCsLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors,bool foldOn=true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorFore"];
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].BackColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorBack"];
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Default].ForeColor =
|
||||
lexerColors[LexerType.Cs, "DefaultFore"];
|
||||
scintilla.Styles[Style.Cpp.Default].BackColor =
|
||||
lexerColors[LexerType.Cs, "DefaultBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Word].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Cs, "WordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Cs, "WordBack"];
|
||||
|
||||
// TYPE WORD, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Cs, "Word2Fore"];
|
||||
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Cs, "Word2Back"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Number].ForeColor =
|
||||
lexerColors[LexerType.Cs, "NumberFore"];
|
||||
scintilla.Styles[Style.Cpp.Number].BackColor =
|
||||
lexerColors[LexerType.Cs, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.String].ForeColor =
|
||||
lexerColors[LexerType.Cs, "StringFore"];
|
||||
scintilla.Styles[Style.Cpp.String].BackColor =
|
||||
lexerColors[LexerType.Cs, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Character].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CharacterFore"];
|
||||
scintilla.Styles[Style.Cpp.Character].BackColor =
|
||||
lexerColors[LexerType.Cs, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Operator].ForeColor =
|
||||
lexerColors[LexerType.Cs, "OperatorFore"];
|
||||
scintilla.Styles[Style.Cpp.Operator].BackColor =
|
||||
lexerColors[LexerType.Cs, "OperatorBack"];
|
||||
|
||||
// VERBATIM, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Verbatim].ForeColor =
|
||||
lexerColors[LexerType.Cs, "VerbatimFore"];
|
||||
scintilla.Styles[Style.Cpp.Verbatim].BackColor =
|
||||
lexerColors[LexerType.Cs, "VerbatimBack"];
|
||||
|
||||
// REGEX, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.Regex].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Cs, "RegexFore"];
|
||||
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Cs, "RegexBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.Comment].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentFore"];
|
||||
scintilla.Styles[Style.Cpp.Comment].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentLine].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLine].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentLineBack"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocBack"];
|
||||
|
||||
// COMMENT LINE DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentLineDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentLineDocBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocKeywordFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocKeywordBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD ERROR, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocKeywordErrorFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor =
|
||||
lexerColors[LexerType.Cs, "CommentDocKeywordErrorBack"];
|
||||
|
||||
// PREPROCESSOR COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.PreprocessorComment].ForeColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorCommentFore"];
|
||||
scintilla.Styles[Style.Cpp.PreprocessorComment].BackColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorCommentBack"];
|
||||
|
||||
// PREPROCESSOR COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].ForeColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorCommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.PreprocessorCommentDoc].BackColor =
|
||||
lexerColors[LexerType.Cs, "PreprocessorCommentDocBack"];
|
||||
scintilla.LexerName = "cpp";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Cs);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
class CreateLexerCss: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Cascading Style Sheets (CSS).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateCssLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 0
|
||||
scintilla.Styles[Style.Css.Default].ForeColor = lexerColors[LexerType.Css, "DefaultFore"];
|
||||
scintilla.Styles[Style.Css.Default].BackColor = lexerColors[LexerType.Css, "DefaultBack"];
|
||||
|
||||
// TAG, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Css.Tag].ForeColor = lexerColors[LexerType.Css, "TagFore"];
|
||||
scintilla.Styles[Style.Css.Tag].BackColor = lexerColors[LexerType.Css, "TagBack"];
|
||||
|
||||
// CLASS, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.Css.Class].ForeColor = lexerColors[LexerType.Css, "ClassFore"];
|
||||
scintilla.Styles[Style.Css.Class].BackColor = lexerColors[LexerType.Css, "ClassBack"];
|
||||
|
||||
// PSEUDOCLASS, fontStyle = 1, styleId = 3
|
||||
scintilla.Styles[Style.Css.PseudoClass].Bold = true;
|
||||
scintilla.Styles[Style.Css.PseudoClass].ForeColor = lexerColors[LexerType.Css, "PseudoClassFore"];
|
||||
scintilla.Styles[Style.Css.PseudoClass].BackColor = lexerColors[LexerType.Css, "PseudoClassBack"];
|
||||
|
||||
// UNKNOWN_PSEUDOCLASS, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Css.UnknownPseudoClass].ForeColor = lexerColors[LexerType.Css, "UnknownPseudoClassFore"];
|
||||
scintilla.Styles[Style.Css.UnknownPseudoClass].BackColor = lexerColors[LexerType.Css, "UnknownPseudoClassBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 5
|
||||
scintilla.Styles[Style.Css.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Css.Operator].ForeColor = lexerColors[LexerType.Css, "OperatorFore"];
|
||||
scintilla.Styles[Style.Css.Operator].BackColor = lexerColors[LexerType.Css, "OperatorBack"];
|
||||
|
||||
// IDENTIFIER, fontStyle = 1, styleId = 6
|
||||
scintilla.Styles[Style.Css.Identifier].Bold = true;
|
||||
scintilla.Styles[Style.Css.Identifier].ForeColor = lexerColors[LexerType.Css, "IdentifierFore"];
|
||||
scintilla.Styles[Style.Css.Identifier].BackColor = lexerColors[LexerType.Css, "IdentifierBack"];
|
||||
|
||||
// UNKNOWN_IDENTIFIER, fontStyle = 0, styleId = 7
|
||||
scintilla.Styles[Style.Css.UnknownIdentifier].ForeColor = lexerColors[LexerType.Css, "UnknownIdentifierFore"];
|
||||
scintilla.Styles[Style.Css.UnknownIdentifier].BackColor = lexerColors[LexerType.Css, "UnknownIdentifierBack"];
|
||||
|
||||
// VALUE, fontStyle = 1, styleId = 8
|
||||
scintilla.Styles[Style.Css.Value].Bold = true;
|
||||
scintilla.Styles[Style.Css.Value].ForeColor = lexerColors[LexerType.Css, "ValueFore"];
|
||||
scintilla.Styles[Style.Css.Value].BackColor = lexerColors[LexerType.Css, "ValueBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 9
|
||||
scintilla.Styles[Style.Css.Comment].ForeColor = lexerColors[LexerType.Css, "CommentFore"];
|
||||
scintilla.Styles[Style.Css.Comment].BackColor = lexerColors[LexerType.Css, "CommentBack"];
|
||||
|
||||
// ID, fontStyle = 1, styleId = 10
|
||||
scintilla.Styles[Style.Css.Id].Bold = true;
|
||||
scintilla.Styles[Style.Css.Id].ForeColor = lexerColors[LexerType.Css, "IdFore"];
|
||||
scintilla.Styles[Style.Css.Id].BackColor = lexerColors[LexerType.Css, "IdBack"];
|
||||
|
||||
// IMPORTANT, fontStyle = 1, styleId = 11
|
||||
scintilla.Styles[Style.Css.Important].Bold = true;
|
||||
scintilla.Styles[Style.Css.Important].ForeColor = lexerColors[LexerType.Css, "ImportantFore"];
|
||||
scintilla.Styles[Style.Css.Important].BackColor = lexerColors[LexerType.Css, "ImportantBack"];
|
||||
|
||||
// DIRECTIVE, fontStyle = 0, styleId = 12
|
||||
scintilla.Styles[Style.Css.Directive].ForeColor = lexerColors[LexerType.Css, "DirectiveFore"];
|
||||
scintilla.Styles[Style.Css.Directive].BackColor = lexerColors[LexerType.Css, "DirectiveBack"];
|
||||
|
||||
scintilla.LexerName = "css";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Css);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the HTML lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
class CreateLexerHtml: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the HTML (Hypertext Markup Language).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateHtmlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
// HTML should be simple but the embedded scripts make it hard for lexical "analysis"..
|
||||
ClearStyle(scintilla);
|
||||
|
||||
//..therefore the weird logic.. (which might malfunction)..
|
||||
SetHtmlStyles(scintilla, lexerColors);
|
||||
SetPhpStyles(scintilla, lexerColors);
|
||||
scintilla.LexerName = "hypertext";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.HTML);
|
||||
|
||||
SetScriptedHtml(LexerType.HTML, scintilla, lexerColors);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the INI lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerIni: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the INI (properties file).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateIniLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 0
|
||||
scintilla.Styles[Style.Properties.Default].ForeColor = lexerColors[LexerType.INI, "DefaultFore"];
|
||||
scintilla.Styles[Style.Properties.Default].BackColor = lexerColors[LexerType.INI, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Properties.Comment].ForeColor = lexerColors[LexerType.INI, "CommentFore"];
|
||||
scintilla.Styles[Style.Properties.Comment].BackColor = lexerColors[LexerType.INI, "CommentBack"];
|
||||
|
||||
// SECTION, fontStyle = 1, styleId = 2
|
||||
scintilla.Styles[Style.Properties.Section].Bold = true;
|
||||
scintilla.Styles[Style.Properties.Section].ForeColor = lexerColors[LexerType.INI, "SectionFore"];
|
||||
scintilla.Styles[Style.Properties.Section].BackColor = lexerColors[LexerType.INI, "SectionBack"];
|
||||
|
||||
// ASSIGNMENT, fontStyle = 1, styleId = 3
|
||||
scintilla.Styles[Style.Properties.Assignment].Bold = true;
|
||||
scintilla.Styles[Style.Properties.Assignment].ForeColor = lexerColors[LexerType.INI, "AssignmentFore"];
|
||||
scintilla.Styles[Style.Properties.Assignment].BackColor = lexerColors[LexerType.INI, "AssignmentBack"];
|
||||
|
||||
// DEFVAL, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Properties.DefVal].ForeColor = lexerColors[LexerType.INI, "DefValFore"];
|
||||
scintilla.Styles[Style.Properties.DefVal].BackColor = lexerColors[LexerType.INI, "DefValBack"];
|
||||
scintilla.LexerName = "props";
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
// ReSharper disable once CommentTypo
|
||||
/// <summary>
|
||||
/// Constants for the InnoSetup script language.
|
||||
/// </summary>
|
||||
// ReSharper disable once IdentifierTypo
|
||||
public static class InnoSetup
|
||||
{
|
||||
///
|
||||
/// Summary:
|
||||
/// Default style index.
|
||||
public const int Default = 0;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Identifier style index.
|
||||
public const int Identifier = 1;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Comment style '{' index.
|
||||
public const int Comment = 2;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Comment style 2 "(*" index.
|
||||
public const int Comment2 = 3;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Comment line style "//" index.
|
||||
public const int CommentLine = 4;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Preprocessor style "{$" index.
|
||||
public const int Preprocessor = 5;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Preprocessor style 2 "(*$" index.
|
||||
public const int Preprocessor2 = 6;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Number style index.
|
||||
public const int Number = 7;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Hexadecimal number style index.
|
||||
public const int HexNumber = 8;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Word (keyword set 0) style index.
|
||||
public const int Word = 9;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Double-quoted string style index.
|
||||
public const int String = 10;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Unclosed string EOL style index.
|
||||
public const int StringEol = 11;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Single-quoted string style index.
|
||||
public const int Character = 12;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Operator style index.
|
||||
public const int Operator = 13;
|
||||
|
||||
///
|
||||
/// Summary:
|
||||
/// Assembly style index.
|
||||
public const int Asm = 14;
|
||||
}
|
||||
|
||||
// ReSharper disable once CommentTypo
|
||||
/// <summary>
|
||||
/// A class for the InnoSetup lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
// ReSharper disable once IdentifierTypo
|
||||
public class CreateLexerInnoSetup: CreateLexerCommon
|
||||
{
|
||||
// ReSharper disable once CommentTypo
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the InnoSetup programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
// ReSharper disable once IdentifierTypo
|
||||
public static bool CreateInnoSetupLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Default].ForeColor = lexerColors[LexerType.InnoSetup, "DefaultFore"];
|
||||
scintilla.Styles[InnoSetup.Default].BackColor = lexerColors[LexerType.InnoSetup, "DefaultBack"];
|
||||
|
||||
// IDENTIFIER, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Identifier].ForeColor = lexerColors[LexerType.InnoSetup, "IdentifierFore"];
|
||||
scintilla.Styles[InnoSetup.Identifier].BackColor = lexerColors[LexerType.InnoSetup, "IdentifierBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Comment].ForeColor = lexerColors[LexerType.InnoSetup, "CommentFore"];
|
||||
scintilla.Styles[InnoSetup.Comment].BackColor = lexerColors[LexerType.InnoSetup, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Comment2].ForeColor = lexerColors[LexerType.InnoSetup, "Comment2Fore"];
|
||||
scintilla.Styles[InnoSetup.Comment2].BackColor = lexerColors[LexerType.InnoSetup, "Comment2Back"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.CommentLine].ForeColor = lexerColors[LexerType.InnoSetup, "CommentLineFore"];
|
||||
scintilla.Styles[InnoSetup.CommentLine].BackColor = lexerColors[LexerType.InnoSetup, "CommentLineBack"];
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Preprocessor].ForeColor = lexerColors[LexerType.InnoSetup, "PreprocessorFore"];
|
||||
scintilla.Styles[InnoSetup.Preprocessor].BackColor = lexerColors[LexerType.InnoSetup, "PreprocessorBack"];
|
||||
|
||||
// PREPROCESSOR2, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Preprocessor2].ForeColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Fore"];
|
||||
scintilla.Styles[InnoSetup.Preprocessor2].BackColor = lexerColors[LexerType.InnoSetup, "Preprocessor2Back"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Number].ForeColor = lexerColors[LexerType.InnoSetup, "NumberFore"];
|
||||
scintilla.Styles[InnoSetup.Number].BackColor = lexerColors[LexerType.InnoSetup, "NumberBack"];
|
||||
|
||||
// HEX NUMBER, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.HexNumber].ForeColor = lexerColors[LexerType.InnoSetup, "HexNumberFore"];
|
||||
scintilla.Styles[InnoSetup.HexNumber].BackColor = lexerColors[LexerType.InnoSetup, "HexNumberBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1
|
||||
scintilla.Styles[InnoSetup.Word].Bold = true;
|
||||
scintilla.Styles[InnoSetup.Word].ForeColor = lexerColors[LexerType.InnoSetup, "WordFore"];
|
||||
scintilla.Styles[InnoSetup.Word].BackColor = lexerColors[LexerType.InnoSetup, "WordBack"];
|
||||
|
||||
// STRING, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.String].ForeColor = lexerColors[LexerType.InnoSetup, "StringFore"];
|
||||
scintilla.Styles[InnoSetup.String].BackColor = lexerColors[LexerType.InnoSetup, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0
|
||||
scintilla.Styles[InnoSetup.Character].ForeColor = lexerColors[LexerType.InnoSetup, "CharacterFore"];
|
||||
scintilla.Styles[InnoSetup.Character].BackColor = lexerColors[LexerType.InnoSetup, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[InnoSetup.Operator].Bold = true;
|
||||
scintilla.Styles[InnoSetup.Operator].ForeColor = lexerColors[LexerType.InnoSetup, "OperatorFore"];
|
||||
scintilla.Styles[InnoSetup.Operator].BackColor = lexerColors[LexerType.InnoSetup, "OperatorBack"];
|
||||
|
||||
// ASM, fontStyle = 1
|
||||
scintilla.Styles[InnoSetup.Asm].Bold = true;
|
||||
scintilla.Styles[InnoSetup.Asm].ForeColor = lexerColors[LexerType.InnoSetup, "ForeColorFore"];
|
||||
scintilla.Styles[InnoSetup.Asm].BackColor = lexerColors[LexerType.InnoSetup, "ForeColorBack"];
|
||||
scintilla.LexerName = "inno";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.InnoSetup);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a color value of a given integer containing an RGB color value.
|
||||
/// </summary>
|
||||
/// <param name="rgb">The RGB color value.</param>
|
||||
/// <returns>System.Drawing.Color.</returns>
|
||||
public static System.Drawing.Color IntToColor(int rgb)
|
||||
{
|
||||
return System.Drawing.Color.FromArgb(255, (byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Java lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerJava : CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Java programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateJavaLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0, styleId = 9
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = lexerColors[LexerType.Java, "PreprocessorFore"];
|
||||
scintilla.Styles[Style.Cpp.Preprocessor].BackColor = lexerColors[LexerType.Java, "PreprocessorBack"];
|
||||
|
||||
// Style.Cpp.Identifier ?, Style.Cpp.Default = 0..
|
||||
// DEFAULT, fontStyle = 0, styleId = 11
|
||||
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.Java, "DefaultFore"];
|
||||
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.Java, "DefaultBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1, styleId = 5
|
||||
scintilla.Styles[Style.Cpp.Word].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.Java, "InstructionWordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.Java, "InstructionWordBack"];
|
||||
|
||||
// TYPE WORD, fontStyle = 0, styleId = 16
|
||||
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.Java, "TypeWordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.Java, "TypeWordBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.Java, "NumberFore"];
|
||||
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.Java, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 6
|
||||
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.Java, "StringFore"];
|
||||
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.Java, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0, styleId = 7
|
||||
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.Java, "CharacterFore"];
|
||||
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.Java, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 10
|
||||
scintilla.Styles[Style.Cpp.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.Java, "OperatorFore"];
|
||||
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.Java, "OperatorBack"];
|
||||
|
||||
// VERBATIM, fontStyle = 0, styleId = 13
|
||||
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.Java, "VerbatimFore"];
|
||||
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.Java, "VerbatimBack"];
|
||||
|
||||
// REGEX, fontStyle = 1, styleId = 14
|
||||
scintilla.Styles[Style.Cpp.Regex].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.Java, "RegexFore"];
|
||||
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.Java, "RegexBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.Java, "CommentFore"];
|
||||
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.Java, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.Java, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.Java, "CommentLineBack"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.Java, "CommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.Java, "CommentDocBack"];
|
||||
|
||||
// COMMENT LINE DOC, fontStyle = 0, styleId = 15
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.Java, "CommentLineDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.Java, "CommentLineDocBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.Java, "CommentDocKeywordErrorBack"];
|
||||
scintilla.LexerName = "cpp";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Java);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
class CreateLexerJavaScript: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Java programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateJavaScriptLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// 11 ?, Style.Cpp.Default = 0..
|
||||
// DEFAULT, fontStyle = 0, styleId = 11
|
||||
scintilla.Styles[Style.Cpp.Default].ForeColor = lexerColors[LexerType.JavaScript, "DefaultFore"];
|
||||
scintilla.Styles[Style.Cpp.Default].BackColor = lexerColors[LexerType.JavaScript, "DefaultBack"];
|
||||
// TODO::From here onward!!
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1, styleId = 5
|
||||
scintilla.Styles[Style.Cpp.Word].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Word].ForeColor = lexerColors[LexerType.JavaScript, "InstructionWordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word].BackColor = lexerColors[LexerType.JavaScript, "InstructionWordBack"];
|
||||
|
||||
// TYPE WORD, fontStyle = 0, styleId = 16
|
||||
scintilla.Styles[Style.Cpp.Word2].ForeColor = lexerColors[LexerType.JavaScript, "TypeWordFore"];
|
||||
scintilla.Styles[Style.Cpp.Word2].BackColor = lexerColors[LexerType.JavaScript, "TypeWordBack"];
|
||||
|
||||
// WINDOW INSTRUCTION, fontStyle = 1, styleId = 19
|
||||
scintilla.Styles[Style.Cpp.GlobalClass].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.GlobalClass].ForeColor = lexerColors[LexerType.JavaScript, "WindowInstructionFore"];
|
||||
scintilla.Styles[Style.Cpp.GlobalClass].BackColor = lexerColors[LexerType.JavaScript, "WindowInstructionBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Cpp.Number].ForeColor = lexerColors[LexerType.JavaScript, "NumberFore"];
|
||||
scintilla.Styles[Style.Cpp.Number].BackColor = lexerColors[LexerType.JavaScript, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 6
|
||||
scintilla.Styles[Style.Cpp.String].ForeColor = lexerColors[LexerType.JavaScript, "StringFore"];
|
||||
scintilla.Styles[Style.Cpp.String].BackColor = lexerColors[LexerType.JavaScript, "StringBack"];
|
||||
|
||||
// STRINGRAW, fontStyle = 0, styleId = 20
|
||||
scintilla.Styles[Style.Cpp.StringRaw].ForeColor = lexerColors[LexerType.JavaScript, "StringRawFore"];
|
||||
scintilla.Styles[Style.Cpp.StringRaw].BackColor = lexerColors[LexerType.JavaScript, "StringRawBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0, styleId = 7
|
||||
scintilla.Styles[Style.Cpp.Character].ForeColor = lexerColors[LexerType.JavaScript, "CharacterFore"];
|
||||
scintilla.Styles[Style.Cpp.Character].BackColor = lexerColors[LexerType.JavaScript, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 10
|
||||
scintilla.Styles[Style.Cpp.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Operator].ForeColor = lexerColors[LexerType.JavaScript, "OperatorFore"];
|
||||
scintilla.Styles[Style.Cpp.Operator].BackColor = lexerColors[LexerType.JavaScript, "OperatorBack"];
|
||||
|
||||
// VERBATIM, fontStyle = 0, styleId = 13
|
||||
scintilla.Styles[Style.Cpp.Verbatim].ForeColor = lexerColors[LexerType.JavaScript, "VerbatimFore"];
|
||||
scintilla.Styles[Style.Cpp.Verbatim].BackColor = lexerColors[LexerType.JavaScript, "VerbatimBack"];
|
||||
|
||||
// REGEX, fontStyle = 1, styleId = 14
|
||||
scintilla.Styles[Style.Cpp.Regex].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.Regex].ForeColor = lexerColors[LexerType.JavaScript, "RegexFore"];
|
||||
scintilla.Styles[Style.Cpp.Regex].BackColor = lexerColors[LexerType.JavaScript, "RegexBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Cpp.Comment].ForeColor = lexerColors[LexerType.JavaScript, "CommentFore"];
|
||||
scintilla.Styles[Style.Cpp.Comment].BackColor = lexerColors[LexerType.JavaScript, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.Cpp.CommentLine].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLine].BackColor = lexerColors[LexerType.JavaScript, "CommentLineBack"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentDocBack"];
|
||||
|
||||
// COMMENT LINE DOC, fontStyle = 0, styleId = 15
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = lexerColors[LexerType.JavaScript, "CommentLineDocFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentLineDoc].BackColor = lexerColors[LexerType.JavaScript, "CommentLineDocBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 17
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].Bold = true;
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeyword].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD ERROR, fontStyle = 0, styleId = 18
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorFore"];
|
||||
scintilla.Styles[Style.Cpp.CommentDocKeywordError].BackColor = lexerColors[LexerType.JavaScript, "CommentDocKeywordErrorBack"];
|
||||
scintilla.LexerName = "cpp";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.JavaScript);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the YAML lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerJson: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the YAML (YAML Ain't Markup Language).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateJsonLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT
|
||||
scintilla.Styles[Style.Json.Default].ForeColor = lexerColors[LexerType.Json, "JsonDefaultFore"];
|
||||
scintilla.Styles[Style.Json.Default].BackColor = lexerColors[LexerType.Json, "JsonDefaultBack"];
|
||||
|
||||
// NUMBER
|
||||
scintilla.Styles[Style.Json.Number].ForeColor = lexerColors[LexerType.Json, "JsonNumberFore"];
|
||||
scintilla.Styles[Style.Json.Number].BackColor = lexerColors[LexerType.Json, "JsonNumberBack"];
|
||||
|
||||
// STRING
|
||||
scintilla.Styles[Style.Json.String].ForeColor = lexerColors[LexerType.Json, "JsonStringFore"];
|
||||
scintilla.Styles[Style.Json.String].BackColor = lexerColors[LexerType.Json, "JsonStringBack"];
|
||||
|
||||
// UNCLOSED STRING
|
||||
scintilla.Styles[Style.Json.StringEol].ForeColor = lexerColors[LexerType.Json, "JsonUnclosedStringFore"];
|
||||
scintilla.Styles[Style.Json.StringEol].BackColor = lexerColors[LexerType.Json, "JsonUnclosedStringBack"];
|
||||
|
||||
// PROPERTY
|
||||
scintilla.Styles[Style.Json.PropertyName].ForeColor = lexerColors[LexerType.Json, "JsonPropertyFore"];
|
||||
scintilla.Styles[Style.Json.PropertyName].BackColor = lexerColors[LexerType.Json, "JsonPropertyBack"];
|
||||
|
||||
// ESCAPE SEQUENCE
|
||||
scintilla.Styles[Style.Json.LineComment].ForeColor = lexerColors[LexerType.Json, "JsonEscapeSequenceFore"];
|
||||
scintilla.Styles[Style.Json.LineComment].BackColor = lexerColors[LexerType.Json, "JsonEscapeSequenceBack"];
|
||||
|
||||
// LINE COMMENT
|
||||
scintilla.Styles[Style.Json.LineComment].ForeColor = lexerColors[LexerType.Json, "JsonLineCommentFore"];
|
||||
scintilla.Styles[Style.Json.LineComment].BackColor = lexerColors[LexerType.Json, "JsonLineCommentBack"];
|
||||
scintilla.Styles[Style.Json.LineComment].Italic = true;
|
||||
|
||||
// BLOCK COMMENT
|
||||
scintilla.Styles[Style.Json.BlockComment].ForeColor = lexerColors[LexerType.Json, "JsonBlockCommentFore"];
|
||||
scintilla.Styles[Style.Json.BlockComment].BackColor = lexerColors[LexerType.Json, "JsonBlockCommentBack"];
|
||||
|
||||
// OPERATOR
|
||||
scintilla.Styles[Style.Json.Operator].ForeColor = lexerColors[LexerType.Json, "JsonOperatorFore"];
|
||||
scintilla.Styles[Style.Json.Operator].BackColor = lexerColors[LexerType.Json, "JsonOperatorBack"];
|
||||
|
||||
// URL/IRI
|
||||
scintilla.Styles[Style.Json.Uri].ForeColor = lexerColors[LexerType.Json, "JsonUriFore"];
|
||||
scintilla.Styles[Style.Json.Uri].BackColor = lexerColors[LexerType.Json, "JsonUriBack"];
|
||||
|
||||
// JSON-LD COMPACT IRI
|
||||
scintilla.Styles[Style.Json.CompactIRI].ForeColor = lexerColors[LexerType.Json, "JsonCompactIRIFore"];
|
||||
scintilla.Styles[Style.Json.CompactIRI].BackColor = lexerColors[LexerType.Json, "JsonCompactIRIBack"];
|
||||
|
||||
// JSON KEYWORD
|
||||
scintilla.Styles[Style.Json.Keyword].ForeColor = lexerColors[LexerType.Json, "JsonKeywordFore"];
|
||||
scintilla.Styles[Style.Json.Keyword].BackColor = lexerColors[LexerType.Json, "JsonKeywordBack"];
|
||||
|
||||
// JSON-LD KEYWORD
|
||||
scintilla.Styles[Style.Json.LdKeyword].ForeColor = lexerColors[LexerType.Json, "JsonLdKeywordFore"];
|
||||
scintilla.Styles[Style.Json.LdKeyword].BackColor = lexerColors[LexerType.Json, "JsonLdKeywordBack"];
|
||||
|
||||
// PARSING ERROR
|
||||
scintilla.Styles[Style.Json.LdKeyword].ForeColor = lexerColors[LexerType.Json, "JsonErrorFore"];
|
||||
scintilla.Styles[Style.Json.LdKeyword].BackColor = lexerColors[LexerType.Json, "JsonErrorBack"];
|
||||
scintilla.LexerName = "json";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Json);
|
||||
|
||||
scintilla.SetProperty("lexer.json.allow.comments", "1");
|
||||
scintilla.SetProperty("lexer.json.escape.sequence", "1");
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the NSIS lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerNsis: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the NSIS (Nullsoft Scriptable Install System).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateNsisLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// NSIS not found..
|
||||
#region NSIS_CONSTANTS
|
||||
const int SCE_NSIS_DEFAULT = 0;
|
||||
const int SCE_NSIS_COMMENT = 1;
|
||||
const int SCE_NSIS_STRINGDQ = 2;
|
||||
const int SCE_NSIS_STRINGLQ = 3;
|
||||
const int SCE_NSIS_STRINGRQ = 4;
|
||||
const int SCE_NSIS_FUNCTION = 5;
|
||||
const int SCE_NSIS_VARIABLE = 6;
|
||||
const int SCE_NSIS_LABEL = 7;
|
||||
const int SCE_NSIS_USERDEFINED = 8;
|
||||
const int SCE_NSIS_SECTIONDEF = 9;
|
||||
const int SCE_NSIS_SUBSECTIONDEF = 10;
|
||||
const int SCE_NSIS_IFDEFINEDEF = 11;
|
||||
const int SCE_NSIS_MACRODEF = 12;
|
||||
const int SCE_NSIS_STRINGVAR = 13;
|
||||
const int SCE_NSIS_NUMBER = 14;
|
||||
const int SCE_NSIS_SECTIONGROUP = 15;
|
||||
const int SCE_NSIS_PAGEEX = 16;
|
||||
const int SCE_NSIS_FUNCTIONDEF = 17;
|
||||
const int SCE_NSIS_COMMENTBOX = 18;
|
||||
#endregion
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_DEFAULT].ForeColor = lexerColors[LexerType.Nsis, "DefaultFore"];
|
||||
scintilla.Styles[SCE_NSIS_DEFAULT].BackColor = lexerColors[LexerType.Nsis, "DefaultBack"];
|
||||
|
||||
// COMMENTLINE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_COMMENT].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
|
||||
scintilla.Styles[SCE_NSIS_COMMENT].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];
|
||||
|
||||
// STRING DOUBLE QUOTE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_STRINGDQ].ForeColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteFore"];
|
||||
scintilla.Styles[SCE_NSIS_STRINGDQ].BackColor = lexerColors[LexerType.Nsis, "StringDoubleQuoteBack"];
|
||||
|
||||
// STRING LEFT QUOTE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_STRINGLQ].ForeColor = lexerColors[LexerType.Nsis, "StringLeftQuoteFore"];
|
||||
scintilla.Styles[SCE_NSIS_STRINGLQ].BackColor = lexerColors[LexerType.Nsis, "StringLeftQuoteBack"];
|
||||
|
||||
// STRING RIGHT QUOTE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_STRINGRQ].ForeColor = lexerColors[LexerType.Nsis, "StringRightQuoteFore"];
|
||||
scintilla.Styles[SCE_NSIS_STRINGRQ].BackColor = lexerColors[LexerType.Nsis, "StringRightQuoteBack"];
|
||||
|
||||
// FUNCTION, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_FUNCTION].ForeColor = lexerColors[LexerType.Nsis, "FunctionFore"];
|
||||
scintilla.Styles[SCE_NSIS_FUNCTION].BackColor = lexerColors[LexerType.Nsis, "FunctionBack"];
|
||||
|
||||
// VARIABLE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_VARIABLE].ForeColor = lexerColors[LexerType.Nsis, "VariableFore"];
|
||||
scintilla.Styles[SCE_NSIS_VARIABLE].BackColor = lexerColors[LexerType.Nsis, "VariableBack"];
|
||||
|
||||
// LABEL, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_LABEL].ForeColor = lexerColors[LexerType.Nsis, "LabelFore"];
|
||||
scintilla.Styles[SCE_NSIS_LABEL].BackColor = lexerColors[LexerType.Nsis, "LabelBack"];
|
||||
|
||||
// USER DEFINED, fontStyle = 4
|
||||
scintilla.Styles[SCE_NSIS_USERDEFINED].ForeColor = lexerColors[LexerType.Nsis, "UserDefinedFore"];
|
||||
scintilla.Styles[SCE_NSIS_USERDEFINED].BackColor = lexerColors[LexerType.Nsis, "UserDefinedBack"];
|
||||
|
||||
// SECTION, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_SECTIONDEF].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_SECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SectionFore"];
|
||||
scintilla.Styles[SCE_NSIS_SECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SectionBack"];
|
||||
|
||||
// SUBSECTION, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "SubSectionFore"];
|
||||
scintilla.Styles[SCE_NSIS_SUBSECTIONDEF].BackColor = lexerColors[LexerType.Nsis, "SubSectionBack"];
|
||||
|
||||
// IF DEFINE, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_IFDEFINEDEF].ForeColor = lexerColors[LexerType.Nsis, "IfDefineFore"];
|
||||
scintilla.Styles[SCE_NSIS_IFDEFINEDEF].BackColor = lexerColors[LexerType.Nsis, "IfDefineBack"];
|
||||
|
||||
// MACRO, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_MACRODEF].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_MACRODEF].ForeColor = lexerColors[LexerType.Nsis, "MacroFore"];
|
||||
scintilla.Styles[SCE_NSIS_MACRODEF].BackColor = lexerColors[LexerType.Nsis, "MacroBack"];
|
||||
|
||||
// STRING VAR, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_STRINGVAR].ForeColor = lexerColors[LexerType.Nsis, "StringVarFore"];
|
||||
scintilla.Styles[SCE_NSIS_STRINGVAR].BackColor = lexerColors[LexerType.Nsis, "StringVarBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_NUMBER].ForeColor = lexerColors[LexerType.Nsis, "NumberFore"];
|
||||
scintilla.Styles[SCE_NSIS_NUMBER].BackColor = lexerColors[LexerType.Nsis, "NumberBack"];
|
||||
|
||||
// SECTION GROUP, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_SECTIONGROUP].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_SECTIONGROUP].ForeColor = lexerColors[LexerType.Nsis, "SectionGroupFore"];
|
||||
scintilla.Styles[SCE_NSIS_SECTIONGROUP].BackColor = lexerColors[LexerType.Nsis, "SectionGroupBack"];
|
||||
|
||||
// PAGE EX, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_PAGEEX].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_PAGEEX].ForeColor = lexerColors[LexerType.Nsis, "PageExFore"];
|
||||
scintilla.Styles[SCE_NSIS_PAGEEX].BackColor = lexerColors[LexerType.Nsis, "PageExBack"];
|
||||
|
||||
// FUNCTION DEFINITIONS, fontStyle = 1
|
||||
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].Bold = true;
|
||||
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].ForeColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsFore"];
|
||||
scintilla.Styles[SCE_NSIS_FUNCTIONDEF].BackColor = lexerColors[LexerType.Nsis, "FunctionDefinitionsBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[SCE_NSIS_COMMENTBOX].ForeColor = lexerColors[LexerType.Nsis, "CommentFore"];
|
||||
scintilla.Styles[SCE_NSIS_COMMENTBOX].BackColor = lexerColors[LexerType.Nsis, "CommentBack"];
|
||||
scintilla.LexerName = "nsis";
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Nsis);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for plain text.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
class CreateLexerNull: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for a plain text file.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateNullLexer(Scintilla scintilla)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
scintilla.LexerName = "null";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Pascal lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerPascal: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Pascal programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreatePascalLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Default].ForeColor = lexerColors[LexerType.Pascal, "DefaultFore"];
|
||||
scintilla.Styles[Style.Pascal.Default].BackColor = lexerColors[LexerType.Pascal, "DefaultBack"];
|
||||
|
||||
// IDENTIFIER, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Identifier].ForeColor = lexerColors[LexerType.Pascal, "IdentifierFore"];
|
||||
scintilla.Styles[Style.Pascal.Identifier].BackColor = lexerColors[LexerType.Pascal, "IdentifierBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Comment].ForeColor = lexerColors[LexerType.Pascal, "CommentFore"];
|
||||
scintilla.Styles[Style.Pascal.Comment].BackColor = lexerColors[LexerType.Pascal, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Comment2].ForeColor = lexerColors[LexerType.Pascal, "Comment2Fore"];
|
||||
scintilla.Styles[Style.Pascal.Comment2].BackColor = lexerColors[LexerType.Pascal, "Comment2Back"];
|
||||
|
||||
// COMMENT DOC, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.CommentLine].ForeColor = lexerColors[LexerType.Pascal, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Pascal.CommentLine].BackColor = lexerColors[LexerType.Pascal, "CommentLineBack"];
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Preprocessor].ForeColor = lexerColors[LexerType.Pascal, "PreprocessorFore"];
|
||||
scintilla.Styles[Style.Pascal.Preprocessor].BackColor = lexerColors[LexerType.Pascal, "PreprocessorBack"];
|
||||
|
||||
// PREPROCESSOR2, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Preprocessor2].ForeColor = lexerColors[LexerType.Pascal, "Preprocessor2Fore"];
|
||||
scintilla.Styles[Style.Pascal.Preprocessor2].BackColor = lexerColors[LexerType.Pascal, "Preprocessor2Back"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Number].ForeColor = lexerColors[LexerType.Pascal, "NumberFore"];
|
||||
scintilla.Styles[Style.Pascal.Number].BackColor = lexerColors[LexerType.Pascal, "NumberBack"];
|
||||
|
||||
// HEX NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.HexNumber].ForeColor = lexerColors[LexerType.Pascal, "HexNumberFore"];
|
||||
scintilla.Styles[Style.Pascal.HexNumber].BackColor = lexerColors[LexerType.Pascal, "HexNumberBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Pascal.Word].Bold = true;
|
||||
scintilla.Styles[Style.Pascal.Word].ForeColor = lexerColors[LexerType.Pascal, "WordFore"];
|
||||
scintilla.Styles[Style.Pascal.Word].BackColor = lexerColors[LexerType.Pascal, "WordBack"];
|
||||
|
||||
// STRING, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.String].ForeColor = lexerColors[LexerType.Pascal, "StringFore"];
|
||||
scintilla.Styles[Style.Pascal.String].BackColor = lexerColors[LexerType.Pascal, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0
|
||||
scintilla.Styles[Style.Pascal.Character].ForeColor = lexerColors[LexerType.Pascal, "CharacterFore"];
|
||||
scintilla.Styles[Style.Pascal.Character].BackColor = lexerColors[LexerType.Pascal, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[Style.Pascal.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Pascal.Operator].ForeColor = lexerColors[LexerType.Pascal, "OperatorFore"];
|
||||
scintilla.Styles[Style.Pascal.Operator].BackColor = lexerColors[LexerType.Pascal, "OperatorBack"];
|
||||
|
||||
// ASM, fontStyle = 1
|
||||
scintilla.Styles[Style.Pascal.Asm].Bold = true;
|
||||
scintilla.Styles[Style.Pascal.Asm].ForeColor = lexerColors[LexerType.Pascal, "ForeColorFore"];
|
||||
scintilla.Styles[Style.Pascal.Asm].BackColor = lexerColors[LexerType.Pascal, "ForeColorBack"];
|
||||
scintilla.LexerName = "pascal";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Pascal);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the PHP lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerPhp: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the PHP programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreatePhpLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
//ClearStyle(scintilla);
|
||||
////..therefore the weird logic.. (which might malfunction)..
|
||||
//SetPhpStyles(scintilla, lexerColors);
|
||||
//SetHtmlStyles(scintilla, lexerColors);
|
||||
|
||||
//scintilla.LexerName = "phpscript";
|
||||
|
||||
////ScintillaKeyWords.SetKeywords(scintilla, LexerType.PHP);
|
||||
|
||||
//SetScriptedHtml(LexerType.PHP, scintilla, lexerColors);
|
||||
//if (foldOn)
|
||||
// AddFolding(scintilla);
|
||||
//return true;
|
||||
ClearStyle(scintilla);
|
||||
|
||||
//..therefore the weird logic.. (which might malfunction)..
|
||||
SetHtmlStyles(scintilla, lexerColors);
|
||||
SetPhpStyles(scintilla, lexerColors);
|
||||
SetJSStyles(scintilla, lexerColors);
|
||||
scintilla.LexerName = "hypertext";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.HTML);
|
||||
|
||||
SetScriptedHtml(LexerType.HTML, scintilla, lexerColors);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Windows PowerShell lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerPowerShell: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Windows PowerShell script language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreatePowerShellLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 0
|
||||
scintilla.Styles[Style.PowerShell.Default].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "DefaultFore"];
|
||||
scintilla.Styles[Style.PowerShell.Default].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.PowerShell.Comment].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentFore"];
|
||||
scintilla.Styles[Style.PowerShell.Comment].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentBack"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.PowerShell.String].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "StringFore"];
|
||||
scintilla.Styles[Style.PowerShell.String].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.PowerShell.Character].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CharacterFore"];
|
||||
scintilla.Styles[Style.PowerShell.Character].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CharacterBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.PowerShell.Number].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "NumberFore"];
|
||||
scintilla.Styles[Style.PowerShell.Number].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "NumberBack"];
|
||||
|
||||
// VARIABLE, fontStyle = 1, styleId = 5
|
||||
scintilla.Styles[Style.PowerShell.Variable].Bold = true;
|
||||
scintilla.Styles[Style.PowerShell.Variable].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "VariableFore"];
|
||||
scintilla.Styles[Style.PowerShell.Variable].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "VariableBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 6
|
||||
scintilla.Styles[Style.PowerShell.Operator].Bold = true;
|
||||
scintilla.Styles[Style.PowerShell.Operator].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "OperatorFore"];
|
||||
scintilla.Styles[Style.PowerShell.Operator].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "OperatorBack"];
|
||||
|
||||
// INSTRUCTION WORD, fontStyle = 1, styleId = 8
|
||||
scintilla.Styles[Style.PowerShell.Keyword].Bold = true;
|
||||
scintilla.Styles[Style.PowerShell.Keyword].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "InstructionWordFore"];
|
||||
scintilla.Styles[Style.PowerShell.Keyword].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "InstructionWordBack"];
|
||||
|
||||
// CMDLET, fontStyle = 0, styleId = 9
|
||||
scintilla.Styles[Style.PowerShell.Cmdlet].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommandletFore"];
|
||||
scintilla.Styles[Style.PowerShell.Cmdlet].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommandletBack"];
|
||||
|
||||
// ALIAS, fontStyle = 0, styleId = 10
|
||||
scintilla.Styles[Style.PowerShell.Alias].ForeColor = lexerColors[LexerType.WindowsPowerShell, "AliasFore"];
|
||||
scintilla.Styles[Style.PowerShell.Alias].BackColor = lexerColors[LexerType.WindowsPowerShell, "AliasBack"];
|
||||
|
||||
// COMMENT STREAM, fontStyle = 0, styleId = 13
|
||||
scintilla.Styles[Style.PowerShell.CommentStream].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentStreamFore"];
|
||||
scintilla.Styles[Style.PowerShell.CommentStream].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentStreamBack"];
|
||||
|
||||
// HERE STRING, fontStyle = 0, styleId = 14
|
||||
scintilla.Styles[Style.PowerShell.HereString].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "HereStringFore"];
|
||||
scintilla.Styles[Style.PowerShell.HereString].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "HereStringBack"];
|
||||
|
||||
// HERE CHARACTER, fontStyle = 0, styleId = 15
|
||||
scintilla.Styles[Style.PowerShell.HereCharacter].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "HereCharacterFore"];
|
||||
scintilla.Styles[Style.PowerShell.HereCharacter].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "HereCharacterBack"];
|
||||
|
||||
// COMMENT DOC KEYWORD, fontStyle = 1, styleId = 16
|
||||
scintilla.Styles[Style.PowerShell.CommentDocKeyword].Bold = true;
|
||||
scintilla.Styles[Style.PowerShell.CommentDocKeyword].ForeColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordFore"];
|
||||
scintilla.Styles[Style.PowerShell.CommentDocKeyword].BackColor =
|
||||
lexerColors[LexerType.WindowsPowerShell, "CommentDocKeywordBack"];
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.WindowsPowerShell);
|
||||
|
||||
scintilla.LexerName = "powershell";
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Python lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerPython: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Python programming language.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreatePythonLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 0
|
||||
scintilla.Styles[Style.Python.Default].ForeColor = lexerColors[LexerType.Python, "DefaultFore"];
|
||||
scintilla.Styles[Style.Python.Default].BackColor = lexerColors[LexerType.Python, "DefaultBack"];
|
||||
|
||||
// COMMENTLINE, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Python.CommentLine].ForeColor = lexerColors[LexerType.Python, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Python.CommentLine].BackColor = lexerColors[LexerType.Python, "CommentLineBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0, styleId = 2
|
||||
scintilla.Styles[Style.Python.Number].ForeColor = lexerColors[LexerType.Python, "NumberFore"];
|
||||
scintilla.Styles[Style.Python.Number].BackColor = lexerColors[LexerType.Python, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.Python.String].ForeColor = lexerColors[LexerType.Python, "StringFore"];
|
||||
scintilla.Styles[Style.Python.String].BackColor = lexerColors[LexerType.Python, "StringBack"];
|
||||
|
||||
// CHARACTER, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Python.Character].ForeColor = lexerColors[LexerType.Python, "CharacterFore"];
|
||||
scintilla.Styles[Style.Python.Character].BackColor = lexerColors[LexerType.Python, "CharacterBack"];
|
||||
|
||||
// KEYWORDS, fontStyle = 1, styleId = 5
|
||||
scintilla.Styles[Style.Python.Word].Bold = true;
|
||||
scintilla.Styles[Style.Python.Word].ForeColor = lexerColors[LexerType.Python, "WordFore"];
|
||||
scintilla.Styles[Style.Python.Word].BackColor = lexerColors[LexerType.Python, "WordBack"];
|
||||
|
||||
// TRIPLE, fontStyle = 0, styleId = 6
|
||||
scintilla.Styles[Style.Python.Triple].ForeColor = lexerColors[LexerType.Python, "TripleFore"];
|
||||
scintilla.Styles[Style.Python.Triple].BackColor = lexerColors[LexerType.Python, "TripleBack"];
|
||||
|
||||
// TRIPLEDOUBLE, fontStyle = 0, styleId = 7
|
||||
scintilla.Styles[Style.Python.TripleDouble].ForeColor = lexerColors[LexerType.Python, "TripleDoubleFore"];
|
||||
scintilla.Styles[Style.Python.TripleDouble].BackColor = lexerColors[LexerType.Python, "TripleDoubleBack"];
|
||||
|
||||
// CLASSNAME, fontStyle = 1, styleId = 8
|
||||
scintilla.Styles[Style.Python.ClassName].Bold = true;
|
||||
scintilla.Styles[Style.Python.ClassName].ForeColor = lexerColors[LexerType.Python, "ClassNameFore"];
|
||||
scintilla.Styles[Style.Python.ClassName].BackColor = lexerColors[LexerType.Python, "ClassNameBack"];
|
||||
|
||||
// DEFNAME, fontStyle = 0, styleId = 9
|
||||
scintilla.Styles[Style.Python.DefName].ForeColor = lexerColors[LexerType.Python, "DefNameFore"];
|
||||
scintilla.Styles[Style.Python.DefName].BackColor = lexerColors[LexerType.Python, "DefNameBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 10
|
||||
scintilla.Styles[Style.Python.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Python.Operator].ForeColor = lexerColors[LexerType.Python, "OperatorFore"];
|
||||
scintilla.Styles[Style.Python.Operator].BackColor = lexerColors[LexerType.Python, "OperatorBack"];
|
||||
|
||||
// IDENTIFIER, fontStyle = 0, styleId = 11
|
||||
scintilla.Styles[Style.Python.Identifier].ForeColor = lexerColors[LexerType.Python, "IdentifierFore"];
|
||||
scintilla.Styles[Style.Python.Identifier].BackColor = lexerColors[LexerType.Python, "IdentifierBack"];
|
||||
|
||||
// COMMENTBLOCK, fontStyle = 0, styleId = 12
|
||||
scintilla.Styles[Style.Python.CommentBlock].ForeColor = lexerColors[LexerType.Python, "CommentBlockFore"];
|
||||
scintilla.Styles[Style.Python.CommentBlock].BackColor = lexerColors[LexerType.Python, "CommentBlockBack"];
|
||||
|
||||
// DECORATOR, fontStyle = 2, styleId = 15
|
||||
scintilla.Styles[Style.Python.Decorator].Italic = true;
|
||||
scintilla.Styles[Style.Python.Decorator].ForeColor = lexerColors[LexerType.Python, "DecoratorFore"];
|
||||
scintilla.Styles[Style.Python.Decorator].BackColor = lexerColors[LexerType.Python, "DecoratorBack"];
|
||||
|
||||
scintilla.LexerName = "python";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.Python);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the SQL lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerSql: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the Structured Query Language (SQL).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateSqlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// KEYWORD, fontStyle = 1
|
||||
scintilla.Styles[Style.Sql.Word].Bold = true;
|
||||
scintilla.Styles[Style.Sql.Word].ForeColor = lexerColors[LexerType.SQL, "WordFore"];
|
||||
scintilla.Styles[Style.Sql.Word].BackColor = lexerColors[LexerType.SQL, "WordBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Sql.Number].ForeColor = lexerColors[LexerType.SQL, "NumberFore"];
|
||||
scintilla.Styles[Style.Sql.Number].BackColor = lexerColors[LexerType.SQL, "NumberBack"];
|
||||
|
||||
// STRING, fontStyle = 0
|
||||
scintilla.Styles[Style.Sql.String].ForeColor = lexerColors[LexerType.SQL, "StringFore"];
|
||||
scintilla.Styles[Style.Sql.String].BackColor = lexerColors[LexerType.SQL, "StringBack"];
|
||||
|
||||
// STRING2, fontStyle = 0
|
||||
scintilla.Styles[Style.Sql.Character].ForeColor =
|
||||
lexerColors[LexerType.SQL, "CharacterFore"];
|
||||
scintilla.Styles[Style.Sql.Character].BackColor =
|
||||
lexerColors[LexerType.SQL, "CharacterBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1
|
||||
scintilla.Styles[Style.Sql.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Sql.Operator].ForeColor =
|
||||
lexerColors[LexerType.SQL, "OperatorFore"];
|
||||
scintilla.Styles[Style.Sql.Operator].BackColor =
|
||||
lexerColors[LexerType.SQL, "OperatorBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Sql.Comment].ForeColor = lexerColors[LexerType.SQL, "CommentFore"];
|
||||
scintilla.Styles[Style.Sql.Comment].BackColor = lexerColors[LexerType.SQL, "CommentBack"];
|
||||
|
||||
// COMMENT LINE, fontStyle = 0
|
||||
scintilla.Styles[Style.Sql.CommentLine].ForeColor =
|
||||
lexerColors[LexerType.SQL, "CommentLineFore"];
|
||||
scintilla.Styles[Style.Sql.CommentLine].BackColor =
|
||||
lexerColors[LexerType.SQL, "CommentLineBack"];
|
||||
|
||||
scintilla.LexerName = "sql";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.SQL);
|
||||
|
||||
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.SqlFolding);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the Batch lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerVb: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the batch script file.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateVbLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// DEFAULT, fontStyle = 0, styleId = 7
|
||||
scintilla.Styles[Style.Vb.Default].ForeColor = lexerColors[LexerType.VbDotNet, "DefaultFore"];
|
||||
scintilla.Styles[Style.Vb.Default].BackColor = lexerColors[LexerType.VbDotNet, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0, styleId = 1
|
||||
scintilla.Styles[Style.Vb.Comment].ForeColor = lexerColors[LexerType.VbDotNet, "CommentFore"];
|
||||
scintilla.Styles[Style.Vb.Comment].BackColor = lexerColors[LexerType.VbDotNet, "CommentBack"];
|
||||
|
||||
// NUMBER, fontStyle = 1, styleId = 2
|
||||
scintilla.Styles[Style.Vb.Number].Bold = true;
|
||||
scintilla.Styles[Style.Vb.Number].ForeColor = lexerColors[LexerType.VbDotNet, "NumberFore"];
|
||||
scintilla.Styles[Style.Vb.Number].BackColor = lexerColors[LexerType.VbDotNet, "NumberBack"];
|
||||
|
||||
// WORD, fontStyle = 0, styleId = 3
|
||||
scintilla.Styles[Style.Vb.Keyword].ForeColor = lexerColors[LexerType.VbDotNet, "WordFore"];
|
||||
scintilla.Styles[Style.Vb.Keyword].BackColor = lexerColors[LexerType.VbDotNet, "WordBack"];
|
||||
|
||||
// WORD2, fontStyle = 0, styleId = 10
|
||||
scintilla.Styles[Style.Vb.Keyword2].ForeColor = lexerColors[LexerType.VbDotNet, "Word2Fore"];
|
||||
scintilla.Styles[Style.Vb.Keyword2].BackColor = lexerColors[LexerType.VbDotNet, "Word2Back"];
|
||||
|
||||
// STRING, fontStyle = 0, styleId = 4
|
||||
scintilla.Styles[Style.Vb.String].ForeColor = lexerColors[LexerType.VbDotNet, "StringFore"];
|
||||
scintilla.Styles[Style.Vb.String].BackColor = lexerColors[LexerType.VbDotNet, "StringBack"];
|
||||
|
||||
// PREPROCESSOR, fontStyle = 0, styleId = 5
|
||||
scintilla.Styles[Style.Vb.Preprocessor].ForeColor = lexerColors[LexerType.VbDotNet, "PreprocessorFore"];
|
||||
scintilla.Styles[Style.Vb.Preprocessor].BackColor = lexerColors[LexerType.VbDotNet, "PreprocessorBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 1, styleId = 6
|
||||
scintilla.Styles[Style.Vb.Operator].Bold = true;
|
||||
scintilla.Styles[Style.Vb.Operator].ForeColor = lexerColors[LexerType.VbDotNet, "OperatorFore"];
|
||||
scintilla.Styles[Style.Vb.Operator].BackColor = lexerColors[LexerType.VbDotNet, "OperatorBack"];
|
||||
|
||||
// DATE, fontStyle = 0, styleId = 8
|
||||
scintilla.Styles[Style.Vb.Date].ForeColor = lexerColors[LexerType.VbDotNet, "DateFore"];
|
||||
scintilla.Styles[Style.Vb.Date].BackColor = lexerColors[LexerType.VbDotNet, "DateBack"];
|
||||
scintilla.LexerName = "vb";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.VbDotNet);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.LexerColors;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the XML lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerXml: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the XML (The eXtensible Markup Language).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateXmlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
// XMLSTART, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.XmlStart].ForeColor =
|
||||
lexerColors[LexerType.Xml, "XmlStartFore"];
|
||||
scintilla.Styles[Style.Xml.XmlStart].BackColor =
|
||||
lexerColors[LexerType.Xml, "XmlStartBack"];
|
||||
|
||||
// XMLEND, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.XmlEnd].ForeColor = lexerColors[LexerType.Xml, "XmlEndFore"];
|
||||
scintilla.Styles[Style.Xml.XmlEnd].BackColor = lexerColors[LexerType.Xml, "XmlEndBack"];
|
||||
|
||||
// DEFAULT, fontStyle = 1
|
||||
scintilla.Styles[Style.Xml.Default].Bold = true;
|
||||
scintilla.Styles[Style.Xml.Default].ForeColor = lexerColors[LexerType.Xml, "DefaultFore"];
|
||||
scintilla.Styles[Style.Xml.Default].BackColor = lexerColors[LexerType.Xml, "DefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.Comment].ForeColor = lexerColors[LexerType.Xml, "CommentFore"];
|
||||
scintilla.Styles[Style.Xml.Comment].BackColor = lexerColors[LexerType.Xml, "CommentBack"];
|
||||
|
||||
// NUMBER, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.Number].ForeColor = lexerColors[LexerType.Xml, "NumberFore"];
|
||||
scintilla.Styles[Style.Xml.Number].BackColor = lexerColors[LexerType.Xml, "NumberBack"];
|
||||
|
||||
// DOUBLESTRING, fontStyle = 1
|
||||
scintilla.Styles[Style.Xml.DoubleString].Bold = true;
|
||||
scintilla.Styles[Style.Xml.DoubleString].ForeColor =
|
||||
lexerColors[LexerType.Xml, "DoubleStringFore"];
|
||||
scintilla.Styles[Style.Xml.DoubleString].BackColor =
|
||||
lexerColors[LexerType.Xml, "DoubleStringBack"];
|
||||
|
||||
// SINGLESTRING, fontStyle = 1
|
||||
scintilla.Styles[Style.Xml.SingleString].Bold = true;
|
||||
scintilla.Styles[Style.Xml.SingleString].ForeColor =
|
||||
lexerColors[LexerType.Xml, "SingleStringFore"];
|
||||
scintilla.Styles[Style.Xml.SingleString].BackColor =
|
||||
lexerColors[LexerType.Xml, "SingleStringBack"];
|
||||
|
||||
// TAG, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.Tag].ForeColor = lexerColors[LexerType.Xml, "TagFore"];
|
||||
scintilla.Styles[Style.Xml.Tag].BackColor = lexerColors[LexerType.Xml, "TagBack"];
|
||||
|
||||
// TAGEND, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.TagEnd].ForeColor = lexerColors[LexerType.Xml, "TagEndFore"];
|
||||
scintilla.Styles[Style.Xml.TagEnd].BackColor = lexerColors[LexerType.Xml, "TagEndBack"];
|
||||
|
||||
// TAGUNKNOWN, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.TagUnknown].ForeColor =
|
||||
lexerColors[LexerType.Xml, "TagUnknownFore"];
|
||||
scintilla.Styles[Style.Xml.TagUnknown].BackColor =
|
||||
lexerColors[LexerType.Xml, "TagUnknownBack"];
|
||||
|
||||
// ATTRIBUTE, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.Attribute].ForeColor =
|
||||
lexerColors[LexerType.Xml, "AttributeFore"];
|
||||
scintilla.Styles[Style.Xml.Attribute].BackColor =
|
||||
lexerColors[LexerType.Xml, "AttributeBack"];
|
||||
|
||||
// ATTRIBUTEUNKNOWN, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.AttributeUnknown].ForeColor =
|
||||
lexerColors[LexerType.Xml, "AttributeUnknownFore"];
|
||||
scintilla.Styles[Style.Xml.AttributeUnknown].BackColor =
|
||||
lexerColors[LexerType.Xml, "AttributeUnknownBack"];
|
||||
|
||||
// SGMLDEFAULT, fontStyle = 0
|
||||
scintilla.Styles[21].ForeColor = lexerColors[LexerType.Xml, "SgmlDefaultFore"];
|
||||
scintilla.Styles[21].BackColor = lexerColors[LexerType.Xml, "SgmlDefaultBack"];
|
||||
|
||||
// CDATA, fontStyle = 0
|
||||
scintilla.Styles[Style.Xml.CData].ForeColor = lexerColors[LexerType.Xml, "CDataFore"];
|
||||
scintilla.Styles[Style.Xml.CData].BackColor = lexerColors[LexerType.Xml, "CDataBack"];
|
||||
|
||||
// ENTITY, fontStyle = 2
|
||||
scintilla.Styles[Style.Xml.Entity].Italic = true;
|
||||
scintilla.Styles[Style.Xml.Entity].ForeColor = lexerColors[LexerType.Xml, "EntityFore"];
|
||||
scintilla.Styles[Style.Xml.Entity].BackColor = lexerColors[LexerType.Xml, "EntityBack"];
|
||||
|
||||
scintilla.LexerName = "xml";
|
||||
|
||||
// folding for a XML lexer..
|
||||
LexerFoldProperties.SetScintillaProperties(scintilla, LexerFoldProperties.XmlFolding);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ScintillaNET;
|
||||
using VPKSoft.ScintillaLexers.HelperClasses;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class for the YAML lexer.
|
||||
/// Implements the <see cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
/// </summary>
|
||||
/// <seealso cref="VPKSoft.ScintillaLexers.CreateSpecificLexer.CreateLexerCommon" />
|
||||
public class CreateLexerYaml: CreateLexerCommon
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the lexer for a given Scintilla class instance for the YAML (YAML Ain't Markup Language).
|
||||
/// </summary>
|
||||
/// <param name="scintilla">A Scintilla class instance to set the lexer style for.</param>
|
||||
/// <param name="lexerColors">A <see cref="LexerColors"/> class instance for the lexer coloring.</param>
|
||||
/// <returns>True if the operation was successful; otherwise false.</returns>
|
||||
public static bool CreateYamlLexer(Scintilla scintilla, LexerColors.LexerColors lexerColors, bool foldOn = true)
|
||||
{
|
||||
ClearStyle(scintilla);
|
||||
|
||||
#region YAML_CONSTANTS
|
||||
const int SCE_YAML_DEFAULT = 0;
|
||||
const int SCE_YAML_COMMENT = 1;
|
||||
const int SCE_YAML_IDENTIFIER = 2;
|
||||
const int SCE_YAML_KEYWORD = 3;
|
||||
const int SCE_YAML_NUMBER = 4;
|
||||
const int SCE_YAML_REFERENCE = 5;
|
||||
const int SCE_YAML_DOCUMENT = 6;
|
||||
const int SCE_YAML_TEXT = 7;
|
||||
const int SCE_YAML_ERROR = 8;
|
||||
const int SCE_YAML_OPERATOR = 9;
|
||||
#endregion
|
||||
|
||||
// DEFAULT, fontStyle = 0
|
||||
scintilla.Styles[SCE_YAML_DEFAULT].ForeColor = lexerColors[LexerType.YAML, "YamlDefaultFore"];
|
||||
scintilla.Styles[SCE_YAML_DEFAULT].BackColor = lexerColors[LexerType.YAML, "YamlDefaultBack"];
|
||||
|
||||
// COMMENT, fontStyle = 1
|
||||
scintilla.Styles[SCE_YAML_COMMENT].ForeColor = lexerColors[LexerType.YAML, "CommentFore"];
|
||||
scintilla.Styles[SCE_YAML_COMMENT].BackColor = lexerColors[LexerType.YAML, "CommentBack"];
|
||||
|
||||
// IDENTIFIER, fontStyle = 2
|
||||
scintilla.Styles[SCE_YAML_IDENTIFIER].Bold = true;
|
||||
scintilla.Styles[SCE_YAML_IDENTIFIER].ForeColor = lexerColors[LexerType.YAML, "IdentifierFore"];
|
||||
scintilla.Styles[SCE_YAML_IDENTIFIER].BackColor = lexerColors[LexerType.YAML, "IdentifierBack"];
|
||||
|
||||
// KEYWORD, fontStyle = 3
|
||||
scintilla.Styles[SCE_YAML_KEYWORD].Bold = true;
|
||||
scintilla.Styles[SCE_YAML_KEYWORD].ForeColor = lexerColors[LexerType.YAML, "KeywordFore"];
|
||||
scintilla.Styles[SCE_YAML_KEYWORD].BackColor = lexerColors[LexerType.YAML, "KeywordBack"];
|
||||
|
||||
// NUMBER, fontStyle = 4
|
||||
scintilla.Styles[SCE_YAML_NUMBER].ForeColor = lexerColors[LexerType.YAML, "NumberFore"];
|
||||
scintilla.Styles[SCE_YAML_NUMBER].BackColor = lexerColors[LexerType.YAML, "NumberBack"];
|
||||
|
||||
// REFERENCE, fontStyle = 5
|
||||
scintilla.Styles[SCE_YAML_REFERENCE].ForeColor = lexerColors[LexerType.YAML, "ReferenceFore"];
|
||||
scintilla.Styles[SCE_YAML_REFERENCE].BackColor = lexerColors[LexerType.YAML, "ReferenceBack"];
|
||||
|
||||
// DOCUMENT, fontStyle = 6
|
||||
scintilla.Styles[SCE_YAML_DOCUMENT].ForeColor = lexerColors[LexerType.YAML, "DocumentFore"];
|
||||
scintilla.Styles[SCE_YAML_DOCUMENT].BackColor = lexerColors[LexerType.YAML, "DocumentBack"];
|
||||
|
||||
// TEXT, fontStyle = 7
|
||||
scintilla.Styles[SCE_YAML_TEXT].Bold = true;
|
||||
scintilla.Styles[SCE_YAML_TEXT].ForeColor = lexerColors[LexerType.YAML, "TextFore"];
|
||||
scintilla.Styles[SCE_YAML_TEXT].BackColor = lexerColors[LexerType.YAML, "TextBack"];
|
||||
|
||||
// ERROR, fontStyle = 8
|
||||
scintilla.Styles[SCE_YAML_ERROR].ForeColor = lexerColors[LexerType.YAML, "ErrorFore"];
|
||||
scintilla.Styles[SCE_YAML_ERROR].BackColor = lexerColors[LexerType.YAML, "ErrorBack"];
|
||||
|
||||
// OPERATOR, fontStyle = 9
|
||||
scintilla.Styles[SCE_YAML_OPERATOR].ForeColor = lexerColors[LexerType.YAML, "OperatorFore"];
|
||||
scintilla.Styles[SCE_YAML_OPERATOR].BackColor = lexerColors[LexerType.YAML, "OperatorBack"];
|
||||
|
||||
scintilla.LexerName = "yaml";
|
||||
|
||||
ScintillaKeyWords.SetKeywords(scintilla, LexerType.YAML);
|
||||
if (foldOn)
|
||||
AddFolding(scintilla);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
#region License
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright(c) 2020 Petteri Kautonen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ScintillaNET;
|
||||
using static VPKSoft.ScintillaLexers.LexerEnumerations;
|
||||
|
||||
namespace VPKSoft.ScintillaLexers.CreateSpecificLexer
|
||||
{
|
||||
/// <summary>
|
||||
/// A class containing code folding properties for different lexers.
|
||||
/// </summary>
|
||||
public class LexerFoldProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the fold property.
|
||||
/// </summary>
|
||||
/// <value>The name of the fold property.</value>
|
||||
public string FoldPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fold property value.
|
||||
/// </summary>
|
||||
/// <value>The fold property value.</value>
|
||||
public string FoldPropertyValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default folding properties for all lexers.
|
||||
/// </summary>
|
||||
public static List<LexerFoldProperties> DefaultFolding { get; set; } = new List<LexerFoldProperties>(new[]
|
||||
{
|
||||
new LexerFoldProperties {FoldPropertyName = "fold", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.compact", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.preprocessor", FoldPropertyValue = "1"},
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the additional folding properties for the XML (eXtensible Markup Language) lexer.
|
||||
/// </summary>
|
||||
public static List<LexerFoldProperties> XmlFolding { get; set; } = new List<LexerFoldProperties>(new[]
|
||||
{
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.html", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "html.tags.case.sensitive", FoldPropertyValue = "1"},
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the additional folding properties for the SQL (Structured Query Language) lexer.
|
||||
/// </summary>
|
||||
public static List<LexerFoldProperties> SqlFolding { get; set; } = new List<LexerFoldProperties>(new[]
|
||||
{
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.sql.at.else", FoldPropertyValue = "1"}, // for a SQL lexer..
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.comment", FoldPropertyValue = "1"}, // for a SQL lexer..
|
||||
new LexerFoldProperties {FoldPropertyName = "sql.backslash.escapes", FoldPropertyValue = "1"}, // for a SQL lexer.. (Enables backslash as an escape character in SQL.)
|
||||
new LexerFoldProperties {FoldPropertyName = "lexer.sql.numbersign.comment", FoldPropertyValue = "1"}, // for a SQL lexer.. (If lexer.sql.numbersign.comment property is set to 0 a line beginning with '#' will not be a comment.)
|
||||
new LexerFoldProperties {FoldPropertyName = "lexer.sql.allow.dotted.word", FoldPropertyValue = "1"}, // for a SQL lexer.. (set to 1 to colorize recognized words with dots (recommended for Oracle PL/SQL objects))
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the additional folding properties for the HTML (Hypertext Markup Language) lexer.
|
||||
/// </summary>
|
||||
public static List<LexerFoldProperties> HyperTextFolding { get; set; } = new List<LexerFoldProperties>(new[]
|
||||
{
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.hypertext.comment", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.hypertext.heredoc", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.html.preprocessor", FoldPropertyValue = "1"},
|
||||
new LexerFoldProperties {FoldPropertyName = "fold.html", FoldPropertyValue = "1"},
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Sets the <see cref="Scintilla"/> properties.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The <see cref="Scintilla"/> instance of which properties to set.</param>
|
||||
/// <param name="foldProperties">A list of fold properties.</param>
|
||||
public static void SetScintillaProperties(Scintilla scintilla, List<LexerFoldProperties> foldProperties)
|
||||
{
|
||||
foreach (var foldProperty in foldProperties)
|
||||
{
|
||||
scintilla.SetProperty(foldProperty.FoldPropertyName, foldProperty.FoldPropertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default folding for all lexers.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The <see cref="Scintilla"/> instance of which default folding properties to set.</param>
|
||||
public static void FoldDefault(Scintilla scintilla)
|
||||
{
|
||||
SetScintillaProperties(scintilla, DefaultFolding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fold properties to a given lexer type.
|
||||
/// </summary>
|
||||
/// <param name="scintilla">The <see cref="Scintilla"/> of which fold properties to set.</param>
|
||||
/// <param name="lexerType">Type of the lexer.</param>
|
||||
public static void SetFoldProperties(Scintilla scintilla, LexerType lexerType)
|
||||
{
|
||||
switch (lexerType)
|
||||
{
|
||||
case LexerType.HTML:
|
||||
SetScintillaProperties(scintilla, HyperTextFolding); break;
|
||||
case LexerType.SQL:
|
||||
SetScintillaProperties(scintilla, SqlFolding); break;
|
||||
case LexerType.Xml:
|
||||
SetScintillaProperties(scintilla, XmlFolding); break;
|
||||
default:
|
||||
SetScintillaProperties(scintilla, DefaultFolding); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user