Пример #1
0
        /// <summary>
        /// Checks for errors before applying a rule.
        /// </summary>
        /// <param name="node">The node instance to check.</param>
        /// <param name="dataList">Optional data collected during inspection of sources.</param>
        /// <param name="data">Private data to give to Apply() upon return.</param>
        /// <returns>True if an error occured.</returns>
        public override bool CheckConsistency(IManifestNumberExpression node, IDictionary <ISourceTemplate, object> dataList, out object data)
        {
            bool Success = true;

            data = null;

            if (!StringValidation.IsValidIdentifier(node, node.Text, out string ValidText, out IErrorStringValidity StringError))
            {
                Success = false;
            }
        private void CheckReplicates(IList <ICompiledReplicate> replicateList, ReplicationContext context)
        {
            foreach (ICompiledReplicate Replicate in replicateList)
            {
                IName  ReplicateName     = (IName)Replicate.ReplicateName;
                string ReplicateNameText = ReplicateName.Text;

                if (!StringValidation.IsValidIdentifier(ReplicateName, ReplicateNameText, out string ValidReplicateName, out IErrorStringValidity StringError))
                {
                    ErrorList.AddError(StringError);
                }
Пример #3
0
        private bool IsPathAssigned(IList <string> stringPath, IList <BaseNode.IIdentifier> identifierPath)
        {
            bool Result = true;

            Result &= stringPath.Count == identifierPath.Count;

            for (int i = 0; i < stringPath.Count && i < identifierPath.Count; i++)
            {
                string StringText = stringPath[i];
                Debug.Assert(StringValidation.IsValidIdentifier(StringText));

                IIdentifier Identifier = (IIdentifier)identifierPath[i];

                Debug.Assert(Identifier.ValidText.IsAssigned);
                string IdentifierText = Identifier.ValidText.Item;
                Debug.Assert(StringValidation.IsValidIdentifier(IdentifierText));

                Result &= StringText == IdentifierText;
            }

            return(Result);
        }