public OALScripts parse() throws IOException {
        OALScripts scripts = new OALScripts();

        CommonTokenStream tokens = new CommonTokenStream(lexer);

        OALParser parser = new OALParser(tokens);

        ParseTree tree = parser.root();
        ParseTreeWalker walker = new ParseTreeWalker();

        walker.walk(new OALListener(scripts, sourcePackage), tree);

        return scripts;
    }
@Test
    public void testParse() throws IOException {
        ScriptParser parser = ScriptParser.createFromScriptText(
            "endpoint_resp_time = from(Endpoint.latency).longAvg(); //comment test" + "\n" + "Service_avg = from(Service.latency).longAvg()",
            TEST_SOURCE_PACKAGE
        );
        List<AnalysisResult> results = parser.parse().getMetricsStmts();

        Assertions.assertEquals(2, results.size());

        AnalysisResult endpointAvg = results.get(0);
        Assertions.assertEquals("EndpointRespTime", endpointAvg.getMetricsName());
        Assertions.assertEquals("Endpoint", endpointAvg.getFrom().getSourceName());
        Assertions.assertEquals("[latency]", endpointAvg.getFrom().getSourceAttribute().toString());
        Assertions.assertEquals("longAvg", endpointAvg.getAggregationFuncStmt().getAggregationFunctionName());

        AnalysisResult serviceAvg = results.get(1);
        Assertions.assertEquals("ServiceAvg", serviceAvg.getMetricsName());
        Assertions.assertEquals("Service", serviceAvg.getFrom().getSourceName());
        Assertions.assertEquals("[latency]", serviceAvg.getFrom().getSourceAttribute().toString());
        Assertions.assertEquals("longAvg", serviceAvg.getAggregationFuncStmt().getAggregationFunctionName());
    }