Ejemplo n.º 1
0
        public void TestParseIf()
        {
            var lexer = new Mq4Lexer();
            var resultTokens = lexer.BuildTextTokens(ScriptUtils.CodeWithIfs);

            var parser = new Mq4Parser();
            var astTree = parser.Parse(resultTokens);

            Assert.IsTrue(astTree.Children.Count == 1);
        }
Ejemplo n.º 2
0
        public void TestParseGetMargin()
        {
            var lexer = new Mq4Lexer();
            var resultTokens = lexer.BuildTextTokens(ScriptUtils.GetMarginFunctionWithComplexComments);

            var parser = new Mq4Parser();
            var astTree = parser.Parse(resultTokens);

            Assert.IsTrue(astTree.Children.Count == 1);
        }
Ejemplo n.º 3
0
        public void TestMethod1()
        {
            var lexer = new Mq4Lexer();
            var resultTokens = lexer.BuildTextTokens(ScriptUtils.ComplexCode);

            var parser = new Mq4Parser();
            var astTree = parser.Parse(resultTokens);

            Assert.IsTrue(astTree.Children.Count == 8);
        }
Ejemplo n.º 4
0
        public static void GenerateCode()
        {
            var lexer = new Mq4Lexer();
            var resultTokens = lexer.BuildTextTokens(ScriptUtils.ComplexCode);

            var parser = new Mq4Parser();
            var astTree = parser.Parse(resultTokens);
            var semantic = new SemanticAnalysis(astTree);
            semantic.Perform();

            var codeGenerator = new CsCodeGenerator();
            codeGenerator.GenerateCodeForNode(astTree.Children[0]);
        }
Ejemplo n.º 5
0
 public Mq4Translator()
 {
     _lexer = new Mq4Lexer();
     _parser = new Mq4Parser();
     _codeGenerator = new CsCodeGenerator();
 }