本文整理汇总了Java中org.parboiled.BaseParser类的典型用法代码示例。如果您正苦于以下问题:Java BaseParser类的具体用法?Java BaseParser怎么用?Java BaseParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseParser类属于org.parboiled包,在下文中一共展示了BaseParser类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethodInsn
import org.parboiled.BaseParser; //导入依赖的package包/类
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
switch (opcode) {
case INVOKESTATIC:
if (!hasExplicitActionOnlyAnnotation && isBooleanValueOfZ(owner, name, desc)) {
containsImplicitActions = true;
} else if (isActionRoot(owner, name)) {
containsExplicitActions = true;
}
break;
case INVOKESPECIAL:
if ("<init>".equals(name)) {
if (isVarRoot(owner, name, desc)) {
containsVars = true;
}
} else if (isAssignableTo(owner, BaseParser.class)) {
containsPotentialSuperCalls = true;
}
break;
}
super.visitMethodInsn(opcode, owner, name, desc);
}
示例2: testRuleWithActionAccessingPrivateField
import org.parboiled.BaseParser; //导入依赖的package包/类
@Test
public synchronized void testRuleWithActionAccessingPrivateField() throws Exception {
setup(new BaseParser<Object>() {
private int privateInt = 5;
public Rule RuleWithActionAccessingPrivateField() {
return Sequence('a', privateInt == 0);
}
}.getClass());
try {
processMethod("RuleWithActionAccessingPrivateField", processors);
fail();
} catch (Exception e) {
assertEquals(e.getMessage(),
"Rule method 'RuleWithActionAccessingPrivateField' contains an illegal access to private field 'privateInt'.\n" +
"Mark the field protected or package-private if you want to prevent public access!");
}
}
示例3: testRuleWithActionAccessingPrivateMethod
import org.parboiled.BaseParser; //导入依赖的package包/类
@Test
public synchronized void testRuleWithActionAccessingPrivateMethod() throws Exception {
setup(new BaseParser<Object>() {
public Rule RuleWithActionAccessingPrivateMethod() {
return Sequence('a', privateAction());
}
private boolean privateAction() {
return true;
}
}.getClass());
try {
processMethod("RuleWithActionAccessingPrivateMethod", processors);
fail();
} catch (Exception e) {
assertEquals(e.getMessage(),
"Rule method 'RuleWithActionAccessingPrivateMethod' contains an illegal call to private method 'privateAction'.\n" +
"Mark 'privateAction' protected or package-private if you want to prevent public access!");
}
}
示例4: attributesRules
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule attributesRules() {
StringBuilderVar text = new StringBuilderVar();
return NodeSequence(
Sp(),
"{",
OneOrMore(TestNot("}"), TestNot(Newline()), BaseParser.ANY, text.append(matchedChar())),
"}",
Sp(),
Newline(),
push(new AttributesNode(text.getString()))
);
}
示例5: Name
import org.parboiled.BaseParser; //导入依赖的package包/类
@SuppressSubnodes
public Rule Name() {
StringBuilderVar text = new StringBuilderVar();
return Sequence(FirstOf(
Sequence(Ch('"'), OneOrMore(TestNot('"'), BaseParser.ANY, text.append(matchedChar())), Ch('"')),
OneOrMore(TestNot("="), TestNot(Newline()), BaseParser.ANY, text.append(matchedChar()))),
push(text.getString())
);
}
示例6: Value
import org.parboiled.BaseParser; //导入依赖的package包/类
@SuppressSubnodes
public Rule Value() {
StringBuilderVar text = new StringBuilderVar();
return Sequence(FirstOf(
Sequence(Ch('"'), OneOrMore(TestNot('"'), BaseParser.ANY, text.append(matchedChar())), Ch('"')),
OneOrMore(TestNot("}"), TestNot(","), TestNot(Newline()), BaseParser.ANY, text.append(matchedChar()))),
push(text.getString())
);
}
示例7: asciiFenceRule
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule asciiFenceRule() {
StringBuilderVar text = new StringBuilderVar();
return NodeSequence(
BlockBeginMarker(),
OneOrMore(TestNot(Newline(), BlockEndMarker()), BaseParser.ANY, text.append(matchedChar())),
Newline(),
((NamedBlockNode) peek()).appendBody(text.getString()),
BlockEndMarker()
);
}
示例8: BlockBeginMarker
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule BlockBeginMarker() {
StringBuilderVar text = new StringBuilderVar();
return NodeSequence(
Sp(),
"{%",
OneOrMore(TestNot("%}"), BaseParser.ANY, text.append(matchedChar())),
Sp(),
"%}",
push(new NamedBlockNode(text.getString())),
Newline());
}
示例9: BlockEndMarker
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule BlockEndMarker() {
StringBuilderVar text = new StringBuilderVar();
//((NamedBlockNode)peek()).getHeaderTag(),
return Sequence(
Sp(),
"{%",
OneOrMore(TestNot("%}"), BaseParser.ANY, text.append(matchedChar())),
"%}",
Sp(),
((NamedBlockNode) peek()).endTag(text.getString()),
Newline());
}
示例10: BlockBeginMarker
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule BlockBeginMarker() {
StringBuilderVar text = new StringBuilderVar();
return NodeSequence(
Sp(),
"[",
OneOrMore(TestNot("]"), BaseParser.ANY, text.append(matchedChar())),
"]",
Newline(),
Sp(),
NOrMore('-', 4),
push(new NamedBlockNode(text.getString())),
Newline());
}
示例11: Query
import org.parboiled.BaseParser; //导入依赖的package包/类
public Rule Query() {
return Sequence(push(new SPARQLQuery()), WS(), Prologue(),
FirstOf(SelectQuery(), ConstructQuery(), AskQuery(), DescribeQuery()), ValuesClause(), BaseParser.EOI);
}
示例12: isActionRoot
import org.parboiled.BaseParser; //导入依赖的package包/类
public static boolean isActionRoot(String methodOwner, String methodName) {
checkArgNotNull(methodOwner, "methodOwner");
checkArgNotNull(methodName, "methodName");
return "ACTION".equals(methodName) && isAssignableTo(methodOwner, BaseParser.class);
}
示例13: Body
import org.parboiled.BaseParser; //导入依赖的package包/类
Rule Body() {
return OneOrMore(TestNot(TAG), BaseParser.ANY);
}
示例14: register
import org.parboiled.BaseParser; //导入依赖的package包/类
public <T extends BaseParser> ParserContext register (Class type, T parser) {
this.parsers.put(type, parser);
return this;
}