コード例 #1
0
ファイル: MvxParser.cs プロジェクト: yuewah/mvx-unity-ngui
        protected bool TryReadValue(AllowNonQuotedText allowNonQuotedText, out object value)
        {
            SkipWhitespace();

            if (IsComplete)
            {
                throw new MvxException("Unexpected termination while reading value in {0}", FullText);
            }

            var currentChar = CurrentChar;

            if (currentChar == '\'' || currentChar == '\"')
            {
                value = ReadQuotedString();
                return(true);
            }

            if (char.IsDigit(currentChar) || currentChar == '-')
            {
                value = ReadNumber();
                return(true);
            }

            bool booleanValue;

            if (TryReadBoolean(out booleanValue))
            {
                value = booleanValue;
                return(true);
            }

            if (TryReadNull())
            {
                value = null;
                return(true);
            }

            if (allowNonQuotedText == AllowNonQuotedText.Allow)
            {
                value = ReadTextUntil(',', ';');
                return(true);
            }

            value = null;
            return(false);
        }
コード例 #2
0
        protected bool TryReadValue(AllowNonQuotedText allowNonQuotedText, out object value)
        {
            SkipWhitespace();

            if (IsComplete)
            {
                throw new MvxException("Unexpected termination while reading value in {0}", FullText);
            }

            var currentChar = CurrentChar;
            if (currentChar == '\'' || currentChar == '\"')
            {
                value = ReadQuotedString();
                return true;
            }

            if (char.IsDigit(currentChar) || currentChar == '-')
            {
                value = ReadNumber();
                return true;
            }

            bool booleanValue;
            if (TryReadBoolean(out booleanValue))
            {
                value = booleanValue;
                return true;
            }

            if (TryReadNull())
            {
                value = null;
                return true;
            }

            if (allowNonQuotedText == AllowNonQuotedText.Allow)
            {
                value = ReadTextUntil(',', ';');
                return true;
            }

            value = null;
            return false;
        }