Example usage for org.antlr.v4.runtime RuleContext getPayload

List of usage examples for org.antlr.v4.runtime RuleContext getPayload

Introduction

In this page you can find the example usage for org.antlr.v4.runtime RuleContext getPayload.

Prototype

@Override
    public RuleContext getPayload() 

Source Link

Usage

From source file:de.dfki.resc28.ole.bootstrap.Util.java

public static Literal toStringLiteral(RuleContext ctx, String separator) {
    if (ctx != null) {
        String descr[] = new String[ctx.getPayload().getChildCount()];
        for (int i = 0; i < ctx.getPayload().getChildCount(); i++) {
            descr[i] = ctx.getPayload().getChild(i).getText();
        }//w  w  w .ja  v  a  2  s. c  om

        return ResourceFactory.createTypedLiteral(StringUtils.join(descr, separator), XSDDatatype.XSDstring);
    } else {
        return ResourceFactory.createPlainLiteral("Something went wrong!");
    }
}