Exemple #1
0
        private bool AddTerm(Term value)
        {
            var added = true;

            if (_isFraction)
            {
                if (_terms.Length > 0)
                {
                    value = new PrimitiveTerm(UnitType.Unknown, _terms[_terms.Length - 1] + "/" + value);
                }
                _terms.SetLastTerm(value);
                _isFraction = false;
            }
            else if (_functionBuffers.Count > 0)
            {
                _functionBuffers.Peek().TermList.Add(value);
            }
            else if (_terms.Length == 0)
            {
                _terms.AddTerm(value);
            }
            else if (_parsingContext == ParsingContext.InSingleValue)
            {
                _terms.AddTerm(value);
            }
            else
            {
                added = false;
            }

            return(added);
        }
Exemple #2
0
        public GenericFunction(string name, List <Term> arguments)
        {
            this.Name = name;

            var list = new TermList();

            for (int n = 0; n < arguments.Count; n++)
            {
                list.AddTerm(arguments[n]);
                if (n == arguments.Count - 1)
                {
                    break;
                }
                list.AddSeparator(GrammarSegment.Comma);
            }
            this.Arguments = list;
        }