@Test(expected = SyntaxError.class) public void testSyntaxError() throws SyntaxError { String dsl = "ENTITY Error AHHH"; SchemaParser.parse(new StringReader(dsl)); }
private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); static RawSchema parse(Reader r); }
SchemaParser { private RawSchema parse() throws SyntaxError { RawSchemaBuilder rawSchemaBuilder = new RawSchemaBuilder(); nextToken(); while (currentToken != TokenType.EOF) { switch (currentToken) { case INTERFACE: rawSchemaBuilder.addInterface(parseEntity()); break; case ENTITY: rawSchemaBuilder.addEntity(parseEntity()); break; } } return rawSchemaBuilder.build(); } private  SchemaParser(Reader r); static RawSchema parse(Reader r);  }