diff --git a/ColorCode.Core/Common/LanguageId.cs b/ColorCode.Core/Common/LanguageId.cs index 4458b08..71352d6 100644 --- a/ColorCode.Core/Common/LanguageId.cs +++ b/ColorCode.Core/Common/LanguageId.cs @@ -28,7 +28,5 @@ public static class LanguageId public const string Haskell = "haskell"; public const string Markdown = "markdown"; public const string Fortran = "fortran"; - public const string Python = "python"; - public const string MatLab = "matlab"; } } \ No newline at end of file diff --git a/ColorCode.Core/Compilation/Languages/MatLab.cs b/ColorCode.Core/Compilation/Languages/MatLab.cs deleted file mode 100644 index 4e9b1a4..0000000 --- a/ColorCode.Core/Compilation/Languages/MatLab.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using ColorCode.Common; - -namespace ColorCode.Compilation.Languages -{ - public class MatLab : ILanguage - { - public string Id - { - get { return LanguageId.MatLab; } - } - - public string Name - { - get { return "MATLAB"; } - } - - public string CssClassName - { - get { return "matlab"; } - } - - public string FirstLinePattern - { - get - { - return null; - } - } - - public IList Rules - { - get - { - return new List - { - // regular comments - new LanguageRule( - @"(%.*)\r?", - new Dictionary - { - { 0, ScopeName.Comment }, - }), - - // regular strings - new LanguageRule( - @"(? - { - { 0, ScopeName.String }, - }), - new LanguageRule( - @"""[^\n]*?""", - new Dictionary - { - { 0, ScopeName.String }, - }), - - // keywords - new LanguageRule( - @"(?i)\b(break|case|catch|continue|else|elseif|end|for|function|global|if|otherwise|persistent|return|switch|try|while)\b", - new Dictionary - { - { 1, ScopeName.Keyword }, - }), - - // line continuation - new LanguageRule( - @"\.\.\.", - new Dictionary - { - { 0, ScopeName.Continuation }, - }), - - // numbers - new LanguageRule( - @"\b([0-9.]|[0-9.]+(e-*)(?=[0-9]))+?\b", - new Dictionary - { - { 0, ScopeName.Number }, - }), - }; - } - } - - public bool HasAlias(string lang) - { - switch (lang.ToLower()) - { - case "m": - return true; - - case "mat": - return true; - - case "matlab": - return true; - - default: - return false; - } - } - - public override string ToString() - { - return Name; - } - } -} \ No newline at end of file diff --git a/ColorCode.Core/Compilation/Languages/Python.cs b/ColorCode.Core/Compilation/Languages/Python.cs deleted file mode 100644 index aa082b8..0000000 --- a/ColorCode.Core/Compilation/Languages/Python.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using ColorCode.Common; - -namespace ColorCode.Compilation.Languages -{ - public class Python : ILanguage - { - public string Id - { - get { return LanguageId.Python; } - } - - public string Name - { - get { return "Python"; } - } - - public string CssClassName - { - get { return "python"; } - } - - public string FirstLinePattern - { - get - { - return null; - } - } - - public IList Rules - { - get - { - return new List - { - // docstring comments - new LanguageRule( - @"(?<=:\s*)(""{3})([^""]+)(""{3})", - new Dictionary - { - { 0, ScopeName.Comment }, - }), - new LanguageRule( - @"(?<=:\s*)('{3})([^']+)('{3})", - new Dictionary - { - { 0, ScopeName.Comment }, - }), - - // regular comments - new LanguageRule( - @"(#.*)\r?", - new Dictionary - { - { 0, ScopeName.Comment }, - }), - - // multi-line strings - new LanguageRule( - @"(?<==\s*f*b*r*u*)(""{3})([^""]+)(""{3})", - new Dictionary - { - { 0, ScopeName.String }, - }), - new LanguageRule( - @"(?<==\s*f*b*r*u*)('{3})([^']+)('{3})", - new Dictionary - { - { 0, ScopeName.String }, - }), - - // regular strings - new LanguageRule( - @"'[^\n]*?'", - new Dictionary - { - { 0, ScopeName.String }, - }), - new LanguageRule( - @"""[^\n]*?""", - new Dictionary - { - { 0, ScopeName.String }, - }), - - // keywords - new LanguageRule( - @"(?i)\b(False|await|else|import|pass|None|break|except|in|raise|True|class|finally|is|return|and|continue|for|lambda|try|as|def|from|" + - @"nonlocal|while|assert|del|global|not|with|async|elif|if|or|yield|self)\b", - new Dictionary - { - { 1, ScopeName.Keyword }, - }), - - // intrinsic functions - new LanguageRule( - @"(?i)\b(abs|delattr|hash|memoryview|set|all|dict|help|min|setattr|any|dir|hex|next|slice|ascii|divmod|id|object|sorted|bin|enumerate" + - "|input|oct|staticmethod|bool|eval|int|open|str|breakpoint|exec|isinstance|ord|sum|bytearray|filter|issubclass|pow|super|bytes|float" + - "|iter|print|tuple|callable|format|len|property|type|chr|frozenset|list|range|vars|classmethod|getattr|locals|repr|zip|compile|globals" + - @"|map|reversed|__import__|complex|hasattr|max|round)\b", - new Dictionary - { - { 1, ScopeName.Intrinsic }, - }), - - // numbers - new LanguageRule( - @"\b([0-9.]|[0-9.]+(e-*)(?=[0-9]))+?\b", - new Dictionary - { - { 0, ScopeName.Number }, - }), - }; - } - } - - public bool HasAlias(string lang) - { - switch (lang.ToLower()) - { - case "py": - return true; - - case "python": - return true; - - default: - return false; - } - } - - public override string ToString() - { - return Name; - } - } -} \ No newline at end of file diff --git a/ColorCode.Core/Languages.cs b/ColorCode.Core/Languages.cs index 447d727..c2b4bd8 100644 --- a/ColorCode.Core/Languages.cs +++ b/ColorCode.Core/Languages.cs @@ -49,8 +49,6 @@ static Languages() Load(); Load(); Load(); - Load(); - Load(); } /// @@ -259,24 +257,6 @@ public static ILanguage Fortran get { return LanguageRepository.FindById(LanguageId.Fortran); } } - /// - /// Language support for Python. - /// - /// Language support for Python. - public static ILanguage Python - { - get { return LanguageRepository.FindById(LanguageId.Python); } - } - - /// - /// Language support for MATLAB. - /// - /// Language support for MATLAB. - public static ILanguage MATLAB - { - get { return LanguageRepository.FindById(LanguageId.MatLab); } - } - /// /// Finds a loaded language by the specified identifier. /// diff --git a/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj b/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj index 6a41eee..84af20c 100644 --- a/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj +++ b/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + net6.0 false diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1f99bc1..b65fcac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,7 +7,7 @@ pr: - rel/* pool: - vmImage: windows-2022 + vmImage: windows-latest variables: BuildConfiguration: Release @@ -47,15 +47,16 @@ steps: - powershell: .\build\Install-WindowsSdkISO.ps1 18362 -- task: DotNetCoreCLI@2 - inputs: - command: custom - custom: msbuild - arguments: /t:restore .\ColorCode.sln - displayName: NuGet restore +# Build solution +- script: msbuild /r /bl .\ColorCode.sln + displayName: Build solution -- powershell: .\build\build.ps1 - displayName: Build +- task: PublishBuildArtifacts@1 + displayName: Publish Package Artifacts + condition: always() + inputs: + pathToPublish: .\msbuild.binlog + artifactName: Binlogs - task: PowerShell@2 displayName: Authenticode Sign Packages