public RawError(string input)
        {
            UiExceptionHelper.CheckNotNull(input, "input");
            _input = input;

            return;
        }
Esempio n. 2
0
        /// <summary>
        /// Classify the given LexToken into a ClassificationTag.
        /// </summary>
        /// <param name="token">The token to be classified.</param>
        /// <returns>The smState value.</returns>
        public ClassificationTag Classify(LexToken token)
        {
            int classTag;

            UiExceptionHelper.CheckNotNull(token, "token");

            classTag = AcceptLexToken(token);

            if (classTag == SMSTATE_CODE &&
                _keywords.ContainsKey(token.Text))
            {
                return(ClassificationTag.Keyword);
            }

            // Parsing a token whoose Text value is set to '\'
            // causes the classifier to set/reset is escaping mode.

            if (token.Text == "\\" &&
                _sm_output == SMSTATE_STRING &&
                !_escaping)
            {
                _escaping = true;
            }
            else
            {
                _escaping = false;
            }

            return(_tags[classTag]);
        }
Esempio n. 3
0
        public FormattedCode(string csharpText, int[] strIndexes, byte[] tagValues, int[] lineIndexes)
        {
            UiExceptionHelper.CheckNotNull(csharpText, "csharpText");
            UiExceptionHelper.CheckNotNull(strIndexes, "strIndexes");
            UiExceptionHelper.CheckNotNull(tagValues, "tagValues");
            UiExceptionHelper.CheckNotNull(lineIndexes, "lineIndexes");

            _codeInfo = new CodeInfo();

            _codeInfo.Text = csharpText;

            _codeInfo.IndexArray = new List <int>();
            foreach (int index in strIndexes)
            {
                _codeInfo.IndexArray.Add(index);
            }

            _codeInfo.TagArray = new List <byte>();
            foreach (byte tag in tagValues)
            {
                _codeInfo.TagArray.Add(tag);
            }

            _codeInfo.LineArray = new List <int>();
            foreach (int line in lineIndexes)
            {
                _codeInfo.LineArray.Add(line);
            }

            return;
        }
        /// <summary>
        /// Locates and fills RawError.Path property with the first
        /// Unix path values found from RawError.Input property.
        /// </summary>
        /// <param name="parser">The stack trace parser. This parameter
        /// must not be null.</param>
        /// <param name="args">The RawError from which retrieving and
        /// filling Input and Path properties. This parameter cannot not
        /// be null.</param>
        /// <returns>True if a match occured, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posSlash;
            int    posColon;
            string path;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            if ((posSlash = indexOfFirstSlash(args.Input, 0)) == -1)
            {
                return(false);
            }

            if ((posColon = PathCompositeParser.IndexOfTrailingColon(args.Input, posSlash + 1)) == -1)
            {
                return(false);
            }

            path = args.Input.Substring(posSlash, posColon - posSlash);
            path = path.Trim();

            if (path.Length <= 1)
            {
                return(false);
            }

            args.Path = path;

            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// Locates and fills RawError.Path property with the first
        /// Windows path values found from RawError.Input property.
        /// </summary>
        /// <param name="parser">The stack trace parser. This parameter
        /// must not be null.</param>
        /// <param name="args">The RawError from which retrieving and
        /// filling Input and Path properties. This parameter cannot not
        /// be null.</param>
        /// <returns>True if a match occured, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posDriveLetter;
            int    posTrailingColon;
            string path;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            posDriveLetter = lookForDriveLetter(args.Input, 0);
            if (posDriveLetter == -1)
            {
                return(false);
            }

            posTrailingColon = PathCompositeParser.IndexOfTrailingColon(args.Input, posDriveLetter + 3);
            if (posTrailingColon == -1)
            {
                return(false);
            }

            path = args.Input.Substring(posDriveLetter, posTrailingColon - posDriveLetter);
            path = path.Trim();

            if (path.Length <= 3)
            {
                return(false);
            }

            args.Path = path;

            return(true);
        }
        /// <summary>
        /// Register a new IErrorDisplay in the toolbar.
        /// </summary>
        public void Register(IErrorDisplay display)
        {
            ToolStripItem item;
            int           sepIndex;

            UiExceptionHelper.CheckNotNull(display, "display");
            UiExceptionHelper.CheckNotNull(display.PluginItem, "display.PluginItem");

            item        = display.PluginItem;
            item.Tag    = display;
            item.Click += new EventHandler(item_Click);

            _displays.Add(display);
            sepIndex = Items.IndexOf(_separator);
            Items.Insert(sepIndex, item);

            if (display.OptionItems != null)
            {
                ToolStripItem[] array = display.OptionItems;
                foreach (ToolStripItem value in array)
                {
                    value.Visible = false;
                    Items.Add(value);
                }
            }

            if (_displays.Count == 1)
            {
                SelectedDisplay = display;
            }

            return;
        }
