Examples of ParseNode


Examples of org.jboss.byteman.rule.grammar.ParseNode

                String typeName = typeTree.getText();
                return getTypeGroup().create(typeName);
            }
            case ARRAY:
            {
                ParseNode child0 = (ParseNode)typeTree.getChild(0);
                Type baseType = getBindingType(child0);
                if (baseType != null) {
                    return getTypeGroup().createArray(baseType);
                } else {
                    return null;
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

        String fullText = "BIND\n" + text + "\nIF TRUE DO NOTHING";
        try {
            ECATokenLexer lexer = new ECATokenLexer(new StringReader(fullText));
            ECAGrammarParser parser = new ECAGrammarParser(lexer);
            Symbol event_parse = parser.parse();
            ParseNode eventTree = (ParseNode)event_parse.value;
            Event event = new Event(rule, eventTree);
            return event;
        } catch (Exception e) {
            throw new ParseException("org.jboss.byteman.rule.Event : error parsing event\n" + text, e);
        }
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

                int tag = eventTree.getTag();
                switch (tag) {
                    case COMMA:
                    {
                        // update before we risk an exception
                        ParseNode child0 = (ParseNode)eventTree.getChild(0);
                        eventTree = (ParseNode)eventTree.getChild(1);
                        addBinding(bindings, child0);
                    }
                    break;
                    case ASSIGN:
                    {
                        // update before we risk an exception
                        ParseNode saveTree = eventTree;
                        eventTree = null;
                        addBinding(bindings, saveTree);
                    }
                    break;
                    default:
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

        if (tag != ASSIGN) {
            String message = "Event.createBindings : unexpected token Type in binding " + tag + " for token " + bindingTree.getText() + bindingTree.getPos();
            throw new TypeException(message);
        }

        ParseNode varTree = (ParseNode)bindingTree.getChild(0);
        ParseNode exprTree = (ParseNode)bindingTree.getChild(1);
        Binding binding;

        binding = createBinding(varTree);

        // don't allow current binding to be used when parsing the expression
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

            {
                return new Binding(rule, varTree.getText());
            }
            case COLON:
            {
                ParseNode child0 = (ParseNode)varTree.getChild(0);
                ParseNode child1 = (ParseNode)varTree.getChild(1);
                if (child0.getTag() != IDENTIFIER) {
                    throw new TypeException("Event.createBindings : unexpected token type in variable declaration" + child0.getTag() + " for token " + child0.getText() + child0.getPos());
                } else if (child1.getTag() != IDENTIFIER && child1.getTag() != ARRAY) {
                    throw new TypeException("Event.createBindings : unexpected token Type in variable type declaration" + child1.getTag()  + " for token " + child1.getText() + child1.getPos());
                }
                Type type = getBindingType(child1);
                if (type == null) {
                    throw new TypeException("Event.createBindings : incompatible type in declaration of variable " + child1.getText() + child1.getPos());
                }
                return new Binding(rule, child0.getText(), type);
            }
            default:
            {
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

                String typeName = typeTree.getText();
                return getTypeGroup().create(typeName);
            }
            case ARRAY:
            {
                ParseNode child0 = (ParseNode)typeTree.getChild(0);
                Type baseType = getBindingType(child0);
                if (baseType != null) {
                    return getTypeGroup().createArray(baseType);
                } else {
                    return null;
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

        String fullText = "BIND NOTHING IF TRUE DO \n" + text;
        try {
            ECATokenLexer lexer = new ECATokenLexer(new StringReader(text));
            ECAGrammarParser parser = new ECAGrammarParser(lexer);
            Symbol parse = parser.parse();
            ParseNode parseTree = (ParseNode)parse.value;
            ParseNode actionTree = (ParseNode)parseTree.getChild(3);
            Action action = new Action(rule, actionTree);
            return action;
        } catch (Exception e) {
            throw new ParseException("org.jboss.byteman.rule.Action : error parsing action\n" + text);
        }
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

        String fullText = "BIND NOTHING IF TRUE DO \n" + text;
        try {
            ECATokenLexer lexer = new ECATokenLexer(new StringReader(text));
            ECAGrammarParser parser = new ECAGrammarParser(lexer);
            Symbol parse = parser.parse();
            ParseNode parseTree = (ParseNode)parse.value;
            ParseNode actionTree = (ParseNode)parseTree.getChild(3);
            Action action = new Action(rule, actionTree);
            return action;
        } catch (Exception e) {
            throw new ParseException("org.jboss.byteman.rule.Action : error parsing action\n" + text);
        }
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

        String fulltext = "BIND NOTHING IF \n" + text + "\n DO NOTHING";
        try {
            ECATokenLexer lexer = new ECATokenLexer(new StringReader(text));
            ECAGrammarParser parser = new ECAGrammarParser(lexer);
            Symbol condition_parse = parser.parse();
            ParseNode conditionTree = (ParseNode) condition_parse.value;
            Condition condition = new Condition(rule, conditionTree);
            return condition;
        } catch (Exception e) {
            throw new ParseException("org.jboss.byteman.rule.Condition : error parsing condition\n" + text, e);
        }
View Full Code Here

Examples of org.jboss.byteman.rule.grammar.ParseNode

    private List<Method> accessibleMethods;

    private Rule(RuleScript ruleScript, ClassLoader loader, HelperManager helperManager)
            throws ParseException, TypeException, CompileException
    {
        ParseNode ruleTree;

        this.ruleScript = ruleScript;
        this.helperClass = null;
        this.loader = loader;

        typeGroup = new TypeGroup(loader);
        bindings = new Bindings();
        checked = false;
        triggerClass = null;
        triggerMethod = null;
        triggerDescriptor = null;
        triggerAccess = 0;
        returnType = null;
        accessibleFields =  null;
        accessibleMethods = null;
        // this is only set when the rule is created via a real installed transformer
        this.helperManager =  helperManager;
        ECAGrammarParser parser = null;
        try {
            String file = getFile();
            ECATokenLexer lexer = new ECATokenLexer(new StringReader(ruleScript.getRuleText()));
            lexer.setStartLine(getLine());
            lexer.setFile(file);
            parser = new ECAGrammarParser(lexer);
            parser.setFile(file);
            Symbol parse = (debugParse ? parser.debug_parse() : parser.parse());
            if (parser.getErrorCount() != 0) {
                String message = "rule " + ruleScript.getName();
                message += parser.getErrors();
                throw new ParseException(message);
            }
            ruleTree = (ParseNode) parse.value;
        } catch (ParseException pe) {
            throw pe;
        } catch (Throwable th) {
            String message = "rule " + ruleScript.getName();
            if (parser != null && parser.getErrorCount() != 0) {
                message += parser.getErrors();
            }
            message += "\n" + th.getMessage();
            throw new ParseException(message);
        }

        ParseNode eventTree = (ParseNode)ruleTree.getChild(0);
        ParseNode conditionTree = (ParseNode)ruleTree.getChild(1);
        ParseNode actionTree = (ParseNode)ruleTree.getChild(2);

        event = Event.create(this, eventTree);
        condition = Condition.create(this, conditionTree);
        action = Action.create(this, actionTree);
        key = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.