Ejemplo n.º 1
0
        private IStatementNode ParseSimpleStatementNode(bool canHaveLabel = false)
        {
            var token = this.NextToken();

            while (token != null && token.Type == TokenType.NewLine)
            {
                token = this.NextToken();
            }

            if (token == null)
            {
                return(null);
            }

            if (token.Type == TokenType.Name)
            {
                IStatementNode stmt = this.TryParseNameStatement(token.Value);

                if (stmt != null)
                {
                    return(stmt);
                }
            }

            this.PushToken(token);

            if (token.Type == TokenType.Delimiter && token.Value == "{")
            {
                return(this.ParseStatementBlock());
            }

            IExpressionNode node = this.ParseExpressionNode();

            if (node == null)
            {
                return(null);
            }

            AssignmentNode anode = this.TryParseAssignmentNode(node);

            if (anode != null)
            {
                return(anode);
            }

            if (this.TryParseToken(TokenType.Operator, "<-"))
            {
                var cmdnode = new SendNode(node, this.ParseExpressionNode());
                return(cmdnode);
            }

            var cmd = new ExpressionStatementNode(node);

            return(cmd);
        }
Ejemplo n.º 2
0
        /// Sorry for that
        public static void OnSelectedItemChanged()
        {
            Node node = SelectedItem as Node;

            SendNode?.Invoke(node);
        }