Exemple #1
0
        public void Process()
        {
            paramsList = new List <Param>();

            for (CurrentLineCount = 0; CurrentLineCount < Lines.Length; CurrentLineCount++)
            {
                string line = Lines[CurrentLineCount];

                if (string.IsNullOrEmpty(line))                 // ignore empty lines
                {
                    continue;
                }

                if (!paramMatcher.IsLineComment(line))                 // if there is no comment but something else. That means the doc comment section has end
                {
                    langMatcher.GetDataStructureType(lang, line)?.Initialize(this);

                    // cleans the params list to be used for the next function or whatever, even if there is no dataStructure match
                    paramsList.Clear();

                    continue;
                }

                Param lineParam = paramMatcher.GetLineParam(line);

                if (lineParam == null)                 // if there is no line param
                {
                    string foundLineParamString = paramMatcher.GetLineParamString(line);

                    if (!string.IsNullOrEmpty(foundLineParamString))                     // if there is a not registered param
                    {
                        NeoDoc.WriteErrors("Unregistered param detected", new List <string>()
                        {
                            "'" + foundLineParamString + "' ('" + line + "')"
                        }, relPath, CurrentLineCount + 1, (int)NeoDoc.ERROR_CODES.UNREGISTERED_PARAM);
                    }
                    else
                    {
                        if (paramMatcher.IsLineCommentStart(line))          // if matching e.g. "---"
                        {
                            paramsList.Clear();                             // clear the paramsList if a new docu block starts

                            lineParam = new DescParam();                    // start with a new description by default. HINT: That means that if using e.g. `---` instead of `--` while documenting e.g. a param addition in a new line, this line will be handled as a new description entry instead of a continued param addition / param description.

                            paramsList.Add(lineParam);
                        }
                        else if (paramsList.Count > 0)                              // if there are params in the list
                        {
                            lineParam = paramsList.ElementAt(paramsList.Count - 1); // use last param as new line param to support multiline commenting style e.g.
                        }

                        lineParam?.ProcessAddition(paramMatcher.GetLineCommentData(line));                         // add additional content
                    }
                }
                else
                {
                    lineParam.ModifyFileParser(this);                     // e.g. function or wrapper params will clean params list if it already contains a wrapper / ...
                }
            }

            paramsList = null;
        }