Пример #1
0
        /// <summary>
        /// The text value of the word.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("TextWord.");
            sb.SentenceAppend(mClass.ToString());
            if (_LiteralType != Enums.LiteralType.none)
            {
                sb.SentenceAppend(_LiteralType.ToString());
            }
            sb.SentenceAppend(mValue);
            return(sb.ToString());
        }
Пример #2
0
        public static ScanAtomCode ToScanAtomCode(this LiteralType LitType)
        {
            switch (LitType)
            {
            case LiteralType.Char:
            case LiteralType.String:
            case LiteralType.VerbatimString:
                return(ScanAtomCode.Quoted);

            case LiteralType.Decimal:
            case LiteralType.Float:
            case LiteralType.Integer:
            case LiteralType.Long:
                return(ScanAtomCode.Numeric);

            default:
                throw new ApplicationException("unsupported LiteralType. " + LitType.ToString());
            }
        }
Пример #3
0
        public TextWord(string Text, LiteralType LiteralType, TextTraits Traits)
        {
            mValue       = Text;
            _LiteralType = LiteralType;

            if (this.LiteralType.IsNumeric( ))
            {
                mClass = WordClassification.Numeric;
            }
            else if (this.LiteralType.IsQuoted( ))
            {
                mClass = WordClassification.Quoted;
            }
            else
            {
                throw new ApplicationException(
                          "LiteralType is not supported. " + LiteralType.ToString());
            }

            mTraits    = Traits;
            _BraceChar = null;
        }