예제 #1
0
        public void RollToken(PListToken Token)
        {
            var Len = Token.Value_.Length;

            for (var Index = 0; Index < Len; ++Index)
            {
                RollChar();
            }
        }
예제 #2
0
        public PListToken ReadToken()
        {
            var Token    = new PListToken();
            var Text     = new StringBuilder();
            var InString = false;

            while (true)
            {
                var Ch = ReadChar();

                if (Ch == char.MinValue)
                {
                    Token.Type_ = PListTokenType.EndOfFile;
                    break;
                }

                if (Ch == '"' && !InString)
                {
                    InString = true;
                    continue;
                }

                if (InString || !IsSymbol(Ch))
                {
                    if (Ch == '"')
                    {
                        InString = false;
                        break;
                    }

                    Text.Append(Ch);
                }
                else
                {
                    if (Text.Length == 0)
                    {
                        Text.Append(Ch);
                    }
                    else
                    {
                        RollChar();
                    }
                    break;
                }
            }

            Token.Value_ = Text.ToString();
            Token.Type_  = GetType(Token.Value_);

            return(Token);
        }