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