]> O.S.I.I.S - jp/crowedit.git/commitdiff
wip, save commit
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 21 Jul 2025 04:45:21 +0000 (06:45 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 21 Jul 2025 04:45:21 +0000 (06:45 +0200)
37 files changed:
CrowEdit.csproj
CrowEditBase/CrowEditBase.csproj
CrowEditBase/src/Compiler/SourceDocument.cs
CrowEditBase/src/CrowEditBase.cs
CrowEditBase/src/Editor.cs
CrowEditBase/src/Service.cs
CrowEditBase/src/SourceEditor.cs
SyntaxThemes/test.syntax [new file with mode: 0644]
plugins/CECrowPlugin/CECrowPlugin.csproj
plugins/CECrowPlugin/default.conf
plugins/CECrowPlugin/src/CrowService.cs
plugins/CECrowPlugin/src/DebugInterface.cs
plugins/CECrowPlugin/src/DebugInterfaceWidget.cs
plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs
plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs
plugins/CECrowPlugin/ui/IMLEditor.itmp [new file with mode: 0644]
plugins/CECrowPlugin/ui/winCrowPreview.crow
plugins/CEEbnfPlugin/CEEbnfPlugin.csproj
plugins/CEEbnfPlugin/src/Parsing/EbnfDocument.cs
plugins/CENetcoreDbgPlugin/CENetcoreDbgPlugin.csproj
plugins/CENetcoreDbgPlugin/src/NetcoreDbgService.cs
plugins/CENugetPlugin/CENugetPlugin.csproj
plugins/CENugetPlugin/src/NugetService.cs
plugins/CERoslynPlugin/CERoslynPlugin.csproj
plugins/CERoslynPlugin/src/CSDocument.cs [deleted file]
plugins/CERoslynPlugin/src/CSTokenType.cs [deleted file]
plugins/CERoslynPlugin/src/CSTokenizer.cs [deleted file]
plugins/CERoslynPlugin/src/Parsing/CSDocument.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/Parsing/CSSyntaxNodes.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/Parsing/CSTokenType.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/Parsing/CSTokenizer.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/Parsing/SyntaxNodes.cs [deleted file]
plugins/CERoslynPlugin/src/RoslynService.cs
plugins/CEXmlPlugin/CEXmlPlugin.csproj
plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs
src/CrowEdit.cs
ui/windows/winThemeEditor.crow

index 9415782d393f7f53a22ac1588866d1b6490c17ed..c77614be41394d1248385703be3e83d4558d54e6 100644 (file)
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFramework>net9</TargetFramework>
+               <TargetFramework>net6</TargetFramework>
                <OutputType>WinExe</OutputType>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
index 15f76efe8fcf28ea8b55198f6e3d3018640d7090..4f93924c0a968f5b342958bd954868252da126a5 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
 
index 8518ca825e19c93c68af65d40df770b9e0fb1c21..8ee2e1dd942d79add91e44b429af94e9cd8b2ca1 100644 (file)
@@ -128,7 +128,7 @@ namespace CrowEditBase
                }
                #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))
index 9be1cc79d314a35bfbe5a5f8fdaebcef6ac8231d..58459aa171dd36ade94974d28fc7ea6d4f297177 100644 (file)
@@ -48,6 +48,7 @@ namespace CrowEditBase
                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;
index 50128dad61f0e23585c2fb0fffa9302177c17eeb..4eebf3ed6d14e64d45a8ddf94856a8d8de6132e7 100644 (file)
@@ -32,9 +32,9 @@ namespace CrowEditBase
 
                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);
                }
index 3f042a7d31e3e7e9baaffc3be03a7234b0cb738b..80967d4ada7c22cc1b8416f1ebb31c9ab35c6eda 100644 (file)
@@ -67,7 +67,7 @@ namespace CrowEditBase
                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;
        }
index 6208f0d6f94dfbb9d910745685559f79f38d2f6e..a12b1c4b19fc4dedaa65d70af6353ffcf085b53c 100644 (file)
@@ -568,7 +568,7 @@ namespace CrowEditBase
                        }
                }
 
-
+               #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;
@@ -869,6 +869,8 @@ namespace CrowEditBase
                        }
                        gr.Translate (ScrollX, 0);
                }
