Example #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());
        }
        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());
            }
        }
Example #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;
        }