private static NodeTestCase compile(final NodeTestDSLParser parser) {
try {
compilation_unit_return cur = parser.compilation_unit();
if ( parser.hasErrors() ) {
NodeTestCase result = new NodeTestCase();
result.setErrors( parser.getErrorMessages() );
return result;
}
NodeTestCase testCase = walk( parser.getTokenStream(),
(CommonTree) cur.getTree() );
return testCase;
} catch ( RecognitionException e ) {
NodeTestCase result = new NodeTestCase();
result.setErrors( Collections.singletonList( e.getMessage() ) );
return result;
}
}