@Test public void testParseGoodInput() { assertThat( ParboiledInterfaceSpecifier.parse("eth0"), equalTo(new ParboiledInterfaceSpecifier(new NameInterfaceAstNode("eth0")))); }
public static ParboiledInterfaceSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.INTERFACE_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.INTERFACE_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof InterfaceAstNode, "ParboiledInterfaceSpecifier requires an InterfaceSpecifier input"); return new ParboiledInterfaceSpecifier((InterfaceAstNode) ast); }
ParboiledInterfaceSpecifier implements InterfaceSpecifier { public static ParboiledInterfaceSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.INTERFACE_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.INTERFACE_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof InterfaceAstNode, "ParboiledInterfaceSpecifier requires an InterfaceSpecifier input"); return new ParboiledInterfaceSpecifier((InterfaceAstNode) ast); } }
ParboiledInterfaceSpecifier implements InterfaceSpecifier { public static ParboiledInterfaceSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.INTERFACE_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.INTERFACE_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof InterfaceAstNode, "ParboiledInterfaceSpecifier requires an InterfaceSpecifier input"); return new ParboiledInterfaceSpecifier((InterfaceAstNode) ast); } ParboiledInterfaceSpecifier(InterfaceAstNode ast); }
ParboiledInterfaceSpecifier implements InterfaceSpecifier { public static ParboiledInterfaceSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.INTERFACE_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.INTERFACE_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof InterfaceAstNode, "ParboiledInterfaceSpecifier requires an InterfaceSpecifier input"); return new ParboiledInterfaceSpecifier((InterfaceAstNode) ast); } ParboiledInterfaceSpecifier(InterfaceAstNode ast); static ParboiledInterfaceSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<NodeInterfacePair> resolve(Set<String> nodes, SpecifierContext ctxt); }
ParboiledInterfaceSpecifier implements InterfaceSpecifier { public static ParboiledInterfaceSpecifier parse(String input) { ParsingResult<AstNode> result = new ReportingParseRunner<AstNode>( Parser.instance().getInputRule(Grammar.INTERFACE_SPECIFIER)) .run(input); if (!result.parseErrors.isEmpty()) { throw new IllegalArgumentException( ParserUtils.getErrorString( input, Grammar.INTERFACE_SPECIFIER, (InvalidInputError) result.parseErrors.get(0), Parser.ANCHORS)); } AstNode ast = ParserUtils.getAst(result); checkArgument( ast instanceof InterfaceAstNode, "ParboiledInterfaceSpecifier requires an InterfaceSpecifier input"); return new ParboiledInterfaceSpecifier((InterfaceAstNode) ast); } ParboiledInterfaceSpecifier(InterfaceAstNode ast); static ParboiledInterfaceSpecifier parse(String input); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<NodeInterfacePair> resolve(Set<String> nodes, SpecifierContext ctxt);  }