How to use the antlr4.ParserRuleContext function in antlr4

To help you get started, we’ve selected a few antlr4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github protofire / solhint / lib / common / ast-printer.js View on Github external
explore(ctx, indentation) {
        let ruleName = ctx.parser.ruleNames[ctx.ruleIndex];

        console.log('  '.repeat(indentation + 1) + ruleName + ' ' + ctx.getText());

        for (let i = 0; i < ctx.getChildCount(); i++) {
            let element = ctx.getChild(i);

            if (element instanceof antlr4.ParserRuleContext) {
                this.explore(element, indentation + 1);
            } else {
                console.log('  '.repeat(indentation + 2) + element.constructor.name + ' ' + element.getText());
            }
        }
    }
github hyperledger-labs / weaver-dlt-interoperability / common / policy-dsl / parser / PolicyParser.js View on Github external
listener.enterRoot(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof PolicyListener ) {
	        listener.exitRoot(this);
		}
	}


}



class ExpressionContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = PolicyParser.RULE_expression;
    }


	 
		copyFrom(ctx) {
github hyperledger-labs / weaver-dlt-interoperability / common / policy-dsl / parser / PolicyParser.js View on Github external
listener.enterBooleanAndExpression(this);
		}
	}

	exitRule(listener) {
	    if(listener instanceof PolicyListener ) {
	        listener.exitBooleanAndExpression(this);
		}
	}


}

PolicyParser.BooleanAndExpressionContext = BooleanAndExpressionContext;

class Count_expressionContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = PolicyParser.RULE_count_expression;
    }

	COUNT() {
	    return this.getToken(PolicyParser.COUNT, 0);
	};
github hyperledger-labs / weaver-dlt-interoperability / common / policy-dsl / parser / PolicyParser.js View on Github external
PolicyParser.COUNT = 2;
PolicyParser.INTLIT = 3;
PolicyParser.AND = 4;
PolicyParser.OR = 5;
PolicyParser.GREATER_THAN = 6;
PolicyParser.LESS_THAN = 7;
PolicyParser.EQUAL = 8;
PolicyParser.GREATER_THAN_EQUAL = 9;
PolicyParser.LESS_THAN_EQUAL = 10;
PolicyParser.ID = 11;

PolicyParser.RULE_root = 0;
PolicyParser.RULE_expression = 1;
PolicyParser.RULE_count_expression = 2;

class RootContext extends antlr4.ParserRuleContext {

    constructor(parser, parent, invokingState) {
        if(parent===undefined) {
            parent = null;
        }
        if(invokingState===undefined || invokingState===null) {
            invokingState = -1;
        }
        super(parent, invokingState);
        this.parser = parser;
        this.ruleIndex = PolicyParser.RULE_root;
    }

	expression() {
	    return this.getTypedRuleContext(ExpressionContext,0);
	};