Ejemplo n.º 1
0
 /// <summary>
 /// Returns next token that is not whitespace.
 /// </summary>
 /// <returns></returns>
 private Topology.Converters.WellKnownText.TokenType NextNonWhitespaceToken()
 {
     Topology.Converters.WellKnownText.TokenType type = this.NextTokenAny();
     while ((type == Topology.Converters.WellKnownText.TokenType.Whitespace) || (type == Topology.Converters.WellKnownText.TokenType.Eol))
     {
         type = this.NextTokenAny();
     }
     return(type);
 }
Ejemplo n.º 2
0
        private Topology.Converters.WellKnownText.TokenType NextTokenAny()
        {
            Topology.Converters.WellKnownText.TokenType eof = Topology.Converters.WellKnownText.TokenType.Eof;
            char[] chArray = new char[1];
            this._currentToken     = "";
            this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Eof;
            int  num   = this._reader.Read(chArray, 0, 1);
            bool flag  = false;
            bool flag2 = false;

            byte[]        bytes    = null;
            ASCIIEncoding encoding = new ASCIIEncoding();

            char[] chars = null;
            while (num != 0)
            {
                bytes = new byte[] { (byte)this._reader.Peek() };
                chars = encoding.GetChars(bytes);
                char character = chArray[0];
                char ch2       = chars[0];
                this._currentTokenType = this.GetType(character);
                eof = this.GetType(ch2);
                if (flag2 && (character == '_'))
                {
                    this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Word;
                }
                if (flag2 && (this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Number))
                {
                    this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Word;
                }
                if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Word) && (ch2 == '_'))
                {
                    eof   = Topology.Converters.WellKnownText.TokenType.Word;
                    flag2 = true;
                }
                if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Word) && (eof == Topology.Converters.WellKnownText.TokenType.Number))
                {
                    eof   = Topology.Converters.WellKnownText.TokenType.Word;
                    flag2 = true;
                }
                if (((character == '-') && (eof == Topology.Converters.WellKnownText.TokenType.Number)) && !flag)
                {
                    this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Number;
                    eof = Topology.Converters.WellKnownText.TokenType.Number;
                }
                if ((flag && (eof == Topology.Converters.WellKnownText.TokenType.Number)) && (character == '.'))
                {
                    this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Number;
                }
                if (((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Number) && (ch2 == '.')) && !flag)
                {
                    eof  = Topology.Converters.WellKnownText.TokenType.Number;
                    flag = true;
                }
                this._colNumber++;
                if (this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Eol)
                {
                    this._lineNumber++;
                    this._colNumber = 1;
                }
                this._currentToken = this._currentToken + character;
                if (this._currentTokenType != eof)
                {
                    num = 0;
                }
                else
                {
                    if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Symbol) && (character != '-'))
                    {
                        num = 0;
                        continue;
                    }
                    num = this._reader.Read(chArray, 0, 1);
                }
            }
            return(this._currentTokenType);
        }
Ejemplo n.º 3
0
 private Topology.Converters.WellKnownText.TokenType NextTokenAny()
 {
     Topology.Converters.WellKnownText.TokenType eof = Topology.Converters.WellKnownText.TokenType.Eof;
     char[] chArray = new char[1];
     this._currentToken = "";
     this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Eof;
     int num = this._reader.Read(chArray, 0, 1);
     bool flag = false;
     bool flag2 = false;
     byte[] bytes = null;
     ASCIIEncoding encoding = new ASCIIEncoding();
     char[] chars = null;
     while (num != 0)
     {
         bytes = new byte[] { (byte) this._reader.Peek() };
         chars = encoding.GetChars(bytes);
         char character = chArray[0];
         char ch2 = chars[0];
         this._currentTokenType = this.GetType(character);
         eof = this.GetType(ch2);
         if (flag2 && (character == '_'))
         {
             this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Word;
         }
         if (flag2 && (this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Number))
         {
             this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Word;
         }
         if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Word) && (ch2 == '_'))
         {
             eof = Topology.Converters.WellKnownText.TokenType.Word;
             flag2 = true;
         }
         if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Word) && (eof == Topology.Converters.WellKnownText.TokenType.Number))
         {
             eof = Topology.Converters.WellKnownText.TokenType.Word;
             flag2 = true;
         }
         if (((character == '-') && (eof == Topology.Converters.WellKnownText.TokenType.Number)) && !flag)
         {
             this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Number;
             eof = Topology.Converters.WellKnownText.TokenType.Number;
         }
         if ((flag && (eof == Topology.Converters.WellKnownText.TokenType.Number)) && (character == '.'))
         {
             this._currentTokenType = Topology.Converters.WellKnownText.TokenType.Number;
         }
         if (((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Number) && (ch2 == '.')) && !flag)
         {
             eof = Topology.Converters.WellKnownText.TokenType.Number;
             flag = true;
         }
         this._colNumber++;
         if (this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Eol)
         {
             this._lineNumber++;
             this._colNumber = 1;
         }
         this._currentToken = this._currentToken + character;
         if (this._currentTokenType != eof)
         {
             num = 0;
         }
         else
         {
             if ((this._currentTokenType == Topology.Converters.WellKnownText.TokenType.Symbol) && (character != '-'))
             {
                 num = 0;
                 continue;
             }
             num = this._reader.Read(chArray, 0, 1);
         }
     }
     return this._currentTokenType;
 }