Пример #1
0
        private AST Statement()
        {
            switch (currentToken.Type)
            {
            case TokenType.CONF:
                return(ProgramConfig());

            case TokenType.ASSIGN:
                return(Define());

            case TokenType.USING:
                return(Using());

            case TokenType.IMPORT:
                return(Import());

            case TokenType.SIGN:
                return(Signature());

            case TokenType.ROUTE:
                return(Route());

            default:
                ChainAST chainAST = Chain();
                Eat(TokenType.SEMIC);
                return(chainAST);
            }
        }
Пример #2
0
        private Group Visit(ChainAST chainAST)
        {
            ILinkable linkable = Visit(chainAST.Tree) as ILinkable;

            if (linkable as Model != null)
            {
                Group group = new Group();
                Model model = linkable as Model;
                group.AddInputModel(model);
                group.AddOutputModel(model);
                return(group);
            }
            else if (linkable as Group != null)
            {
                return(linkable as Group);
            }
            else
            {
                throw logger.Error(new LigralException($"Unknown type {linkable}"));
            }
        }