<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net9</TargetFramework>
+ <TargetFramework>net6</TargetFramework>
<OutputType>WinExe</OutputType>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
}
#endregion
protected abstract SyntaxAnalyser CreateSyntaxAnalyser ();
- public virtual Color GetColorForToken (Token token)
+ public virtual Color GetColorForToken (Token token, SyntaxNode node = null)
{
TokenType tokType = token.Type;
if (tokType.HasFlag (TokenType.Punctuation))
public ObservableList<Plugin> Plugins = new ObservableList<Plugin> ();
public ObservableList<Project> Projects = new ObservableList<Project> ();
+ public ObservableList<KeyBinding> KeyBindings = new ObservableList<KeyBinding>();
#region logging
LogItem currentLog;
public Command CMDCut, CMDCopy, CMDPaste;
void initCommands () {
- CMDCut = new ActionCommand ("Cut", Cut, "#icons.scissors.svg", false);
- CMDCopy = new ActionCommand ("Copy", Copy, "#icons.copy-file.svg", false);
- CMDPaste = new ActionCommand ("Paste", Paste, "#icons.paste-on-document.svg", true);
+ CMDCut = new ActionCommand (this, "Cut", Cut, "#icons.scissors.svg", new KeyBinding(Key.X, Modifier.Control), false);
+ CMDCopy = new ActionCommand (this, "Copy", Copy, "#icons.copy-file.svg", new KeyBinding(Key.C, Modifier.Control), false);
+ CMDPaste = new ActionCommand (this, "Paste", Paste, "#icons.paste-on-document.svg", new KeyBinding(Key.P, Modifier.Control), true);
ContextCommands = new CommandGroup (CMDCut, CMDCopy, CMDPaste);
}
public abstract void Stop ();
public abstract void Pause ();
//windows having this service as datasource
- public virtual string[] ServiceWindowsPath => ["#ui.winServiceConfig.crow"];
+ public virtual string[] ServiceWindowsPath => new string[] {"#ui.winServiceConfig.crow"};
public virtual Document OpenDocument (string fullPath) => null;
}
}
}
-
+ #region Drawing
protected virtual void fillHighlight (IContext gr, int l, CharLocation selStart, CharLocation selEnd, RectangleD selRect, Color color) {
if (selStart.Line == selEnd.Line) {
selRect.X += selStart.VisualCharXPosition;
}
gr.Translate (ScrollX, 0);
}
+ #endregion
+
protected override RectangleD? computeTextCursor (Rectangle cursor) {
Rectangle cb = ClientRectangle;
cursor -= new Point (ScrollX, ScrollY);
--- /dev/null
+default = Jet;#20DADA;False;False
+leftMargin = Grey;Black;True;True
+Selection = White;Black;False;False
+keyword = Blue;Transparent;False;False
+DocumentationComment = MediumSeaGreen;Transparent;True;False
+Region = DeepPink;Transparent;False;False
+FoldedRegion = #FFFFF8;#35B23C;True;False
+Documentation = GreenYellow;#00E800;False;False
+trivia = Grey;Transparent;False;False
+PreprocessorDirective = #1D1493;Transparent;False;False
+PreprocessorMessage = #001493;Transparent;True;False
+PredefinedType = DarkCyan;Transparent;False;False
+AccessibilityModifier = RoyalBlue;Transparent;False;False
+DisabledText = Grey;Transparent;False;False
+identifier = Onyx;Transparent;False;False
+Namespace = RoyalBlue;Transparent;True;False
+NamedType = DarkGreen;Transparent;True;False
+Property = Green;Transparent;True;False
+Field = Black;Transparent;False;False
+Method = DarkOliveGreen;Transparent;True;False
+LiteralExpression = FireBrick;Transparent;False;True
+error = Red;Transparent;False;False
+TypeSyntax = DarkCyan;Transparent;False;False
+TypeDeclaration = Lavender;Transparent;False;False
+Punctuation = Black;Transparent;False;False
+ContextualKeyword = DarkBlue;Transparent;True;False
+InstanceExpression = Jet;Transparent;False;False
+NamespaceMemberDeclaration = Jet;Transparent;False;False
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
MainService=CECrowPlugin.CrowService
-FileAssociations = CECrowPlugin.ImlDocument:.crow,.iml,.itmp,.template,.tmp:#ui.sourceEditor.itmp;CECrowPlugin.Style.StyleDocument:.style:#ui.sourceEditor.itmp
+FileAssociations = CECrowPlugin.ImlDocument:.crow,.iml,.itmp,.template,.tmp:#CECrowPlugin.ui.IMLEditor.itmp;CECrowPlugin.Style.StyleDocument:.style:#ui.sourceEditor.itmp
namespace CECrowPlugin
{
public class CrowService : Service {
+ CrowEditBase.LogItem logger;
#region CTOR/DTOR
public CrowService () : base () {
+ logger = App.GetLog("CrowService");
+
restoreCrowAssemblies ();
initCommands ();
App.ValueChanged += app_ValueChanged;
CurrentSolution = sol;
else
CurrentSolution = null;
+ } else if (e.MemberName == "CurrentDocument") {
+ if (e.NewValue is Document doc)
+ CurrentDocument = doc;
+ else
+ CurrentDocument = null;
}
}
- public override string[] ServiceWindowsPath => [
+ public override string[] ServiceWindowsPath => new string [] {
"#CECrowPlugin.ui.winConfiguration.crow",
"#CECrowPlugin.ui.winGraphicTree.crow",
- "#CECrowPlugin.ui.winProperties.crow"
- ];
+ "#CECrowPlugin.ui.winProperties.crow",
+ "#CECrowPlugin.ui.winCrowPreview.crow",
+ };
#region Commands
public Command CMDStartRecording, CMDStopRecording, CMDRefresh, CMDAddEventToRecord, CMDRemoveEventToRecord;
}
Project currentSolution;
+ Document currentDocument;
Exception currentException;
public string ErrorMessage = "";
public bool ServiceIsInError;
CMDRun.CanExecute = value;
NotifyValueChanged(value);
}
- }
-
+ }
public double ZoomFactor {
get => Configuration.Global.Get<Double> ("CrowPreviewZoomFactor", 1.0);
set {
App.ForceMousePosition();
}
public void UpdateRootWidget(Type widgetType, object instance) {
- GraphicTree = new List<ForeignWidgetContainer>([new ForeignWidgetContainer(widgetType, instance)]);
+ GraphicTree = new List<ForeignWidgetContainer>(new ForeignWidgetContainer[] {new ForeignWidgetContainer(widgetType, instance)});
}
IEnumerable<object> getStyling () {
if (App.CurrentProject is CERoslynPlugin.SolutionProject sol) {
if (sol.StartupProject is CERoslynPlugin.MSBuildProject csprj) {
foreach (var style in csprj.Flatten.OfType<CERoslynPlugin.MSBuildProjectItemNode>()
- .Where (pin=>pin.NodeType == NodeType.EmbeddedResource && pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase)))
+ .Where (pin=>pin.NodeType == NodeType.EmbeddedResource && pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase))) {
+ logger.Add(LogType.Low, $"style found: {style.FullPath}");
yield return style.FullPath;
+ }
foreach (var refP in csprj.ReferencedProjects) {
foreach (var style in refP.Flatten.OfType<CERoslynPlugin.MSBuildProjectItemNode>()
.Where (pin=>pin.NodeType == NodeType.EmbeddedResource &&
- pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase)))
+ pin.FullPath.EndsWith (".style", StringComparison.OrdinalIgnoreCase))) {
+ logger.Add(LogType.Low, $"style found: {style.FullPath}");
yield return style.FullPath;
+ }
}
}
}
NotifyValueChanged (currentSolution);
}
}
+ public Document CurrentDocument {
+ get => currentDocument;
+ set {
+ //CERoslynPlugin.SolutionProject sol = value as CERoslynPlugin.SolutionProject;
+ if (currentDocument == value)
+ return;
+ currentDocument = value;
+ NotifyValueChanged (currentDocument);
+
+ /*if (currentDocument is ImlDocument iml) {
+ LoadIML(iml.source.ToString());
+ }*/
+ }
+ }
+
#region Additional crow Assemblies
string selectedCrowAssembly = null;
}
}
#endregion
-
-
}
}
\ No newline at end of file
delCrowServiceUpdateRootWidget = (Action<Type,object>)Delegate.CreateDelegate(typeof(Action<Type,object>), crowService,
t.GetMethod("UpdateRootWidget"));
-
- /*delCrowServiceGetScreenCoordinate = (GetScreenCoordinateDelegateType)Delegate.CreateDelegate(typeof(GetScreenCoordinateDelegateType), crowService,
- t.GetMethod("getMouseScreenCoordinates", BindingFlags.Instance | BindingFlags.NonPublic));*/
delCrowServiceGetStyling = (Func<IEnumerable<object>>)Delegate.CreateDelegate (typeof (Func<IEnumerable<object>>), crowService,
t.GetMethod ("getStyling", BindingFlags.Instance | BindingFlags.NonPublic));
delCrowServiceGetStreamFromPath = (Func<string, Stream>)Delegate.CreateDelegate (typeof (Func<string, Stream>), crowService,
ClearInterface();
initDictionaries();
foreach (object style in delCrowServiceGetStyling ()) {
- if (style is string stylePath)
+ if (style is string stylePath) {
LoadStyle (stylePath);
- else if (style is Assembly styleAssembly)
+ } else if (style is Assembly styleAssembly) {
loadStylingFromAssembly (styleAssembly);
+ }
}
}
public void ReloadIml () {
namespace CECrowPlugin
{
public class DebugInterfaceWidget : Widget {
+ #region CTOR/DTOR
public DebugInterfaceWidget () : base () {
CrowIFaceService = App.GetService<CrowService> ();
if (crowIFaceService != null)
crowIFaceService.ValueChanged -= service_ValueChanged;
}
- void service_ValueChanged(object instance, ValueChangeEventArgs e) {
+ #endregion
+
+ void service_ValueChanged(object instance, ValueChangeEventArgs e) {
if (e.MemberName == "CurrentWidget") {
if (e.NewValue is ForeignWidgetContainer fwc)
CurrentWidget = fwc;
CMDRefresh, //CMDZoomIn, CMDZoomOut,
crowIFaceService.CMDStartRecording,
crowIFaceService.CMDStopRecording,
- crowIFaceService.CMDOpenConfig,
- (Parent.LogicalParent as DockWindow).CMDClose
+ crowIFaceService.CMDOpenConfig
+ //(Parent.LogicalParent as DockWindow).CMDClose
);
public CrowService CrowIFaceService {
get => crowIFaceService;
RegisterForRepaint ();
}
}
+
protected void backgroundThreadFunc () {
Stopwatch sw = Stopwatch.StartNew ();
int refreshRate = crowIFaceService == null ? 10 : crowIFaceService.RefreshRate;
imlSource = tmp.ToString ();
- crowIFaceService?.LoadIML (imlSource);
+ /*if (crowIFaceService.EncloseInTemplatedControl && !string.IsNullOrEmpty(crowIFaceService.TemplateContainerSource)) {
+ if (!string.IsNullOrEmpty(imlSource) && imlSource.StartsWith("<?xml")) {
+ int pos = src.IndexOf('>');
+ if (pos > 0)
+ src = imlSource.Substring(pos + 1);
+ }
+ string tmpCloseTag = crowIFaceService.TemplateContainerSource.Split (' ', StringSplitOptions.RemoveEmptyEntries)[0].Replace ("<","").TrimEnd('/','>');
+ crowIFaceService?.LoadIML ($"{crowIFaceService.TemplateContainerSource.TrimEnd('/','>')}><Template>{src}</Template></{tmpCloseTag}>");
+ } else*/
+ crowIFaceService?.LoadIML (imlSource);
RegisterForRedraw ();
}
if (hoverWidget != null && hoverWidget != currentWidget) {
//currentWidget.
RectangleD r = hoverWidget.GetScreenCoordinate() + Slot.Position + Parent.ClientRectangle.Position;
- ctx.SetDash([1,3]);
+ ctx.SetDash(new double[] {1,3});
ctx.SetSource(Colors.Yellow);
ctx.Rectangle(r, 1);
- ctx.SetDash([]);
+ ctx.SetDash(new double[] {});
}
if (currentWidget != null) {
//currentWidget.
}*/
}
+ CrowService crowService;
+ public CrowService CrowService {
+ get => crowService;
+ set {
+ if (crowService == value)
+ return;
+ crowService = value;
+ NotifyValueChanged (crowService);
+ }
+ }
+ public bool EncloseInTemplatedControl {
+ get => Configuration.Global.Get (nameof(EncloseInTemplatedControl), false);
+ set {
+ if (EncloseInTemplatedControl == value)
+ return;
+ Configuration.Global.Set (nameof(EncloseInTemplatedControl), value);
+ NotifyValueChanged (value);
+
+ }
+ }
+ public string TemplateContainerSource {
+ get => Configuration.Global.Get (nameof(TemplateContainerSource), "<Button/>");
+ set {
+ if (TemplateContainerSource == value)
+ return;
+ Configuration.Global.Set (nameof(TemplateContainerSource), value);
+ NotifyValueChanged (value);
+ }
+ }
+
protected override SyntaxAnalyser CreateSyntaxAnalyser() => new ImlSyntaxAnalyser (ImmutableBufferCopy);
public override string GetTokenTypeString (TokenType tokenType) => ((ImlTokenType)tokenType).ToString();
return null;
}
- public override Color GetColorForToken(Token token)
+ public override Color GetColorForToken(Token token, SyntaxNode node = null)
{
TokenType tokType = token.Type;
switch ((ImlTokenType)tokType) {
return null;
}
public override string GetTokenTypeString (TokenType tokenType) => ((StyleTokenType)tokenType).ToString();
- public override Color GetColorForToken(Token token)
+ public override Color GetColorForToken(Token token, SyntaxNode node = null)
{
TokenType tokType = token.Type;
StyleTokenType xmlTokType = (StyleTokenType)tokType;
--- /dev/null
+<?xml version="1.0"?>
+<ListItem IsVisible="{IsSelected}" IsSelected="{²IsSelected}" Selected="{/tb.HasFocus='true'}">
+ <VerticalStack Spacing="0">
+ <ListBox Style="DockWinTitleBarIconMenu" Data="{../dbgIfaceWidget.WindowCommands}"/>
+ <VerticalStack Background="Black" Height="40%" >
+ <HorizontalStack Height="Fit" Spacing="5" >
+ <CheckBox Caption="Load source as template in:" Width="Fit" Name="cbEncloseInTemplate" IsChecked="{²EncloseInTemplatedControl}"/>
+ <TextBox Width="Stretched" Text="{²TemplateContainerSource}" IsEnabled="{../cbEncloseInTemplate.IsChecked}"/>
+ </HorizontalStack>
+ <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{²CurrentWidget}"
+ BubbleEvents="None"
+ Document="{}"/>
+ <!--<Popper IsVisible="{PreviewHasError}" Background="DarkRed">
+ <Template>
+ <CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}">
+ <Template>
+ <Label DataSource="{CurrentException}" Text="{Message}" Background="Red" Foreground="White" Width="Stretched" Margin="2"
+ Multiline="true"/>
+ </Template>
+ </CheckBox>
+ </Template>
+ <Label Text="{CurrentException}" Background="DarkRed" Foreground="White" Width="90%" Margin="2" Multiline="true"/>
+ </Popper>-->
+ </VerticalStack>
+ <Splitter/>
+ <HorizontalStack Spacing="0" Background="WhiteSmoke">
+ <SourceEditor Name="tb" Font="mono, 14" Margin='0' CurrentNode="{CurrentNode}"
+ Document="{}" TextChanged="onTextChanged" />
+ <ScrollBar Value="{²../tb.ScrollY}"
+ LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
+ CursorRatio="{../tb.ChildHeightRatio}" Maximum="{../tb.MaxScrollY}" />
+ </HorizontalStack>
+ <ScrollBar Style="HScrollBar" Value="{²../tb.ScrollX}"
+ LargeIncrement="{../tb.PageWidth}" SmallIncrement="1"
+ CursorRatio="{../tb.ChildWidthRatio}" Maximum="{../tb.MaxScrollX}" />
+ <HorizontalStack Height="Fit" Spacing='3'>
+ <Widget Width="Stretched"/>
+ <Label Text="TokType" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentTokenType}" Margin="3"/>
+ <Label Text="Tok" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentTokenString}" Margin="3"/>
+ <Label Text="Node" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentNode}" Margin="3"/>
+ <Label Text="MouseY:" Foreground="Grey"/>
+ <Label Text="{../../tb.MouseY}" Margin="3"/>
+ <Label Text="VisibleLines:" Foreground="Grey"/>
+ <Label Text="{../../tb.VisibleLines}" Margin="3"/>
+ <Label Text="ScrollX:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollX}" Margin="3"/>
+ <Label Text="ScrollY:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollY}" Margin="3"/>
+ <Label Text="ScrollLine:" Foreground="Grey"/>
+ <Label Text="{../../tb.ScrollLine}" Margin="3"/>
+ <Label Text="HoverLine:" Foreground="Grey"/>
+ <Label Text="{../../tb.HoverLine}" Margin="3"/>
+ <Label Text="Line:" Foreground="Grey"/>
+ <Label Text="{../../tb.CurrentLine}" Margin="3"/>
+ <Label Text="Col:" Foreground="Grey"/>
+ <Label Text="{../../tb.TabulatedColumn}" Margin="3"/>
+ </HorizontalStack>
+ </VerticalStack>
+</ListItem>
<?xml version="1.0"?>
<DockWindow Caption="Crow Preview" Width="60%" Commands="{/dbgIfaceWidget.WindowCommands}">
- <VerticalStack Background="Black" >
- <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{CurrentWidget}"
+ <VerticalStack Background="Black" >
+ <HorizontalStack Height="Fit" Spacing="5" >
+ <CheckBox Caption="Load source as template in:" Width="Fit" Name="cbEncloseInTemplate" IsChecked="{²EncloseInTemplatedControl}"/>
+ <TextBox Width="Stretched" Text="{²TemplateContainerSource}" IsEnabled="{../cbEncloseInTemplate.IsChecked}"/>
+ </HorizontalStack>
+ <DebugInterfaceWidget Name="dbgIfaceWidget" Focusable="true" CurrentWidget="{²CurrentWidget}"
BubbleEvents="None"
Document="{CurrentDocument}"/>
- <Popper DataSource="{../dbgIfaceWidget.CrowIFaceService}" IsVisible="{PreviewHasError}" Background="DarkRed">
+ <Popper IsVisible="{PreviewHasError}" Background="DarkRed">
<Template>
<CheckBox IsChecked="{²./IsPopped}" MouseEnter="{IsChecked='true'}" MouseLeave="{IsChecked='false'}">
<Template>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
return null;
}
- public override Color GetColorForToken(Token token)
+ public override Color GetColorForToken(Token token, SyntaxNode node = null)
{
TokenType tokType = token.Type;
EbnfTokenType xmlTokType = (EbnfTokenType)tokType;
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
namespace NetcoreDbgPlugin
{
public class NetcoreDbgService : Service {
- public override string[] ServiceWindowsPath => ["#CENetcoreDbgPlugin.ui.winConfiguration.crow"];
+ public override string[] ServiceWindowsPath => new string[] {"#CENetcoreDbgPlugin.ui.winConfiguration.crow"};
public NetcoreDbgService () : base () {
initCommands();
App.ValueChanged += app_ValueChanged;
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
namespace NugetPlugin
{
public class NugetService : Service {
- public override string[] ServiceWindowsPath => ["#CENugetPlugin.ui.winConfiguration.crow"];
+ public override string[] ServiceWindowsPath => new string[] {"#CENugetPlugin.ui.winConfiguration.crow"};
public NugetService () : base () {
initCommands();
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using System.Linq;
-using Crow.Text;
-using System.Collections.Generic;
-using System.Diagnostics;
-using Crow;
-using IML = Crow.IML;
-using System.Collections;
-using System.Reflection;
-using CrowEditBase;
-using Drawing2D;
-
-//using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-
-using static CrowEditBase.CrowEditBase;
-using System.Threading;
-
-
-namespace CERoslynPlugin
-{
- /*public static class Extensions {
- public static CSTokenType GetTokenType (this Token tok) => (XmlTokenType)tok.Type;
- public static void SetTokenType (this Token tok, CSTokenType type) => tok.Type = (TokenType)type;
- }*/
- public class CSDocument : SourceDocument {
-
- static CSDocument () {
- App.GetService<RoslynService> ()?.Start ();
- }
-
- public CSDocument (string fullPath, string editorPath) : base (fullPath, editorPath) { }
-
- #region SourceDocument abstract class implementation
- protected override SyntaxAnalyser CreateSyntaxAnalyser() => new CSSyntaxAnalyser (ImmutableBufferCopy);
-
- public override IList GetSuggestions (int absoluteTextPos, int currentTokenIndex, SyntaxNode CurrentNode, CharLocation loc)
- {
- /*Token currentToken = GetTokenByIndex(currentTokenIndex);
- throw new NotImplementedException();*/
- return null;
- }
- #endregion
-
- public override string GetTokenTypeString (TokenType tokenType) => ((SyntaxKind)tokenType).ToString();
- public override Color GetColorForToken(Token token)
- {
- SyntaxKind syntaxKind = (SyntaxKind)token.Type;
- TokenType tokType = token.Type;
- CSTokenType xmlTokType = (CSTokenType)tokType;
-
- if (SyntaxFacts.IsPredefinedType(syntaxKind))
- return Colors.Fuchsia;
- if (SyntaxFacts.IsLiteralExpression(syntaxKind))
- return Colors.DarkGoldenRod;
- if (SyntaxFacts.IsPreprocessorKeyword(syntaxKind))
- return Colors.Indigo;
- if (SyntaxFacts.IsKeywordKind(syntaxKind))
- return Colors.DodgerBlue;
- if (SyntaxFacts.IsPunctuation(syntaxKind))
- return Colors.Black;
-
- if (syntaxKind == SyntaxKind.IdentifierToken)
- return Colors.Blue;
-
- if (xmlTokType.HasFlag (CSTokenType.Punctuation))
- return Colors.DarkGrey;
- if (tokType.HasFlag (TokenType.WhiteSpace))
- return Colors.Silver;
- if (xmlTokType.HasFlag (CSTokenType.Trivia))
- return Colors.DimGrey;
- else if (xmlTokType == CSTokenType.Name)
- return Colors.Green;
- if (xmlTokType == CSTokenType.TypeKeyword)
- return Colors.Blue;
- if (xmlTokType == CSTokenType.Keyword)
- return Colors.DarkBlue;
- if (xmlTokType == CSTokenType.VisibilityKeyword)
- return Colors.SlateBlue;
- if (xmlTokType == CSTokenType.Directive)
- return Colors.Black;
- if (xmlTokType == CSTokenType.Operator)
- return Colors.DarkSlateBlue;
- return Colors.Red;
-
- }
-
- protected override void apply(TextChange change)
- {
- buffer.Update(change);
- NotifyValueChanged ("IsDirty", IsDirty);
- CMDSave.CanExecute = IsDirty;
-
- parse();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2025 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-
-namespace CERoslynPlugin
-{
- [Flags]
- public enum CSTokenType {
- Unknown,
-
- Trivia = 0x0100,
- WhiteSpace = 0x4100,
- Tabulation = 0x4101,
- LineBreak = 0x4102,
- LineComment = 0x0103,
- BlockCommentStart = 0x0104,
- BlockComment = 0x0105,
- BlockCommentEnd = 0x0106,
- Name = 0x0200,
- Punctuation = 0x0400,
- OpenBrace = 0x0401,
- CloseBrace = 0x0402,
- OpenBracket = 0x0403,
- CloseBracket = 0x0404,
- OpenParen = 0x0405,
- CloseParenToken = 0x0406,
- DoubleQuote = 0x0407,
- SingleQuote = 0x0408,
-
- Operator = 0x0800,
- Keyword = 0x1000,
- TypeKeyword = 0x1001,
- TryKeyword = 0x1002,
- VisibilityKeyword = 0x1003,
- NewKeyword = 0x1004,
- Region = 0x1005,
- Directive = 0x1006,
-
- }
-}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
-using System;
-using Crow.Text;
-using System.Collections.Generic;
-using CrowEditBase;
-
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis;
-using SyntaxNode = Microsoft.CodeAnalysis.SyntaxNode;
-using System.Text.RegularExpressions;
-
-namespace CERoslynPlugin
-{
- public class CSTokenizer : Tokenizer
- {
- public SyntaxTree syntaxTree;
- public CSTokenizer(SyntaxTree syntaxTree) {
- this.syntaxTree = syntaxTree;
- }
-
- public override Token[] Tokenize(ReadOnlySpan<char> source = default)
- {
- /*foreach (var e in Enum.GetNames(typeof(SyntaxKind))) {
- Console.WriteLine($"case SyntaxKind.{e}:");
- Console.WriteLine($"\treturn CSTokenType.Unknown;");
- }*/
-
-// syntaxTree = CSharpSyntaxTree.ParseText(source.ToString());
- CsharpSyntaxWalkerTokenizer bridge = new CsharpSyntaxWalkerTokenizer();
- bridge.Visit(syntaxTree.GetRoot());
- Toks = bridge.Toks;
- return Toks.ToArray();
- }
-
- }
-
- class CsharpSyntaxWalkerTokenizer : CSharpSyntaxWalker
- {
- public List<Token> Toks;
- public CsharpSyntaxWalkerTokenizer () : base (SyntaxWalkerDepth.StructuredTrivia)
- {
- Toks = new List<Token>(100);
- }
- public override void Visit (SyntaxNode node)
- {
- base.Visit (node);
- }
-
- public override void VisitToken (SyntaxToken token)
- {
- VisitLeadingTrivia (token);
-
- if (SyntaxFacts.IsLiteralExpression (token.Kind ())) {
- addMultilineToken(token.ToString(), token.Span, (TokenType)convertTokenType(token.Kind()));
- } else {
- Microsoft.CodeAnalysis.Text.TextSpan span = token.Span;
-
- Toks.Add (new Token(span.Start, span.Length, (TokenType)convertTokenType(token.Kind())));
- }
-
- VisitTrailingTrivia (token);
- }
-
- public override void VisitTrivia (SyntaxTrivia trivia)
- {
- SyntaxKind kind = trivia.Kind ();
- Microsoft.CodeAnalysis.Text.TextSpan span = trivia.Span;
- if (kind == SyntaxKind.EndOfLineTrivia) {
- Toks.Add (new Token(span.Start, span.Length, TokenType.LineBreak));
- return;
- }
- if (trivia.HasStructure)
- this.Visit ((CSharpSyntaxNode)trivia.GetStructure());
- else if (trivia.IsKind (SyntaxKind.DisabledTextTrivia) || trivia.IsKind (SyntaxKind.MultiLineCommentTrivia))
- addMultilineToken(trivia.ToString(), trivia.Span, (TokenType)trivia.RawKind);
- else {
- Toks.Add (new Token(span.Start, span.Length, (TokenType)trivia.RawKind));
- }
- }
- int startOfTok;
- void addTok (ref SpanCharReader reader, int offset, Enum tokType) {
- if (reader.CurrentPosition == startOfTok)
- return;
- Toks.Add (new Token((TokenType)tokType,startOfTok + offset, reader.CurrentPosition + offset));
- startOfTok = reader.CurrentPosition;
- }
- void addMultilineToken(ReadOnlySpan<char> txt, Microsoft.CodeAnalysis.Text.TextSpan span, TokenType mainType) {
- SpanCharReader reader = new SpanCharReader(txt);
- startOfTok = 0;
-
- while(!reader.EndOfSpan) {
- switch (reader.Peek) {
- case '\x85':
- case '\x2028':
- case '\xA':
- addTok (ref reader, span.Start, mainType);
- reader.Read();
- addTok (ref reader, span.Start, TokenType.LineBreak);
- break;
- case '\xD':
- addTok (ref reader, span.Start, mainType);
- reader.Read();
- if (reader.IsNextCharIn ('\xA', '\x85'))
- reader.Read();
- addTok (ref reader, span.Start, TokenType.LineBreak);
- break;
- case '\x20':
- case '\x9':
- addTok (ref reader, span.Start, mainType);
- char c = reader.Read();
- while (reader.TryPeek (c))
- reader.Read();
- addTok (ref reader, span.Start, c == '\x20' ? TokenType.WhiteSpace : TokenType.Tabulation);
- break;
- default:
- reader.Read();
- break;
- }
- }
- addTok (ref reader, span.Start, mainType);
- }
- CSTokenType convertTokenType(SyntaxKind kind) {
- return (CSTokenType)kind;
- /*switch (kind) {
- case SyntaxKind.None:
- return CSTokenType.Unknown;
- case SyntaxKind.List:
- return CSTokenType.Unknown;
- case SyntaxKind.TildeToken:
- case SyntaxKind.ExclamationToken:
- case SyntaxKind.DollarToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.PercentToken:
- return CSTokenType.Operator;
- case SyntaxKind.CaretToken:
- case SyntaxKind.AmpersandToken:
- case SyntaxKind.AsteriskToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.OpenParenToken:
- return CSTokenType.OpenParen;
- case SyntaxKind.CloseParenToken:
- return CSTokenType.CloseParenToken;
- case SyntaxKind.MinusToken:
- case SyntaxKind.PlusToken:
- case SyntaxKind.EqualsToken:
- return CSTokenType.Operator;
- case SyntaxKind.OpenBraceToken:
- return CSTokenType.OpenBrace;
- case SyntaxKind.CloseBraceToken:
- return CSTokenType.CloseBrace;
- case SyntaxKind.OpenBracketToken:
- return CSTokenType.OpenBracket;
- case SyntaxKind.CloseBracketToken:
- return CSTokenType.CloseBracket;
- case SyntaxKind.BarToken:
- return CSTokenType.Operator;
- case SyntaxKind.BackslashToken:
- case SyntaxKind.ColonToken:
- case SyntaxKind.SemicolonToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.DoubleQuoteToken:
- return CSTokenType.DoubleQuote;
- case SyntaxKind.SingleQuoteToken:
- return CSTokenType.SingleQuote;
- case SyntaxKind.LessThanToken:
- return CSTokenType.Operator;
- case SyntaxKind.CommaToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.GreaterThanToken:
- return CSTokenType.Operator;
- case SyntaxKind.DotToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.QuestionToken:
- case SyntaxKind.HashToken:
- case SyntaxKind.SlashToken:
- case SyntaxKind.DotDotToken:
- return CSTokenType.Punctuation;
- case SyntaxKind.SlashGreaterThanToken:
- return CSTokenType.Unknown;
- case SyntaxKind.LessThanSlashToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlCommentStartToken:
- return CSTokenType.BlockCommentStart;
- case SyntaxKind.XmlCommentEndToken:
- return CSTokenType.BlockCommentEnd;
- case SyntaxKind.XmlCDataStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlCDataEndToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlProcessingInstructionStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlProcessingInstructionEndToken:
- return CSTokenType.Unknown;
- case SyntaxKind.BarBarToken:
- return CSTokenType.Unknown;
- case SyntaxKind.AmpersandAmpersandToken:
- return CSTokenType.Unknown;
- case SyntaxKind.MinusMinusToken:
- case SyntaxKind.PlusPlusToken:
- case SyntaxKind.ColonColonToken:
- case SyntaxKind.QuestionQuestionToken:
- case SyntaxKind.MinusGreaterThanToken:
- case SyntaxKind.ExclamationEqualsToken:
- case SyntaxKind.EqualsEqualsToken:
- case SyntaxKind.EqualsGreaterThanToken:
- case SyntaxKind.LessThanEqualsToken:
- case SyntaxKind.LessThanLessThanToken:
- case SyntaxKind.LessThanLessThanEqualsToken:
- case SyntaxKind.GreaterThanEqualsToken:
- case SyntaxKind.GreaterThanGreaterThanToken:
- case SyntaxKind.GreaterThanGreaterThanEqualsToken:
- case SyntaxKind.SlashEqualsToken:
- case SyntaxKind.AsteriskEqualsToken:
- case SyntaxKind.BarEqualsToken:
- case SyntaxKind.AmpersandEqualsToken:
- case SyntaxKind.PlusEqualsToken:
- case SyntaxKind.MinusEqualsToken:
- case SyntaxKind.CaretEqualsToken:
- case SyntaxKind.PercentEqualsToken:
- case SyntaxKind.QuestionQuestionEqualsToken:
- case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
- case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
- return CSTokenType.Operator;
- case SyntaxKind.BoolKeyword:
- case SyntaxKind.ByteKeyword:
- case SyntaxKind.SByteKeyword:
- case SyntaxKind.ShortKeyword:
- case SyntaxKind.UShortKeyword:
- case SyntaxKind.IntKeyword:
- case SyntaxKind.UIntKeyword:
- case SyntaxKind.LongKeyword:
- case SyntaxKind.ULongKeyword:
- case SyntaxKind.DoubleKeyword:
- case SyntaxKind.FloatKeyword:
- case SyntaxKind.DecimalKeyword:
- case SyntaxKind.StringKeyword:
- case SyntaxKind.CharKeyword:
- case SyntaxKind.VoidKeyword:
- case SyntaxKind.ObjectKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.TypeOfKeyword:
- case SyntaxKind.SizeOfKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.NullKeyword:
- case SyntaxKind.TrueKeyword:
- case SyntaxKind.FalseKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.IfKeyword:
- case SyntaxKind.ElseKeyword:
- case SyntaxKind.WhileKeyword:
- case SyntaxKind.ForKeyword:
- case SyntaxKind.ForEachKeyword:
- case SyntaxKind.DoKeyword:
- case SyntaxKind.SwitchKeyword:
- case SyntaxKind.CaseKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.DefaultKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.TryKeyword:
- case SyntaxKind.CatchKeyword:
- case SyntaxKind.FinallyKeyword:
- return CSTokenType.TryKeyword;
- case SyntaxKind.LockKeyword:
- case SyntaxKind.GotoKeyword:
- case SyntaxKind.BreakKeyword:
- case SyntaxKind.ContinueKeyword:
- case SyntaxKind.ReturnKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.ThrowKeyword:
- return CSTokenType.TryKeyword;
- case SyntaxKind.PublicKeyword:
- case SyntaxKind.PrivateKeyword:
- case SyntaxKind.InternalKeyword:
- case SyntaxKind.ProtectedKeyword:
- case SyntaxKind.StaticKeyword:
- case SyntaxKind.ReadOnlyKeyword:
- case SyntaxKind.SealedKeyword:
- return CSTokenType.VisibilityKeyword;
- case SyntaxKind.ConstKeyword:
- case SyntaxKind.FixedKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.StackAllocKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.VolatileKeyword:
- return CSTokenType.VisibilityKeyword;
- case SyntaxKind.NewKeyword:
- return CSTokenType.NewKeyword;
- case SyntaxKind.OverrideKeyword:
- case SyntaxKind.AbstractKeyword:
- case SyntaxKind.VirtualKeyword:
- return CSTokenType.VisibilityKeyword;
- case SyntaxKind.EventKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.ExternKeyword:
- return CSTokenType.VisibilityKeyword;
- case SyntaxKind.RefKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.OutKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.InKeyword:
- case SyntaxKind.IsKeyword:
- case SyntaxKind.AsKeyword:
- return CSTokenType.Operator;
- case SyntaxKind.ParamsKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ArgListKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.MakeRefKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RefTypeKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RefValueKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ThisKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.BaseKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.NamespaceKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.UsingKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.ClassKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.StructKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.InterfaceKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.EnumKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.DelegateKeyword:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.CheckedKeyword:
- case SyntaxKind.UncheckedKeyword:
- case SyntaxKind.UnsafeKeyword:
- case SyntaxKind.OperatorKeyword:
- case SyntaxKind.ExplicitKeyword:
- case SyntaxKind.ImplicitKeyword:
- case SyntaxKind.YieldKeyword:
- case SyntaxKind.PartialKeyword:
- case SyntaxKind.AliasKeyword:
- case SyntaxKind.GlobalKeyword:
- case SyntaxKind.AssemblyKeyword:
- case SyntaxKind.ModuleKeyword:
- case SyntaxKind.TypeKeyword:
- case SyntaxKind.FieldKeyword:
- case SyntaxKind.MethodKeyword:
- case SyntaxKind.ParamKeyword:
- case SyntaxKind.PropertyKeyword:
- case SyntaxKind.TypeVarKeyword:
- case SyntaxKind.GetKeyword:
- case SyntaxKind.SetKeyword:
- case SyntaxKind.AddKeyword:
- case SyntaxKind.RemoveKeyword:
- case SyntaxKind.WhereKeyword:
- case SyntaxKind.FromKeyword:
- case SyntaxKind.GroupKeyword:
- case SyntaxKind.JoinKeyword:
- case SyntaxKind.IntoKeyword:
- case SyntaxKind.LetKeyword:
- case SyntaxKind.ByKeyword:
- case SyntaxKind.SelectKeyword:
- case SyntaxKind.OrderByKeyword:
- return CSTokenType.Keyword;
- case SyntaxKind.OnKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.EqualsKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.AscendingKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.DescendingKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.NameOfKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.AsyncKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.AwaitKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.WhenKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.OrKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.AndKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.NotKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.WithKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.InitKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RecordKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ManagedKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.UnmanagedKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RequiredKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ScopedKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.FileKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ElifKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.EndIfKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RegionKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.EndRegionKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.DefineKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.UndefKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.WarningKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ErrorKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.LineKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.PragmaKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.HiddenKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ChecksumKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.DisableKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.RestoreKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.ReferenceKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringEndToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedVerbatimStringStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.LoadKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.NullableKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.EnableKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.WarningsKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.AnnotationsKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.VarKeyword:
- return CSTokenType.Unknown;
- case SyntaxKind.UnderscoreToken:
- return CSTokenType.Unknown;
- case SyntaxKind.OmittedTypeArgumentToken:
- return CSTokenType.Unknown;
- case SyntaxKind.OmittedArraySizeExpressionToken:
- return CSTokenType.Unknown;
- case SyntaxKind.EndOfDirectiveToken:
- return CSTokenType.Unknown;
- case SyntaxKind.EndOfDocumentationCommentToken:
- return CSTokenType.Unknown;
- case SyntaxKind.EndOfFileToken:
- return CSTokenType.Unknown;
- case SyntaxKind.BadToken:
- return CSTokenType.Unknown;
- case SyntaxKind.IdentifierToken:
- return CSTokenType.Unknown;
- case SyntaxKind.NumericLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.CharacterLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.StringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlEntityLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlTextLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlTextLiteralNewLineToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringTextToken:
- return CSTokenType.Unknown;
- case SyntaxKind.SingleLineRawStringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.MultiLineRawStringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.Utf8StringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.Utf8SingleLineRawStringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.Utf8MultiLineRawStringLiteralToken:
- return CSTokenType.Unknown;
- case SyntaxKind.EndOfLineTrivia:
- return CSTokenType.LineBreak;
- case SyntaxKind.WhitespaceTrivia:
- return CSTokenType.WhiteSpace;
- case SyntaxKind.SingleLineCommentTrivia:
- return CSTokenType.LineComment;
- case SyntaxKind.MultiLineCommentTrivia:
- return CSTokenType.LineComment;
- case SyntaxKind.DocumentationCommentExteriorTrivia:
- case SyntaxKind.SingleLineDocumentationCommentTrivia:
- case SyntaxKind.MultiLineDocumentationCommentTrivia:
- case SyntaxKind.DisabledTextTrivia:
- return CSTokenType.Trivia;
- case SyntaxKind.PreprocessingMessageTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.IfDirectiveTrivia:
- case SyntaxKind.ElifDirectiveTrivia:
- case SyntaxKind.ElseDirectiveTrivia:
- case SyntaxKind.EndIfDirectiveTrivia:
- return CSTokenType.Directive;
- case SyntaxKind.RegionDirectiveTrivia:
- case SyntaxKind.EndRegionDirectiveTrivia:
- return CSTokenType.Region;
- case SyntaxKind.DefineDirectiveTrivia:
- case SyntaxKind.UndefDirectiveTrivia:
- case SyntaxKind.ErrorDirectiveTrivia:
- case SyntaxKind.WarningDirectiveTrivia:
- case SyntaxKind.LineDirectiveTrivia:
- case SyntaxKind.PragmaWarningDirectiveTrivia:
- case SyntaxKind.PragmaChecksumDirectiveTrivia:
- case SyntaxKind.ReferenceDirectiveTrivia:
- return CSTokenType.Directive;
- case SyntaxKind.BadDirectiveTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.SkippedTokensTrivia:
- return CSTokenType.Trivia;
- case SyntaxKind.ConflictMarkerTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.XmlElement:
- case SyntaxKind.XmlElementStartTag:
- case SyntaxKind.XmlElementEndTag:
- case SyntaxKind.XmlEmptyElement:
- case SyntaxKind.XmlTextAttribute:
- case SyntaxKind.XmlCrefAttribute:
- case SyntaxKind.XmlNameAttribute:
- case SyntaxKind.XmlName:
- case SyntaxKind.XmlPrefix:
- case SyntaxKind.XmlText:
- case SyntaxKind.XmlCDataSection:
- case SyntaxKind.XmlComment:
- case SyntaxKind.XmlProcessingInstruction:
- return CSTokenType.Trivia;
- case SyntaxKind.TypeCref:
- return CSTokenType.Unknown;
- case SyntaxKind.QualifiedCref:
- return CSTokenType.Unknown;
- case SyntaxKind.NameMemberCref:
- return CSTokenType.Unknown;
- case SyntaxKind.IndexerMemberCref:
- return CSTokenType.Unknown;
- case SyntaxKind.OperatorMemberCref:
- return CSTokenType.Unknown;
- case SyntaxKind.ConversionOperatorMemberCref:
- return CSTokenType.Unknown;
- case SyntaxKind.CrefParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.CrefBracketedParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.CrefParameter:
- return CSTokenType.Unknown;
- case SyntaxKind.IdentifierName:
- return CSTokenType.Name;
- case SyntaxKind.QualifiedName:
- return CSTokenType.Name;
- case SyntaxKind.GenericName:
- return CSTokenType.Name;
- case SyntaxKind.TypeArgumentList:
- return CSTokenType.Unknown;
- case SyntaxKind.AliasQualifiedName:
- return CSTokenType.Unknown;
- case SyntaxKind.PredefinedType:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.ArrayType:
- return CSTokenType.TypeKeyword;
- case SyntaxKind.ArrayRankSpecifier:
- return CSTokenType.Unknown;
- case SyntaxKind.PointerType:
- return CSTokenType.Unknown;
- case SyntaxKind.NullableType:
- return CSTokenType.Unknown;
- case SyntaxKind.OmittedTypeArgument:
- return CSTokenType.Unknown;
-
- case SyntaxKind.ParenthesizedExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ConditionalExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.InvocationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ElementAccessExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ArgumentList:
- return CSTokenType.Unknown;
- case SyntaxKind.BracketedArgumentList:
- return CSTokenType.Unknown;
- case SyntaxKind.Argument:
- return CSTokenType.Unknown;
- case SyntaxKind.NameColon:
- return CSTokenType.Unknown;
- case SyntaxKind.CastExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AnonymousMethodExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SimpleLambdaExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ParenthesizedLambdaExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ObjectInitializerExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.CollectionInitializerExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ArrayInitializerExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AnonymousObjectMemberDeclarator:
- return CSTokenType.Unknown;
- case SyntaxKind.ComplexElementInitializerExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ObjectCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AnonymousObjectCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ArrayCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ImplicitArrayCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.StackAllocArrayCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.OmittedArraySizeExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ImplicitElementAccess:
- return CSTokenType.Unknown;
- case SyntaxKind.IsPatternExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RangeExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ImplicitObjectCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AddExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SubtractExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.MultiplyExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.DivideExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ModuloExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LeftShiftExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RightShiftExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LogicalOrExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LogicalAndExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.BitwiseOrExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.BitwiseAndExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ExclusiveOrExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.EqualsExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.NotEqualsExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LessThanExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LessThanOrEqualExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.GreaterThanExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.GreaterThanOrEqualExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.IsExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AsExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.CoalesceExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SimpleMemberAccessExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PointerMemberAccessExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ConditionalAccessExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.UnsignedRightShiftExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.MemberBindingExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ElementBindingExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SimpleAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AddAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SubtractAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.MultiplyAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.DivideAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ModuloAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AndAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ExclusiveOrAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.OrAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LeftShiftAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RightShiftAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.CoalesceAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.UnsignedRightShiftAssignmentExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.UnaryPlusExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.UnaryMinusExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.BitwiseNotExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.LogicalNotExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PreIncrementExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PreDecrementExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PointerIndirectionExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AddressOfExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PostIncrementExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.PostDecrementExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.AwaitExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.IndexExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ThisExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.BaseExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ArgListExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.NumericLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.StringLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.CharacterLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.TrueLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.FalseLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.NullLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.DefaultLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.Utf8StringLiteralExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.TypeOfExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SizeOfExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.CheckedExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.UncheckedExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.DefaultExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.MakeRefExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RefValueExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RefTypeExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.QueryExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.QueryBody:
- return CSTokenType.Unknown;
- case SyntaxKind.FromClause:
- return CSTokenType.Unknown;
- case SyntaxKind.LetClause:
- return CSTokenType.Unknown;
- case SyntaxKind.JoinClause:
- return CSTokenType.Unknown;
- case SyntaxKind.JoinIntoClause:
- return CSTokenType.Unknown;
- case SyntaxKind.WhereClause:
- return CSTokenType.Unknown;
- case SyntaxKind.OrderByClause:
- return CSTokenType.Unknown;
- case SyntaxKind.AscendingOrdering:
- return CSTokenType.Unknown;
- case SyntaxKind.DescendingOrdering:
- return CSTokenType.Unknown;
- case SyntaxKind.SelectClause:
- return CSTokenType.Unknown;
- case SyntaxKind.GroupClause:
- return CSTokenType.Unknown;
- case SyntaxKind.QueryContinuation:
- return CSTokenType.Unknown;
- case SyntaxKind.Block:
- return CSTokenType.Unknown;
- case SyntaxKind.LocalDeclarationStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.VariableDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.VariableDeclarator:
- return CSTokenType.Unknown;
- case SyntaxKind.EqualsValueClause:
- return CSTokenType.Unknown;
- case SyntaxKind.ExpressionStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.EmptyStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.LabeledStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.GotoStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.GotoCaseStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.GotoDefaultStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.BreakStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ContinueStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ReturnStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.YieldReturnStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.YieldBreakStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ThrowStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.WhileStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.DoStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ForStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ForEachStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.UsingStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.FixedStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.CheckedStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.UncheckedStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.UnsafeStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.LockStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.IfStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.ElseClause:
- return CSTokenType.Unknown;
- case SyntaxKind.SwitchStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.SwitchSection:
- return CSTokenType.Unknown;
- case SyntaxKind.CaseSwitchLabel:
- return CSTokenType.Unknown;
- case SyntaxKind.DefaultSwitchLabel:
- return CSTokenType.Unknown;
- case SyntaxKind.TryStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.CatchClause:
- return CSTokenType.Unknown;
- case SyntaxKind.CatchDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.CatchFilterClause:
- return CSTokenType.Unknown;
- case SyntaxKind.FinallyClause:
- return CSTokenType.Unknown;
- case SyntaxKind.LocalFunctionStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.CompilationUnit:
- return CSTokenType.Unknown;
- case SyntaxKind.GlobalStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.NamespaceDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.UsingDirective:
- return CSTokenType.Unknown;
- case SyntaxKind.ExternAliasDirective:
- return CSTokenType.Unknown;
- case SyntaxKind.FileScopedNamespaceDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.AttributeList:
- return CSTokenType.Unknown;
- case SyntaxKind.AttributeTargetSpecifier:
- return CSTokenType.Unknown;
- case SyntaxKind.Attribute:
- return CSTokenType.Unknown;
- case SyntaxKind.AttributeArgumentList:
- return CSTokenType.Unknown;
- case SyntaxKind.AttributeArgument:
- return CSTokenType.Unknown;
- case SyntaxKind.NameEquals:
- return CSTokenType.Unknown;
- case SyntaxKind.ClassDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.StructDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.InterfaceDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.EnumDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.DelegateDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.BaseList:
- return CSTokenType.Unknown;
- case SyntaxKind.SimpleBaseType:
- return CSTokenType.Unknown;
- case SyntaxKind.TypeParameterConstraintClause:
- return CSTokenType.Unknown;
- case SyntaxKind.ConstructorConstraint:
- return CSTokenType.Unknown;
- case SyntaxKind.ClassConstraint:
- return CSTokenType.Unknown;
- case SyntaxKind.StructConstraint:
- return CSTokenType.Unknown;
- case SyntaxKind.TypeConstraint:
- return CSTokenType.Unknown;
- case SyntaxKind.ExplicitInterfaceSpecifier:
- return CSTokenType.Unknown;
- case SyntaxKind.EnumMemberDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.FieldDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.EventFieldDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.MethodDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.OperatorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.ConversionOperatorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.ConstructorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.BaseConstructorInitializer:
- return CSTokenType.Unknown;
- case SyntaxKind.ThisConstructorInitializer:
- return CSTokenType.Unknown;
- case SyntaxKind.DestructorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.PropertyDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.EventDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.IndexerDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.AccessorList:
- return CSTokenType.Unknown;
- case SyntaxKind.GetAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.SetAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.AddAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.RemoveAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.UnknownAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.ParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.BracketedParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.Parameter:
- return CSTokenType.Unknown;
- case SyntaxKind.TypeParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.TypeParameter:
- return CSTokenType.Unknown;
- case SyntaxKind.IncompleteMember:
- return CSTokenType.Unknown;
- case SyntaxKind.ArrowExpressionClause:
- return CSTokenType.Unknown;
- case SyntaxKind.Interpolation:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedStringText:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolationAlignmentClause:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolationFormatClause:
- return CSTokenType.Unknown;
- case SyntaxKind.ShebangDirectiveTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.LoadDirectiveTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.TupleType:
- return CSTokenType.Unknown;
- case SyntaxKind.TupleElement:
- return CSTokenType.Unknown;
- case SyntaxKind.TupleExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SingleVariableDesignation:
- return CSTokenType.Unknown;
- case SyntaxKind.ParenthesizedVariableDesignation:
- return CSTokenType.Unknown;
- case SyntaxKind.ForEachVariableStatement:
- return CSTokenType.Unknown;
- case SyntaxKind.DeclarationPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.ConstantPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.CasePatternSwitchLabel:
- return CSTokenType.Unknown;
- case SyntaxKind.WhenClause:
- return CSTokenType.Unknown;
- case SyntaxKind.DiscardDesignation:
- return CSTokenType.Unknown;
- case SyntaxKind.RecursivePattern:
- return CSTokenType.Unknown;
- case SyntaxKind.PropertyPatternClause:
- return CSTokenType.Unknown;
- case SyntaxKind.Subpattern:
- return CSTokenType.Unknown;
- case SyntaxKind.PositionalPatternClause:
- return CSTokenType.Unknown;
- case SyntaxKind.DiscardPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.SwitchExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SwitchExpressionArm:
- return CSTokenType.Unknown;
- case SyntaxKind.VarPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.ParenthesizedPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.RelationalPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.TypePattern:
- return CSTokenType.Unknown;
- case SyntaxKind.OrPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.AndPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.NotPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.SlicePattern:
- return CSTokenType.Unknown;
- case SyntaxKind.ListPattern:
- return CSTokenType.Unknown;
- case SyntaxKind.DeclarationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RefExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RefType:
- return CSTokenType.Unknown;
- case SyntaxKind.ThrowExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ImplicitStackAllocArrayCreationExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.SuppressNullableWarningExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.NullableDirectiveTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerType:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerParameter:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerParameterList:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerCallingConvention:
- return CSTokenType.Unknown;
- case SyntaxKind.InitAccessorDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.WithExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.WithInitializerExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.RecordDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.DefaultConstraint:
- return CSTokenType.Unknown;
- case SyntaxKind.PrimaryConstructorBaseType:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerUnmanagedCallingConventionList:
- return CSTokenType.Unknown;
- case SyntaxKind.FunctionPointerUnmanagedCallingConvention:
- return CSTokenType.Unknown;
- case SyntaxKind.RecordStructDeclaration:
- return CSTokenType.Unknown;
- case SyntaxKind.ExpressionColon:
- return CSTokenType.Unknown;
- case SyntaxKind.LineDirectivePosition:
- return CSTokenType.Unknown;
- case SyntaxKind.LineSpanDirectiveTrivia:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedSingleLineRawStringStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedMultiLineRawStringStartToken:
- return CSTokenType.Unknown;
- case SyntaxKind.InterpolatedRawStringEndToken:
- return CSTokenType.Unknown;
- case SyntaxKind.ScopedType:
- return CSTokenType.Unknown;
- case SyntaxKind.CollectionExpression:
- return CSTokenType.Unknown;
- case SyntaxKind.ExpressionElement:
- return CSTokenType.Unknown;
- case SyntaxKind.SpreadElement:
- return CSTokenType.Unknown;
- default:
- return CSTokenType.Unknown;
- }*/
- }
- }
-}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using System.Linq;
+using Crow.Text;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Crow;
+using IML = Crow.IML;
+using System.Collections;
+using System.Reflection;
+using CrowEditBase;
+using Drawing2D;
+
+//using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+
+using static CrowEditBase.CrowEditBase;
+using System.Threading;
+
+
+namespace CERoslynPlugin
+{
+ /*public static class Extensions {
+ public static CSTokenType GetTokenType (this Token tok) => (XmlTokenType)tok.Type;
+ public static void SetTokenType (this Token tok, CSTokenType type) => tok.Type = (TokenType)type;
+ }*/
+ public class CSDocument : SourceDocument {
+
+ static CSDocument () {
+ App.GetService<RoslynService> ()?.Start ();
+ }
+
+ public CSDocument (string fullPath, string editorPath) : base (fullPath, editorPath) { }
+
+ #region SourceDocument abstract class implementation
+ protected override SyntaxAnalyser CreateSyntaxAnalyser() => new CSSyntaxAnalyser (ImmutableBufferCopy);
+
+ public override IList GetSuggestions (int absoluteTextPos, int currentTokenIndex, SyntaxNode CurrentNode, CharLocation loc)
+ {
+ /*Token currentToken = GetTokenByIndex(currentTokenIndex);
+ throw new NotImplementedException();*/
+ return null;
+ }
+ #endregion
+
+ public override string GetTokenTypeString (TokenType tokenType) => ((SyntaxKind)tokenType).ToString();
+ public override Color GetColorForToken(Token token, SyntaxNode node = null)
+ {
+ if (node is CSToken cstok) {
+ Console.WriteLine($"=> {cstok.Parent}");
+ }
+ SyntaxKind syntaxKind = (SyntaxKind)token.Type;
+ TokenType tokType = token.Type;
+ CSTokenType csTokType = (CSTokenType)tokType;
+
+ if (SyntaxFacts.IsPredefinedType(syntaxKind))
+ return Colors.Fuchsia;
+ if (SyntaxFacts.IsLiteralExpression(syntaxKind))
+ return Colors.DarkGoldenRod;
+ if (SyntaxFacts.IsPreprocessorKeyword(syntaxKind))
+ return Colors.Indigo;
+ if (SyntaxFacts.IsKeywordKind(syntaxKind))
+ return Colors.DodgerBlue;
+ if (SyntaxFacts.IsPunctuation(syntaxKind))
+ return Colors.Black;
+
+ if (syntaxKind == SyntaxKind.IdentifierToken)
+ return Colors.Blue;
+
+ if (csTokType.HasFlag (CSTokenType.Punctuation))
+ return Colors.DarkGrey;
+ if (tokType.HasFlag (TokenType.WhiteSpace))
+ return Colors.Silver;
+ if (csTokType.HasFlag (CSTokenType.Trivia))
+ return Colors.DimGrey;
+ else if (csTokType == CSTokenType.Name)
+ return Colors.Green;
+ if (csTokType == CSTokenType.TypeKeyword)
+ return Colors.Blue;
+ if (csTokType == CSTokenType.Keyword)
+ return Colors.DarkBlue;
+ if (csTokType == CSTokenType.VisibilityKeyword)
+ return Colors.SlateBlue;
+ if (csTokType == CSTokenType.Directive)
+ return Colors.Black;
+ if (csTokType == CSTokenType.Operator)
+ return Colors.DarkSlateBlue;
+ return Colors.Red;
+
+ }
+
+ protected override void apply(TextChange change)
+ {
+ buffer.Update(change);
+ NotifyValueChanged ("IsDirty", IsDirty);
+ CMDSave.CanExecute = IsDirty;
+
+ parse();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2021-2025 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using CrowEditBase;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+
+namespace CERoslynPlugin
+{
+ public enum TriviaPos { none, leading, trailing };
+ public class CSRootSyntax : SyntaxRootNode {
+ public CSRootSyntax (ReadOnlyTextBuffer source) : base (source, null) { }
+ internal void SetTokens(Token[] tokens) {
+ this.tokens = tokens;
+ }
+ }
+ public class CSToken : SingleTokenSyntax {
+ SyntaxToken cstoken;
+ public CSToken(SyntaxToken token, Token tok) : base (tok) {
+ cstoken = token;
+ }
+ public override string ToString() => $"TOK: {cstoken.Kind()}";
+ }
+ public class CSTriviaSyntax : MultiNodeSyntax {
+ public TriviaPos TriviaPos;
+ public SyntaxTrivia Trivia;
+ public CSTriviaSyntax(SyntaxTrivia trivia, TriviaPos triviaPos) {
+ Trivia = trivia;
+ TriviaPos = triviaPos;
+ }
+ public override string ToString() => $"TriviaSyntax({TriviaPos}): {Trivia}";
+ }
+ public class CSTrivia : SingleTokenSyntax {
+ SyntaxTrivia cstrivia;
+ public CSTrivia(SyntaxTrivia token, Token tok) : base (tok) {
+ cstrivia = token;
+ }
+ public override string ToString() => $"Trivia: {cstrivia.Kind()}";
+ }
+ public class CSSyntaxNode : MultiNodeSyntax {
+ protected Microsoft.CodeAnalysis.SyntaxNode node;
+ public CSSyntaxNode(Microsoft.CodeAnalysis.SyntaxNode node) {
+ this.node = node;
+ }
+ public override string ToString() => $"{node.Kind()}";
+ }
+ public class CSUsingDirectiveSyntax : CSSyntaxNode {
+ public CSUsingDirectiveSyntax(Microsoft.CodeAnalysis.SyntaxNode node) : base(node) { }
+ /*public override int FoldedLineCount => base.FoldedLineCount;
+ public override bool IsFoldable => (PreviousSibling == null || !PreviousSibling.GetType().IsAssignableFrom(typeof(UsingDirectiveSyntax)))
+ && NextSibling != null && NextSibling.GetType().IsAssignableFrom(typeof(UsingDirectiveSyntax));*/
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2025 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+
+namespace CERoslynPlugin
+{
+ [Flags]
+ public enum CSTokenType {
+ Unknown,
+
+ Trivia = 0x0100,
+ WhiteSpace = 0x4100,
+ Tabulation = 0x4101,
+ LineBreak = 0x4102,
+ LineComment = 0x0103,
+ BlockCommentStart = 0x0104,
+ BlockComment = 0x0105,
+ BlockCommentEnd = 0x0106,
+ Name = 0x0200,
+ Punctuation = 0x0400,
+ OpenBrace = 0x0401,
+ CloseBrace = 0x0402,
+ OpenBracket = 0x0403,
+ CloseBracket = 0x0404,
+ OpenParen = 0x0405,
+ CloseParenToken = 0x0406,
+ DoubleQuote = 0x0407,
+ SingleQuote = 0x0408,
+
+ Operator = 0x0800,
+ Keyword = 0x1000,
+ TypeKeyword = 0x1001,
+ TryKeyword = 0x1002,
+ VisibilityKeyword = 0x1003,
+ NewKeyword = 0x1004,
+ Region = 0x1005,
+ Directive = 0x1006,
+
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Crow.Text;
+using System.Collections.Generic;
+using CrowEditBase;
+
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis;
+using SyntaxNode = Microsoft.CodeAnalysis.SyntaxNode;
+using System.Text.RegularExpressions;
+
+namespace CERoslynPlugin
+{
+ public class CSTokenizer : Tokenizer
+ {
+ public SyntaxTree syntaxTree;
+ public CSTokenizer(SyntaxTree syntaxTree) {
+ this.syntaxTree = syntaxTree;
+ }
+
+ public override Token[] Tokenize(ReadOnlySpan<char> source = default)
+ {
+ /*foreach (var e in Enum.GetNames(typeof(SyntaxKind))) {
+ Console.WriteLine($"case SyntaxKind.{e}:");
+ Console.WriteLine($"\treturn CSTokenType.Unknown;");
+ }*/
+
+// syntaxTree = CSharpSyntaxTree.ParseText(source.ToString());
+ CsharpSyntaxWalkerTokenizer bridge = new CsharpSyntaxWalkerTokenizer();
+ bridge.Visit(syntaxTree.GetRoot());
+ Toks = bridge.Toks;
+ return Toks.ToArray();
+ }
+
+ }
+
+ class CsharpSyntaxWalkerTokenizer : CSharpSyntaxWalker
+ {
+ public List<Token> Toks;
+ public CsharpSyntaxWalkerTokenizer () : base (SyntaxWalkerDepth.StructuredTrivia)
+ {
+ Toks = new List<Token>(100);
+ }
+ public override void Visit (SyntaxNode node)
+ {
+ base.Visit (node);
+ }
+
+ public override void VisitToken (SyntaxToken token)
+ {
+ VisitLeadingTrivia (token);
+
+ if (SyntaxFacts.IsLiteralExpression (token.Kind ())) {
+ addMultilineToken(token.ToString(), token.Span, (TokenType)convertTokenType(token.Kind()));
+ } else {
+ Microsoft.CodeAnalysis.Text.TextSpan span = token.Span;
+
+ Toks.Add (new Token(span.Start, span.Length, (TokenType)convertTokenType(token.Kind())));
+ }
+
+ VisitTrailingTrivia (token);
+ }
+
+ public override void VisitTrivia (SyntaxTrivia trivia)
+ {
+ SyntaxKind kind = trivia.Kind ();
+ Microsoft.CodeAnalysis.Text.TextSpan span = trivia.Span;
+ if (kind == SyntaxKind.EndOfLineTrivia) {
+ Toks.Add (new Token(span.Start, span.Length, TokenType.LineBreak));
+ return;
+ }
+ if (trivia.HasStructure)
+ this.Visit ((CSharpSyntaxNode)trivia.GetStructure());
+ else if (trivia.IsKind (SyntaxKind.DisabledTextTrivia) || trivia.IsKind (SyntaxKind.MultiLineCommentTrivia))
+ addMultilineToken(trivia.ToString(), trivia.Span, (TokenType)trivia.RawKind);
+ else {
+ Toks.Add (new Token(span.Start, span.Length, (TokenType)trivia.RawKind));
+ }
+ }
+ int startOfTok;
+ void addTok (ref SpanCharReader reader, int offset, Enum tokType) {
+ if (reader.CurrentPosition == startOfTok)
+ return;
+ Toks.Add (new Token((TokenType)tokType,startOfTok + offset, reader.CurrentPosition + offset));
+ startOfTok = reader.CurrentPosition;
+ }
+ void addMultilineToken(ReadOnlySpan<char> txt, Microsoft.CodeAnalysis.Text.TextSpan span, TokenType mainType) {
+ SpanCharReader reader = new SpanCharReader(txt);
+ startOfTok = 0;
+
+ while(!reader.EndOfSpan) {
+ switch (reader.Peek) {
+ case '\x85':
+ case '\x2028':
+ case '\xA':
+ addTok (ref reader, span.Start, mainType);
+ reader.Read();
+ addTok (ref reader, span.Start, TokenType.LineBreak);
+ break;
+ case '\xD':
+ addTok (ref reader, span.Start, mainType);
+ reader.Read();
+ if (reader.IsNextCharIn ('\xA', '\x85'))
+ reader.Read();
+ addTok (ref reader, span.Start, TokenType.LineBreak);
+ break;
+ case '\x20':
+ case '\x9':
+ addTok (ref reader, span.Start, mainType);
+ char c = reader.Read();
+ while (reader.TryPeek (c))
+ reader.Read();
+ addTok (ref reader, span.Start, c == '\x20' ? TokenType.WhiteSpace : TokenType.Tabulation);
+ break;
+ default:
+ reader.Read();
+ break;
+ }
+ }
+ addTok (ref reader, span.Start, mainType);
+ }
+ CSTokenType convertTokenType(SyntaxKind kind) {
+ return (CSTokenType)kind;
+ /*switch (kind) {
+ case SyntaxKind.None:
+ return CSTokenType.Unknown;
+ case SyntaxKind.List:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TildeToken:
+ case SyntaxKind.ExclamationToken:
+ case SyntaxKind.DollarToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.PercentToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.CaretToken:
+ case SyntaxKind.AmpersandToken:
+ case SyntaxKind.AsteriskToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.OpenParenToken:
+ return CSTokenType.OpenParen;
+ case SyntaxKind.CloseParenToken:
+ return CSTokenType.CloseParenToken;
+ case SyntaxKind.MinusToken:
+ case SyntaxKind.PlusToken:
+ case SyntaxKind.EqualsToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.OpenBraceToken:
+ return CSTokenType.OpenBrace;
+ case SyntaxKind.CloseBraceToken:
+ return CSTokenType.CloseBrace;
+ case SyntaxKind.OpenBracketToken:
+ return CSTokenType.OpenBracket;
+ case SyntaxKind.CloseBracketToken:
+ return CSTokenType.CloseBracket;
+ case SyntaxKind.BarToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.BackslashToken:
+ case SyntaxKind.ColonToken:
+ case SyntaxKind.SemicolonToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.DoubleQuoteToken:
+ return CSTokenType.DoubleQuote;
+ case SyntaxKind.SingleQuoteToken:
+ return CSTokenType.SingleQuote;
+ case SyntaxKind.LessThanToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.CommaToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.GreaterThanToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.DotToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.QuestionToken:
+ case SyntaxKind.HashToken:
+ case SyntaxKind.SlashToken:
+ case SyntaxKind.DotDotToken:
+ return CSTokenType.Punctuation;
+ case SyntaxKind.SlashGreaterThanToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LessThanSlashToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlCommentStartToken:
+ return CSTokenType.BlockCommentStart;
+ case SyntaxKind.XmlCommentEndToken:
+ return CSTokenType.BlockCommentEnd;
+ case SyntaxKind.XmlCDataStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlCDataEndToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlProcessingInstructionStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlProcessingInstructionEndToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BarBarToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AmpersandAmpersandToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MinusMinusToken:
+ case SyntaxKind.PlusPlusToken:
+ case SyntaxKind.ColonColonToken:
+ case SyntaxKind.QuestionQuestionToken:
+ case SyntaxKind.MinusGreaterThanToken:
+ case SyntaxKind.ExclamationEqualsToken:
+ case SyntaxKind.EqualsEqualsToken:
+ case SyntaxKind.EqualsGreaterThanToken:
+ case SyntaxKind.LessThanEqualsToken:
+ case SyntaxKind.LessThanLessThanToken:
+ case SyntaxKind.LessThanLessThanEqualsToken:
+ case SyntaxKind.GreaterThanEqualsToken:
+ case SyntaxKind.GreaterThanGreaterThanToken:
+ case SyntaxKind.GreaterThanGreaterThanEqualsToken:
+ case SyntaxKind.SlashEqualsToken:
+ case SyntaxKind.AsteriskEqualsToken:
+ case SyntaxKind.BarEqualsToken:
+ case SyntaxKind.AmpersandEqualsToken:
+ case SyntaxKind.PlusEqualsToken:
+ case SyntaxKind.MinusEqualsToken:
+ case SyntaxKind.CaretEqualsToken:
+ case SyntaxKind.PercentEqualsToken:
+ case SyntaxKind.QuestionQuestionEqualsToken:
+ case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
+ case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
+ return CSTokenType.Operator;
+ case SyntaxKind.BoolKeyword:
+ case SyntaxKind.ByteKeyword:
+ case SyntaxKind.SByteKeyword:
+ case SyntaxKind.ShortKeyword:
+ case SyntaxKind.UShortKeyword:
+ case SyntaxKind.IntKeyword:
+ case SyntaxKind.UIntKeyword:
+ case SyntaxKind.LongKeyword:
+ case SyntaxKind.ULongKeyword:
+ case SyntaxKind.DoubleKeyword:
+ case SyntaxKind.FloatKeyword:
+ case SyntaxKind.DecimalKeyword:
+ case SyntaxKind.StringKeyword:
+ case SyntaxKind.CharKeyword:
+ case SyntaxKind.VoidKeyword:
+ case SyntaxKind.ObjectKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.TypeOfKeyword:
+ case SyntaxKind.SizeOfKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.NullKeyword:
+ case SyntaxKind.TrueKeyword:
+ case SyntaxKind.FalseKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.IfKeyword:
+ case SyntaxKind.ElseKeyword:
+ case SyntaxKind.WhileKeyword:
+ case SyntaxKind.ForKeyword:
+ case SyntaxKind.ForEachKeyword:
+ case SyntaxKind.DoKeyword:
+ case SyntaxKind.SwitchKeyword:
+ case SyntaxKind.CaseKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.DefaultKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.TryKeyword:
+ case SyntaxKind.CatchKeyword:
+ case SyntaxKind.FinallyKeyword:
+ return CSTokenType.TryKeyword;
+ case SyntaxKind.LockKeyword:
+ case SyntaxKind.GotoKeyword:
+ case SyntaxKind.BreakKeyword:
+ case SyntaxKind.ContinueKeyword:
+ case SyntaxKind.ReturnKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.ThrowKeyword:
+ return CSTokenType.TryKeyword;
+ case SyntaxKind.PublicKeyword:
+ case SyntaxKind.PrivateKeyword:
+ case SyntaxKind.InternalKeyword:
+ case SyntaxKind.ProtectedKeyword:
+ case SyntaxKind.StaticKeyword:
+ case SyntaxKind.ReadOnlyKeyword:
+ case SyntaxKind.SealedKeyword:
+ return CSTokenType.VisibilityKeyword;
+ case SyntaxKind.ConstKeyword:
+ case SyntaxKind.FixedKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.StackAllocKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.VolatileKeyword:
+ return CSTokenType.VisibilityKeyword;
+ case SyntaxKind.NewKeyword:
+ return CSTokenType.NewKeyword;
+ case SyntaxKind.OverrideKeyword:
+ case SyntaxKind.AbstractKeyword:
+ case SyntaxKind.VirtualKeyword:
+ return CSTokenType.VisibilityKeyword;
+ case SyntaxKind.EventKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.ExternKeyword:
+ return CSTokenType.VisibilityKeyword;
+ case SyntaxKind.RefKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.OutKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.InKeyword:
+ case SyntaxKind.IsKeyword:
+ case SyntaxKind.AsKeyword:
+ return CSTokenType.Operator;
+ case SyntaxKind.ParamsKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArgListKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MakeRefKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefTypeKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefValueKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ThisKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.BaseKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.NamespaceKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.UsingKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.ClassKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.StructKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.InterfaceKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.EnumKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.DelegateKeyword:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.CheckedKeyword:
+ case SyntaxKind.UncheckedKeyword:
+ case SyntaxKind.UnsafeKeyword:
+ case SyntaxKind.OperatorKeyword:
+ case SyntaxKind.ExplicitKeyword:
+ case SyntaxKind.ImplicitKeyword:
+ case SyntaxKind.YieldKeyword:
+ case SyntaxKind.PartialKeyword:
+ case SyntaxKind.AliasKeyword:
+ case SyntaxKind.GlobalKeyword:
+ case SyntaxKind.AssemblyKeyword:
+ case SyntaxKind.ModuleKeyword:
+ case SyntaxKind.TypeKeyword:
+ case SyntaxKind.FieldKeyword:
+ case SyntaxKind.MethodKeyword:
+ case SyntaxKind.ParamKeyword:
+ case SyntaxKind.PropertyKeyword:
+ case SyntaxKind.TypeVarKeyword:
+ case SyntaxKind.GetKeyword:
+ case SyntaxKind.SetKeyword:
+ case SyntaxKind.AddKeyword:
+ case SyntaxKind.RemoveKeyword:
+ case SyntaxKind.WhereKeyword:
+ case SyntaxKind.FromKeyword:
+ case SyntaxKind.GroupKeyword:
+ case SyntaxKind.JoinKeyword:
+ case SyntaxKind.IntoKeyword:
+ case SyntaxKind.LetKeyword:
+ case SyntaxKind.ByKeyword:
+ case SyntaxKind.SelectKeyword:
+ case SyntaxKind.OrderByKeyword:
+ return CSTokenType.Keyword;
+ case SyntaxKind.OnKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EqualsKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AscendingKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DescendingKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NameOfKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AsyncKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AwaitKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WhenKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OrKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AndKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NotKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WithKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InitKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RecordKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ManagedKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnmanagedKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RequiredKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ScopedKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FileKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ElifKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndIfKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RegionKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndRegionKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DefineKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UndefKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WarningKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ErrorKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LineKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PragmaKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.HiddenKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ChecksumKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DisableKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RestoreKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ReferenceKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringEndToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedVerbatimStringStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LoadKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NullableKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EnableKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WarningsKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AnnotationsKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.VarKeyword:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnderscoreToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OmittedTypeArgumentToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OmittedArraySizeExpressionToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndOfDirectiveToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndOfDocumentationCommentToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndOfFileToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BadToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IdentifierToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NumericLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CharacterLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.StringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlEntityLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlTextLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlTextLiteralNewLineToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringTextToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SingleLineRawStringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MultiLineRawStringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Utf8StringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Utf8SingleLineRawStringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Utf8MultiLineRawStringLiteralToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EndOfLineTrivia:
+ return CSTokenType.LineBreak;
+ case SyntaxKind.WhitespaceTrivia:
+ return CSTokenType.WhiteSpace;
+ case SyntaxKind.SingleLineCommentTrivia:
+ return CSTokenType.LineComment;
+ case SyntaxKind.MultiLineCommentTrivia:
+ return CSTokenType.LineComment;
+ case SyntaxKind.DocumentationCommentExteriorTrivia:
+ case SyntaxKind.SingleLineDocumentationCommentTrivia:
+ case SyntaxKind.MultiLineDocumentationCommentTrivia:
+ case SyntaxKind.DisabledTextTrivia:
+ return CSTokenType.Trivia;
+ case SyntaxKind.PreprocessingMessageTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IfDirectiveTrivia:
+ case SyntaxKind.ElifDirectiveTrivia:
+ case SyntaxKind.ElseDirectiveTrivia:
+ case SyntaxKind.EndIfDirectiveTrivia:
+ return CSTokenType.Directive;
+ case SyntaxKind.RegionDirectiveTrivia:
+ case SyntaxKind.EndRegionDirectiveTrivia:
+ return CSTokenType.Region;
+ case SyntaxKind.DefineDirectiveTrivia:
+ case SyntaxKind.UndefDirectiveTrivia:
+ case SyntaxKind.ErrorDirectiveTrivia:
+ case SyntaxKind.WarningDirectiveTrivia:
+ case SyntaxKind.LineDirectiveTrivia:
+ case SyntaxKind.PragmaWarningDirectiveTrivia:
+ case SyntaxKind.PragmaChecksumDirectiveTrivia:
+ case SyntaxKind.ReferenceDirectiveTrivia:
+ return CSTokenType.Directive;
+ case SyntaxKind.BadDirectiveTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SkippedTokensTrivia:
+ return CSTokenType.Trivia;
+ case SyntaxKind.ConflictMarkerTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.XmlElement:
+ case SyntaxKind.XmlElementStartTag:
+ case SyntaxKind.XmlElementEndTag:
+ case SyntaxKind.XmlEmptyElement:
+ case SyntaxKind.XmlTextAttribute:
+ case SyntaxKind.XmlCrefAttribute:
+ case SyntaxKind.XmlNameAttribute:
+ case SyntaxKind.XmlName:
+ case SyntaxKind.XmlPrefix:
+ case SyntaxKind.XmlText:
+ case SyntaxKind.XmlCDataSection:
+ case SyntaxKind.XmlComment:
+ case SyntaxKind.XmlProcessingInstruction:
+ return CSTokenType.Trivia;
+ case SyntaxKind.TypeCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.QualifiedCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NameMemberCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IndexerMemberCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OperatorMemberCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConversionOperatorMemberCref:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CrefParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CrefBracketedParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CrefParameter:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IdentifierName:
+ return CSTokenType.Name;
+ case SyntaxKind.QualifiedName:
+ return CSTokenType.Name;
+ case SyntaxKind.GenericName:
+ return CSTokenType.Name;
+ case SyntaxKind.TypeArgumentList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AliasQualifiedName:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PredefinedType:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.ArrayType:
+ return CSTokenType.TypeKeyword;
+ case SyntaxKind.ArrayRankSpecifier:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PointerType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NullableType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OmittedTypeArgument:
+ return CSTokenType.Unknown;
+
+ case SyntaxKind.ParenthesizedExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConditionalExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InvocationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ElementAccessExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArgumentList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BracketedArgumentList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Argument:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NameColon:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CastExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AnonymousMethodExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SimpleLambdaExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ParenthesizedLambdaExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ObjectInitializerExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CollectionInitializerExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArrayInitializerExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AnonymousObjectMemberDeclarator:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ComplexElementInitializerExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ObjectCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AnonymousObjectCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArrayCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ImplicitArrayCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.StackAllocArrayCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OmittedArraySizeExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ImplicitElementAccess:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IsPatternExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RangeExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ImplicitObjectCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AddExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SubtractExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MultiplyExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DivideExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ModuloExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LeftShiftExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RightShiftExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LogicalOrExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LogicalAndExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BitwiseOrExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BitwiseAndExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExclusiveOrExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EqualsExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NotEqualsExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LessThanExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LessThanOrEqualExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GreaterThanExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GreaterThanOrEqualExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IsExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AsExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CoalesceExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SimpleMemberAccessExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PointerMemberAccessExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConditionalAccessExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnsignedRightShiftExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MemberBindingExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ElementBindingExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SimpleAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AddAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SubtractAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MultiplyAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DivideAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ModuloAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AndAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExclusiveOrAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OrAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LeftShiftAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RightShiftAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CoalesceAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnsignedRightShiftAssignmentExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnaryPlusExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnaryMinusExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BitwiseNotExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LogicalNotExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PreIncrementExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PreDecrementExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PointerIndirectionExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AddressOfExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PostIncrementExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PostDecrementExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AwaitExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IndexExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ThisExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BaseExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArgListExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NumericLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.StringLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CharacterLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TrueLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FalseLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NullLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DefaultLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Utf8StringLiteralExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypeOfExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SizeOfExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CheckedExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UncheckedExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DefaultExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MakeRefExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefValueExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefTypeExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.QueryExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.QueryBody:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FromClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LetClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.JoinClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.JoinIntoClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WhereClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OrderByClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AscendingOrdering:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DescendingOrdering:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SelectClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GroupClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.QueryContinuation:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Block:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LocalDeclarationStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.VariableDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.VariableDeclarator:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EqualsValueClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExpressionStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EmptyStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LabeledStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GotoStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GotoCaseStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GotoDefaultStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BreakStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ContinueStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ReturnStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.YieldReturnStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.YieldBreakStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ThrowStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WhileStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DoStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ForStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ForEachStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UsingStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FixedStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CheckedStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UncheckedStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnsafeStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LockStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IfStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ElseClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SwitchStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SwitchSection:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CaseSwitchLabel:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DefaultSwitchLabel:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TryStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CatchClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CatchDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CatchFilterClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FinallyClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LocalFunctionStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CompilationUnit:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GlobalStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NamespaceDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UsingDirective:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExternAliasDirective:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FileScopedNamespaceDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AttributeList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AttributeTargetSpecifier:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Attribute:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AttributeArgumentList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AttributeArgument:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NameEquals:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ClassDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.StructDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterfaceDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EnumDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DelegateDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BaseList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SimpleBaseType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypeParameterConstraintClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConstructorConstraint:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ClassConstraint:
+ return CSTokenType.Unknown;
+ case SyntaxKind.StructConstraint:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypeConstraint:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExplicitInterfaceSpecifier:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EnumMemberDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FieldDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EventFieldDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.MethodDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OperatorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConversionOperatorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConstructorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BaseConstructorInitializer:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ThisConstructorInitializer:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DestructorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PropertyDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.EventDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IndexerDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AccessorList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.GetAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SetAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AddAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RemoveAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.UnknownAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.BracketedParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Parameter:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypeParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypeParameter:
+ return CSTokenType.Unknown;
+ case SyntaxKind.IncompleteMember:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ArrowExpressionClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Interpolation:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedStringText:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolationAlignmentClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolationFormatClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ShebangDirectiveTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LoadDirectiveTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TupleType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TupleElement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TupleExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SingleVariableDesignation:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ParenthesizedVariableDesignation:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ForEachVariableStatement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DeclarationPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ConstantPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CasePatternSwitchLabel:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WhenClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DiscardDesignation:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RecursivePattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PropertyPatternClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.Subpattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PositionalPatternClause:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DiscardPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SwitchExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SwitchExpressionArm:
+ return CSTokenType.Unknown;
+ case SyntaxKind.VarPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ParenthesizedPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RelationalPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.TypePattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.OrPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.AndPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NotPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SlicePattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ListPattern:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DeclarationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RefType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ThrowExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ImplicitStackAllocArrayCreationExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SuppressNullableWarningExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.NullableDirectiveTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerParameter:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerParameterList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerCallingConvention:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InitAccessorDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WithExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.WithInitializerExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RecordDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.DefaultConstraint:
+ return CSTokenType.Unknown;
+ case SyntaxKind.PrimaryConstructorBaseType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerUnmanagedCallingConventionList:
+ return CSTokenType.Unknown;
+ case SyntaxKind.FunctionPointerUnmanagedCallingConvention:
+ return CSTokenType.Unknown;
+ case SyntaxKind.RecordStructDeclaration:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExpressionColon:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LineDirectivePosition:
+ return CSTokenType.Unknown;
+ case SyntaxKind.LineSpanDirectiveTrivia:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedSingleLineRawStringStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedMultiLineRawStringStartToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.InterpolatedRawStringEndToken:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ScopedType:
+ return CSTokenType.Unknown;
+ case SyntaxKind.CollectionExpression:
+ return CSTokenType.Unknown;
+ case SyntaxKind.ExpressionElement:
+ return CSTokenType.Unknown;
+ case SyntaxKind.SpreadElement:
+ return CSTokenType.Unknown;
+ default:
+ return CSTokenType.Unknown;
+ }*/
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-// Copyright (c) 2021-2025 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
-//
-// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-using CrowEditBase;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-
-namespace CERoslynPlugin
-{
- public enum TriviaPos { none, leading, trailing };
- public class CSRootSyntax : SyntaxRootNode {
- public CSRootSyntax (ReadOnlyTextBuffer source) : base (source, null) { }
- internal void SetTokens(Token[] tokens) {
- this.tokens = tokens;
- }
- }
- public class CSToken : SingleTokenSyntax {
- SyntaxToken cstoken;
- public CSToken(SyntaxToken token, Token tok) : base (tok) {
- cstoken = token;
- }
- public override string ToString() => $"TOK: {cstoken.Kind()}";
- }
- public class CSTriviaSyntax : MultiNodeSyntax {
- public TriviaPos TriviaPos;
- public SyntaxTrivia Trivia;
- public CSTriviaSyntax(SyntaxTrivia trivia, TriviaPos triviaPos) {
- Trivia = trivia;
- TriviaPos = triviaPos;
- }
- public override string ToString() => $"TriviaSyntax({TriviaPos}): {Trivia}";
- }
- public class CSTrivia : SingleTokenSyntax {
- SyntaxTrivia cstrivia;
- public CSTrivia(SyntaxTrivia token, Token tok) : base (tok) {
- cstrivia = token;
- }
- public override string ToString() => $"Trivia: {cstrivia.Kind()}";
- }
- public class CSSyntaxNode : MultiNodeSyntax {
- protected Microsoft.CodeAnalysis.SyntaxNode node;
- public CSSyntaxNode(Microsoft.CodeAnalysis.SyntaxNode node) {
- this.node = node;
- }
- public override string ToString() => $"{node.Kind()}";
- }
- public class CSUsingDirectiveSyntax : CSSyntaxNode {
- public CSUsingDirectiveSyntax(Microsoft.CodeAnalysis.SyntaxNode node) : base(node) { }
- /*public override int FoldedLineCount => base.FoldedLineCount;
- public override bool IsFoldable => (PreviousSibling == null || !PreviousSibling.GetType().IsAssignableFrom(typeof(UsingDirectiveSyntax)))
- && NextSibling != null && NextSibling.GetType().IsAssignableFrom(typeof(UsingDirectiveSyntax));*/
- }
-}
\ No newline at end of file
namespace CERoslynPlugin
{
public class RoslynService : Service {
- public override string[] ServiceWindowsPath => ["#CERoslynPlugin.ui.winConfiguration.crow"];
+ public override string[] ServiceWindowsPath => new string[] {"#CERoslynPlugin.ui.winConfiguration.crow"};
CELogger logger;
internal CELogger Logger {
get => logger;
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net9</TargetFrameworks>
+ <TargetFrameworks>net6</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
return null;
if (!eets.HasClosingToken)
sug.Change.ChangedText += ">";
- return new List<Suggestion>([sug]);
+ return new List<Suggestion>(new Suggestion[] {sug});
}
}
} else {//startTag or empty element
return null;
}
- public override Color GetColorForToken(Token token)
+ public override Color GetColorForToken(Token token, SyntaxNode node = null)
{
TokenType tokType = token.Type;
XmlTokenType xmlTokType = (XmlTokenType)tokType;
CMDSyntaxTheme_SaveAs = new ActionCommand ("Save As...", () => saveSyntaxThemeAs ());
}
+ void initKeyBindings () {
+
+ }
+
static void loadWindowWithThisDataSource(object sender, string path) {
Widget w = sender as Widget;
CrowEdit e = w.IFace as CrowEdit;
Template="#ui.ColorPicker2.template"/>
<ColorPicker Margin="0" DataSource="{Value}" RootDataLevel="true" MinimumSize="0,0" CurrentColor="{²Background}" Height="Stretched" Width="Stretched"
Template="#ui.ColorPicker2.template"/>
- <CheckBox DataSource="{Value}" RootDataLevel="true" Caption="" IsChecked="{²Bold}" />
- <CheckBox DataSource="{Value}" RootDataLevel="true" Caption="" IsChecked="{²Italic}" />
+ <Container DataSource="{Value}" RootDataLevel="true">
+ <CheckBox Caption="" IsChecked="{²Bold}" />
+ </Container>
+ <Container DataSource="{Value}" RootDataLevel="true">
+ <CheckBox DataSource="{Value}" RootDataLevel="true" Caption="" IsChecked="{²Italic}" />
+ </Container>
</TableRow>
</ItemTemplate>
</ListBox>