Пример #1
0
 void ITreeWalker.Visit(MatchStatement statement)
 {
     statement.Validate(this);
     InsertMatch(() => statement.Reference.Accept(this), () =>
     {
         _loops.Push(true);
         statement.Cases.Accept(this);
         _loops.Pop();
     });
 }
Пример #2
0
 public void Visit(MatchStatement matchstmt)
 {
     Console.Write("match (");
     matchstmt.expression.Accept(this);
     Console.WriteLine(") {");
     foreach (var matchcase in matchstmt.matchCases)
     {
         Console.Write($"\t{matchcase.Type} : ");
         matchcase.Statement.Accept(this);
         Console.WriteLine();
     }
     if (matchstmt.defaultCase != null)
     {
         Console.Write("\tdefault : ");
         matchstmt.defaultCase.Accept(this);
     }
     Console.WriteLine();
     Console.WriteLine("}");
 }
Пример #3
0
        void ITreeWalker.Visit(MatchStatement statement)
        {
            var name = "^~#" + _loops.Count;

            statement.Validate(this);
            statement.Reference.Accept(this);
            _operations.Add(new SetsOperation(name));
            InsertJump(_operations.Count + 1);
            var jumpToEnd = InsertMarker();

            _loops.Push(new LoopInfo {
                Break = jumpToEnd, Continue = jumpToEnd
            });
            statement.Cases.Accept(this);
            _loops.Pop();
            var end = _operations.Count;

            _operations.Add(new DelVarOperation(name));
            _operations.Add(PopOperation.Instance);
            InsertJump(jumpToEnd, end - 1);
        }
Пример #4
0
        public void VisitMatchStatement(MatchStatement matchStmt)
        {
            int tmp_counter = scope_counter;
            DecendScope();
            scope_counter = 0;

            matchStmt.Target.AcceptWalker(this);
            matchStmt.Clauses.AcceptWalker(this);

            AscendScope();
            scope_counter = tmp_counter + 1;
        }
Пример #5
0
 internal CaseStatementBuilder(MatchStatement <D> statement, Action <ParameterExpression> scope)
 {
     this.scope     = scope;
     this.statement = statement;
 }
Пример #6
0
 /// <summary>
 /// Visits a match statement - accepts the condition and body.
 /// </summary>
 public virtual void Visit(MatchStatement statement)
 {
     statement.Reference.Accept(this);
     statement.Cases.Accept(this);
 }
 void ITreeWalker.Visit(MatchStatement statement)
 {
     Header("Statement/Match");
     WriteProperty("Reference", statement.Reference);
     WriteProperty("Cases", statement.Cases);
 }
Пример #8
0
 public void VisitMatchStatement(MatchStatement matchStmt)
 {
 }
 void ITreeWalker.Visit(MatchStatement statement)
 {
     statement.Validate(this);
     statement.Reference.Accept(this);
     statement.Cases.Accept(this);
 }
Пример #10
0
 public void Visit(MatchStatement matchStatement)
 {
 }