Exemple #1
0
        public static void Rule(Term lhs, Atom atom, OptionalTermBody optionalTermBody)
        {
            CodeCompoundTerm codeCompoundTerm;

            if (optionalTermBody.CodeTerms == null)
            {
                CodeFunctor codeFunctor = new CodeFunctor(atom.Text);

                codeCompoundTerm = new CodeCompoundTerm(codeFunctor);
            }
            else
            {
                CodeFunctor codeFunctor = new CodeFunctor(atom.Text, optionalTermBody.CodeTerms.Count);

                if (codeFunctor.Arity == 0)
                {
                    codeCompoundTerm = new CodeCompoundTerm(codeFunctor);
                }
                else
                {
                    codeCompoundTerm = new CodeCompoundTerm(codeFunctor, optionalTermBody.CodeTerms);
                }
            }

            lhs.CodeCompoundTerm = codeCompoundTerm;
        }
Exemple #2
0
        public static void Rule(Clause lhs, OptionalProcedureComments optionalProcedureComments, Term term, OptionalRuleBody optionalBody)
        {
            var comments = optionalProcedureComments.Comments ??
                           (IEnumerable<CodeComment>) new CodeComment[] {};

            var codeCompoundTerms = optionalBody.CodeCompoundTerms ??
                                    (IEnumerable<CodeCompoundTerm>) new CodeCompoundTerm[] {};

            lhs.CodeSentence = new CodeSentence(comments, term.CodeCompoundTerm, codeCompoundTerms);
        }
Exemple #3
0
        public static void Rule(Clause lhs, OptionalProcedureComments optionalProcedureComments, Term term, OptionalRuleBody optionalBody)
        {
            IEnumerable<CodeComment> comments = optionalProcedureComments.Comments;
            if (comments == null)
            {
                comments = new CodeComment[] { };
            }

            IEnumerable<CodeCompoundTerm> codeCompoundTerms = optionalBody.CodeCompoundTerms;
            if (codeCompoundTerms == null)
            {
                codeCompoundTerms = new CodeCompoundTerm[] { };
            }

            lhs.CodeSentence = new CodeSentence(comments, term.CodeCompoundTerm, codeCompoundTerms);
        }
Exemple #4
0
 public static void Rule(Element lhs, Term term)
 {
     lhs.CodeTerm = term.CodeCompoundTerm;
 }
Exemple #5
0
        public static void Rule(Clause lhs, OptionalProcedureComments optionalProcedureComments, Term term, OptionalRuleBody optionalBody)
        {
            var comments = optionalProcedureComments.Comments ??
                           (IEnumerable <CodeComment>) new CodeComment[] {};

            var codeCompoundTerms = optionalBody.CodeCompoundTerms ??
                                    (IEnumerable <CodeCompoundTerm>) new CodeCompoundTerm[] {};

            lhs.CodeSentence = new CodeSentence(comments, term.CodeCompoundTerm, codeCompoundTerms);
        }