+               #endregion
+
                protected override RectangleD? computeTextCursor (Rectangle cursor) {
                        Rectangle cb = ClientRectangle;
                        cursor -= new Point (ScrollX, ScrollY);
diff --git a/SyntaxThemes/test.syntax b/SyntaxThemes/test.syntax
new file mode 100644 (file)
index 0000000..aec7a6a
--- /dev/null
@@ -0,0 +1,28 @@
+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
index ad99b95b6a0c2225e16ffc70903daf8ba315d8ba..6a23cfde378116924d409439af7195bec1e39ba8 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
 
index ec9ddfd80601e18dfcec5116b643b3f9d0159dc3..4ba1084651b18d7b88ee8b5076cfae9333e4c9c4 100644 (file)
@@ -1,2 +1,2 @@
 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
index b47295e67270b0f443db1ce4fe5bfc0430448345..80a9865449bd7f8ff75b62bb28a800a68fe5ebf4 100644 (file)
@@ -24,8 +24,11 @@ using CERoslynPlugin;
 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;
@@ -41,13 +44,19 @@ namespace CECrowPlugin
                                        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;
@@ -145,6 +154,7 @@ namespace CECrowPlugin
                }
                
                Project currentSolution;
+               Document currentDocument;
                Exception currentException;
                public string ErrorMessage = "";
                public bool ServiceIsInError;
@@ -312,8 +322,7 @@ namespace CECrowPlugin
                                CMDRun.CanExecute = value;
                                NotifyValueChanged(value);
                        }
-               }
-               
+               }               
                public double ZoomFactor {
                        get => Configuration.Global.Get<Double> ("CrowPreviewZoomFactor", 1.0);
                        set {
@@ -388,19 +397,23 @@ namespace CECrowPlugin
                        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;
+                                               }
                                        }
                                }
                        }
@@ -624,6 +637,21 @@ namespace CECrowPlugin
                                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;
@@ -1064,7 +1092,5 @@ namespace CECrowPlugin
                        }
                }
                #endregion
-
-
        }
 }
\ No newline at end of file
index a021908ee5bcb3535bd466acf3025e259d304062..c85f0e99f8a3e1e014bf5b42572c4d6685bc7d54 100644 (file)
@@ -154,9 +154,6 @@ namespace CECrowPlugin
                        
                        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,
@@ -199,10 +196,11 @@ namespace CECrowPlugin
                        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 () {
index 7fbaf5b4e93856855149553b282a6072558090c1..559b6c3afec93820ec9fb532a555b7d64a308536 100644 (file)
@@ -17,6 +17,7 @@ using Crow;
 namespace CECrowPlugin
 {
        public class DebugInterfaceWidget : Widget {
+               #region CTOR/DTOR
                public DebugInterfaceWidget () : base () {
                        
                        CrowIFaceService = App.GetService<CrowService> ();
@@ -54,7 +55,9 @@ namespace CECrowPlugin
                        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;
@@ -79,8 +82,8 @@ namespace CECrowPlugin
                        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;
@@ -132,6 +135,7 @@ namespace CECrowPlugin
                                RegisterForRepaint ();
                        }
                }
+               
                protected void backgroundThreadFunc () {
                        Stopwatch sw = Stopwatch.StartNew ();
                        int refreshRate = crowIFaceService == null ? 10 : crowIFaceService.RefreshRate;
@@ -164,7 +168,16 @@ namespace CECrowPlugin
 
                        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 ();
                }
@@ -223,10 +236,10 @@ namespace CECrowPlugin
                                        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.
index 34a684f975e32bd13414c35464f9d3837fa59fe7..031f0cf8d99fd5abb8db144281112a9bfd2b3bc7 100644 (file)
@@ -37,6 +37,36 @@ namespace CECrowPlugin
                        }*/
                }
 
+               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();
 
@@ -200,7 +230,7 @@ namespace CECrowPlugin
                        return null;
                }
 
