@Test public void shouldParseWildcard() { assertThat(parser.parseWildcard(tokenize("*")), is(wildcard())); assertThat(parser.parseWildcard(tokenize("*:*")), is(wildcard())); assertThat(parser.parseWildcard(tokenize("*:name")), is(nameTest(null, "name"))); assertThat(parser.parseWildcard(tokenize("name:*")), is(nameTest("name", null))); }
protected NameTest parseWildcard( TokenStream tokens ) { if (tokens.canConsume('*')) { if (tokens.canConsume(':')) { if (tokens.canConsume('*')) { return new NameTest(null, null); } String localName = tokens.consume(); return new NameTest(null, decode(localName)); } return new NameTest(null, null); } if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL) && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) { String prefix = tokens.consume(); tokens.consume(':'); tokens.consume('*'); return new NameTest(decode(prefix), null); } return null; }
XPathParser { protected NameTest parseWildcard( TokenStream tokens ) { if (tokens.canConsume('*')) { if (tokens.canConsume(':')) { if (tokens.canConsume('*')) { return new NameTest(null, null); } String localName = tokens.consume(); return new NameTest(null, decode(localName)); } return new NameTest(null, null); } if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL) && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) { String prefix = tokens.consume(); tokens.consume(':'); tokens.consume('*'); return new NameTest(decode(prefix), null); } return null; } }
XPathParser { protected NameTest parseWildcard( TokenStream tokens ) { if (tokens.canConsume('*')) { if (tokens.canConsume(':')) { if (tokens.canConsume('*')) { return new NameTest(null, null); } String localName = tokens.consume(); return new NameTest(null, decode(localName)); } return new NameTest(null, null); } if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL) && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) { String prefix = tokens.consume(); tokens.consume(':'); tokens.consume('*'); return new NameTest(decode(prefix), null); } return null; } XPathParser( TypeSystem context ); }
XPathParser { protected NameTest parseWildcard( TokenStream tokens ) { if (tokens.canConsume('*')) { if (tokens.canConsume(':')) { if (tokens.canConsume('*')) { return new NameTest(null, null); } String localName = tokens.consume(); return new NameTest(null, decode(localName)); } return new NameTest(null, null); } if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL) && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) { String prefix = tokens.consume(); tokens.consume(':'); tokens.consume('*'); return new NameTest(decode(prefix), null); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath ); }
XPathParser { protected NameTest parseWildcard( TokenStream tokens ) { if (tokens.canConsume('*')) { if (tokens.canConsume(':')) { if (tokens.canConsume('*')) { return new NameTest(null, null); } String localName = tokens.consume(); return new NameTest(null, decode(localName)); } return new NameTest(null, null); } if (tokens.matches(XPathTokenizer.NAME, XPathTokenizer.SYMBOL, XPathTokenizer.SYMBOL) && tokens.matches(TokenStream.ANY_VALUE, ":", "*")) { String prefix = tokens.consume(); tokens.consume(':'); tokens.consume('*'); return new NameTest(decode(prefix), null); } return null; } XPathParser( TypeSystem context ); Component parseXPath( String xpath );  }