Esempio n. 1
0
        private Group Visit(GotoOpAST gotoOpAST)
        {
            ILinkable source      = Visit(gotoOpAST.Source) as ILinkable;
            ILinkable destination = Visit(gotoOpAST.Destination) as ILinkable;

            if (source != null && destination != null)
            {
                try
                {
                    source.Connect(destination);
                }
                catch (LigralException)
                {
                    throw logger.Error(new SemanticException(gotoOpAST.FindToken()));
                }
            }
            else
            {
                throw logger.Error(new SemanticException(gotoOpAST.FindToken(), "Invalid connection"));
            }
            Group group = new Group();

            group.AddInputModel(source);
            group.AddOutputModel(destination);
            return(group);
        }
Esempio n. 2
0
        private ChainAST Chain()
        {
            AST nodeExprAST = NodeExpr(true);

            while (currentToken.Type == TokenType.GOTO)
            {
                OperatorToken gotoToken = (OperatorToken)currentToken;
                Eat(TokenType.GOTO);
                nodeExprAST = new GotoOpAST(nodeExprAST, NodeExpr(false), gotoToken);
            }
            return(new ChainAST(nodeExprAST));
        }