-               public override Color GetColorForToken(Token token)
+               public override Color GetColorForToken(Token token, SyntaxNode node = null)
                {
                        TokenType tokType = token.Type;
                        switch ((ImlTokenType)tokType) {
index 98c95535078acca6f17d4f856c63e56ed2ff2319..bf83d6724fe8322e349a8543fdda2a1ec7dec837 100644 (file)
@@ -32,7 +32,7 @@ namespace CECrowPlugin.Style
                        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;
diff --git a/plugins/CECrowPlugin/ui/IMLEditor.itmp b/plugins/CECrowPlugin/ui/IMLEditor.itmp
new file mode 100644 (file)
index 0000000..b5cda47
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>
index e0edc44b184ff426a13d7726523fca95e745d5e8..c32cdb7278aa391c1a847b276d87bebf9599dc76 100644 (file)
@@ -1,10 +1,14 @@
 <?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>
index 7752c0c820742a0129ae618d5f06d0021f089895..c560bb204c9dfdb5017b8ecdfaec5f67dc78be1c 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
        <ItemGroup>
index 010a6ff2823ad4784edc981bf7618a5f05ac7a6a..a80ea5b1d0c10fa3ba987b5b80198fc18c40de60 100644 (file)
@@ -23,7 +23,7 @@ namespace CrowEdit.Ebnf
                        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;
index 891c3a0e0efe5f4be2ccfaa6c0326cb623b3ba52..4b1ed392b765c3bedfe8a81435a22bb41c9c45f3 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
 
index 83a9e12a2b719d69eb61eda28f108460d66947da..326a8e70233b3ef48be0a146875e82e84204c794 100644 (file)
@@ -10,7 +10,7 @@ using Crow;
 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;
index 5baba235089cf3df722e80e504cd09b035321349..7de324e826b08ccc27ce714d0fba5fe8dec38ee1 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
 
index d460325b2b2a7bb72241e3930ae7bd99f105f1ea..56ea8e834402e22be78e8b0b635e4a42746a6d99 100644 (file)
@@ -26,7 +26,7 @@ using System.Net.Http;
 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();
index 0aa3ed12e12129fc1e68005efccc3f82688f66c5..00b4cb02e06bb946fbd3a95a29800d4f7a9d8775 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
        <ItemGroup>
diff --git a/plugins/CERoslynPlugin/src/CSDocument.cs b/plugins/CERoslynPlugin/src/CSDocument.cs
deleted file mode 100644 (file)
index 292317e..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// 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
diff --git a/plugins/CERoslynPlugin/src/CSTokenType.cs b/plugins/CERoslynPlugin/src/CSTokenType.cs
deleted file mode 100644 (file)
index f33801d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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
diff --git a/plugins/CERoslynPlugin/src/CSTokenizer.cs b/plugins/CERoslynPlugin/src/CSTokenizer.cs
deleted file mode 100644 (file)
index 9076639..0000000
+++ /dev/null
@@ -1,1123 +0,0 @@
-// 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
diff --git a/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs b/plugins/CERoslynPlugin/src/Parsing/CSDocument.cs
new file mode 100644 (file)
index 0000000..a12ceb3
--- /dev/null
@@ -0,0 +1,105 @@
+// 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
diff --git a/plugins/CERoslynPlugin/src/Parsing/CSSyntaxNodes.cs b/plugins/CERoslynPlugin/src/Parsing/CSSyntaxNodes.cs
new file mode 100644 (file)
index 0000000..d502494
--- /dev/null
@@ -0,0 +1,54 @@
+// 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
diff --git a/plugins/CERoslynPlugin/src/Parsing/CSTokenType.cs b/plugins/CERoslynPlugin/src/Parsing/CSTokenType.cs
new file mode 100644 (file)
index 0000000..f33801d
--- /dev/null
@@ -0,0 +1,42 @@
+// 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
diff --git a/plugins/CERoslynPlugin/src/Parsing/CSTokenizer.cs b/plugins/CERoslynPlugin/src/Parsing/CSTokenizer.cs
new file mode 100644 (file)
index 0000000..9076639
--- /dev/null
@@ -0,0 +1,1123 @@
+// 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
diff --git a/plugins/CERoslynPlugin/src/Parsing/SyntaxNodes.cs b/plugins/CERoslynPlugin/src/Parsing/SyntaxNodes.cs
deleted file mode 100644 (file)
index d502494..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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
index 9df1211da53a1702da2d6c6b0de212323d97b314..e9275ef13bed424b18eec93df32afff6cf1a51cc 100644 (file)
@@ -18,7 +18,7 @@ using Crow;
 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;
index 3b9707f27efe861c989db9a798ca38563ebf993f..1718ec85ac4f86c5935722e85ff0f5cb0485b431 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>net9</TargetFrameworks>
+               <TargetFrameworks>net6</TargetFrameworks>
                <EnableDefaultItems>false</EnableDefaultItems>
        </PropertyGroup>
 
index eaac3c1658c1a2d2d4f9e30e8ade24681de34432..1ef21b74b83bba219eb57f6f5ce07ef439b3c026 100644 (file)
@@ -48,7 +48,7 @@ namespace CrowEdit.Xml
                                                                        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
@@ -105,7 +105,7 @@ namespace CrowEdit.Xml
                        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;
index a206b1c4f50af81f62638b4a46088bc79686c861..444d2c0acbae5e1791b21de32ab7ffb4993e920c 100644 (file)
@@ -142,6 +142,10 @@ namespace CrowEdit
                        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;
index 0c828cb676044a41aca2c34e53f50afab60cdfe9..8242c441abebb47090305ab02ca5d46478f489cd 100644 (file)
                                                                 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>