Пример #1
0
        /// <summary>
        /// Finds the matching nodes of a <see cref="IManifestCharacterExpression"/>.
        /// </summary>
        /// <param name="node">The agent expression to check.</param>
        /// <param name="errorList">The list of errors found.</param>
        /// <param name="resolvedResult">The expression result types upon return.</param>
        /// <param name="resolvedException">Exceptions the expression can throw upon return.</param>
        /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param>
        /// <param name="expressionConstant">The expression constant upon return.</param>
        public static bool ResolveCompilerReferences(IManifestCharacterExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant)
        {
            resolvedResult     = null;
            resolvedException  = null;
            constantSourceList = new SealableList <IExpression>();
            expressionConstant = NeutralLanguageConstant.NotConstant;

            IClass EmbeddingClass = node.EmbeddingClass;
            string ValidText      = node.ValidText.Item;

            Debug.Assert(ValidText.Length == 1);
            char ValidChar = ValidText[0];

            if (!Expression.IsLanguageTypeAvailable(LanguageClasses.Character.Guid, node, out ITypeName CharacterTypeName, out ICompiledType CharacterType))
            {
                errorList.AddError(new ErrorCharacterTypeMissing(node));
                return(false);
            }

            resolvedResult = new ResultType(CharacterTypeName, CharacterType, string.Empty);

            resolvedException  = new ResultException();
            expressionConstant = new CharacterLanguageConstant(ValidChar);

#if COVERAGE
            Debug.Assert(!node.IsComplex);
#endif

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Compares two expressions.
        /// </summary>
        /// <param name="other">The other expression.</param>
        protected bool IsExpressionEqual(IManifestCharacterExpression other)
        {
            Debug.Assert(other != null);

            bool Result = true;

            Result &= ValidText.Item == other.ValidText.Item;

            return(Result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CSharpManifestCharacterExpression"/> class.
 /// </summary>
 /// <param name="context">The creation context.</param>
 /// <param name="source">The Easly expression from which the C# expression is created.</param>
 protected CSharpManifestCharacterExpression(ICSharpContext context, IManifestCharacterExpression source)
     : base(context, source)
 {
 }
 /// <summary>
 /// Creates a new C# expression.
 /// </summary>
 /// <param name="context">The creation context.</param>
 /// <param name="source">The Easly expression from which the C# expression is created.</param>
 public static ICSharpManifestCharacterExpression Create(ICSharpContext context, IManifestCharacterExpression source)
 {
     return(new CSharpManifestCharacterExpression(context, source));
 }