// Path: versions/development/parsers/antlr4/Java/src/test/java/org/openwdl/wdl/parser/WdlParserTestErrorListener.java
// public static class SyntaxError {
// 
//     private final Object offendingSymbol;
//     private final int line;
//     private final int position;
//     private final String message;
// 
//     SyntaxError(Object offendingSymbol, int line, int position, String message) {
//         this.offendingSymbol = offendingSymbol;
//         this.line = line;
//         this.position = position;
//         this.message = message;
//     }
// 
//     public Object getOffendingSymbol() {
//         return offendingSymbol;
//     }
// 
//     public int getLine() {
//         return line;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public AssertionError getAssertionError() {
//         return new AssertionError(toString());
//     }
// 
//     @Override
//     public String toString() {
//         return "line " + line + ":" + position + " " + message;
//     }
// }


import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.ParseTree;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.openwdl.wdl.parser.WdlParser.*;
import org.openwdl.wdl.parser.WdlParserTestErrorListener.SyntaxError;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
        Assertions.assertEquals("some string part ", stringContext.string_part().getText());
        String_expr_with_string_partContext exprWithStringPartContext = stringContext.string_expr_with_string_part(0);
        Assertions.assertEquals(" some string part after", exprWithStringPartContext.string_part().getText());
        ExprContext exprTree = exprWithStringPartContext.string_expr_part().expr();
        Assertions.assertEquals("ident+ident", exprTree.getText());
        Expr_infixContext exprContext = exprTree.expr_infix();
        Infix1Context infix1Context = (Infix1Context) exprContext.getChild(0);
        Infix2Context infix2Context = (Infix2Context) infix1Context.getChild(0);
        Infix3Context infix3Context = (Infix3Context) infix2Context.getChild(0);
        AddContext addContext = (AddContext) infix3Context.getChild(0);
        Assertions.assertEquals("ident", addContext.expr_infix3().getText());
        Assertions.assertEquals("ident", addContext.expr_infix4().getText());

    }

    @Test
    public void testSquoteStringInterpolationInfiniteRecursion() {
        String interpolation = "'some string part ~{ident + 'hello ${ident}' + ident} some string part after'";
        WdlParser parser = getParser(interpolation);
        WdlParserTestErrorListener errorListener = new WdlParserTestErrorListener();
        parser.addErrorListener(errorListener);


        StringContext stringContext = parser.string();
        Assertions.assertFalse(errorListener.hasErrors());
        Assertions.assertNotNull(stringContext);
        Assertions.assertEquals("some string part ", stringContext.string_part().getText());
        String_expr_with_string_partContext exprWithStringPartContext = stringContext.string_expr_with_string_part(0);
        Assertions.assertEquals(" some string part after", exprWithStringPartContext.string_part().getText());
        ExprContext exprTree = exprWithStringPartContext.string_expr_part().expr();
// Path: versions/development/parsers/antlr4/Java/src/test/java/org/openwdl/wdl/parser/WdlParserTestErrorListener.java
// public static class SyntaxError {
// 
//     private final Object offendingSymbol;
//     private final int line;
//     private final int position;
//     private final String message;
// 
//     SyntaxError(Object offendingSymbol, int line, int position, String message) {
//         this.offendingSymbol = offendingSymbol;
//         this.line = line;
//         this.position = position;
//         this.message = message;
//     }
// 
//     public Object getOffendingSymbol() {
//         return offendingSymbol;
//     }
// 
//     public int getLine() {
//         return line;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public AssertionError getAssertionError() {
//         return new AssertionError(toString());
//     }
// 
//     @Override
//     public String toString() {
//         return "line " + line + ":" + position + " " + message;
//     }
// }


// Path: versions/1.0/parsers/antlr4/Java/src/test/java/org/openwdl/wdl/parser/WDLParserTest.java
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.ParseTree;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.openwdl.wdl.parser.WdlParser.*;
import org.openwdl.wdl.parser.WdlParserTestErrorListener.SyntaxError;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

        Assertions.assertEquals("some string part ", stringContext.string_part().getText());
        String_expr_with_string_partContext exprWithStringPartContext = stringContext.string_expr_with_string_part(0);
        Assertions.assertEquals(" some string part after", exprWithStringPartContext.string_part().getText());
        ExprContext exprTree = exprWithStringPartContext.string_expr_part().expr();
        Assertions.assertEquals("ident+ident", exprTree.getText());
        Expr_infixContext exprContext = exprTree.expr_infix();
        Infix1Context infix1Context = (Infix1Context) exprContext.getChild(0);
        Infix2Context infix2Context = (Infix2Context) infix1Context.getChild(0);
        Infix3Context infix3Context = (Infix3Context) infix2Context.getChild(0);
        AddContext addContext = (AddContext) infix3Context.getChild(0);
        Assertions.assertEquals("ident", addContext.expr_infix3().getText());
        Assertions.assertEquals("ident", addContext.expr_infix4().getText());

    }

    @Test
    public void testSquoteStringInterpolationInfiniteRecursion() {
        String interpolation = "'some string part ~{ident + 'hello ${ident}' + ident} some string part after'";
        WdlParser parser = getParser(interpolation);
        WdlParserTestErrorListener errorListener = new WdlParserTestErrorListener();
        parser.addErrorListener(errorListener);


        StringContext stringContext = parser.string();
        Assertions.assertFalse(errorListener.hasErrors());
        Assertions.assertNotNull(stringContext);
        Assertions.assertEquals("some string part ", stringContext.string_part().getText());
        String_expr_with_string_partContext exprWithStringPartContext = stringContext.string_expr_with_string_part(0);
        Assertions.assertEquals(" some string part after", exprWithStringPartContext.string_part().getText());
        ExprContext exprTree = exprWithStringPartContext.string_expr_part().expr();
        Assertions.assertEquals("ident+'hello ${ident}'+ident", exprTree.getText());