Exemple #1
0
        // Called at the start of the parse and after every token. Skips
        // whitespace and comments, and.
        void SkipSpace()
        {
            while (_pos.Index < _input.Length)
            {
                var ch = (int)_input[_pos.Index];
                switch (ch)
                {
                case 32:
                case 160:     // ' '
                    _pos = _pos.Increment(1);
                    break;

                case 13:
                    if (_pos.Index + 1 < _input.Length && _input[_pos.Index + 1] == 10)
                    {
                        _pos = _pos.Increment(1);
                    }
                    goto case 10;

                case 10:
                case 8232:
                case 8233:
                    _pos = new Position(_pos.Line + 1, 0, _pos.Index + 1);
                    break;

                case 47:     // '/'
                    switch ((int)_input.Get(_pos.Index + 1))
                    {
                    case 42:         // '*'
                        SkipBlockComment();
                        break;

                    case 47:
                        SkipLineComment(2);
                        break;

                    default:
                        return;
                    }
                    break;

                default:
                    if (ch > 8 && ch < 14 || ch >= 5760 && NonAsciIwhitespace.IsMatch(((char)ch).ToString()))
                    {
                        _pos = _pos.Increment(1);
                        break;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
Exemple #2
0
        // Called at the start of the parse and after every token. Skips
        // whitespace and comments, and.
        void SkipSpace()
        {
            while (_pos.Index < _input.Length)
            {
                var ch = (int)_input[_pos.Index];
                switch (ch)
                {
                case CharCode.Space:
                case CharCode.NoBreakSpace:
                    _pos = _pos.Increment(1);
                    break;

                case CharCode.CarriageReturn:
                    if (_pos.Index + 1 < _input.Length && _input[_pos.Index + 1] == 10)
                    {
                        _pos = _pos.Increment(1);
                    }
                    goto case CharCode.LineFeed;

                case CharCode.LineFeed:
                case CharCode.LineSeparator:
                case CharCode.ParagraphSeparator:
                    _pos = new Position(_pos.Line + 1, 0, _pos.Index + 1);
                    break;

                case CharCode.Slash:
                    switch ((int)_input.Get(_pos.Index + 1))
                    {
                    case CharCode.Asterisk:
                        SkipBlockComment();
                        break;

                    case CharCode.Slash:
                        SkipLineComment(2);
                        break;

                    default:
                        return;
                    }
                    break;

                default:
                    if (ch > CharCode.BackSpace && ch < CharCode.ShiftOut || ch >= CharCode.OghamSpaceMark && NonAsciIwhitespace.IsMatch(((char)ch).ToString()))
                    {
                        _pos = _pos.Increment(1);
                        break;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }