本文整理汇总了Java中org.codehaus.jparsec.Scanners类的典型用法代码示例。如果您正苦于以下问题:Java Scanners类的具体用法?Java Scanners怎么用?Java Scanners使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scanners类属于org.codehaus.jparsec包,在下文中一共展示了Scanners类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectStatement
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
private Parser<SelectStatement> selectStatement()
{
return Scanners.stringCaseInsensitive("select")
.next(WHITESPACE)
.next(queryExpression())
.map(query -> new SelectStatement(Main.current.helper().searcher().search(query.substring(1, query.length()-1))));
}
示例2: findStatement
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
private Parser<FindStatement> findStatement()
{
return Scanners.stringCaseInsensitive("find")
.next(WHITESPACE)
.next(queryExpression())
.map(query -> new FindStatement(Main.current.helper().searcher().search(query.substring(1, query.length()-1))));
}
示例3: parse
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
/** Parses {@code string} to a {@link TypeToken}. */
public TypeToken<?> parse(String string) throws ParserException {
Parser.Reference<Type> ref = Parser.newReference();
Parser<Type> type = Parsers.or(
wildcardType(ref.lazy()), parameterizedType(ref.lazy()), arrayClass(), rawType());
ref.set(type.postfix(TERMS.phrase("[", "]").retn(Types::newArrayType)));
return TypeToken.of(
ref.get().from(TERMS.tokenizer(), Scanners.WHITESPACES.optional()).parse(string));
}
示例4: regexIntegerPair
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
protected Parser<Integer> regexIntegerPair(String keyword, boolean isCaseSensitive) {
return paddedRegex(keyword, false, isCaseSensitive).next(Scanners.INTEGER)
.map(new Map<String, Integer>() {
@Override
public Integer map(String arg0) {
return Integer.parseInt(arg0);
}
});
}
示例5: match
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
@Override
public int match(String input) {
Parser<List<List<String>>> p = ((Scanners.isChar('a').many1().followedBy(Scanners.isChar('b')).source()).many1()
.followedBy(Scanners.isChar('c'))).many1();
List<List<String>> out = p.parse(input);
return out.size();
}
示例6: queryExpression
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
private Parser<String> queryExpression() {
return Parsers.or(
Scanners.SINGLE_QUOTE_STRING
); }
示例7: regex
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
protected Parser<String> regex(String pattern, String name, boolean isCaseSensitive) {
Pattern p = Pattern.compile(pattern, isCaseSensitive ? 0 : CASE_INSENSITIVE);
return Scanners.pattern(Patterns.regex(p), name).source();
}
示例8: any
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Any> any() {
return Scanners.isChar('.').map(Maps.constant(new Any()));
}
示例9: eos
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Eos> eos() {
final Parser<Void> p = Scanners.isChar('$');
return p.map(Maps.constant(new Node.Eos()));
}
示例10: group
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Group> group() {
final Parser<Regex> p =
Parsers.between(Scanners.isChar('('), regexRef.lazy(), Scanners.isChar(')'));
return p.map(fromConstructor(Group.class));
}
示例11: negativeSet
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.NegativeSet> negativeSet() {
final Parser<List<SetItem>> p =
Parsers.between(Scanners.string("[^"), setItems(), Scanners.isChar(']'));
return p.map(fromConstructor(Node.NegativeSet.class));
}
示例12: optional
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.Optional> optional() {
final Parser<? extends Elementary> p = elementary().followedBy(Scanners.isChar('?'));
return p.map(fromConstructor(Node.Optional.class));
}
示例13: plus
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.Plus> plus() {
final Parser<? extends Elementary> p = elementary().followedBy(Scanners.isChar('+'));
return p.map(fromConstructor(Node.Plus.class));
}
示例14: positiveSet
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.PositiveSet> positiveSet() {
final Parser<List<SetItem>> p =
Parsers.between(Scanners.isChar('['), setItems(), Scanners.isChar(']'));
return p.map(fromConstructor(Node.PositiveSet.class));
}
示例15: star
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.Star> star() {
final Parser<? extends Elementary> p = elementary().followedBy(Scanners.isChar('*'));
return p.map(fromConstructor(Node.Star.class));
}