Tidy.Core.Lexer.ParseServerInstruction C# (CSharp) Method

ParseServerInstruction() public method

public ParseServerInstruction ( ) : int
return int
        public virtual int ParseServerInstruction()
        {
            int c;
            int delim = '"';
            bool isrule = false;

            c = Input.ReadChar();
            AddCharToLexer(c);

            /* check for ASP, PHP or Tango */
            if (c == '%' || c == '?' || c == '@')
            {
                isrule = true;
            }

            for (;;)
            {
                c = Input.ReadChar();

                if (c == StreamIn.END_OF_STREAM)
                {
                    break;
                }

                if (c == '>')
                {
                    if (isrule)
                    {
                        AddCharToLexer(c);
                    }
                    else
                    {
                        Input.UngetChar(c);
                    }
                    break;
                }

                /* if not recognized as ASP, PHP or Tango */
                /* then also finish value on whitespace */
                if (!isrule)
                {
                    int map = Map((char) c);

                    if ((map & WHITE) != 0)
                    {
                        break;
                    }
                }

                AddCharToLexer(c);

                if (c == '"')
                {
                    do
                    {
                        c = Input.ReadChar();
                        AddCharToLexer(c);
                    } while (c != '"');
                    delim = '\'';
                    continue;
                }

                if (c == '\'')
                {
                    do
                    {
                        c = Input.ReadChar();
                        AddCharToLexer(c);
                    } while (c != '\'');
                }
            }

            return delim;
        }