Esempio n. 7
0
        /// <summary>
        /// Try to match a function name by reading RawError.Input.
        /// If a match is found, the method outputs the result into
        /// RawError.Function and returns true.
        /// </summary>
        /// <param name="parser">An instance of parser, this parameter
        /// cannot be null.</param>
        /// <param name="args">An instance of RawError. This parameter
        /// cannot be null.</param>
        /// <returns>True if a match occurs, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posEndingParenthesis;
            int    posOpeningParenthesis;
            int    posName;
            int    endName;
            string res;
            int    i;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            posEndingParenthesis  = args.Input.LastIndexOf(")");
            posOpeningParenthesis = args.Input.LastIndexOf("(");

            if (posEndingParenthesis == -1 || posOpeningParenthesis == -1 ||
                posOpeningParenthesis > posEndingParenthesis)
            {
                return(false);
            }

            endName = posOpeningParenthesis;
            for (i = posOpeningParenthesis - 1; i >= 0; i--)
            {
                if (args.Input[i] != ' ')
                {
                    break;
                }

                endName = i;
            }

            posName = -1;
            for (i = endName - 1; i >= 0; i--)
            {
                if (args.Input[i] == ' ')
                {
                    break;
                }

                posName = i;
            }

            // Added this test to allow for odd case where we would
            // otherwise include the leading "at" or "à" in name.
            if (posName == 0)
            {
                return(false);
            }

            if (posName == -1)
            {
                return(false);
            }

            res           = args.Input.Substring(posName, posEndingParenthesis - posName + 1);
            args.Function = res;

            return(true);
        }
Esempio n. 8
0
            public State(int initialState, TransitionData[] transitions)
            {
                int i;
                int j;

                UiExceptionHelper.CheckNotNull(transitions, "transitions");
                UiExceptionHelper.CheckTrue(
                    transitions.Length == 8,
                    "expecting transitions.Length to be 8",
                    "transitions");

                for (i = 0; i < transitions.Length; ++i)
                {
                    for (j = 0; j < transitions.Length; ++j)
                    {
                        if (j == i)
                        {
                            continue;
                        }

                        if (transitions[j].Transition == transitions[i].Transition)
                        {
                            UiExceptionHelper.CheckTrue(false,
                                                        String.Format("transition '{0}' already present", transitions[j].Transition),
                                                        "transitions");
                        }
                    }
                }


                InitialState = initialState;
                Transitions  = transitions;

                return;
            }
Esempio n. 9
0
        /// <summary>
        /// Setup the text to be splitted in tokens.
        ///
        /// Client code must call Next() first before getting
        /// the first available token (if any).
        /// </summary>
        public void Parse(string codeCSharp)
        {
            UiExceptionHelper.CheckNotNull(codeCSharp, "text");

            _text     = codeCSharp;
            _position = 0;

            return;
        }
Esempio n. 10
0
        public float LineIndexToYCoordinate(int lineIndex, Graphics g, Font font)
        {
            UiExceptionHelper.CheckNotNull(g, "g");
            UiExceptionHelper.CheckNotNull(font, "font");

            SizeF sz = g.MeasureString("m", font);

            return(lineIndex * sz.Height);
        }
        public ErrorItem ToErrorItem()
        {
            UiExceptionHelper.CheckTrue(
                _function != null,
                "Cannot create instance of ErrorItem without a valid value in Function",
                "Function");

            return(new ErrorItem(_path, _function, _line));
        }
