Beispiel #1
0
        public TokenTree build(OfficeMath expression)
        {
            foundIdentifiers.Clear();

            TokenList rootTokens = new TokenList();

            foreach (OpenXmlElement element in expression.ChildElements)
            {
                IToken processedElement = processElement(element);
                rootTokens.Append(processedElement);
            }

            return(new TokenTree(rootTokens, foundIdentifiers));
        }
Beispiel #2
0
        private RadicalToken processRadical(Radical r)
        {
            TokenList degree  = new TokenList();
            TokenList radBase = new TokenList();

            if (!r.Degree.HasChildren)
            {
                degree.Append(new TextRunToken("2"));
            }
            else
            {
                foreach (var child in r.Degree)
                {
                    degree.Append(processElement(child));
                }
            }

            foreach (var child in r.Base)
            {
                radBase.Append(processElement(child));
            }

            return(new RadicalToken(radBase, degree));
        }
Beispiel #3
0
        private IToken processMathFunction(MathFunction f)
        {
            TokenList funcName = new TokenList();
            TokenList funcBase = new TokenList();

            foreach (var child in f.FunctionName)
            {
                funcName.Append(processElement(child));
            }

            foreach (var child in f.Base)
            {
                funcBase.Append(processElement(child));
            }

            return(new FunctionApplyToken(funcBase, funcName));
        }
Beispiel #4
0
        private SuperscriptToken processSupScript(Superscript s)
        {
            TokenList supBase  = new TokenList();
            TokenList argument = new TokenList();

            foreach (var child in s.Base)
            {
                supBase.Append(processElement(child));
            }

            foreach (var child in s.SuperArgument)
            {
                argument.Append(processElement(child));
            }

            return(new SuperscriptToken(supBase, argument));
        }
Beispiel #5
0
        private FractionToken processFraction(Fraction f)
        {
            TokenList denominator = new TokenList();
            TokenList numerator   = new TokenList();

            foreach (var child in f.Denominator)
            {
                denominator.Append(processElement(child));
            }

            foreach (var child in f.Numerator)
            {
                numerator.Append(processElement(child));
            }

            return(new FractionToken(numerator, denominator));
        }