straightline/src/test/java/org/poormanscastle/studies/compilers/TestUtils.java
/**
     * programs are expected to reside in files in resources/grammar_v01/
     *
     * @param fileName
     * @return
     */
programs are expected to reside in files in resources/grammar_v01
@param fileName
@return
programs are expected to reside in files in resources / grammar_v01 @param fileName @return
public static Program loadProgram(String path, String fileName, boolean validate) throws Exception {
        checkNotNull(path);
        checkArgument(!StringUtils.isEmpty(fileName));
        Program program = new OhAstParser(TestUtils.getTestdataAsInputStream(StringUtils.join(
                path.endsWith("/") ? path : StringUtils.join(path, "/"), fileName))).P();
        checkNotNull(program);
        if (validate) {
            SymbolTableCreatorVisitor symbolTableCreator = new SymbolTableCreatorVisitor();
            program.accept(symbolTableCreator);
            if (!symbolTableCreator.isAstValid()) {
                throw new RuntimeException();
            }
        }
        return program;
    }
public static Program loadProgram ( String path , String fileName , boolean validate ) throws Exception { checkNotNull ( path ) ; checkArgument ( ! StringUtils . isEmpty ( fileName ) ) ; Program program = new OhAstParser ( TestUtils . getTestdataAsInputStream ( StringUtils . join ( path . endsWith ( "/" ) ? path : StringUtils . join ( path , "/" ) , fileName ) ) ) . P ( ) ; checkNotNull ( program ) ; if ( validate ) { SymbolTableCreatorVisitor symbolTableCreator = new SymbolTableCreatorVisitor ( ) ; program . accept ( symbolTableCreator ) ; if ( ! symbolTableCreator . isAstValid ( ) ) { throw new RuntimeException ( ) ; } } return program ; }
programs are expected to reside in files in resources/grammar_v01
 @param fileName
 @return
programs are expected to reside in files in resources / grammar_v01 @param fileName @return