Пример #1
0
        public PlotForm()
        {
            InitializeComponent();
            InitializePlotView();

            this.parseProperties   = new ParseProperties();
            this.tokenTreeBuilder  = new TokenTreeBuilder(parseProperties);
            this.syntaxTreeBuilder = new SyntaxTreeBuilder(parseProperties);
            this.parsedExpressions = new List <OpenXMLExpression>();
        }
Пример #2
0
        static void Main(string[] args)
        {
            String docPath = @"..\..\proba - Copy.docx";

            WordprocessingDocument doc = WordprocessingDocument.Open(docPath, false);
            Body docBody = doc.MainDocumentPart.Document.Body;

            ParseProperties   parseProperties   = buildProperties();
            TokenTreeBuilder  tokenTreeBuilder  = new TokenTreeBuilder(parseProperties);
            SyntaxTreeBuilder syntaxTreeBuilder = new SyntaxTreeBuilder(parseProperties);

            List <OfficeMath> mathExpressions = new List <OfficeMath>(docBody.Descendants <OfficeMath>());

            foreach (var expression in mathExpressions)
            {
                if (String.IsNullOrWhiteSpace(expression.InnerText))
                {
                    continue;
                }

                Console.WriteLine("OMath paragraph found!");
                Console.WriteLine(System.Xml.Linq.XDocument.Parse(expression.OuterXml).ToString());

                TokenTree  tokenTree  = tokenTreeBuilder.build(expression);
                SyntaxTree syntaxTree = syntaxTreeBuilder.Build(tokenTree);

                Console.WriteLine("\nSyntax tree built!");
                Console.WriteLine("Postfix notation: ");
                Console.WriteLine(syntaxTree.toPostfixNotation());
                Console.WriteLine("Infix notation: ");
                Console.WriteLine(syntaxTree.toInfixNotation());
                Console.WriteLine("\n====================================================================\n");
            }



            Console.Read();
        }