private static boolean compile(String grammarFileName, String grammarStr, String parserName, String startRuleName,
							Path tempDirPath
	) {
		RunOptions runOptions = createOptionsForJavaToolTests(grammarFileName, grammarStr, parserName, null,
				false, false, startRuleName, null,
				false, false, Stage.Compile);
		try (JavaRunner runner = new JavaRunner(tempDirPath, false)) {
			JavaCompiledState compiledState = (JavaCompiledState) runner.run(runOptions);
			return !compiledState.containsErrors();
		}
	}
This is a regression test for antlr/antlr4#670 "exception when importing
grammar".
https://github.com/antlr/antlr4/issues/670
tool-testsuite/test/org/antlr/v4/test/tool/TestCompositeGrammars.java