Exemplo n.º 1
0
 public void array_indexing_with_AllowSemiColonAsActualParameterSeparator()
 {
     Analyzer a = new Analyzer(new AnalyzerOptions()
     {
         AllowSemiColonAsActualParameterSeparator = true
     });
     Tokenizer p = new Tokenizer();
     {
         p.Reset("array['H1';'H2','H3';'H4']");
         p.IsErrorOrEndOfInput.Should().Be(false);
         Expr e = a.Analyse(p);
         e.Should().BeOfType <AccessorCallExpr>();
         AccessorCallExpr ac = e as AccessorCallExpr;
         IsConstant(ac.Arguments[0], "H1");
         IsConstant(ac.Arguments[1], "H2");
         IsConstant(ac.Arguments[2], "H3");
         IsConstant(ac.Arguments[3], "H4");
     }
     {
         p.Reset("array[1+2;K > 67;test(8);A[N;O;T;H;E;R];'A']");
         p.IsErrorOrEndOfInput.Should().Be(false);
         Expr e = a.Analyse(p);
         e.Should().BeOfType <AccessorCallExpr>();
         AccessorCallExpr ac = e as AccessorCallExpr;
         ac.Arguments.Should().HaveCount(5);
     }
 }
Exemplo n.º 2
0
 public void array_indexing_is_an_accessor_call_expr()
 {
     Analyzer  a = new Analyzer();
     Tokenizer p = new Tokenizer();
     {
         p.Reset("a[9]");
         p.IsErrorOrEndOfInput.Should().Be(false);
         Expr e = a.Analyse(p);
         e.Should().BeOfType <AccessorCallExpr>();
         AccessorCallExpr ac = e as AccessorCallExpr;
         IsConstant(ac.Arguments[0], 9.0);
     }
     {
         p.Reset("array['Hello World!','H']");
         p.IsErrorOrEndOfInput.Should().Be(false);
         Expr e = a.Analyse(p);
         e.Should().BeOfType <AccessorCallExpr>();
         AccessorCallExpr ac = e as AccessorCallExpr;
         IsConstant(ac.Arguments[0], "Hello World!");
         IsConstant(ac.Arguments[1], "H");
     }
 }