@Test public void testParseBadInput() { _thrown.expect(IllegalArgumentException.class); _thrown.expectMessage("Error parsing"); ParboiledLocationSpecifier.parse("@connected"); }
public static ParboiledLocationSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.LOCATION_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.LOCATION_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof LocationAstNode, "ParboiledLocationSpecifier requires a LocationSpecifier input"); return new ParboiledLocationSpecifier((LocationAstNode) ast); }
ParboiledLocationSpecifier implements LocationSpecifier { public static ParboiledLocationSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.LOCATION_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.LOCATION_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof LocationAstNode, "ParboiledLocationSpecifier requires a LocationSpecifier input"); return new ParboiledLocationSpecifier((LocationAstNode) ast); } }
ParboiledLocationSpecifier implements LocationSpecifier { public static ParboiledLocationSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.LOCATION_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.LOCATION_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof LocationAstNode, "ParboiledLocationSpecifier requires a LocationSpecifier input"); return new ParboiledLocationSpecifier((LocationAstNode) ast); } ParboiledLocationSpecifier(LocationAstNode ast); }
ParboiledLocationSpecifier implements LocationSpecifier { public static ParboiledLocationSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.LOCATION_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.LOCATION_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof LocationAstNode, "ParboiledLocationSpecifier requires a LocationSpecifier input"); return new ParboiledLocationSpecifier((LocationAstNode) ast); } ParboiledLocationSpecifier(LocationAstNode ast); static ParboiledLocationSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<Location> resolve(SpecifierContext ctxt); }
ParboiledLocationSpecifier implements LocationSpecifier { public static ParboiledLocationSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.LOCATION_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.LOCATION_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof LocationAstNode, "ParboiledLocationSpecifier requires a LocationSpecifier input"); return new ParboiledLocationSpecifier((LocationAstNode) ast); } ParboiledLocationSpecifier(LocationAstNode ast); static ParboiledLocationSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<Location> resolve(SpecifierContext ctxt);  }