diff --git a/GenerateHighlightContent/HighLightSection.cs b/GenerateHighlightContent/HighLightSection.cs index 2a687bd..3c6f84a 100644 --- a/GenerateHighlightContent/HighLightSection.cs +++ b/GenerateHighlightContent/HighLightSection.cs @@ -19,6 +19,9 @@ public override bool IsReadOnly() [ConfigurationProperty("ProcessName", DefaultValue = "highlight.exe")] public string ProcessName { get { return base["ProcessName"].ToString(); } } + [ConfigurationProperty("ThemeFolder", DefaultValue = "themes")] + public string ThemeFolder { get { return base["ThemeFolder"].ToString(); } } + [ConfigurationProperty("GeneralArguments", IsRequired = true, IsDefaultCollection = true)] public GeneralArgumentsCollection GeneralArguments { diff --git a/GenerateHighlightContent/Properties/AssemblyInfo.cs b/GenerateHighlightContent/Properties/AssemblyInfo.cs index 1fb2226..b9a4279 100644 --- a/GenerateHighlightContent/Properties/AssemblyInfo.cs +++ b/GenerateHighlightContent/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 // 指定為預設值: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.0.0")] +[assembly: AssemblyVersion("2.3.0.0")] +[assembly: AssemblyFileVersion("2.3.0.0")] diff --git a/NoteHighlightAddin/AddIn.cs b/NoteHighlightAddin/AddIn.cs index 428f37c..b341050 100644 --- a/NoteHighlightAddin/AddIn.cs +++ b/NoteHighlightAddin/AddIn.cs @@ -294,9 +294,24 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High XElement cell2 = new XElement(ns + "Cell"); cell2.Add(new XAttribute("shadingColor", colorString)); + string defaultStyle = ""; + var arrayLine = htmlContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); - foreach (var item in arrayLine) + foreach (var it in arrayLine) { + string item = it; + + if(item.StartsWith("") + { + continue; + } + var itemNr = ""; var itemLine = ""; if (parameters.ShowLineNumber) @@ -313,8 +328,9 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High itemLine = item; } - string nr = string.Format(@"", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value) + - itemNr.Replace("'", "'") + ""; + //string nr = string.Format(@"", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value) + + // itemNr.Replace("'", "'") + ""; + string nr = defaultStyle + itemNr.Replace("'", "'") + ""; cell1.Add(new XElement(ns + "OEChildren", new XElement(ns + "OE", @@ -326,8 +342,9 @@ public XDocument InsertHighLightCode(string htmlContent, string[] position, High itemLine = item; } //string s = item.Replace(@"style=""", string.Format(@"style=""font-family:{0}; ", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value)); - string s = string.Format(@"", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value) + - itemLine.Replace("'", "'") + ""; + //string s = string.Format(@"", GenerateHighlightContent.GenerateHighLight.Config.OutputArguments["Font"].Value) + + // itemLine.Replace("'", "'") + ""; + string s = defaultStyle + itemLine.Replace("'", "'") + ""; cell2.Add(new XElement(ns + "OEChildren", new XElement(ns + "OE", diff --git a/NoteHighlightAddin/App.config b/NoteHighlightAddin/App.config index f6af634..0c83571 100644 --- a/NoteHighlightAddin/App.config +++ b/NoteHighlightAddin/App.config @@ -4,7 +4,7 @@
-
+
@@ -23,12 +23,13 @@ - + + diff --git a/NoteHighlightAddin/MainForm.Designer.cs b/NoteHighlightAddin/MainForm.Designer.cs index edd4a8b..56845a1 100644 --- a/NoteHighlightAddin/MainForm.Designer.cs +++ b/NoteHighlightAddin/MainForm.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + NoteHighlightForm.Properties.Settings settings1 = new NoteHighlightForm.Properties.Settings(); this.btnCodeHighLight = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.cbx_style = new System.Windows.Forms.ComboBox(); @@ -37,9 +38,9 @@ private void InitializeComponent() this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); + this.btnBackground = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); - this.btnBackground = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); @@ -49,10 +50,9 @@ private void InitializeComponent() // this.btnCodeHighLight.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnCodeHighLight.Dock = System.Windows.Forms.DockStyle.Right; - this.btnCodeHighLight.Location = new System.Drawing.Point(550, 0); - this.btnCodeHighLight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCodeHighLight.Location = new System.Drawing.Point(413, 0); this.btnCodeHighLight.Name = "btnCodeHighLight"; - this.btnCodeHighLight.Size = new System.Drawing.Size(139, 61); + this.btnCodeHighLight.Size = new System.Drawing.Size(104, 50); this.btnCodeHighLight.TabIndex = 0; this.btnCodeHighLight.Text = "&OK"; this.btnCodeHighLight.UseVisualStyleBackColor = true; @@ -61,41 +61,33 @@ private void InitializeComponent() // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(37, 25); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(28, 20); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(46, 17); + this.label1.Size = new System.Drawing.Size(36, 13); this.label1.TabIndex = 0; this.label1.Text = "Style:"; // // cbx_style // this.cbx_style.FormattingEnabled = true; - this.cbx_style.Items.AddRange(new object[] { - "edit-flashdevelop", - "rand01", - "fruit", - "edit-jedit", - "edit-emacs", - "edit-eclipse", - "bright", - "bclear", - "edit-msvs2008"}); - this.cbx_style.Location = new System.Drawing.Point(99, 21); - this.cbx_style.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbx_style.Location = new System.Drawing.Point(74, 17); this.cbx_style.Name = "cbx_style"; - this.cbx_style.Size = new System.Drawing.Size(160, 24); + this.cbx_style.Size = new System.Drawing.Size(121, 21); this.cbx_style.TabIndex = 0; // // cbx_Clipboard // this.cbx_Clipboard.AutoSize = true; - this.cbx_Clipboard.Checked = global::NoteHighlightForm.Properties.Settings.Default.SaveOnClipboard; - this.cbx_Clipboard.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::NoteHighlightForm.Properties.Settings.Default, "SaveOnClipboard", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.cbx_Clipboard.Location = new System.Drawing.Point(361, 24); - this.cbx_Clipboard.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + settings1.BackgroundColor = System.Drawing.Color.White; + settings1.HighLightStyle = 0; + settings1.SaveOnClipboard = false; + settings1.SettingsKey = ""; + settings1.ShowLineNumber = true; + this.cbx_Clipboard.Checked = settings1.SaveOnClipboard; + this.cbx_Clipboard.DataBindings.Add(new System.Windows.Forms.Binding("Checked", settings1, "SaveOnClipboard", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); + this.cbx_Clipboard.Location = new System.Drawing.Point(271, 20); this.cbx_Clipboard.Name = "cbx_Clipboard"; - this.cbx_Clipboard.Size = new System.Drawing.Size(161, 21); + this.cbx_Clipboard.Size = new System.Drawing.Size(122, 17); this.cbx_Clipboard.TabIndex = 1; this.cbx_Clipboard.Text = "Copy to Clipboard(&C)"; this.cbx_Clipboard.UseVisualStyleBackColor = true; @@ -103,13 +95,12 @@ private void InitializeComponent() // cbx_lineNumber // this.cbx_lineNumber.AutoSize = true; - this.cbx_lineNumber.Checked = global::NoteHighlightForm.Properties.Settings.Default.ShowLineNumber; + this.cbx_lineNumber.Checked = settings1.ShowLineNumber; this.cbx_lineNumber.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbx_lineNumber.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::NoteHighlightForm.Properties.Settings.Default, "ShowLineNumber", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.cbx_lineNumber.Location = new System.Drawing.Point(540, 24); - this.cbx_lineNumber.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbx_lineNumber.DataBindings.Add(new System.Windows.Forms.Binding("Checked", settings1, "ShowLineNumber", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); + this.cbx_lineNumber.Location = new System.Drawing.Point(405, 20); this.cbx_lineNumber.Name = "cbx_lineNumber"; - this.cbx_lineNumber.Size = new System.Drawing.Size(131, 21); + this.cbx_lineNumber.Size = new System.Drawing.Size(100, 17); this.cbx_lineNumber.TabIndex = 2; this.cbx_lineNumber.Text = "Line Number(&N)"; this.cbx_lineNumber.UseVisualStyleBackColor = true; @@ -120,9 +111,8 @@ private void InitializeComponent() this.txtCode.Dock = System.Windows.Forms.DockStyle.Fill; this.txtCode.IsReadOnly = false; this.txtCode.Location = new System.Drawing.Point(0, 0); - this.txtCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtCode.Name = "txtCode"; - this.txtCode.Size = new System.Drawing.Size(689, 469); + this.txtCode.Size = new System.Drawing.Size(517, 380); this.txtCode.TabIndex = 0; // // panel1 @@ -133,9 +123,8 @@ private void InitializeComponent() this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(689, 65); + this.panel1.Size = new System.Drawing.Size(517, 53); this.panel1.TabIndex = 1; // // panel2 @@ -143,43 +132,41 @@ private void InitializeComponent() this.panel2.Controls.Add(this.btnBackground); this.panel2.Controls.Add(this.btnCodeHighLight); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 534); - this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel2.Location = new System.Drawing.Point(0, 433); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(689, 61); + this.panel2.Size = new System.Drawing.Size(517, 50); this.panel2.TabIndex = 2; // + // btnBackground + // + this.btnBackground.Location = new System.Drawing.Point(9, 2); + this.btnBackground.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnBackground.Name = "btnBackground"; + this.btnBackground.Size = new System.Drawing.Size(79, 41); + this.btnBackground.TabIndex = 1; + this.btnBackground.Text = "Box Color"; + this.btnBackground.UseVisualStyleBackColor = true; + this.btnBackground.Click += new System.EventHandler(this.btnBackground_Click); + // // panel3 // this.panel3.Controls.Add(this.txtCode); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel3.Location = new System.Drawing.Point(0, 65); - this.panel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel3.Location = new System.Drawing.Point(0, 53); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(689, 469); + this.panel3.Size = new System.Drawing.Size(517, 380); this.panel3.TabIndex = 0; // - // btnBackground - // - this.btnBackground.Location = new System.Drawing.Point(12, 3); - this.btnBackground.Name = "btnBackground"; - this.btnBackground.Size = new System.Drawing.Size(105, 50); - this.btnBackground.TabIndex = 1; - this.btnBackground.Text = "Background Color"; - this.btnBackground.UseVisualStyleBackColor = true; - this.btnBackground.Click += new System.EventHandler(btnBackground_Click); - // // MainForm // this.AcceptButton = this.btnCodeHighLight; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(689, 595); + this.ClientSize = new System.Drawing.Size(517, 483); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Name = "CodeForm"; + this.Name = "MainForm"; this.Text = "NoteHighLight"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.CodeForm_FormClosed); this.Load += new System.EventHandler(this.CodeForm_Load); diff --git a/NoteHighlightAddin/MainForm.cs b/NoteHighlightAddin/MainForm.cs index d3cb9d2..757b8e2 100644 --- a/NoteHighlightAddin/MainForm.cs +++ b/NoteHighlightAddin/MainForm.cs @@ -1,13 +1,16 @@ using GenerateHighlightContent; +using Helper; using ICSharpCode.TextEditor.Document; using NoteHighLightForm; using System; using System.Collections.Generic; using System.ComponentModel; +using System.Configuration; using System.Data; using System.Drawing; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -52,7 +55,34 @@ public MainForm(string codeType, string fileName) _codeType = codeType; _fileName = fileName; InitializeComponent(); + LoadThemes(); + } + + private void LoadThemes() + { + try + { + Configuration c = ConfigurationManager.OpenExeConfiguration(Assembly.GetCallingAssembly().Location); + HighLightSection section = c.GetSection("HighLightSection") as HighLightSection; + + var workingDirectory = Path.Combine(ProcessHelper.GetDirectoryFromPath(Assembly.GetCallingAssembly().Location), section.FolderName, section.ThemeFolder); + + string[] files = Directory.GetFiles(workingDirectory, "*.theme"); + + foreach (var item in files) + { + cbx_style.Items.Add(Path.GetFileNameWithoutExtension(item)); + } + } + catch (Exception e) + { + MessageBox.Show("Exception from MainForm.LoadThemes:" + e.Message); + return; + } + + + } #endregion diff --git a/NoteHighlightAddin/Properties/AssemblyInfo.cs b/NoteHighlightAddin/Properties/AssemblyInfo.cs index 143c88f..e897066 100644 --- a/NoteHighlightAddin/Properties/AssemblyInfo.cs +++ b/NoteHighlightAddin/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.2.*")] -[assembly: AssemblyFileVersion("2.2.*")] +[assembly: AssemblyVersion("2.3.*")] +[assembly: AssemblyFileVersion("2.3.*")] diff --git a/NoteHighlightAddin/highlight/filetypes.conf b/NoteHighlightAddin/highlight/filetypes.conf index 6118d8a..fc78902 100644 --- a/NoteHighlightAddin/highlight/filetypes.conf +++ b/NoteHighlightAddin/highlight/filetypes.conf @@ -1,7 +1,19 @@ -- File extension and shebang mapping - --- Add an entry for a language syntax which is occupied by multiple source file extensions --- If a filename has no extension by convention (ie. makefile), it also may be listed here +-- +-- Add an entry for a language syntax which is occupied by multiple source file extensions. +-- If there is only one extension, just name the lang file accordingly and it will work. +-- The filetype entries in gui_files/ext/fileopenfilter.conf should also be updated. +-- +-- Extensions can be configured for multiple languages (see "asm", which is assigned to assembler and fasm): +-- - CLI: the first association listed here will be used +-- - GUI: a syntax selection prompt will be shown +-- +-- If a filename has no extension by convention (ie. makefile), it may be configured as "Shebang" +-- +-- Since release 3.36 you can assign filenames to syntax types: +-- { Lang="abc", Filenames={"test.xyz"} } +-- +-- The first filetypes.conf found in a highlight search directory wins. FileMapping = { @@ -9,7 +21,8 @@ FileMapping = { { Lang="algol", Extensions={"alg"} }, { Lang="ampl", Extensions={"dat", "run"} }, { Lang="amtrix", Extensions={"s4", "s4t", "s4h", "hnd", "t4"} }, - { Lang="assembler", Extensions={"a51", "29k", "68s", "68x", "x86", "s"} }, + { Lang="assembler", Extensions={"asm", "a51", "29k", "68s", "68x", "x86"} }, + { Lang="fasm", Extensions={"asm", "inc"} }, { Lang="asp", Extensions={"aspx", "ashx", "ascx"} }, { Lang="ats", Extensions={"dats"} }, { Lang="aspect", Extensions={"was", "wud"} }, @@ -26,6 +39,7 @@ FileMapping = { { Lang="fortran77", Extensions={"f", "for", "ftn"} }, { Lang="fortran90", Extensions={"f95", "f90"} }, { Lang="gambas", Extensions={"class"} }, + { Lang="gdscript", Extensions={"gd"} }, { Lang="haskell", Extensions={"hs"} }, { Lang="ini", Extensions={"doxyfile", "desktop"} }, { Lang="java", Extensions={"groovy", "grv"} }, @@ -98,7 +112,6 @@ FileMapping = { { Lang="lilypond", Extensions={"ly"} }, { Lang="nasal", Extensions={"nas"} }, { Lang="clean", Extensions={"icl"} }, - { Lang="assembler", Extensions={"asm"} }, { Lang="bibtex", Extensions={"bib"} }, { Lang="python", Extensions={"py"} }, { Lang="txt", Extensions={"text"} }, @@ -109,7 +122,9 @@ FileMapping = { { Lang="yaml", Extensions={"yml"} }, { Lang="vimscript", Extensions={"vim", "vimrc"} }, { Lang="purebasic", Extensions={"pb", "pbi"} }, - + { Lang="md", Extensions={"markdown"} }, + { Lang="clojure", Extensions={"clj"} }, + { Lang="xml", Shebang=[[^\s*<\?xml\s+version=\"1\.0\"\s+[^(\?>)]*?>\s*$]] }, { Lang="sh", Shebang=[[^#!\s*(/usr)?(/local)?/bin/(env\s+)?([bd]ash|t?csh|[akz]?sh)]] }, { Lang="make",Shebang=[[^#!\s*(/usr)?(/local)?/bin/(env\s+)?make]] }, diff --git a/NoteHighlightAddin/highlight/highlight.exe b/NoteHighlightAddin/highlight/highlight.exe index 0b7bec0..60d7885 100644 Binary files a/NoteHighlightAddin/highlight/highlight.exe and b/NoteHighlightAddin/highlight/highlight.exe differ diff --git a/NoteHighlightAddin/highlight/langDefs/c.lang b/NoteHighlightAddin/highlight/langDefs/c.lang index 8c19179..829aac1 100644 --- a/NoteHighlightAddin/highlight/langDefs/c.lang +++ b/NoteHighlightAddin/highlight/langDefs/c.lang @@ -26,6 +26,9 @@ Keywords={ "register", "template", "private", "protected", "public", "typeid", "virtual", "volatile", "constexpr", "nullptr", "decltype" } }, + { Id=3, + Regex=[[(\w+)\s*\:\:]] + }, { Id=4, Regex=[[(\w+)\s*\(]] } diff --git a/NoteHighlightAddin/highlight/langDefs/html.lang b/NoteHighlightAddin/highlight/langDefs/html.lang index 0da6c25..bc08bef 100644 --- a/NoteHighlightAddin/highlight/langDefs/html.lang +++ b/NoteHighlightAddin/highlight/langDefs/html.lang @@ -23,6 +23,8 @@ Keywords={ Strings={ Delimiter=[["]], + Escape=[[\A(?!x)x]] + -- see http://stackoverflow.com/questions/1723182/a-regex-that-will-never-be-matched-by-anything } Comments={ diff --git a/NoteHighlightAddin/highlight/langDefs/java.lang b/NoteHighlightAddin/highlight/langDefs/java.lang index bf65017..5224aeb 100644 --- a/NoteHighlightAddin/highlight/langDefs/java.lang +++ b/NoteHighlightAddin/highlight/langDefs/java.lang @@ -2,16 +2,17 @@ Description="Java" Keywords={ { Id=1, - List={"abstract", "default", "if", "private", "this", "do", "implements", - "protected", "throw", "break", "import", "public", "throws", "else", - "instanceof", "return", "transient", "case", "extends", "try", "catch", "final", - "interface", "static", "finally", "strictfp", "volatile", "class", "native", - "super", "while", "const", "for", "new", "switch", "continue", "goto", - "package", "synchronized", "as", "in", "def", "property"}, }, + List={"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", + "continue", "default", "do", "double", "else", "enum", "extends", "final", "finally", + "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", + "long", "native", "new", "package", "private", "protected", "public", "return", "short", + "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", + "transient", "try", "void", "volatile", "while"}, + }, { Id=2, - List={"boolean", "double", "byte", "int", "short", "void", "char", "long", "float"}, + List={"false", "true", "null"}, }, - { Id=3, + { Id=3, Regex=[[@\w+]], }, { Id=4, @@ -39,4 +40,3 @@ Comments={ Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\|]] EnableIndentation=true - diff --git a/NoteHighlightAddin/highlight/langDefs/perl.lang b/NoteHighlightAddin/highlight/langDefs/perl.lang index 9044e56..7ba9a6c 100644 --- a/NoteHighlightAddin/highlight/langDefs/perl.lang +++ b/NoteHighlightAddin/highlight/langDefs/perl.lang @@ -40,7 +40,7 @@ Keywords={ "getprotobyname", "getprotobynumber", "getservbyname", "getservbyport", "getpwuid", "getpwnam", "getgrgid", "getgrnam", "getlogin", "getpwent", "getgrent", "gmtime", "localtime", "time", "warn", "formline", - "reset", "scalar", "prototype", "lock", "tied", "untie", "qw", "qq", "qx", "q", "eval" }, + "reset", "scalar", "prototype", "lock", "tied", "untie", "qq", "qx", "eval" }, }, { Id=4, Regex=[[->([a-zA-Z0-9_]+)]], @@ -53,6 +53,10 @@ Keywords={ Regex=[[\/.*?\/[msixpodualgc]*|m\/.*?\/[msixpodualgc]*|qr\/.*?\/[msixpodual]*|s\/.*?\/.*?\/[msixpodualgcer]*|(?:tr|y)\/.*?\/.*?\/[cdsr]*|m!.*?![msixpodualgc]*|qr!.*?![msixpodual]*|s!.*?!.*?![msixpodualgcer]*|(?:tr|y)!.*?!.*?![cdsr]*|m\?.*?\?[msixpodualgc]*|m\{.*?\}[msixpodualgc]*|qr\{.*?\}[msixpodual]*|s\{.*?\}\s*\{.*?\}[msixpodualgcer]*|(?:tr|y)\{.*?\}\s*\{.*?\}[cdsr]*]], Group=0 }, + + { Id=4, + Regex=[[q[qxwr]?\{|qw\(]] + }, } -- hereDoc opening delimiter, see OnStateChange to handle end of string @@ -60,6 +64,7 @@ Keywords={ Strings={ Delimiter=[=["|'|`|<<["']?[[:alpha:]]+["']?]=], Interpolation=[[ [@\$%]\w+ ]], + } IgnoreCase=false @@ -75,7 +80,7 @@ Comments={ Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|~|\=|\/|\*|\+|\-|\$|\.|\^|\~|\%|\|]] --- fix recognition of $ +-- fix recognition of $ and other Perl perversions function OnStateChange(oldState, newState, token, groupID) -- resolve issue with regex expression which spans strings like "" + VAR + "" @@ -90,14 +95,39 @@ function OnStateChange(oldState, newState, token, groupID) --recognize hereDoc multine strings --do not clear hereDoc if token is ",' or ` if (oldState==HL_STANDARD or oldState==HL_STRING) and newState==HL_STRING and not string.find("\"'`", token) then - hereDoc = string.match(token, "<<'?\"?(%a+)" ) - end + if oldState==HL_STRING and token==hereDoc then hereDoc = nil return HL_STRING_END end + + -- fix issue in CGI.pm testcase (line 1060 ff) + if oldState~=HL_STRING then + qString=0 + end + + if newState==HL_KEYWORD and token=="q{" then + qString=1 + return HL_STRING + end + + if newState==HL_KEYWORD and token=="qw(" then + qString=2 + return HL_STRING + end + + if oldState==HL_STRING and qString==1 and token=="}" then + qString=0 + return HL_STRING_END + end + + if oldState==HL_STRING and qString==2 and token==")" then + qString=0 + return HL_STRING_END + end + return newState end diff --git a/NoteHighlightAddin/highlight/langDefs/php.lang b/NoteHighlightAddin/highlight/langDefs/php.lang index 4242371..0e041cd 100644 --- a/NoteHighlightAddin/highlight/langDefs/php.lang +++ b/NoteHighlightAddin/highlight/langDefs/php.lang @@ -72,5 +72,9 @@ function OnStateChange(oldState, newState, token) hereDoc = string.match(token, "<<<'?(%a+)" ) end + if oldState~=HL_STRING and newState==HL_ESC_SEQ then + return oldState + end + return newState end diff --git a/NoteHighlightAddin/highlight/langDefs/python.lang b/NoteHighlightAddin/highlight/langDefs/python.lang index 2c10c16..1987e52 100644 --- a/NoteHighlightAddin/highlight/langDefs/python.lang +++ b/NoteHighlightAddin/highlight/langDefs/python.lang @@ -1,5 +1,7 @@ Description="Python" +Digits=[[ (?:0x|0X|0o|0O|0b|0B)[0-9a-fA-F\_]+|\d*[\.\_]?[\d\_]+(?:[eE][\-\+]\d+)?[lLuU]* ]] + Keywords={ { Id=1, List={ "break", "continue", "del", "except", "exec", "finally", "pass", @@ -44,7 +46,7 @@ Strings={ Delimiter=[["""|'''|"|']], RawPrefix="r", Escape=[=[\\[ntvbrfa\\\?'"]|\\\d{3}|\\x[[:xdigit:]]{2}]=], - Interpolation=[[ %[%#0\-\+diouxXeEfFgGcrs]+|%\(\w+\)[sd]? ]] + Interpolation=[[ %[%#0\-\+diouxXeEfFgGcrs]+|%\(\w+\)[sd]?|\{\w+\} ]] } IgnoreCase=false diff --git a/NoteHighlightAddin/highlight/langDefs/xml.lang b/NoteHighlightAddin/highlight/langDefs/xml.lang index 399d17d..600838c 100644 --- a/NoteHighlightAddin/highlight/langDefs/xml.lang +++ b/NoteHighlightAddin/highlight/langDefs/xml.lang @@ -16,6 +16,8 @@ Keywords={ Strings={ Delimiter=[["]], + Escape=[[\A(?!x)x]] + -- see http://stackoverflow.com/questions/1723182/a-regex-that-will-never-be-matched-by-anything } Comments={ diff --git a/Setup/Setup.vdproj b/Setup/Setup.vdproj index 99f2415..adc8e09 100644 --- a/Setup/Setup.vdproj +++ b/Setup/Setup.vdproj @@ -27,6 +27,12 @@ } "Entry" { + "MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289" + "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -52,12 +58,6 @@ "Entry" { "MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B" - "OwnerKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B" "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" "MsmSig" = "8:_UNDEFINED" } @@ -87,12 +87,6 @@ } "Entry" { - "MsmKey" = "8:_EC5545A47C005AF1764A83CF0ADF40C5" - "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { "MsmKey" = "8:_UNDEFINED" "OwnerKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B" "MsmSig" = "8:_UNDEFINED" @@ -311,6 +305,26 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289" + { + "SourcePath" = "8:NoteHighlightAddin.tlb" + "TargetName" = "8:NoteHighlightAddin.tlb" + "Tag" = "8:" + "Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:2" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6" { "SourcePath" = "8:..\\NoteHighlightAddin\\App.config" @@ -424,26 +438,6 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_EC5545A47C005AF1764A83CF0ADF40C5" - { - "SourcePath" = "8:NoteHighlightAddin.tlb" - "TargetName" = "8:NoteHighlightAddin.tlb" - "Tag" = "8:" - "Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:2" - "Exclude" = "11:FALSE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } } "FileType" { @@ -577,15 +571,15 @@ { "Name" = "8:NoteHighlightAddin" "ProductName" = "8:NoteHighlight2016" - "ProductCode" = "8:{7D175A2A-59FB-42BD-AF66-FBC5608C9A80}" - "PackageCode" = "8:{E1E264E8-50A6-4D87-9C9C-28D9F29A9DA4}" + "ProductCode" = "8:{60F24B03-C32C-4E84-8E4C-DF696910E5C2}" + "PackageCode" = "8:{17A94C9D-5142-4CC1-93D4-3C8896C40A95}" "UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:2.2" + "ProductVersion" = "8:2.3" "Manufacturer" = "8:CodingRoad" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" diff --git a/SetupX86/SetupX86.vdproj b/SetupX86/SetupX86.vdproj index 5e141ca..46c147a 100644 --- a/SetupX86/SetupX86.vdproj +++ b/SetupX86/SetupX86.vdproj @@ -21,20 +21,20 @@ } "Entry" { - "MsmKey" = "8:_1368D25DED3D7619A6ECC45AF44CC44B" + "MsmKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B" "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6" - "OwnerKey" = "8:_UNDEFINED" + "MsmKey" = "8:_3F5A6705A6B31EBC4C5DA3FC2A052289" + "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_48F0573F2B8540064386DCFBA7665E8F" - "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" + "MsmKey" = "8:_47AFBE13144648689D856D43F6F054E6" + "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -51,38 +51,38 @@ } "Entry" { - "MsmKey" = "8:_BF0DDD11259532587F856D651F450ECC" - "OwnerKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B" + "MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B" + "OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_BF0DDD11259532587F856D651F450ECC" - "OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247" + "MsmKey" = "8:_805E0317B9E0B1539EEBB800C533393B" + "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_CB47DF720F0D7129EABD42EA460E48CA" - "OwnerKey" = "8:_1368D25DED3D7619A6ECC45AF44CC44B" + "MsmKey" = "8:_BF0DDD11259532587F856D651F450ECC" + "OwnerKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_CB47DF720F0D7129EABD42EA460E48CA" - "OwnerKey" = "8:_7CBDA023CD2F435BB8D4D5586B86D83B" + "MsmKey" = "8:_BF0DDD11259532587F856D651F450ECC" + "OwnerKey" = "8:_CBF51C0C38434D629FC3271C5390E247" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_CB47DF720F0D7129EABD42EA460E48CA" - "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" + "MsmKey" = "8:_CBF51C0C38434D629FC3271C5390E247" + "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_CBF51C0C38434D629FC3271C5390E247" - "OwnerKey" = "8:_UNDEFINED" + "MsmKey" = "8:_E4014126696E456F7FC66801CBFEEE19" + "OwnerKey" = "8:_692D7E391D074D36AD2530720FB8D6C4" "MsmSig" = "8:_UNDEFINED" } "Entry" @@ -112,19 +112,19 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_48F0573F2B8540064386DCFBA7665E8F" + "OwnerKey" = "8:_E4014126696E456F7FC66801CBFEEE19" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_1368D25DED3D7619A6ECC45AF44CC44B" + "OwnerKey" = "8:_0FFDD9474C2B804E2E2B2C7C6360577B" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_CB47DF720F0D7129EABD42EA460E48CA" + "OwnerKey" = "8:_805E0317B9E0B1539EEBB800C533393B" "MsmSig" = "8:_UNDEFINED" } } @@ -274,14 +274,14 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1368D25DED3D7619A6ECC45AF44CC44B" + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_0FFDD9474C2B804E2E2B2C7C6360577B" { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" "AssemblyAsmDisplayName" = "8:GenerateHighlightContent, Version=2.0.0.0, Culture=neutral, PublicKeyToken=77d9ec1ac4fb0cdc, processorArchitecture=MSIL" "ScatterAssemblies" { - "_1368D25DED3D7619A6ECC45AF44CC44B" + "_0FFDD9474C2B804E2E2B2C7C6360577B" { "Name" = "8:GenerateHighlightContent.dll" "Attributes" = "3:512" @@ -305,6 +305,26 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3F5A6705A6B31EBC4C5DA3FC2A052289" + { + "SourcePath" = "8:NoteHighlightAddin.tlb" + "TargetName" = "8:NoteHighlightAddin.tlb" + "Tag" = "8:" + "Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:2" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_47AFBE13144648689D856D43F6F054E6" { "SourcePath" = "8:..\\NoteHighlightAddin\\App.config" @@ -325,20 +345,20 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_48F0573F2B8540064386DCFBA7665E8F" + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_805E0317B9E0B1539EEBB800C533393B" { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:ICSharpCode.TextEditor, Version=3.0.0.3437, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" + "AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL" "ScatterAssemblies" { - "_48F0573F2B8540064386DCFBA7665E8F" + "_805E0317B9E0B1539EEBB800C533393B" { - "Name" = "8:ICSharpCode.TextEditor.dll" + "Name" = "8:Helper.dll" "Attributes" = "3:512" } } - "SourcePath" = "8:ICSharpCode.TextEditor.dll" + "SourcePath" = "8:Helper.dll" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36" @@ -352,7 +372,7 @@ "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" - "Exclude" = "11:FALSE" + "Exclude" = "11:TRUE" "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } @@ -387,20 +407,20 @@ "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CB47DF720F0D7129EABD42EA460E48CA" + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E4014126696E456F7FC66801CBFEEE19" { "AssemblyRegister" = "3:1" "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=609b64b0cf912098, processorArchitecture=MSIL" + "AssemblyAsmDisplayName" = "8:ICSharpCode.TextEditor, Version=3.0.0.3437, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" "ScatterAssemblies" { - "_CB47DF720F0D7129EABD42EA460E48CA" + "_E4014126696E456F7FC66801CBFEEE19" { - "Name" = "8:Helper.dll" + "Name" = "8:ICSharpCode.TextEditor.dll" "Attributes" = "3:512" } } - "SourcePath" = "8:Helper.dll" + "SourcePath" = "8:ICSharpCode.TextEditor.dll" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_76DE0C3E4C3C41398EBF2960C9F81C36" @@ -414,7 +434,7 @@ "SharedLegacy" = "11:FALSE" "PackageAs" = "3:1" "Register" = "3:1" - "Exclude" = "11:TRUE" + "Exclude" = "11:FALSE" "IsDependency" = "11:TRUE" "IsolateTo" = "8:" } @@ -551,15 +571,15 @@ { "Name" = "8:NoteHighlightAddin" "ProductName" = "8:NoteHighlight2016" - "ProductCode" = "8:{7D175A2A-59FB-42BD-AF66-FBC5608C9A80}" - "PackageCode" = "8:{E1E264E8-50A6-4D87-9C9C-28D9F29A9DA4}" + "ProductCode" = "8:{0320059E-5CCF-4D53-B546-1AC788EEFFF2}" + "PackageCode" = "8:{2BF3BB79-955B-46E2-B3D5-C5B8566F417D}" "UpgradeCode" = "8:{0025873C-20C5-48D6-A93A-FBD3891A9233}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:2.2" + "ProductVersion" = "8:2.3" "Manufacturer" = "8:CodingRoad" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:"