当前位置: 首页>>代码示例>>Java>>正文


Java BaseParser类代码示例

本文整理汇总了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);
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:24,代码来源:RuleMethod.java

示例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!");
    }
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:20,代码来源:ErrorDetectionTest.java

示例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!");
    }
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:22,代码来源:ErrorDetectionTest.java

示例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()))
    );
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:13,代码来源:AttributesPlugin.java

示例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())
    );
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:10,代码来源:AttributesParser.java

示例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())
    );
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:10,代码来源:AttributesParser.java

示例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()
    );
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:11,代码来源:NamedBlockCurlyBracePlugin.java

示例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());
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:12,代码来源:NamedBlockCurlyBracePlugin.java

示例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());
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:13,代码来源:NamedBlockCurlyBracePlugin.java

示例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());
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:14,代码来源:NamedBlockSquareBracketAndDashPlugin.java

示例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);
}
 
开发者ID:IBCNServices,项目名称:OBEP,代码行数:5,代码来源:SPARQLParser.java

示例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);
}
 
开发者ID:simonwibberley,项目名称:GramExp,代码行数:6,代码来源:AsmUtils.java

示例13: Body

import org.parboiled.BaseParser; //导入依赖的package包/类
Rule Body() {
  return OneOrMore(TestNot(TAG), BaseParser.ANY);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:4,代码来源:PegdownWebSequencelPlugin.java

示例14: register

import org.parboiled.BaseParser; //导入依赖的package包/类
public <T extends BaseParser> ParserContext register (Class type, T parser) {
    this.parsers.put(type, parser);
    return this;
}
 
开发者ID:jtwig,项目名称:jtwig-core,代码行数:5,代码来源:ParserContext.java


注:本文中的org.parboiled.BaseParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。