本文整理汇总了Java中org.codehaus.jparsec.Scanners类的典型用法代码示例。如果您正苦于以下问题:Java Scanners类的具体用法?Java Scanners怎么用?Java Scanners使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scanners类属于org.codehaus.jparsec包,在下文中一共展示了Scanners类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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))));
}
开发者ID:Jakz,项目名称:rom-manager,代码行数:8,代码来源:ScriptParser.java
示例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))));
}
开发者ID:Jakz,项目名称:rom-manager,代码行数:8,代码来源:ScriptParser.java
示例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));
}
开发者ID:jparsec,项目名称:jparsec-g,代码行数:10,代码来源:TypeParser.java
示例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);
}
});
}
开发者ID:lithiumtech,项目名称:starql,代码行数:10,代码来源:JparsecQueryMarkupManager.java
示例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();
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:8,代码来源:Benchmarks.java
示例6: queryExpression
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
private Parser<String> queryExpression() {
return Parsers.or(
Scanners.SINGLE_QUOTE_STRING
); }
开发者ID:Jakz,项目名称:rom-manager,代码行数:5,代码来源:ScriptParser.java
示例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();
}
开发者ID:lithiumtech,项目名称:starql,代码行数:5,代码来源:JparsecQueryMarkupManager.java
示例8: any
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Any> any() {
return Scanners.isChar('.').map(Maps.constant(new Any()));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:4,代码来源:ParserProvider.java
示例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()));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:5,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:6,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:6,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:5,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:5,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:6,代码来源:ParserProvider.java
示例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));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:5,代码来源:ParserProvider.java
示例16: nonGreedyStar
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
Parser<Node.NonGreedyStar> nonGreedyStar() {
final Parser<? extends Elementary> p = elementary().followedBy(Scanners.string("*?"));
return p.map(fromConstructor(Node.NonGreedyStar.class));
}
开发者ID:nes1983,项目名称:tree-regex,代码行数:5,代码来源:ParserProvider.java
示例17: padWithWhitespace
import org.codehaus.jparsec.Scanners; //导入依赖的package包/类
/**
* All added whitespace is optional. To require white space, you should add it to your parser inline.
* @param parser The parser to wrap in optional white space.
* @param leadingWhitespaces If optional white space should prepend the provided parser.
* @return The parser that was wrapped in optional white space.
*/
protected <T> Parser<T> padWithWhitespace(Parser<T> parser, boolean leadingWhitespaces) {
return leadingWhitespaces
? Scanners.WHITESPACES.optional().next(parser).followedBy(Scanners.WHITESPACES.optional())
: parser.followedBy(Scanners.WHITESPACES.optional());
}
开发者ID:lithiumtech,项目名称:starql,代码行数:12,代码来源:JparsecQueryMarkupManager.java
注:本文中的org.codehaus.jparsec.Scanners类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论