Esempio n. 12
0
        /// <summary>
        /// Interprets and highlight the given string as C# code
        /// and return the resulting FormattedCode instance.
        /// </summary>
        /// <param name="csharpCode">A string read as C# code.
        /// This parameter must not be null.</param>
        /// <returns>A FormattedCode instance containing data
        /// to highlight the text with basic syntax coloring.</returns>
        public FormattedCode Format(string csharpCode)
        {
            UiExceptionHelper.CheckNotNull(csharpCode, "csharpCode");

            _info      = FormattedCode.NewCodeInfo();
            csharpCode = PreProcess(csharpCode);
            Parse(csharpCode);

            return(CSCode);
        }
Esempio n. 13
0
        /// <summary>
        /// Gets the formatter assigned to the given extension. If there
        /// is no such assignment, the default formatter is returned.
        /// </summary>
        /// <param name="extension">
        /// A file extension. Ex: "cs", "txt". This parameter cannot be null.
        /// </param>
        /// <returns>A non-null ICodeFormatter.</returns>
        public ICodeFormatter GetFormatterFromExtension(string extension)
        {
            UiExceptionHelper.CheckNotNull(extension, "extension");

            if (_formatters.HasExtension(extension))
            {
                return(_formatters.GetFromExtension(extension));
            }

            return(DefaultFormatter);
        }
Esempio n. 14
0
        /// <summary>
        /// Gets the best formatter that fits the given language. If there
        /// is no such formatter, a default one is returned.
        /// </summary>
        /// <param name="language">
        /// The language name. Ex: "C#", "Java. This parameter cannot be null.
        /// </param>
        /// <returns>
        /// A non-null ICodeFormatter that best fits the request.
        /// </returns>
        public ICodeFormatter GetFormatterFromLanguage(string languageName)
        {
            UiExceptionHelper.CheckNotNull(languageName, "language");

            if (_formatters.HasLanguage(languageName))
            {
                return(_formatters[languageName]);
            }

            return(DefaultFormatter);
        }
Esempio n. 15
0
        /// <summary>
        /// Pick the best available formatter to format the given piece of code.
        /// </summary>
        /// <param name="code">The code to be formatted. This parameter cannot be null.</param>
        /// <param name="language">
        /// The language into which code has been written. Ex: "C#", "Java".
        /// If no such formatter is available, a default formatting is applied.
        /// This parameter cannot be null.
        /// </param>
        /// <returns>
        /// The formatting for this piece of code.
        /// </returns>
        public FormattedCode Format(string code, string language)
        {
            UiExceptionHelper.CheckNotNull(code, "code");
            UiExceptionHelper.CheckNotNull(language, "language");

            if (_formatters.HasLanguage(language))
            {
                return(_formatters[language].Format(code));
            }

            return(DefaultFormatter.Format(code));
        }
Esempio n. 16
0
        /// <summary>
        /// A convenient method to make the formatting of a piece of code when
        /// only the file extension is known.
        /// </summary>
        /// <param name="code">The piece of code to be formatted. This parameter
        /// cannot be null.</param>
        /// <param name="extension">The file extension associated to this piece of code.
        /// Ex: "cs", "cpp". This is used to pick the formatter assigned to. If no such
        /// formatter exists, the default one is picked up.</param>
        /// <returns>The FormattedCode for this piece of code.</returns>
        public FormattedCode FormatFromExtension(string code, string extension)
        {
            UiExceptionHelper.CheckNotNull(code, "code");
            UiExceptionHelper.CheckNotNull(extension, "extension");

            if (_formatters.HasExtension(extension))
            {
                return(_formatters.GetFromExtension(extension).Format(code));
            }

            return(DefaultFormatter.Format(code));
        }
