Esempio n. 1
0
        /// <summary>Parse all of the code loaded into Protean and populate the todo list.</summary>
        public static void Parse()
        {
            // Iterate through each document loaded into Protean - Parse them if they're valid
            foreach (Protean.Hub.Documents.Document tDocument in Protean.Hub.Documents.Globals.Documents)
            {
                if (tDocument != null && tDocument.Document != null && tDocument.Document.Lines.Length > 0)
                {
                    SourceParser.ParseDocument(tDocument);
                }
            }

            // Fire event when finished
            SourceParser.ParsingFinished(null, null);
        }
Esempio n. 2
0
        /// <summary>Parse a single Protean document.</summary>
        /// <param name="doc"></param>
        private static void ParseDocument(Protean.Hub.Documents.Document doc)
        {
            int lineNumber = 1;

            foreach (string tLine in doc.Document.Lines)
            {
                string description             = "";
                bool   itemFound               = false;
                frm_TodoList.ItemType itemType = frm_TodoList.ItemType.Temp;

                // Refactor this to get the first keyword, then do a "switch" on it

                if (tLine != null && tLine.Length > 0)
                {
                    // TODO:
                    if (SourceParser.findKeyword("todo", tLine) != "")
                    {
                        description = SourceParser.findKeyword("todo", tLine);
                        itemType    = frm_TodoList.ItemType.Todo;
                        itemFound   = true;
                    }

                    // TEMP:
                    else if (SourceParser.findKeyword("temp", tLine) != "")
                    {
                        description = SourceParser.findKeyword("temp", tLine);
                        itemType    = frm_TodoList.ItemType.Temp;
                        itemFound   = true;
                    }

                    // HACK:
                    else if (SourceParser.findKeyword("hack", tLine) != "")
                    {
                        description = SourceParser.findKeyword("hack", tLine);
                        itemType    = frm_TodoList.ItemType.Hack;
                        itemFound   = true;
                    }

                    // KLUDGE:
                    else if (SourceParser.findKeyword("kludge", tLine) != "")
                    {
                        description = SourceParser.findKeyword("kludge", tLine);
                        itemType    = frm_TodoList.ItemType.Kludge;
                        itemFound   = true;
                    }

                    // NOTE:
                    else if (SourceParser.findKeyword("note", tLine) != "")
                    {
                        description = SourceParser.findKeyword("note", tLine);
                        itemType    = frm_TodoList.ItemType.Note;
                        itemFound   = true;
                    }
                    // If we found something, add it
                    if (itemFound)
                    {
                        TodoListPlugin.AddItem(itemType, lineNumber, description, doc.File);
                    }
                }

                lineNumber++;
            }
        }