AlphaTab.Importer.AlphaTexImporter.NewSy C# (CSharp) Method

NewSy() private method

Reads the next terminal symbol.
private NewSy ( ) : void
return void
        private void NewSy()
        {
            _sy = AlphaTexSymbols.No;
            do
            {
                if (_ch == Eof)
                {
                    _sy = AlphaTexSymbols.Eof;
                }
                else if (Std.IsWhiteSpace(_ch))
                {
                    // skip whitespaces
                    NextChar();
                }
                else if (_ch == 0x2F /* / */)
                {
                    NextChar();
                    if (_ch == 0x2F /* / */)
                    {
                        // single line comment
                        while (_ch != 0x0D /* \r */ && _ch != 0x0A /* \n */ && _ch != Eof)
                        {
                            NextChar();
                        }
                    }
                    else if (_ch == 0x2A /* * */)
                    {
                        // multiline comment
                        while (_ch != Eof)
                        {
                            if (_ch == 0x2A /* * */) // possible end
                            {
                                NextChar();
                                if (_ch == 0x2F /* / */)
                                {
                                    NextChar();
                                    break;
                                }
                            }
                            else
                            {
                                NextChar();
                            }
                        }
                    }
                    else
                    {
                        Error("symbol", AlphaTexSymbols.String, false);
                    }
                }
                else if (_ch == 0x22 /* " */ || _ch == 0x27 /* ' */)
                {
                    NextChar();
                    var s = new StringBuilder();
                    _sy = AlphaTexSymbols.String;
                    while (_ch != 0x22 /* " */ && _ch != 0x27 /* ' */ && _ch != Eof)
                    {
                        s.AppendChar(_ch);
                        NextChar();
                    }
                    _syData = s.ToString();
                    NextChar();
                }
                else if (_ch == 0x2D /* - */) // negative number
                {
                    // is number?
                    if (_allowNegatives && IsDigit(_ch))
                    {
                        var number = ReadNumber();
                        _sy = AlphaTexSymbols.Number;
                        _syData = number;
                    }
                    else
                    {
                        _sy = AlphaTexSymbols.String;
                        _syData = ReadName();
                    }
                }
                else if (_ch == 0x2E /* . */)
                {
                    _sy = AlphaTexSymbols.Dot;
                    NextChar();
                }
                else if (_ch == 0x3A /* : */)
                {
                    _sy = AlphaTexSymbols.DoubleDot;
                    NextChar();
                }
                else if (_ch == 0x28 /* ( */)
                {
                    _sy = AlphaTexSymbols.LParensis;
                    NextChar();
                }
                else if (_ch == 0x5C /* \ */)
                {
                    NextChar();
                    var name = ReadName();
                    _sy = AlphaTexSymbols.MetaCommand;
                    _syData = name;
                }
                else if (_ch == 0x29 /* ) */)
                {
                    _sy = AlphaTexSymbols.RParensis;
                    NextChar();
                }
                else if (_ch == 0x7B /* { */)
                {
                    _sy = AlphaTexSymbols.LBrace;
                    NextChar();
                }
                else if (_ch == 0x7D /* } */)
                {
                    _sy = AlphaTexSymbols.RBrace;
                    NextChar();
                }
                else if (_ch == 0x7C /* | */)
                {
                    _sy = AlphaTexSymbols.Pipe;
                    NextChar();
                }
                else if (_ch == 0x2A /* * */)
                {
                    _sy = AlphaTexSymbols.Multiply;
                    NextChar();
                }
                else if (IsDigit(_ch))
                {
                    var number = ReadNumber();
                    _sy = AlphaTexSymbols.Number;
                    _syData = number;
                }
                else if (IsLetter(_ch))
                {
                    var name = ReadName();
                    if (TuningParser.IsTuning(name))
                    {
                        _sy = AlphaTexSymbols.Tuning;
                        _syData = name.ToLower();
                    }
                    else
                    {
                        _sy = AlphaTexSymbols.String;
                        _syData = name;
                    }
                }
                else
                {
                    Error("symbol", AlphaTexSymbols.String, false);
                }
            } while (_sy == AlphaTexSymbols.No);
        }