+ private CompilationError[] validate(Reader commandReader) {
+ CommandParser parser = new CommandParser(defaultHandler, new MemoReader(commandReader));
+ validateOnly = true;
+ try {
+ parser.parseCommands();
+ parser.finishBlock();
+ return CompilationError.EMPTY_ARRAY;
+ } catch(SCLExpressionCompilationException e) {
+ return e.getErrors();
+ } catch(SCLSyntaxErrorException e) {
+ return new CompilationError[] { new CompilationError(e.location, e.getMessage()) };
+ } catch(Exception e) {
+ return new CompilationError[] { new CompilationError(Locations.NO_LOCATION, e.getMessage()) };
+ } finally {
+ validateOnly = false;
+ }
+ }
+