Esempio n. 17
0
        /// <summary>
        /// Populates ErrorBrowser with the new display passed in parameter.
        /// If ErrorBrowser is empty, the display becomes automatically the
        /// new selected display.
        /// </summary>
        /// <param name="display"></param>
        public void RegisterDisplay(IErrorDisplay display)
        {
            UiExceptionHelper.CheckNotNull(display, "display");

            Toolbar.Register(display);
            display.OnStackTraceChanged(_stackStace);

            if (Toolbar.SelectedDisplay == null)
            {
                Toolbar.SelectedDisplay = display;
            }

            return;
        }
        public FormattedCode Format(string sourceCode)
        {
            DefaultTextManager text;

            byte[] byteArray;
            int[]  strArray;
            int[]  lineArray;
            int    index;
            int    posLineStart;
            int    posChar;

            UiExceptionHelper.CheckNotNull(sourceCode, "sourceCode");

            sourceCode = PreProcess(sourceCode);

            text      = new DefaultTextManager();
            text.Text = sourceCode;

            strArray  = new int[text.LineCount];
            lineArray = new int[text.LineCount];

            index        = 0;
            posLineStart = 0;
            posChar      = 0;

            foreach (char c in sourceCode)
            {
                if (c == '\n')
                {
                    strArray[index]  = posLineStart;
                    lineArray[index] = index;
                    posLineStart     = posChar + 1;
                    index++;
                }

                posChar++;
            }

            if (index <= text.LineCount - 1)
            {
                strArray[index]  = posLineStart;
                lineArray[index] = index;
            }

            byteArray = new byte[text.LineCount];

            return(new FormattedCode(sourceCode, strArray, byteArray, lineArray));
        }
