]> O.S.I.I.S - jp/crowedit.git/commitdiff
exceptions dockwin, rename document RW Mutex, syntaxRootNode
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 25 Feb 2025 12:36:58 +0000 (13:36 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 25 Feb 2025 12:36:58 +0000 (13:36 +0100)
25 files changed:
CrowEditBase/src/Compiler/SourceDocument.cs
CrowEditBase/src/Compiler/SyntaxAnalyser.cs
CrowEditBase/src/Compiler/SyntaxException.cs
CrowEditBase/src/CrowEditBase.cs
CrowEditBase/src/Document.cs
CrowEditBase/src/Editor.cs
CrowEditBase/src/SourceEditor.cs
CrowEditBase/src/TextDocument.cs
CrowEditBase/ui/sourceEditor.itmp
plugins/CECrowPlugin/src/ImlDocument.cs [deleted file]
plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs [new file with mode: 0644]
plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxAnalyser.cs [new file with mode: 0644]
plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxNodes.cs [new file with mode: 0644]
plugins/CECrowPlugin/src/Parsing/IML/SyntaxAnalyser.cs [deleted file]
plugins/CECrowPlugin/src/Parsing/IML/SyntaxNodes.cs [deleted file]
plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs [new file with mode: 0644]
plugins/CECrowPlugin/src/Parsing/Styling/SyntaxAnalyser.cs
plugins/CECrowPlugin/src/StyleDocument.cs [deleted file]
plugins/CEEbnfPlugin/src/Parsing/EbnfSyntaxAnalyser.cs
plugins/CERoslynPlugin/src/CSSyntaxAnalyser.cs [new file with mode: 0644]
plugins/CERoslynPlugin/src/SyntaxAnalyser.cs [deleted file]
plugins/CEXmlPlugin/src/Parsing/XmlDocument.cs
plugins/CEXmlPlugin/src/Parsing/XmlSyntaxAnalyser.cs
src/CrowEdit.cs
ui/windows/winExceptions.crow [new file with mode: 0644]

index c2ffdb5c2f065658f201845b449501b61780e906..741db824710e61db1e2eb917b05fdc0abdddaf75 100644 (file)
@@ -17,7 +17,10 @@ namespace CrowEditBase
                        : base (fullPath, editorPath) {
                }
                protected Token[] tokens;
-               protected SyntaxNode RootNode;
+               protected SyntaxRootNode root;
+               protected int currentTokenIndex;
+               SyntaxNode currentNode;
+
                protected Token currentToken => currentTokenIndex < 0 ? default : tokens[currentTokenIndex];
                protected Token? previousToken {
                        get {
@@ -26,7 +29,6 @@ namespace CrowEditBase
                                return tokens[currentTokenIndex-1];
                        }
                }
-               SyntaxNode currentNode;
                public SyntaxNode CurrentNode {
                        get => currentNode;
                        set {
@@ -36,16 +38,15 @@ namespace CrowEditBase
                                NotifyValueChanged ("CurrentNode", currentNode);
                        }
                }
-               public string CurrentTokenString => RootNode?.Root.GetTokenStringByIndex (currentTokenIndex);
+               public string CurrentTokenString => root?.GetTokenStringByIndex (currentTokenIndex);
                public Token CurrentToken => currentToken;
-               public bool IsParsed => tokens.Length > 0 && RootNode != null;
+               public bool IsParsed => tokens.Length > 0 && root != null;
+               public SyntaxRootNode Root => root;
 
                //public SyntaxNode EditedNode { get; protected set; }
-               protected int currentTokenIndex;
 
                public Token[] Tokens => tokens;
-               public SyntaxNode SyntaxRootNode => RootNode;
-               public IEnumerable<SyntaxNode> SyntaxRootChildNodes => RootNode?.children;
+               public IEnumerable<SyntaxNode> SyntaxRootChildNodes => root?.children;
                public LineCollection Lines => lines;
                public Token FindTokenIncludingPosition (int pos) {
                        if (pos == 0 || tokens == null || tokens.Length == 0)
@@ -65,30 +66,30 @@ namespace CrowEditBase
                /// if outermost is true, return oldest ancestor exept root node, useful for folding.
                /// </summary>
                public SyntaxNode FindNodeIncludingPosition (int pos, bool outerMost = false) {
-                       if (RootNode == null)
+                       if (root == null)
                                return null;
-                       if (!RootNode.Contains (pos))
+                       if (!root.Contains (pos))
                                return null;
-                       SyntaxNode sn = RootNode.FindNodeIncludingPosition (pos);
+                       SyntaxNode sn = root.FindNodeIncludingPosition (pos);
                        if (outerMost) {
-                               while (sn.Parent != RootNode && sn.Span.Start == sn.Parent.Span.Start)
+                               while (sn.Parent != root && sn.Span.Start == sn.Parent.Span.Start)
                                        sn = sn.Parent;
                        }
                        return sn;
                }
                public T FindNodeIncludingPosition<T> (int pos) {
-                       if (RootNode == null)
+                       if (root == null)
                                return default;
-                       if (!RootNode.Contains (pos))
+                       if (!root.Contains (pos))
                                return default;
-                       return RootNode.FindNodeIncludingPosition<T> (pos);
+                       return root.FindNodeIncludingPosition<T> (pos);
                }
                public SyntaxNode FindNodeIncludingSpan (TextSpan span) {
-                       if (RootNode == null)
+                       if (root == null)
                                return null;
-                       if (!RootNode.Contains (span))
+                       if (!root.Contains (span))
                                return null;
-                       return RootNode.FindNodeIncludingSpan (span);
+                       return root.FindNodeIncludingSpan (span);
                }
                protected override void reloadFromFile () {
                        base.reloadFromFile ();
@@ -104,24 +105,23 @@ namespace CrowEditBase
                        SyntaxAnalyser syntaxAnalyser = CreateSyntaxAnalyser ();
                        
                        if (syntaxAnalyser == null) {
-                               RootNode = null;
+                               root = null;
                                return;
                        }
 
-                       SyntaxNode changedNode = RootNode.FindNodeIncludingSpan (TextSpan.FromStartAndLength (change.Start, change.ChangedText.Length));
-                       
+                       //SyntaxNode changedNode = root.FindNodeIncludingSpan (TextSpan.FromStartAndLength (change.Start, change.ChangedText.Length));                  
                        
                        tokens = tokenizer.Tokenize (buffer.Span);
-
-
                        syntaxAnalyser.Process ();
-                       NotifyValueChanged("Exceptions", syntaxAnalyser.Exceptions);
 
+                       root = syntaxAnalyser.Root;
+                       NotifyValueChanged("Exceptions", syntaxAnalyser.Exceptions);
+                       /*
                        SyntaxNode newNode = syntaxAnalyser.Root.FindNodeIncludingSpan (TextSpan.FromStartAndLength (change.Start, change.ChangedText.Length));
 
                        if (editedNode == null) {
                                //System.Diagnostics.Debugger.Break ();
-                               RootNode = syntaxAnalyser.Root;
+                               root = syntaxAnalyser.Root;
                        } else if (newNode.IsSimilar (editedNode)) {
                                if (!tryReplaceNode (editedNode, newNode))
                                        RootNode = syntaxAnalyser.Root;
@@ -138,6 +138,7 @@ namespace CrowEditBase
                                //System.Diagnostics.Debugger.Break ();
                                RootNode = syntaxAnalyser.Root;
                        }
+                       */
 
                        //updateCurrentTokAndNode (change.End2);
                        //EditedNode = editedNode;
@@ -197,16 +198,11 @@ namespace CrowEditBase
                        Stopwatch sw = Stopwatch.StartNew ();
                        syntaxAnalyser?.Process ();
                        sw.Stop();
-                       RootNode = syntaxAnalyser?.Root;
+                       root = syntaxAnalyser?.Root;
 
                        //CrowEditBase.App.Log (LogType.Low, $"Syntax Analysis done in {sw.ElapsedMilliseconds}(ms) {sw.ElapsedTicks}(ticks)");
                        if (syntaxAnalyser == null)
                                return;
-                       LogItem log = CrowEditBase.App.GetLog(this.FileName);
-                       log.ResetLog();
-                       foreach (SyntaxException ex in syntaxAnalyser.Exceptions)
-                               log.Add(LogType.Error, $"{ex}");
-
                                /*foreach (Token t in Tokens)
                                        Console.WriteLine ($"{t,-40} {Source.AsSpan(t.Start, t.Length).ToString()}");
                                syntaxAnalyser.Root.Dump();*/
index ab2df6784b707d2125c02050b758b46260a0b332..cad6fe1b26ce749545634cd978afab53e8ed0565 100644 (file)
@@ -10,7 +10,7 @@ namespace CrowEditBase
        public abstract class SyntaxAnalyser {
                //protected abstract void Parse(SyntaxNode node);
                protected SourceDocument source;
-               public abstract SyntaxNode Root { get; }
+               public SyntaxRootNode Root { get; protected set; }
                public IEnumerable<SyntaxException> Exceptions => Root?.GetAllExceptions();
                public SyntaxAnalyser (SourceDocument source) {
                        this.source = source;
index d889cc349c354f79f8fb11e6300f2f956d851deb..3031acb3577b14c8281f15c166c28188c7ba6f8a 100644 (file)
@@ -7,10 +7,13 @@ namespace CrowEditBase
 {
        public class SyntaxException : Exception {
                public readonly Token Token;
-               public SyntaxException(string message, Token token = default, Exception innerException = null)
+               public readonly SyntaxAnalyser SyntaxAnalyser;
+               public SyntaxException(string message, Token token = default, SyntaxAnalyser syntaxAnalyser = null, Exception innerException = null)
                                : base (message, innerException) {
                        Token = token;
+                       SyntaxAnalyser = syntaxAnalyser;
                }
-        public override string ToString() => $"{Message}, {Token}";
+               public string TokenString => SyntaxAnalyser.Root.GetTokenString(Token);
+        public override string ToString() => $"{Message}: {TokenString}";
     }
 }
\ No newline at end of file
index 985c14b1bfc5976910776f62ba8e4f226ffabb0e..9ca47496081670cb1fb2cfc4fddc4039f2512430 100644 (file)
@@ -23,6 +23,18 @@ namespace CrowEditBase
                        Log(LogType.Normal,"Crow edit started");
                }
 
+               protected DockStack mainDock;
+               protected const string _defaultFileName = "unnamed.txt";
+               Document currentDocument;
+               Editor currentEditor;
+               Project currentProject;
+               public CommandGroup CommandsRoot, FileCommands, EditCommands, ViewCommands;
+               public ObservableList<Document> OpenedDocuments = new ObservableList<Document> ();
+               public ObservableList<Service> Services = new ObservableList<Service> ();
+               public ObservableList<Plugin> Plugins = new ObservableList<Plugin> ();
+               public ObservableList<Project> Projects = new ObservableList<Project> ();
+
+
                #region logging
                LogItem currentLog;
                public LogItem CurrentLog {
@@ -116,16 +128,7 @@ namespace CrowEditBase
                #endregion
 
 
-               protected const string _defaultFileName = "unnamed.txt";
 
-               Document currentDocument;
-               Editor currentEditor;
-               Project currentProject;
-               public CommandGroup CommandsRoot, FileCommands, EditCommands, ViewCommands;
-               public ObservableList<Document> OpenedDocuments = new ObservableList<Document> ();
-               public ObservableList<Service> Services = new ObservableList<Service> ();
-               public ObservableList<Plugin> Plugins = new ObservableList<Plugin> ();
-               public ObservableList<Project> Projects = new ObservableList<Project> ();
                public T GetService<T> () where T : Service {
                        T service = Services.OfType<T>().FirstOrDefault ();
                        if (service == null) {
@@ -375,7 +378,6 @@ namespace CrowEditBase
 
                        Configuration.Global.Save ();
                }
-               protected DockStack mainDock;
                protected void reloadWinConfigs() {
 
                        if (Configuration.Global.TryGet<string>("WinConfigs", out string conf) && !string.IsNullOrEmpty(conf))
index 56ef87845e104a4d94c25593c95d847c73ad31bd..03db4e518b1b31a9cd905fcb1dcbfdebab2d765a 100644 (file)
@@ -28,11 +28,11 @@ namespace CrowEditBase
                public string EditorPath { get; private set; }//the ressource path is used as an id for editor template selection.
                public event EventHandler CloseEvent;
 
-               protected ReaderWriterLockSlim editorRWLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
-               public void EnterReadLock () => editorRWLock.EnterReadLock ();
-               public void ExitReadLock () => editorRWLock.ExitReadLock ();
-               public void EnterWriteLock () => editorRWLock.EnterWriteLock ();
-               public void ExitWriteLock () => editorRWLock.ExitWriteLock ();
+               protected ReaderWriterLockSlim documentRWLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
+               public void EnterReadLock () => documentRWLock.EnterReadLock ();
+               public void ExitReadLock () => documentRWLock.ExitReadLock ();
+               public void EnterWriteLock () => documentRWLock.EnterWriteLock ();
+               public void ExitWriteLock () => documentRWLock.ExitWriteLock ();
 
                public abstract bool TryGetState<T> (object client, out T state);
                public abstract void RegisterClient (object client);
@@ -98,14 +98,14 @@ namespace CrowEditBase
                protected abstract void readFromDisk ();
                protected abstract void initNewFile ();
                protected virtual void reloadFromFile () {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        try {
                                if (File.Exists (FullPath))
                                        readFromDisk ();
                                else
                                        initNewFile ();
                        } finally {
-                               editorRWLock.ExitWriteLock ();
+                               documentRWLock.ExitWriteLock ();
                        }
                }
                public abstract bool IsDirty { get; }
index dc9613f49b1b351bf0db7b31caa2256635da655c..f447ad5749672841e047ede5f001212519e534aa 100644 (file)
@@ -805,9 +805,12 @@ namespace Crow
                public override void onKeyPress (object sender, KeyPressEventArgs e) {
                        base.onKeyPress (sender, e);
 
-                       TextSpan selection = Selection;
-                       update (new TextChange (selection.Start, selection.Length, e.KeyChar.ToString ()));
+                       if (!e.Handled) {
+                               TextSpan selection = Selection;
+                               update (new TextChange (selection.Start, selection.Length, e.KeyChar.ToString ()));
 
+                               e.Handled = true;
+                       }
                        /*Insert (e.KeyChar.ToString());
 
                        SelRelease = -1;
index 7a77750e15db67d83cca11ed5d41be4b4b639b14..9535d9e7a9613c886b917880c3734e672aea6d4c 100644 (file)
@@ -331,7 +331,7 @@ namespace Crow
                                if (Document is SourceDocument doc) {
                                        switch (e.Key) {
                                                case Key.F3:
-                                                       doc.SyntaxRootNode?.Dump();
+                                                       doc.Root?.Dump();
                                                        break;
                                                case Key.Enter:
                                                case Key.KeypadEnter:
@@ -355,7 +355,7 @@ namespace Crow
                SyntaxNode getFoldStartingAt (int line) {
                        if (!(Document is SourceDocument doc))
                                return null;
-                       IEnumerable<SyntaxNode> folds = doc.SyntaxRootNode.FoldableNodes;
+                       IEnumerable<SyntaxNode> folds = doc.Root.FoldableNodes;
                        if (folds == null)
                                return null;
                        return folds.FirstOrDefault (n => n.StartLine == line);
@@ -365,7 +365,7 @@ namespace Crow
                                return null;
                        doc.EnterReadLock();
                        try {
-                               IEnumerable<SyntaxNode> folds = doc.SyntaxRootNode.FoldableNodes;
+                               IEnumerable<SyntaxNode> folds = doc.Root.FoldableNodes;
                                if (folds == null)
                                        return null;
                                return folds.LastOrDefault (n => n.StartLine <= line && n.EndLine >= line);
@@ -380,7 +380,7 @@ namespace Crow
                        doc.EnterReadLock();
                        try {
                                int foldedLines = 0;
-                               IEnumerator<SyntaxNode> foldsEnum = doc.SyntaxRootNode.FoldableNodes.GetEnumerator();
+                               IEnumerator<SyntaxNode> foldsEnum = doc.Root.FoldableNodes.GetEnumerator();
                                bool notEndOfFolds = foldsEnum.MoveNext();
                                while (notEndOfFolds && foldsEnum.Current.StartLine < absoluteLine) {
                                        if (foldsEnum.Current.isFolded) {
@@ -405,7 +405,7 @@ namespace Crow
                        doc.EnterReadLock();
                        try {
                                int foldedLines = 0;
-                               IEnumerator<SyntaxNode> nodeEnum = doc.SyntaxRootNode.FoldableNodes.GetEnumerator ();
+                               IEnumerator<SyntaxNode> nodeEnum = doc.Root.FoldableNodes.GetEnumerator ();
                                if (!nodeEnum.MoveNext())
                                        return 0;
 
@@ -615,7 +615,7 @@ namespace Crow
 
                                SyntaxNode curNode = null;
 
-                               IEnumerator<SyntaxNode> nodeEnum = doc.SyntaxRootNode.FoldableNodes.GetEnumerator ();
+                               IEnumerator<SyntaxNode> nodeEnum = doc.Root.FoldableNodes.GetEnumerator ();
                                bool notEndOfNodes = nodeEnum.MoveNext();
 
                                gr.LineWidth = 1;
index d64ce276f8a1b11853ff4e80fe651720b8181954..9242e5b6739b860032c09ab585768f77ced8ba5e 100644 (file)
@@ -79,28 +79,28 @@ namespace CrowEditBase
                Dictionary<object, List<TextChange>> registeredClients = new Dictionary<object, List<TextChange>>();
                public override bool TryGetState<T>(object client, out T state) {
                        state = default;
-                       if (editorRWLock.TryEnterReadLock (10)) {
+                       if (documentRWLock.TryEnterReadLock (10)) {
                                try {
                                        state = (T)(object)registeredClients[client];
                                        registeredClients[client] = null;
                                } finally {
-                                       editorRWLock.ExitReadLock ();
+                                       documentRWLock.ExitReadLock ();
                                }
                        }
                        return state != null;
                }
                public override void RegisterClient(object client)
                {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        registeredClients.Add (client, null);
                        //notifyClient (client, new TextChange (0, 0, source));
-                       editorRWLock.ExitWriteLock ();
+                       documentRWLock.ExitWriteLock ();
                }
                public override void UnregisterClient(object client)
                {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        registeredClients.Remove (client);
-                       editorRWLock.ExitWriteLock ();
+                       documentRWLock.ExitWriteLock ();
                }
                void notifyClients (TextChange tc, object triggeringClient = null) {
                        object[] clients = registeredClients.Keys.ToArray ();
@@ -140,7 +140,7 @@ namespace CrowEditBase
                        buffer = new TextBuffer("");
                }
                protected override void reloadFromFile () {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        try {
                                if (File.Exists (FullPath))
                                        readFromDisk ();
@@ -148,7 +148,7 @@ namespace CrowEditBase
                                        initNewFile ();
                                resetUndoRedo ();
                        } finally {
-                               editorRWLock.ExitWriteLock ();
+                               documentRWLock.ExitWriteLock ();
                        }
                }
                protected Stack<TextChange> undoStack = new Stack<TextChange> ();
@@ -173,7 +173,7 @@ namespace CrowEditBase
                }
 
                protected override void undo () {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        try {
                                if (undoStack.TryPop (out TextChange tc)) {
                                        redoStack.Push (tc.Inverse (source));
@@ -185,11 +185,11 @@ namespace CrowEditBase
                                if (undoStack.Count == 0)
                                        CMDUndo.CanExecute = false;
                        } finally {
-                               editorRWLock.ExitWriteLock ();
+                               documentRWLock.ExitWriteLock ();
                        }
                }
                protected override void redo () {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        try {
                                if (redoStack.TryPop (out TextChange tc)) {
                                        undoStack.Push (tc.Inverse (source));
@@ -200,7 +200,7 @@ namespace CrowEditBase
                                if (redoStack.Count == 0)
                                        CMDRedo.CanExecute = false;
                        } finally {
-                               editorRWLock.ExitWriteLock ();
+                               documentRWLock.ExitWriteLock ();
                        }
 
                }
@@ -220,7 +220,7 @@ namespace CrowEditBase
                        CMDSave.CanExecute = IsDirty;                   
                }
                protected void applyTextChange (TextChange change, object triggeringEditor = null) {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        try {
                                undoStack.Push (change.Inverse (source));
                                redoStack.Clear ();
@@ -229,15 +229,14 @@ namespace CrowEditBase
                                apply (change);
                                notifyClients (change, triggeringEditor);
                        } finally {
-                               editorRWLock.ExitWriteLock ();
+                               documentRWLock.ExitWriteLock ();
                        }
-
                }
                protected void onTextChanged (object sender, TextChangeEventArgs e) {
                        applyTextChange (e.Change, sender);
                }
                protected void getLines () {
-                       editorRWLock.EnterWriteLock ();
+                       documentRWLock.EnterWriteLock ();
                        if (lines == null)
                                lines = new LineCollection (10);
                        else
@@ -247,10 +246,10 @@ namespace CrowEditBase
                                lines.Add (new TextLine (0, 0, 0));
                        else
                                lines.Update (source);
-                       editorRWLock.ExitWriteLock ();
+                       documentRWLock.ExitWriteLock ();
                }
                public string GetLineBreak () {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                if (string.IsNullOrEmpty (lineBreak)) {
                                        mixedLineBreak = false;
@@ -271,32 +270,32 @@ namespace CrowEditBase
                                }
                                return lineBreak;
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public CharLocation GetLocation (int absolutePosition) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return lines.GetLocation (absolutePosition);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public int GetAbsolutePosition (CharLocation loc) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return lines.GetAbsolutePosition (loc);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public CharLocation EndLocation {
                        get {
-                               editorRWLock.EnterReadLock ();
+                               documentRWLock.EnterReadLock ();
                                try {
                                        return new CharLocation (lines.Count - 1, lines[lines.Count - 1].Length);
                                } finally {
-                                       editorRWLock.ExitReadLock();
+                                       documentRWLock.ExitReadLock();
                                }
                        }
                }
@@ -304,59 +303,59 @@ namespace CrowEditBase
                        get {
                                if (lines == null)
                                        getLines();
-                               editorRWLock.EnterReadLock ();
+                               documentRWLock.EnterReadLock ();
                                try {
                                        return lines.Count;
                                } finally {
-                                       editorRWLock.ExitReadLock();
+                                       documentRWLock.ExitReadLock();
                                }
                        }
                }
                public int Lenght {
                        get {
-                               editorRWLock.EnterReadLock ();
+                               documentRWLock.EnterReadLock ();
                                try {
                                        return source.Length;
                                } finally {
-                                       editorRWLock.ExitReadLock();
+                                       documentRWLock.ExitReadLock();
                                }
                        }
                }
                public TextLine GetLine (int index) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return lines[index];
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public ReadOnlySpan<char> GetText (TextLine line) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return source.GetLine (line);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public ReadOnlySpan<char> GetText (TextSpan span) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return source.Slice (span.Start, span.Length);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public char GetChar (int pos){
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                return source[pos];
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
 
                public virtual CharLocation GetWordStart (CharLocation loc) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                int pos = lines.GetAbsolutePosition (loc);
                                //skip white spaces
@@ -366,11 +365,11 @@ namespace CrowEditBase
                                        pos--;
                                return lines.GetLocation (pos);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
                public virtual CharLocation GetWordEnd (CharLocation loc) {
-                       editorRWLock.EnterReadLock ();
+                       documentRWLock.EnterReadLock ();
                        try {
                                int pos = lines.GetAbsolutePosition (loc);
                                //skip white spaces
@@ -380,7 +379,7 @@ namespace CrowEditBase
                                        pos++;
                                return lines.GetLocation (pos);
                        } finally {
-                               editorRWLock.ExitReadLock();
+                               documentRWLock.ExitReadLock();
                        }
                }
        }
index ffeb398a70a2463cd861ea462d337022a28138cf..54967ac895e74527348c8c5151f0459de878404d 100644 (file)
@@ -36,7 +36,5 @@
                                <Label Text="Col:" Foreground="Grey"/>
                                <Label Text="{../../tb.TabulatedColumn}" Margin="3"/>
                        </HorizontalStack>
-               <Splitter/>
-               <ListBox Data='{Exceptions}' Height='100' Width='Stretched'/>
        </VerticalStack>
 </ListItem>
diff --git a/plugins/CECrowPlugin/src/ImlDocument.cs b/plugins/CECrowPlugin/src/ImlDocument.cs
deleted file mode 100644 (file)
index 9d4ddc3..0000000
+++ /dev/null
@@ -1,165 +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 static CrowEditBase.CrowEditBase;
-
-using CrowEdit.Xml;
-
-using AttributeSyntax = CrowEdit.Xml.AttributeSyntax;
-using Drawing2D;
-
-namespace CECrowPlugin
-{
-       public class ImlDocument : XmlDocument {
-
-
-               public ImlDocument (string fullPath, string editorPath) : base (fullPath, editorPath) {
-                       App.GetService<CrowService> ()?.Start ();
-
-                       /*if (project is MSBuildProject msbp) {
-                               if (msbp.IsCrowProject)
-                       }*/
-               }
-               protected override Tokenizer CreateTokenizer() => new ImlTokenizer ();
-               protected override SyntaxAnalyser CreateSyntaxAnalyser() => new ImlSyntaxAnalyser (this);
-               public override string GetTokenTypeString (TokenType tokenType) => ((ImlTokenType)tokenType).ToString();
-
-               string[] allWidgetNames = typeof (Widget).Assembly.GetExportedTypes ().Where(t=>typeof(Widget).IsAssignableFrom (t))
-                                       .Select (s => s.Name).ToArray ();
-
-
-               IEnumerable<MemberInfo> getAllCrowTypeMembers (string crowTypeName) {
-                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);
-                       return crowType?.GetMembers (BindingFlags.Public | BindingFlags.Instance).
-                               Where (m=>((m is PropertyInfo pi && pi.CanWrite) || (m is EventInfo)) &&
-                                               m.GetCustomAttribute<XmlIgnoreAttribute>() == null);
-               }
-               MemberInfo getCrowTypeMember (string crowTypeName, string memberName) {
-                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);
-                       return crowType.GetMember (memberName, BindingFlags.Public | BindingFlags.Instance).FirstOrDefault ();
-               }
-               
-               protected bool previousTokHasFlag(ImlTokenType flag) => previousToken.HasValue && previousToken.Value.Type.HasFlag(flag);
-               
-               protected bool tryCast<TOUT> (object objectToCast, out TOUT result) {
-                       result = default;
-                       if (typeof(TOUT).IsAssignableFrom(objectToCast.GetType())) {
-                               result = (TOUT)objectToCast;
-                               return true;
-                       }
-
-                       return false;
-               }
-               public override IList GetSuggestions (CharLocation loc) {
-                       IList sugs = base.GetSuggestions (loc);
-                       if (sugs != null)
-                               return sugs;
-
-                       //Token tok = currentToken.Length == 0 || currentToken.Type.HasFlag(TokenType.Trivia) ? previousToken : currentToken;
-                       Token tok = currentToken;
-
-                       if (tok.GetTokenType() == XmlTokenType.ElementOpen)
-                               return new List<string> (allWidgetNames);
-                       if (tok.GetTokenType() == XmlTokenType.ElementName)
-                               return allWidgetNames.Where (s => s.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                       if ((tok.Type.HasFlag(TokenType.WhiteSpace) || previousTokHasFlag(TokenType.WhiteSpace)) &&
-                                               tryCast(CurrentNode, out ElementTagSyntax ets)) {
-                               if (ets.name.HasValue)
-                                       return getAllCrowTypeMembers (ets.Name).ToList();
-                               return null;
-                       }
-                                               
-                       if (CurrentNode is CrowEdit.Xml.AttributeSyntax attribNode) {
-                               if (CurrentNode.Parent is ElementTagSyntax eltTag) {
-                                       if (!string.IsNullOrEmpty (eltTag.Name)) {
-                                               if (tok.GetTokenType() == XmlTokenType.AttributeName) {
-                                                       return getAllCrowTypeMembers (eltTag.Name)
-                                                               .Where (s => s.Name.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                               } else if (!string.IsNullOrEmpty (attribNode.Name)) {
-                                                       if (tok.GetTokenType() == XmlTokenType.AttributeValue) {
-                                                               MemberInfo mi = getCrowTypeMember (
-                                                                       eltTag.Name, attribNode.Name);
-                                                               if (mi is PropertyInfo pi) {
-                                                                       if (pi.Name == "Style")
-                                                                               return App.Styling.Keys
-                                                                                       .Where (s => s.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                                       if (pi.PropertyType.IsEnum)
-                                                                               return Enum.GetNames (pi.PropertyType)
-                                                                                       .Where (s => s.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                                       if (pi.PropertyType == typeof(bool))
-                                                                               return  (new string[] {"true", "false"}).
-                                                                                       Where (s => s.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                                       if (pi.PropertyType == typeof (Measure))
-                                                                               return (new string[] {"Stretched", "Fit"}).
-                                                                                       Where (s => s.StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                                       if (pi.PropertyType == typeof (Fill))
-                                                                               return  EnumsNET.Enums.GetValues<Colors> ()
-                                                                                       .Where (s => s.ToString().StartsWith (RootNode.Root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
-                                                               }
-                                                       } else if (tok.GetTokenType() == XmlTokenType.AttributeValueOpen) {
-                                                               MemberInfo mi = getCrowTypeMember (
-                                                                       eltTag.Name, attribNode.Name);
-                                                               if (mi is PropertyInfo pi) {
-                                                                       if (pi.Name == "Style")
-                                                                               return App.Styling.Keys.ToList ();
-                                                                       if (pi.PropertyType.IsEnum)
-                                                                               return  Enum.GetNames (pi.PropertyType).ToList ();
-                                                                       if (pi.PropertyType == typeof(bool))
-                                                                               return  new List<string> (new string[] {"true", "false"});
-                                                                       if (pi.PropertyType == typeof (Fill))
-                                                                               return  EnumsNET.Enums.GetValues<Colors> ().ToList ();
-                                                                       if (pi.PropertyType == typeof (Measure))
-                                                                               return  new List<string> (new string[] {"Stretched", "Fit"});
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       } /*else if (tok.GetTokenType() != XmlTokenType.AttributeValueClose &&
-                                       tok.GetTokenType() != XmlTokenType.EmptyElementClosing &&
-                                       tok.GetTokenType() != XmlTokenType.ClosingSign &&
-                                       CurrentNode is ElementStartTagSyntax eltStartTag) {
-                               if (tok.GetTokenType() == XmlTokenType.AttributeName)
-                                       return getAllCrowTypeMembers (eltStartTag.Name)
-                                               .Where (s => s.Name.StartsWith (tok.AsString (Source), StringComparison.OrdinalIgnoreCase)).ToList ();
-                               //else if (tok.Type == TokenType.ElementName)
-                               //      Suggestions = getAllCrowTypeMembers (eltStartTag.NameToken.Value.AsString (Source)).ToList ();
-                       } else {
-                       }*/
-                       return null;
-               }
-               public override bool TryGetCompletionForCurrentToken (object suggestion, out TextChange change, out TextSpan? newSelection) {
-                       return base.TryGetCompletionForCurrentToken (suggestion is MemberInfo mi ? mi.Name : suggestion, out change, out newSelection);
-               }
-
-               public override Color GetColorForToken(TokenType tokType)
-               {
-                       switch ((ImlTokenType)tokType) {
-                               case ImlTokenType.BindingOpen:
-                               case ImlTokenType.BindingClose:
-                                       return Colors.DarkGreen;
-                               case ImlTokenType.BindingName: return Colors.RoyalBlue;
-                               case ImlTokenType.BindingDot: 
-                               case ImlTokenType.BindingDoubleDot: 
-                               case ImlTokenType.BindingLevel: 
-                                       return Colors.MediumVioletRed;
-                               case ImlTokenType.ConstantName:
-                               case ImlTokenType.ConstantRefOpen:
-                               case ImlTokenType.ConstantRefClose:
-                                       return Colors.Brown;
-                       }
-                       return base.GetColorForToken (tokType);
-               }
-       }
-}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs b/plugins/CECrowPlugin/src/Parsing/IML/ImlDocument.cs
new file mode 100644 (file)
index 0000000..72988c6
--- /dev/null
@@ -0,0 +1,165 @@
+// 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 static CrowEditBase.CrowEditBase;
+
+using CrowEdit.Xml;
+
+using AttributeSyntax = CrowEdit.Xml.AttributeSyntax;
+using Drawing2D;
+
+namespace CECrowPlugin
+{
+       public class ImlDocument : XmlDocument {
+
+
+               public ImlDocument (string fullPath, string editorPath) : base (fullPath, editorPath) {
+                       App.GetService<CrowService> ()?.Start ();
+
+                       /*if (project is MSBuildProject msbp) {
+                               if (msbp.IsCrowProject)
+                       }*/
+               }
+               protected override Tokenizer CreateTokenizer() => new ImlTokenizer ();
+               protected override SyntaxAnalyser CreateSyntaxAnalyser() => new ImlSyntaxAnalyser (this);
+               public override string GetTokenTypeString (TokenType tokenType) => ((ImlTokenType)tokenType).ToString();
+
+               string[] allWidgetNames = typeof (Widget).Assembly.GetExportedTypes ().Where(t=>typeof(Widget).IsAssignableFrom (t))
+                                       .Select (s => s.Name).ToArray ();
+
+
+               IEnumerable<MemberInfo> getAllCrowTypeMembers (string crowTypeName) {
+                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);
+                       return crowType?.GetMembers (BindingFlags.Public | BindingFlags.Instance).
+                               Where (m=>((m is PropertyInfo pi && pi.CanWrite) || (m is EventInfo)) &&
+                                               m.GetCustomAttribute<XmlIgnoreAttribute>() == null);
+               }
+               MemberInfo getCrowTypeMember (string crowTypeName, string memberName) {
+                       Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName);
+                       return crowType.GetMember (memberName, BindingFlags.Public | BindingFlags.Instance).FirstOrDefault ();
+               }
+               
+               protected bool previousTokHasFlag(ImlTokenType flag) => previousToken.HasValue && previousToken.Value.Type.HasFlag(flag);
+               
+               protected bool tryCast<TOUT> (object objectToCast, out TOUT result) {
+                       result = default;
+                       if (typeof(TOUT).IsAssignableFrom(objectToCast.GetType())) {
+                               result = (TOUT)objectToCast;
+                               return true;
+                       }
+
+                       return false;
+               }
+               public override IList GetSuggestions (CharLocation loc) {
+                       IList sugs = base.GetSuggestions (loc);
+                       if (sugs != null)
+                               return sugs;
+
+                       //Token tok = currentToken.Length == 0 || currentToken.Type.HasFlag(TokenType.Trivia) ? previousToken : currentToken;
+                       Token tok = currentToken;
+
+                       if (tok.GetTokenType() == XmlTokenType.ElementOpen)
+                               return new List<string> (allWidgetNames);
+                       if (tok.GetTokenType() == XmlTokenType.ElementName)
+                               return allWidgetNames.Where (s => s.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                       if ((tok.Type.HasFlag(TokenType.WhiteSpace) || previousTokHasFlag(TokenType.WhiteSpace)) &&
+                                               tryCast(CurrentNode, out ElementTagSyntax ets)) {
+                               if (ets.name.HasValue)
+                                       return getAllCrowTypeMembers (ets.Name).ToList();
+                               return null;
+                       }
+                                               
+                       if (CurrentNode is CrowEdit.Xml.AttributeSyntax attribNode) {
+                               if (CurrentNode.Parent is ElementTagSyntax eltTag) {
+                                       if (!string.IsNullOrEmpty (eltTag.Name)) {
+                                               if (tok.GetTokenType() == XmlTokenType.AttributeName) {
+                                                       return getAllCrowTypeMembers (eltTag.Name)
+                                                               .Where (s => s.Name.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                               } else if (!string.IsNullOrEmpty (attribNode.Name)) {
+                                                       if (tok.GetTokenType() == XmlTokenType.AttributeValue) {
+                                                               MemberInfo mi = getCrowTypeMember (
+                                                                       eltTag.Name, attribNode.Name);
+                                                               if (mi is PropertyInfo pi) {
+                                                                       if (pi.Name == "Style")
+                                                                               return App.Styling.Keys
+                                                                                       .Where (s => s.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                                                       if (pi.PropertyType.IsEnum)
+                                                                               return Enum.GetNames (pi.PropertyType)
+                                                                                       .Where (s => s.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                                                       if (pi.PropertyType == typeof(bool))
+                                                                               return  (new string[] {"true", "false"}).
+                                                                                       Where (s => s.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                                                       if (pi.PropertyType == typeof (Measure))
+                                                                               return (new string[] {"Stretched", "Fit"}).
+                                                                                       Where (s => s.StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                                                       if (pi.PropertyType == typeof (Fill))
+                                                                               return  EnumsNET.Enums.GetValues<Colors> ()
+                                                                                       .Where (s => s.ToString().StartsWith (root.GetTokenString(tok), StringComparison.OrdinalIgnoreCase)).ToList ();
+                                                               }
+                                                       } else if (tok.GetTokenType() == XmlTokenType.AttributeValueOpen) {
+                                                               MemberInfo mi = getCrowTypeMember (
+                                                                       eltTag.Name, attribNode.Name);
+                                                               if (mi is PropertyInfo pi) {
+                                                                       if (pi.Name == "Style")
+                                                                               return App.Styling.Keys.ToList ();
+                                                                       if (pi.PropertyType.IsEnum)
+                                                                               return  Enum.GetNames (pi.PropertyType).ToList ();
+                                                                       if (pi.PropertyType == typeof(bool))
+                                                                               return  new List<string> (new string[] {"true", "false"});
+                                                                       if (pi.PropertyType == typeof (Fill))
+                                                                               return  EnumsNET.Enums.GetValues<Colors> ().ToList ();
+                                                                       if (pi.PropertyType == typeof (Measure))
+                                                                               return  new List<string> (new string[] {"Stretched", "Fit"});
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       } /*else if (tok.GetTokenType() != XmlTokenType.AttributeValueClose &&
+                                       tok.GetTokenType() != XmlTokenType.EmptyElementClosing &&
+                                       tok.GetTokenType() != XmlTokenType.ClosingSign &&
+                                       CurrentNode is ElementStartTagSyntax eltStartTag) {
+                               if (tok.GetTokenType() == XmlTokenType.AttributeName)
+                                       return getAllCrowTypeMembers (eltStartTag.Name)
+                                               .Where (s => s.Name.StartsWith (tok.AsString (Source), StringComparison.OrdinalIgnoreCase)).ToList ();
+                               //else if (tok.Type == TokenType.ElementName)
+                               //      Suggestions = getAllCrowTypeMembers (eltStartTag.NameToken.Value.AsString (Source)).ToList ();
+                       } else {
+                       }*/
+                       return null;
+               }
+               public override bool TryGetCompletionForCurrentToken (object suggestion, out TextChange change, out TextSpan? newSelection) {
+                       return base.TryGetCompletionForCurrentToken (suggestion is MemberInfo mi ? mi.Name : suggestion, out change, out newSelection);
+               }
+
+               public override Color GetColorForToken(TokenType tokType)
+               {
+                       switch ((ImlTokenType)tokType) {
+                               case ImlTokenType.BindingOpen:
+                               case ImlTokenType.BindingClose:
+                                       return Colors.DarkGreen;
+                               case ImlTokenType.BindingName: return Colors.RoyalBlue;
+                               case ImlTokenType.BindingDot: 
+                               case ImlTokenType.BindingDoubleDot: 
+                               case ImlTokenType.BindingLevel: 
+                                       return Colors.MediumVioletRed;
+                               case ImlTokenType.ConstantName:
+                               case ImlTokenType.ConstantRefOpen:
+                               case ImlTokenType.ConstantRefClose:
+                                       return Colors.Brown;
+                       }
+                       return base.GetColorForToken (tokType);
+               }
+       }
+}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxAnalyser.cs b/plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxAnalyser.cs
new file mode 100644 (file)
index 0000000..db7aa17
--- /dev/null
@@ -0,0 +1,134 @@
+// Copyright (c) 2021-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.Collections.Generic;
+using System.Linq;
+using CrowEditBase;
+using CrowEdit.Xml;
+
+namespace CECrowPlugin
+{
+       public class ImlSyntaxAnalyser : XmlSyntaxAnalyser {
+               public ImlSyntaxAnalyser (ImlDocument source) : base (source) {
+                       this.source = source;
+               }
+
+
+               public override void Process () {
+
+                       base.Process();
+
+/*
+                       ImlDocument xmlDoc = source as ImlDocument;
+                       Exceptions = new List<SyntaxException> ();
+                       currentNode = new XMLRootSyntax (xmlDoc);
+                       currentLine = 0;
+                       Span<Token> toks = source.Tokens;
+                       tokIdx = 0;
+
+                       while (tokIdx < toks.Length) {
+                               Token curTok = toks[tokIdx];
+                               if (curTok.Type == TokenType.LineBreak)
+                                       currentLine++;
+                               else if (!curTok.Type.HasFlag (TokenType.Trivia)) {
+                                       if (currentNode is ElementStartTagSyntax tag) {
+                                               if (curTok.GetTokenType() == XmlTokenType.AttributeName) {
+                                                       AttributeSyntax attribute = new AttributeSyntax (currentLine, tokIdx);
+                                                       attribute.name = 0;
+                                                       currentNode = currentNode.AddChild (attribute);
+                                               } else if (curTok.GetTokenType() == XmlTokenType.ElementName)
+                                                       tag.name = tokIdx - tag.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.ClosingSign) {
+                                                       storeCurrentNode ();
+                                                       currentNode.RemoveChild (tag);
+                                                       currentNode = currentNode.AddChild (new ElementSyntax (tag));
+                                               } else if (curTok.GetTokenType() == XmlTokenType.EmptyElementClosing) {
+                                                       storeCurrentNode ();
+                                                       currentNode.RemoveChild (tag);
+                                                       currentNode = currentNode.AddChild (new EmptyElementSyntax (tag));
+                                                       setCurrentNodeEndLine (currentLine);
+                                                       currentNode = currentNode.Parent;
+                                               } else {
+                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
+                                                       storeCurrentNode (-1);
+                                                       continue;
+                                               }
+                                       } else if (currentNode is ElementSyntax elt) {
+                                               if (curTok.GetTokenType() == XmlTokenType.ElementOpen)
+                                                       currentNode = currentNode.AddChild (new ElementStartTagSyntax (currentLine, tokIdx));
+                                               else if (curTok.GetTokenType() == XmlTokenType.EndElementOpen) {
+                                                       elt.EndTag = new ElementEndTagSyntax (currentLine, tokIdx);
+                                                       currentNode = elt.AddChild (elt.EndTag);
+                                               }
+                                       } else if (currentNode is AttributeSyntax attrib) {
+                                               if (curTok.GetTokenType() == XmlTokenType.EqualSign)
+                                                       if (attrib.equal.HasValue)
+                                                               Exceptions.Add (new SyntaxException  ("Extra equal sign in attribute syntax", curTok));
+                                                       else
+                                                               attrib.equal = tokIdx - attrib.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValueOpen)
+                                                       attrib.valueOpen = tokIdx - attrib.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValue)
+                                                       attrib.valueTok = tokIdx - attrib.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValueClose) {
+                                                       attrib.valueClose = tokIdx - attrib.TokenIndexBase;
+                                                       storeCurrentNode ();
+                                               } else {
+                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
+                                                       storeCurrentNode (-1);
+                                                       continue;
+                                               }
+                                       } else if (currentNode is ElementEndTagSyntax eltEndTag) {
+                                               if (curTok.GetTokenType() == XmlTokenType.ElementName)
+                                                       eltEndTag.name = tokIdx - eltEndTag.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.ClosingSign) {
+                                                       //go up 2 times
+                                                       storeCurrentNode (); storeCurrentNode ();
+                                               } else {
+                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
+                                                       storeCurrentNode (-1);
+                                                       storeCurrentNode (-1);
+                                                       continue;
+                                               }
+                                       } else if (currentNode is XMLRootSyntax) {
+                                               switch (curTok.GetTokenType()) {
+                                                       case XmlTokenType.ElementOpen:
+                                                               currentNode = currentNode.AddChild (new ElementStartTagSyntax (currentLine, tokIdx));
+                                                               break;
+                                                       case XmlTokenType.PI_Start:
+                                                               currentNode = currentNode.AddChild (new ProcessingInstructionSyntax (currentLine, tokIdx));
+                                                               break;
+                                                       default:
+                                                               Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
+                                                               break;
+                                               }
+                                       } else if (currentNode is ProcessingInstructionSyntax pi) {
+                                               if (curTok.GetTokenType() == XmlTokenType.PI_Target)
+                                                       pi.name = tokIdx - pi.TokenIndexBase;
+                                               else if (curTok.GetTokenType() == XmlTokenType.PI_End) {
+                                                       storeCurrentNode ();
+                                               } else if (curTok.GetTokenType() == XmlTokenType.AttributeName) {
+                                                       AttributeSyntax attribute = new AttributeSyntax (currentLine, tokIdx);
+                                                       attribute.name = 0;
+                                                       currentNode = currentNode.AddChild (attribute);
+                                               } else {
+                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
+                                                       storeCurrentNode (-1);
+                                                       continue;
+                                               }
+                                       }
+                               }
+                               tokIdx++;
+                       }
+                       while (currentNode.Parent != null) {
+                               if (!currentNode.LastTokenOffset.HasValue)
+                                       storeCurrentNode (-1);
+                               else
+                                       currentNode = currentNode.Parent;
+                       }
+                       setCurrentNodeEndLine (currentLine);
+                       */
+               }
+       }
+}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxNodes.cs b/plugins/CECrowPlugin/src/Parsing/IML/ImlSyntaxNodes.cs
new file mode 100644 (file)
index 0000000..7885d98
--- /dev/null
@@ -0,0 +1,22 @@
+// 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.Linq;
+using Crow.Text;
+using CrowEditBase;
+
+namespace CECrowPlugin
+{
+
+
+
+       public class AttributeSyntax : SyntaxNode {
+               internal int? name, equal, valueOpen, valueClose, valueTok;
+               public string Name => name.HasValue ? Root.GetTokenStringByIndex (TokenIndexBase + name.Value) : null;
+               public string Value => valueTok.HasValue ? Root.GetTokenStringByIndex (TokenIndexBase + valueTok.Value) : null;
+               public Token? ValueToken => valueTok.HasValue ? Root.GetTokenByIndex (TokenIndexBase + valueTok.Value) : null;
+               public AttributeSyntax (int startLine, int tokenBase)
+                       : base (startLine, tokenBase) {}
+               public override bool IsComplete => base.IsComplete & name.HasValue & equal.HasValue & valueTok.HasValue & valueOpen.HasValue & valueClose.HasValue;
+       }
+}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/IML/SyntaxAnalyser.cs b/plugins/CECrowPlugin/src/Parsing/IML/SyntaxAnalyser.cs
deleted file mode 100644 (file)
index db7aa17..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2021-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.Collections.Generic;
-using System.Linq;
-using CrowEditBase;
-using CrowEdit.Xml;
-
-namespace CECrowPlugin
-{
-       public class ImlSyntaxAnalyser : XmlSyntaxAnalyser {
-               public ImlSyntaxAnalyser (ImlDocument source) : base (source) {
-                       this.source = source;
-               }
-
-
-               public override void Process () {
-
-                       base.Process();
-
-/*
-                       ImlDocument xmlDoc = source as ImlDocument;
-                       Exceptions = new List<SyntaxException> ();
-                       currentNode = new XMLRootSyntax (xmlDoc);
-                       currentLine = 0;
-                       Span<Token> toks = source.Tokens;
-                       tokIdx = 0;
-
-                       while (tokIdx < toks.Length) {
-                               Token curTok = toks[tokIdx];
-                               if (curTok.Type == TokenType.LineBreak)
-                                       currentLine++;
-                               else if (!curTok.Type.HasFlag (TokenType.Trivia)) {
-                                       if (currentNode is ElementStartTagSyntax tag) {
-                                               if (curTok.GetTokenType() == XmlTokenType.AttributeName) {
-                                                       AttributeSyntax attribute = new AttributeSyntax (currentLine, tokIdx);
-                                                       attribute.name = 0;
-                                                       currentNode = currentNode.AddChild (attribute);
-                                               } else if (curTok.GetTokenType() == XmlTokenType.ElementName)
-                                                       tag.name = tokIdx - tag.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.ClosingSign) {
-                                                       storeCurrentNode ();
-                                                       currentNode.RemoveChild (tag);
-                                                       currentNode = currentNode.AddChild (new ElementSyntax (tag));
-                                               } else if (curTok.GetTokenType() == XmlTokenType.EmptyElementClosing) {
-                                                       storeCurrentNode ();
-                                                       currentNode.RemoveChild (tag);
-                                                       currentNode = currentNode.AddChild (new EmptyElementSyntax (tag));
-                                                       setCurrentNodeEndLine (currentLine);
-                                                       currentNode = currentNode.Parent;
-                                               } else {
-                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
-                                                       storeCurrentNode (-1);
-                                                       continue;
-                                               }
-                                       } else if (currentNode is ElementSyntax elt) {
-                                               if (curTok.GetTokenType() == XmlTokenType.ElementOpen)
-                                                       currentNode = currentNode.AddChild (new ElementStartTagSyntax (currentLine, tokIdx));
-                                               else if (curTok.GetTokenType() == XmlTokenType.EndElementOpen) {
-                                                       elt.EndTag = new ElementEndTagSyntax (currentLine, tokIdx);
-                                                       currentNode = elt.AddChild (elt.EndTag);
-                                               }
-                                       } else if (currentNode is AttributeSyntax attrib) {
-                                               if (curTok.GetTokenType() == XmlTokenType.EqualSign)
-                                                       if (attrib.equal.HasValue)
-                                                               Exceptions.Add (new SyntaxException  ("Extra equal sign in attribute syntax", curTok));
-                                                       else
-                                                               attrib.equal = tokIdx - attrib.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValueOpen)
-                                                       attrib.valueOpen = tokIdx - attrib.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValue)
-                                                       attrib.valueTok = tokIdx - attrib.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.AttributeValueClose) {
-                                                       attrib.valueClose = tokIdx - attrib.TokenIndexBase;
-                                                       storeCurrentNode ();
-                                               } else {
-                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
-                                                       storeCurrentNode (-1);
-                                                       continue;
-                                               }
-                                       } else if (currentNode is ElementEndTagSyntax eltEndTag) {
-                                               if (curTok.GetTokenType() == XmlTokenType.ElementName)
-                                                       eltEndTag.name = tokIdx - eltEndTag.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.ClosingSign) {
-                                                       //go up 2 times
-                                                       storeCurrentNode (); storeCurrentNode ();
-                                               } else {
-                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
-                                                       storeCurrentNode (-1);
-                                                       storeCurrentNode (-1);
-                                                       continue;
-                                               }
-                                       } else if (currentNode is XMLRootSyntax) {
-                                               switch (curTok.GetTokenType()) {
-                                                       case XmlTokenType.ElementOpen:
-                                                               currentNode = currentNode.AddChild (new ElementStartTagSyntax (currentLine, tokIdx));
-                                                               break;
-                                                       case XmlTokenType.PI_Start:
-                                                               currentNode = currentNode.AddChild (new ProcessingInstructionSyntax (currentLine, tokIdx));
-                                                               break;
-                                                       default:
-                                                               Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
-                                                               break;
-                                               }
-                                       } else if (currentNode is ProcessingInstructionSyntax pi) {
-                                               if (curTok.GetTokenType() == XmlTokenType.PI_Target)
-                                                       pi.name = tokIdx - pi.TokenIndexBase;
-                                               else if (curTok.GetTokenType() == XmlTokenType.PI_End) {
-                                                       storeCurrentNode ();
-                                               } else if (curTok.GetTokenType() == XmlTokenType.AttributeName) {
-                                                       AttributeSyntax attribute = new AttributeSyntax (currentLine, tokIdx);
-                                                       attribute.name = 0;
-                                                       currentNode = currentNode.AddChild (attribute);
-                                               } else {
-                                                       Exceptions.Add (new SyntaxException  ("Unexpected Token", curTok));
-                                                       storeCurrentNode (-1);
-                                                       continue;
-                                               }
-                                       }
-                               }
-                               tokIdx++;
-                       }
-                       while (currentNode.Parent != null) {
-                               if (!currentNode.LastTokenOffset.HasValue)
-                                       storeCurrentNode (-1);
-                               else
-                                       currentNode = currentNode.Parent;
-                       }
-                       setCurrentNodeEndLine (currentLine);
-                       */
-               }
-       }
-}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/IML/SyntaxNodes.cs b/plugins/CECrowPlugin/src/Parsing/IML/SyntaxNodes.cs
deleted file mode 100644 (file)
index 7885d98..0000000
+++ /dev/null
@@ -1,22 +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.Linq;
-using Crow.Text;
-using CrowEditBase;
-
-namespace CECrowPlugin
-{
-
-
-
-       public class AttributeSyntax : SyntaxNode {
-               internal int? name, equal, valueOpen, valueClose, valueTok;
-               public string Name => name.HasValue ? Root.GetTokenStringByIndex (TokenIndexBase + name.Value) : null;
-               public string Value => valueTok.HasValue ? Root.GetTokenStringByIndex (TokenIndexBase + valueTok.Value) : null;
-               public Token? ValueToken => valueTok.HasValue ? Root.GetTokenByIndex (TokenIndexBase + valueTok.Value) : null;
-               public AttributeSyntax (int startLine, int tokenBase)
-                       : base (startLine, tokenBase) {}
-               public override bool IsComplete => base.IsComplete & name.HasValue & equal.HasValue & valueTok.HasValue & valueOpen.HasValue & valueClose.HasValue;
-       }
-}
\ No newline at end of file
diff --git a/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs b/plugins/CECrowPlugin/src/Parsing/Styling/StyleDocument.cs
new file mode 100644 (file)
index 0000000..215d764
--- /dev/null
@@ -0,0 +1,62 @@
+// 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 Crow;
+using System.Collections;
+using CrowEditBase;
+using static CrowEditBase.CrowEditBase;
+using Drawing2D;
+
+namespace CECrowPlugin.Style
+{
+       public class StyleDocument : SourceDocument {
+
+
+               public StyleDocument (string fullPath, string editorPath) : base (fullPath, editorPath) {
+                       App.GetService<CrowService> ()?.Start ();
+
+                       /*if (project is MSBuildProject msbp) {
+                               if (msbp.IsCrowProject)
+                       }*/
+               }
+
+               protected override Tokenizer CreateTokenizer() => new StyleTokenizer ();
+               protected override SyntaxAnalyser CreateSyntaxAnalyser() => new StyleSyntaxAnalyser (this);
+
+               public override IList GetSuggestions (CharLocation loc) {
+                       Console.ForegroundColor = ConsoleColor.DarkYellow;
+                       Console.WriteLine ($"Tok: {this.CurrentTokenString} {((StyleTokenType)CurrentToken.Type).ToString()}");
+                       Console.ResetColor();
+                       return null;
+               }
+               public override bool TryGetCompletionForCurrentToken(object suggestion, out TextChange change, out TextSpan? newSelection)
+               {
+                       change = default;
+                       newSelection = null;
+                       return false;
+               }
+               public override Color GetColorForToken(TokenType tokType)
+               {
+                       StyleTokenType xmlTokType = (StyleTokenType)tokType;
+                       if (xmlTokType.HasFlag (StyleTokenType.Punctuation))
+                               return Colors.DarkGrey;
+                       if (xmlTokType.HasFlag (StyleTokenType.Trivia))
+                               return Colors.DimGrey;
+                       if (xmlTokType == StyleTokenType.MemberName)
+                               return Colors.Blue;
+                       if (xmlTokType == StyleTokenType.ConstantName)
+                               return Colors.DarkCyan;
+                       else if (xmlTokType.HasFlag (StyleTokenType.Name))
+                               return Colors.Green;
+                       if (xmlTokType == StyleTokenType.MemberValuePart)
+                               return Colors.OrangeRed;
+                       if (xmlTokType == StyleTokenType.EqualSign)
+                               return Colors.Black;
+                       if (xmlTokType == StyleTokenType.Unknown)
+                               return Colors.Red;
+                       return Colors.YellowGreen;
+               }
+       }
+}
\ No newline at end of file
index 47f589d146abc3b151850499930faa194658d302..b4709b7ba0b4b12dc9a3d41dd73fb7b978590b53 100644 (file)
@@ -17,14 +17,13 @@ namespace CECrowPlugin.Style
                }
        }
        public class StyleSyntaxAnalyser : SyntaxAnalyser {
-               public override SyntaxNode Root => currentNode;
                public StyleSyntaxAnalyser (StyleDocument source) : base (source) {
                        this.source = source;
                }
 
                public override void Process () {
                        StyleDocument doc = source as StyleDocument;
-                       currentNode = new StyleRootSyntax (doc);
+                       currentNode = Root = new StyleRootSyntax (doc);
                        currentLine = 0;
                        Span<Token> toks = source.Tokens;
                        tokIdx = 0;
diff --git a/plugins/CECrowPlugin/src/StyleDocument.cs b/plugins/CECrowPlugin/src/StyleDocument.cs
deleted file mode 100644 (file)
index 215d764..0000000
+++ /dev/null
@@ -1,62 +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 Crow;
-using System.Collections;
-using CrowEditBase;
-using static CrowEditBase.CrowEditBase;
-using Drawing2D;
-
-namespace CECrowPlugin.Style
-{
-       public class StyleDocument : SourceDocument {
-
-
-               public StyleDocument (string fullPath, string editorPath) : base (fullPath, editorPath) {
-                       App.GetService<CrowService> ()?.Start ();
-
-                       /*if (project is MSBuildProject msbp) {
-                               if (msbp.IsCrowProject)
-                       }*/
-               }
-
-               protected override Tokenizer CreateTokenizer() => new StyleTokenizer ();
-               protected override SyntaxAnalyser CreateSyntaxAnalyser() => new StyleSyntaxAnalyser (this);
-
-               public override IList GetSuggestions (CharLocation loc) {
-                       Console.ForegroundColor = ConsoleColor.DarkYellow;
-                       Console.WriteLine ($"Tok: {this.CurrentTokenString} {((StyleTokenType)CurrentToken.Type).ToString()}");
-                       Console.ResetColor();
-                       return null;
-               }
-               public override bool TryGetCompletionForCurrentToken(object suggestion, out TextChange change, out TextSpan? newSelection)
-               {
-                       change = default;
-                       newSelection = null;
-                       return false;
-               }
-               public override Color GetColorForToken(TokenType tokType)
-               {
-                       StyleTokenType xmlTokType = (StyleTokenType)tokType;
-                       if (xmlTokType.HasFlag (StyleTokenType.Punctuation))
-                               return Colors.DarkGrey;
-                       if (xmlTokType.HasFlag (StyleTokenType.Trivia))
-                               return Colors.DimGrey;
-                       if (xmlTokType == StyleTokenType.MemberName)
-                               return Colors.Blue;
-                       if (xmlTokType == StyleTokenType.ConstantName)
-                               return Colors.DarkCyan;
-                       else if (xmlTokType.HasFlag (StyleTokenType.Name))
-                               return Colors.Green;
-                       if (xmlTokType == StyleTokenType.MemberValuePart)
-                               return Colors.OrangeRed;
-                       if (xmlTokType == StyleTokenType.EqualSign)
-                               return Colors.Black;
-                       if (xmlTokType == StyleTokenType.Unknown)
-                               return Colors.Red;
-                       return Colors.YellowGreen;
-               }
-       }
-}
\ No newline at end of file
index af47d3c49682d575777de283cb885e4622e2dd67..382a3781af196fd606668b16d0c52475fed75583 100644 (file)
@@ -10,7 +10,6 @@ namespace CrowEdit.Ebnf
 {
 
        public class EbnfSyntaxAnalyser : SyntaxAnalyser {
-        public override SyntaxNode Root => currentNode;
                public EbnfSyntaxAnalyser  (EbnfDocument source) : base (source) {
                        this.source = source;
                }
@@ -27,7 +26,7 @@ namespace CrowEdit.Ebnf
         public override void Process()
         {
             EbnfDocument doc = source as EbnfDocument;
-                       currentNode = new EbnfRootSyntax (doc);
+                       currentNode = Root = new EbnfRootSyntax (doc);
                        currentLine = 0;
                        tokIdx = 0;
                        tokens = doc.Tokens;
diff --git a/plugins/CERoslynPlugin/src/CSSyntaxAnalyser.cs b/plugins/CERoslynPlugin/src/CSSyntaxAnalyser.cs
new file mode 100644 (file)
index 0000000..761e47e
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (c) 2021-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.Collections.Generic;
+using System.Linq;
+using CrowEditBase;
+
+namespace CERoslynPlugin
+{
+       public class CSRootSyntax : SyntaxRootNode {
+               public CSRootSyntax (SourceDocument source)
+                       : base (source) {
+               }
+       }
+       public class CSSyntaxAnalyser : SyntaxAnalyser {
+        /*protected override void Parse(SyntaxNode node)
+        {
+            throw new NotImplementedException();
+        }*/
+
+               public CSSyntaxAnalyser (CSDocument source) : base (source) {
+                       this.source = source;
+               }
+
+               public override void Process () {
+                       currentNode = Root = new CSRootSyntax (source);
+               }
+       }
+}
\ No newline at end of file
diff --git a/plugins/CERoslynPlugin/src/SyntaxAnalyser.cs b/plugins/CERoslynPlugin/src/SyntaxAnalyser.cs
deleted file mode 100644 (file)
index 2c6a545..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2021-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.Collections.Generic;
-using System.Linq;
-using CrowEditBase;
-
-namespace CERoslynPlugin
-{
-       public class CSRootSyntax : SyntaxRootNode {
-               public CSRootSyntax (SourceDocument source)
-                       : base (source) {
-               }
-       }
-       public class CSSyntaxAnalyser : SyntaxAnalyser {
-               public override SyntaxNode Root => currentNode;
-        /*protected override void Parse(SyntaxNode node)
-        {
-            throw new NotImplementedException();
-        }*/
-
-               public CSSyntaxAnalyser (CSDocument source) : base (source) {
-                       this.source = source;
-               }
-
-               public override void Process () {
-                       currentNode = new CSRootSyntax (source);
-               }
-       }
-}
\ No newline at end of file
index 0d1fa306354ac81cc87f385f4f9252bc4b829263..ecdb3d916de25ad32cf243c295e6eaeb402468ca 100644 (file)
@@ -84,7 +84,7 @@ namespace CrowEdit.Xml
                                } else {
                                        int offset = 1;
                                        if (!attrib.valueClose.HasValue) {
-                                               selectedSugg += RootNode.Root.GetTokenStringByIndex(attrib.valueClose.Value);
+                                               selectedSugg += root.GetTokenStringByIndex(attrib.valueClose.Value);
                                                offset = 0;
                                        }
                                        if (tokType == XmlTokenType.AttributeValueOpen)
index c56ade27dc00fc6a1a4931103b4b21aad1539e70..d51c0855d2a3e6509649823850ae3f174f84a25d 100644 (file)
@@ -9,24 +9,15 @@ using CrowEditBase;
 namespace CrowEdit.Xml
 {
        public class XmlSyntaxAnalyser : SyntaxAnalyser {
-               public override SyntaxNode Root => currentNode;
-        /*protected override void Parse(SyntaxNode node)
-        {
-            throw new NotImplementedException();
-        }*/
         public XmlSyntaxAnalyser (XmlDocument source) : base (source) {
                        this.source = source;
                }
-
-               /*public virtual SyntaxNode Process (SyntaxNode startingNode) {
-
-               }*/
                public virtual void ProcessAttributeValueSyntax(AttributeSyntax attrib) {
                        attrib.valueTok = tokIdx - attrib.TokenIndexBase;
                }
                public override void Process () {
                        XmlDocument xmlDoc = source as XmlDocument;
-                       currentNode = new XMLRootSyntax (xmlDoc);
+                       currentNode = Root = new XMLRootSyntax (xmlDoc);
                        currentLine = 0;
                        tokIdx = 0;
                        tokens = source.Tokens;
index 051d6c53f79fda0fbfcc3f934687f054ab9cef3a..35cfa301cab479bcb8055f6238dd6810b04f560a 100644 (file)
@@ -117,6 +117,7 @@ namespace CrowEdit
                        ViewCommands = new CommandGroup ("View",
                                new ActionCommand("Explorer", () => LoadWindow ("#CrowEdit.ui.windows.winFileExplorer.crow", this)),
                                new ActionCommand("Editors", () => LoadWindow ("#CrowEdit.ui.windows.winEditor.crow", this)),
+                               new ActionCommand("Exceptions", () => LoadWindow ("#CrowEdit.ui.windows.winExceptions.crow", this)),
                                new ActionCommand("Projects", () => LoadWindow ("#CrowEdit.ui.windows.winProjects.crow", this)),
                                new ActionCommand("Logs", () => LoadWindow ("#CrowEdit.ui.windows.winLogs.crow", this), "#icons.log.svg"),
                                new ActionCommand("Services", () => LoadWindow ("#CrowEdit.ui.windows.winServices.crow", this), "#icons.services.svg"),
diff --git a/ui/windows/winExceptions.crow b/ui/windows/winExceptions.crow
new file mode 100644 (file)
index 0000000..15c2eaa
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<DockWindow Caption="Exceptions"  Width="40%" Height="20%">
+       <ListBox DataSource="{CurrentDocument}" Data='{Exceptions}' Height='Stretched' Width='Stretched'/>
+</DockWindow>
+
+