Esempio n. 19
0
        /// <summary>
        /// Returns the ICodeFormatter that fit the given language.
        /// </summary>
        /// <param name="language">
        /// A language name, such as: "C#" or "Java".
        /// This parameter cannot be null.
        /// </param>
        /// <returns>
        /// The ICodeFormatter that fit this language.
        /// </returns>
        /// <see cref="HasExtension"/>
        public ICodeFormatter this[string language]
        {
            get
            {
                UiExceptionHelper.CheckNotNull(language, "language");

                foreach (ICodeFormatter item in _toFormatter.Values)
                {
                    if (item.Language == language)
                    {
                        return(item);
                    }
                }

                throw new ArgumentException("unknown language: '" + language + "'");
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Builds the list of all LexToken which text value starts with the one in starter.
        /// </summary>
        /// <param name="starter">The token that the reference text.</param>
        /// <param name="output">The list of tokens which text starts with the one in starter.</param>
        protected void PopulateTokenStartingWith(LexToken starter, List <LexToken> output)
        {
            InternalLexToken token;

            UiExceptionHelper.CheckNotNull(starter, "starter");
            UiExceptionHelper.CheckNotNull(output, "output");

            output.Add(starter);

            token = (InternalLexToken)starter;
            foreach (LexToken item in token.StartingWith)
            {
                output.Add(item);
            }

            return;
        }
        protected SizeF MeasureItem(Graphics g, ErrorItem item)
        {
            SizeF sizeMethod;
            SizeF sizeClass;
            SizeF sizeFile;

            UiExceptionHelper.CheckNotNull(g, "g");
            UiExceptionHelper.CheckNotNull(item, "item");

            sizeClass  = g.MeasureString(item.ClassName, _font);
            sizeMethod = g.MeasureString(item.MethodName, _font);
            sizeFile   = g.MeasureString(item.FileName, _font);

            return(new SizeF(
                       Math.Max(sizeClass.Width, Math.Max(sizeMethod.Width, sizeFile.Width)) + TEXT_MARGIN_X,
                       _itemHeight));
        }
        /// <summary>
        /// Converts the given value into the matching ClassificationTag.
        /// </summary>
        private ClassificationTag _getTagFromByteValue(byte value)
        {
            switch (value)
            {
            case 0: return(ClassificationTag.Code);

            case 1: return(ClassificationTag.Keyword);

            case 2: return(ClassificationTag.Comment);

            case 3: return(ClassificationTag.String);

            default:
                UiExceptionHelper.CheckTrue(false, "should not reach this code", "value");
                break;
            }

            return(ClassificationTag.Code);
        }
Esempio n. 23
0
        /// <summary>
        /// Registers an ICodeFormatter for the given language. The system
        /// is not case sensitive.
        /// </summary>
        /// <param name="formatter">
        /// A non null formatter.
        /// </param>
        /// <param name="language">
        /// A non null file language.
        /// The value must not be empty nor contain '.' and
        /// must not have been already registered.
        /// </param>
        public void Register(ICodeFormatter formatter, string extension)
        {
            UiExceptionHelper.CheckNotNull(formatter, "formatter");
            UiExceptionHelper.CheckNotNull(extension, "language");

            extension = extension.ToLower();

            UiExceptionHelper.CheckTrue(extension.Length > 0,
                                        "language cannot be empty", "language");
            UiExceptionHelper.CheckTrue(extension.LastIndexOf('.') == -1,
                                        "language cannot contain '.'", "language");
            UiExceptionHelper.CheckFalse(_toFormatter.ContainsKey(extension),
                                         "language '" + extension + "' has already an handler. Remove handler first.",
                                         "language");

            _toFormatter.Add(extension, formatter);

            return;
        }
Esempio n. 24
0
        public SizeF GetDocumentSize(FormattedCode code, Graphics g, Font font)
        {
            UiExceptionHelper.CheckNotNull(code, "code");
            UiExceptionHelper.CheckNotNull(g, "g");
            UiExceptionHelper.CheckNotNull(font, "font");

            StringBuilder sample;
            SizeF         measure;
            int           i;

            sample = new StringBuilder();
            for (i = code.MaxLength; i > 0; --i)
            {
                sample.Append("m");
            }

            measure = g.MeasureString(sample.ToString(), font);

            return(new SizeF(measure.Width, measure.Height * code.LineCount));
        }
Esempio n. 25
0
        protected ErrorList(IErrorListRenderer renderer)
        {
            UiExceptionHelper.CheckNotNull(renderer, "display");

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            DoubleBuffered = true;

            _renderer        = renderer;
            _items           = new ErrorItemCollection();
            _stackTrace      = null;
            _selection       = null;
            _workingGraphics = CreateGraphics();
            _hoveredIndex    = -1;

            _autoSelectFirstItem = false;
            _listOrder           = ErrorListOrderPolicy.InitialOrder;

            return;
        }
Esempio n. 26
0
        /// <summary>
        /// Try to match a function name by reading RawError.Input.
        /// If a match is found, the method outputs the result into
        /// RawError.Function and returns true.
        /// </summary>
        /// <param name="parser">An instance of parser, this parameter
        /// cannot be null.</param>
        /// <param name="args">An instance of RawError. This parameter
        /// cannot be null.</param>
        /// <returns>True if a match occurs, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int    posEndingParenthesis;
            int    posOpeningParenthesis;
            int    posName;
            string res;
            int    i;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            posEndingParenthesis  = args.Input.LastIndexOf(")");
            posOpeningParenthesis = args.Input.LastIndexOf("(");

            if (posEndingParenthesis == -1 || posOpeningParenthesis == -1 ||
                posOpeningParenthesis > posEndingParenthesis)
            {
                return(false);
            }

            posName = -1;
            for (i = posOpeningParenthesis - 1; i >= 0; i--)
            {
                if (args.Input[i] == ' ')
                {
                    break;
                }

                posName = i;
            }

            if (posName == -1)
            {
                return(false);
            }

            res           = args.Input.Substring(posName, posEndingParenthesis - posName + 1);
            args.Function = res;

            return(true);
        }
Esempio n. 27
0
        /// <summary>
        /// Reads args.Input and try to locate a line number information.
        /// If a match occurs the method fills args.Line with the identified
        /// integer.
        /// </summary>
        /// <param name="parser">The StackTraceParser instance. The
        /// parameter cannot be null.</param>
        /// <param name="args">The RawError instance from where read and
        /// write Input and Line properties. The parameter cannot be null.</param>
        /// <returns>True if a match occurs, false otherwise.</returns>
        public bool TryParse(StackTraceParser parser, RawError args)
        {
            int posTrailingColon;
            int line;

            UiExceptionHelper.CheckNotNull(parser, "parser");
            UiExceptionHelper.CheckNotNull(args, "args");

            if ((posTrailingColon = args.Input.LastIndexOf(":")) == -1)
            {
                return(false);
            }

            if ((line = lookForLastInteger(args.Input, posTrailingColon)) <= 0)
            {
                return(false);
            }

            args.Line = line;

            return(true);
        }
Esempio n. 28
0
        /// <summary>
        /// An utility method that check data consistency. The operation
        /// raises an exception if an error is found.
        /// </summary>
        public static void CheckData(FormattedCode data)
        {
            List <int> lines;
            int        line;
            int        bound;
            int        i;

            UiExceptionHelper.CheckNotNull(data, "data");

            UiExceptionHelper.CheckTrue(
                data._codeInfo.IndexArray.Count == data._codeInfo.TagArray.Count,
                "IndexArray.Count and TagArray.Count must match.",
                "data");

            bound = data._codeInfo.IndexArray.Count;
            lines = data._codeInfo.LineArray;
            for (i = 0; i < lines.Count; ++i)
            {
                line = lines[i];

                UiExceptionHelper.CheckTrue(
                    line >= 0 && line < bound,
                    "Bad LineArray value at index " + i + ", value was: " + line + ", expected to be in: [0-" + bound + "[.",
                    "data");

                if (i == 0)
                {
                    continue;
                }

                UiExceptionHelper.CheckTrue(
                    lines[i] > lines[i - 1],
                    "Bad LineArray[" + i + "], value was: " + line + ", expected to be > than LineArray[" + (i - 1) + "]=" + lines[i - 1] + ".",
                    "data");
            }

            return;
        }
        public void DrawToGraphics(ErrorItemCollection items,
                                   ErrorItem selected, Graphics g, Rectangle viewport)
        {
            SizeF sizeLineSource;
            int   last;
            int   i;

            UiExceptionHelper.CheckNotNull(items, "items");
            UiExceptionHelper.CheckNotNull(g, "g");

            if (!_paintData.Equals(items, selected, viewport))
            {
                _paintData.Dispose();
                _paintData = new PaintData(items, selected, viewport, g);

                PaintBackground(Resources.ImageErrorList, _paintData.WorkingGraphics,
                                _rectListBackground, viewport);

                sizeLineSource = g.MeasureString("Line 9999", _font);
                _offsetLine    = viewport.Width - sizeLineSource.Width;

                last = LastIndexVisible(items.Count, viewport);
                for (i = FirstIndexVisible(items.Count, viewport); i <= last; ++i)
                {
                    DrawItem(items[i], i, selected == items[i], i == items.Count - 1, false,
                             _paintData.WorkingGraphics, viewport);
                }

                //_paintData.WorkingGraphics.DrawImage(Resources.ErrorList,
                //new Rectangle(0, 0, viewport.Width, _rectShadow.Height),
                //_rectShadow, GraphicsUnit.Pixel);
            }

            _paintData.PaintTo(g);

            return;
        }
Esempio n. 30
0
        /// <summary>
        /// Build a new token and add it to the list of tokens known by TokenDictionary.
        /// Tokens must be added from the longest text value to the shortest otherwise
        /// an exception will be raised.
        /// </summary>
        /// <param name="value">
        /// The token's text value. It must not be null nor empty. It must not be already
        /// defined neither. If there are tokens already defined, value's length must not
        /// be longer than the previous added token.
        /// </param>
        /// <param name="tag">The token's tag value.</param>
        public void Add(string value, LexerTag tag)
        {
            InternalLexToken newToken;

            UiExceptionHelper.CheckNotNull(value, "value");
            UiExceptionHelper.CheckFalse(value == "",
                                         "Token value must not be empty.", "value");
            UiExceptionHelper.CheckFalse(
                Contains(value),
                String.Format("Token '{0}' is already defined.", value),
                "value");
            if (Count > 0)
            {
                UiExceptionHelper.CheckTrue(
                    _list[Count - 1].Text.Length >= value.Length,
                    "Tokens must be inserted from the longest to the shortest value.",
                    "value");
            }

            newToken = new InternalLexToken(value, tag);

            // loop through each item to populate
            // newToken.StartingWith list.

            foreach (InternalLexToken item in _list)
            {
                if (item.Text.StartsWith(value))
                {
                    newToken.StartingWith.Add(item);
                }
            }

            _list.Add(newToken);

            return;
        }