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


Java Var类代码示例

本文整理汇总了Java中org.parboiled.support.Var的典型用法代码示例。如果您正苦于以下问题:Java Var类的具体用法?Java Var怎么用?Java Var使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Var类属于org.parboiled.support包,在下文中一共展示了Var类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Suffix

import org.parboiled.support.Var; //导入依赖的package包/类
public Rule Suffix() {
    Var<Literal> optional = new Var<>();
    Var<SuperNode> pp = new Var<>();
    return Sequence(Primary(),
            Optional(
                    Sequence(FirstOf(
                            QUESTION(),
                            STAR(),
                            PLUS()
                    ), optional.set((Literal) pop()))
            ),
            Optional(
                    Sequence(FirstOf(
                            PUSH(),
                            POP()
                    ), pp.set((SuperNode)pop()))
            ),
            push(new SuffixNode((PrimaryNode)pop(), optional.get(), pp.get()))
    );
}
 
开发者ID:simonwibberley,项目名称:GramExp,代码行数:21,代码来源:PegParser.java

示例2: AdditiveExpr

import org.parboiled.support.Var; //导入依赖的package包/类
/**
 * [12] AdditiveExpr ::= MultiplicativeExpr ( ("+" | "-") MultiplicativeExpr )*
 *
 * Value stack head either: AdditiveExpr / MultiplicativeExpr / UnionExpr / IntersectExceptExpr / InstanceOfExpr / TreatExpr / CastableExpr / CastExpr / UnaryExpr / ValueExpr
 */
public Rule AdditiveExpr() {
    final Var<List<AdditiveExpr.AdditiveOp>> additiveOps = new Var<List<AdditiveExpr.AdditiveOp>>(new ArrayList<AdditiveExpr.AdditiveOp>());
    final Var<AdditiveExpr.Additive> additive = new Var<AdditiveExpr.Additive>();
    return FirstOf(
            Sequence(
                    MultiplicativeExpr(), push(new PartialAdditiveExpr((AbstractOperand)pop())),
                    OneOrMore(Sequence(
                            WS(),
                            FirstOf('+', '-'), ACTION(additive.set(AdditiveExpr.Additive.fromSyntax(match().charAt(0)))),
                            WS(),
                            MultiplicativeExpr(), ACTION(additiveOps.get().add(new AdditiveExpr.AdditiveOp(additive.getAndClear(), (AbstractOperand)pop())))
                    )), push(complete(additiveOps.getAndClear(), pop()))
            ),
            MultiplicativeExpr()
    );
}
 
开发者ID:exquery,项目名称:xpath2-parser,代码行数:22,代码来源:XPathParser.java

示例3: MultiplicativeExpr

import org.parboiled.support.Var; //导入依赖的package包/类
/**
 * [13] MultiplicativeExpr ::= UnionExpr ( ("*" | "div" | "idiv" | "mod") UnionExpr )*
 *
 * Value stack head either: MultiplicativeExpr / UnionExpr / IntersectExceptExpr / InstanceOfExpr / TreatExpr / CastableExpr / CastExpr / UnaryExpr / ValueExpr
 */
public Rule MultiplicativeExpr() {
    final Var<List<MultiplicativeExpr.MultiplicativeOp>> multiplicativeOps = new Var<List<MultiplicativeExpr.MultiplicativeOp>>(new ArrayList<MultiplicativeExpr.MultiplicativeOp>());
    final Var<MultiplicativeExpr.Multiplicative> multiplicative = new Var<MultiplicativeExpr.Multiplicative>();
    return FirstOf(
            Sequence(
                    UnionExpr(), push(new PartialMultiplicativeExpr((AbstractOperand)pop())),
                    OneOrMore(Sequence(
                            WS(),
                            FirstOf('*', "idiv", "div", "mod"), ACTION(multiplicative.set(MultiplicativeExpr.Multiplicative.fromSyntax(match()))),
                            WS(),
                            UnionExpr(), ACTION(multiplicativeOps.get().add(new MultiplicativeExpr.MultiplicativeOp(multiplicative.getAndClear(), (AbstractOperand)pop())))
                    )), push(complete(multiplicativeOps.getAndClear(), pop()))
            ),
            UnionExpr()
    );
}
 
开发者ID:exquery,项目名称:xpath2-parser,代码行数:22,代码来源:XPathParser.java

示例4: UnionExpr

import org.parboiled.support.Var; //导入依赖的package包/类
/**
 * [14] UnionExpr ::= IntersectExceptExpr ( ("union" | "|") IntersectExceptExpr )*
 *
 * Value stack head either: UnionExpr / IntersectExceptExpr / InstanceOfExpr / TreatExpr / CastableExpr / CastExpr / UnaryExpr / ValueExpr
 */
public Rule UnionExpr() {
    final Var<List<AbstractOperand>> unionOps = new Var<List<AbstractOperand>>(new ArrayList<AbstractOperand>());
    return FirstOf(
            Sequence(
                IntersectExceptExpr(), push(new PartialUnionExpr((AbstractOperand)pop())),
                OneOrMore(Sequence(
                        WS(),
                        FirstOf("union", '|'),
                        WS(),
                        IntersectExceptExpr(), ACTION(unionOps.get().add((AbstractOperand)pop()))
                )), push(complete(unionOps.getAndClear(), pop()))
            ),
            IntersectExceptExpr()
    );
}
 
开发者ID:exquery,项目名称:xpath2-parser,代码行数:21,代码来源:XPathParser.java

示例5: IntersectExceptExpr

import org.parboiled.support.Var; //导入依赖的package包/类
/**
 * [15] IntersectExceptExpr ::= InstanceofExpr ( ("intersect" | "except") InstanceofExpr )*
 *
 * Value stack head either: IntersectExceptExpr / InstanceOfExpr / TreatExpr / CastableExpr / CastExpr / UnaryExpr / ValueExpr
 */
public Rule IntersectExceptExpr() {
    final Var<List<IntersectExceptExpr.IntersectExceptOp>> intersectExceptOps = new Var<List<IntersectExceptExpr.IntersectExceptOp>>(new ArrayList<IntersectExceptExpr.IntersectExceptOp>());
    final Var<IntersectExceptExpr.IntersectExcept> intersectExcept = new Var<IntersectExceptExpr.IntersectExcept>();
    return FirstOf(
            Sequence(
                    InstanceofExpr(), push(new PartialIntersectExceptExpr((AbstractOperand)pop())),
                    OneOrMore(Sequence(
                            WS(),
                            FirstOf("intersect", "except"), ACTION(intersectExcept.set(IntersectExceptExpr.IntersectExcept.fromSyntax(match()))),
                            WS(),
                            InstanceofExpr(), ACTION(intersectExceptOps.get().add(new IntersectExceptExpr.IntersectExceptOp(intersectExcept.getAndClear(), (AbstractOperand)pop())))
                    )), push(complete(intersectExceptOps.getAndClear(), pop()))),
            InstanceofExpr()
    );
}
 
开发者ID:exquery,项目名称:xpath2-parser,代码行数:21,代码来源:XPathParser.java

示例6: PossibleOr

import org.parboiled.support.Var; //导入依赖的package包/类
public Rule PossibleOr() {
    Var<List<ContractNode>> elementContracts = new Var<>(new ArrayList<>());
    return Sequence(
            PossibleAnd(),
            elementContracts.get().add(pop()),
            ZeroOrMore(
                    '|',
                    Whitespace(),
                    PossibleAnd(),
                    elementContracts.get().add(pop())
            ),
            push(elementContracts.get().size() == 1
                    ? elementContracts.get().get(0)
                    : new OrContractNode(Collections.unmodifiableList(elementContracts.get()))
            )
    );
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:18,代码来源:PyContractsParser.java

示例7: PossibleAnd

import org.parboiled.support.Var; //导入依赖的package包/类
public Rule PossibleAnd() {
    Var<List<ContractNode>> elementContracts = new Var<>(new ArrayList<>());
    return Sequence(
            HighPriorityElement(),
            elementContracts.get().add(pop()),
            ZeroOrMore(
                    ',',
                    Whitespace(),
                    HighPriorityElement(),
                    elementContracts.get().add(pop())
            ),
            push(elementContracts.get().size() == 1
                    ? elementContracts.get().get(0)
                    : new AndContractNode(Collections.unmodifiableList(elementContracts.get()))
            )
    );
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:18,代码来源:PyContractsParser.java

示例8: PossibleOrTuple

import org.parboiled.support.Var; //导入依赖的package包/类
public Rule PossibleOrTuple() {
    Var<List<ContractNode>> elementContracts = new Var<>(new ArrayList<>());
    return Sequence(
            HighPriorityElement(),
            elementContracts.get().add(pop()),
            ZeroOrMore(
                    '|',
                    Whitespace(),
                    HighPriorityElement(),
                    elementContracts.get().add(pop())
            ),
            push(elementContracts.get().size() == 1
                    ? elementContracts.get().get(0)
                    : new OrContractNode(Collections.unmodifiableList(elementContracts.get())))
    );
}
 
开发者ID:jhominal,项目名称:pysynthetic-intellij,代码行数:17,代码来源:PyContractsParser.java

示例9: ExpressionList

import org.parboiled.support.Var; //导入依赖的package包/类
/**
 * Rule for an expression list, containing zero or more expressions and optional whitespace
 * @return
 */
public Rule ExpressionList() {
	Var<ArrayList<Node<Object>>> expVar=new Var<>(new ArrayList<>());
	return Sequence(
			Optional(WhiteSpace()),
			ZeroOrMore(Sequence( // initial expressions with following whitespace or delimiter
						FirstOf(Sequence(DelimitedExpression(),Optional(WhiteSpace())),
								Sequence(UndelimitedExpression(),FirstOf(WhiteSpace(),Test(AnyOf("([{"))))),
						ListAddAction(expVar)
					  )),
			Optional(Sequence( // final expression without whitespace
						Expression(),
						ListAddAction(expVar))),
			push(magic.ast.ListForm.create(Lists.create(expVar.get()),getSourceInfo()))
			);
}
 
开发者ID:mikera,项目名称:magic,代码行数:20,代码来源:Reader.java

示例10: Point

import org.parboiled.support.Var; //导入依赖的package包/类
Rule Point() {
    Var<String> srid = new Var<String>(defaultSrid);
    return Sequence(
            Optional(Srid(), srid.set((String) pop())),
            "POINT",
            Optional(Ch(' ')),
            FirstOf(
                    Sequence(
                            "EMPTY",
                            push(new Point(new Coordinate(Double.NaN, Double.NaN, Double.NaN, Double.NaN), Dimension.Two, srid.get()))
                    ),
                    Sequence(
                            Optional("ZM", setDimension(Dimension.ThreeMeasured)),
                            Optional(Ch('Z'), setDimension(Dimension.Three)),
                            Optional(Ch('M'), setDimension(Dimension.TwoMeasured)),
                            setDimension(Dimension.Two),
                            Optional(Ch(' ')),
                            "(",
                            Coordinate(),
                            ")",
                            push(new Point((Coordinate) pop(), dimension, srid.get()))
                    )
            )
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:26,代码来源:WKTParser.java

示例11: LineString

import org.parboiled.support.Var; //导入依赖的package包/类
Rule LineString() {
    Var<String> srid = new Var<String>(defaultSrid);
    return Sequence(
            Optional(Srid(), srid.set((String) pop())),
            "LINESTRING",
            Optional(Ch(' ')),
            FirstOf(
                    Sequence(
                            "EMPTY",
                            push(new LineString(new ArrayList<Coordinate>(), Dimension.Two, srid.get()))
                    ),
                    Sequence(
                            Optional("ZM", setDimension(Dimension.ThreeMeasured)),
                            Optional(Ch('Z'), setDimension(Dimension.Three)),
                            Optional(Ch('M'), setDimension(Dimension.TwoMeasured)),
                            setDimension(Dimension.Two),
                            Optional(Ch(' ')),
                            "(",
                            Coordinates(),
                            ")",
                            push(new LineString((List<Coordinate>) pop(), dimension, srid.get()))
                    )
            )
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:26,代码来源:WKTParser.java

示例12: Tin

import org.parboiled.support.Var; //导入依赖的package包/类
Rule Tin() {
    Var<String> srid = new Var<String>(defaultSrid);
    return Sequence(
            Optional(Srid(), srid.set((String) pop())),
            "TIN",
            Optional(Ch(' ')),
            FirstOf(
                    Sequence(
                            "EMPTY",
                            push(new Tin(new ArrayList<Triangle>(), Dimension.Two, srid.get()))
                    ),
                    Sequence(
                            Optional("ZM", setDimension(Dimension.ThreeMeasured)),
                            Optional(Ch('Z'), setDimension(Dimension.Three)),
                            Optional(Ch('M'), setDimension(Dimension.TwoMeasured)),
                            setDimension(Dimension.Two),
                            Optional(Ch(' ')),
                            "(",
                            CoordinateSetsSets(),
                            ")",
                            push(new Tin(getTriangles((List<List<List<Coordinate>>>) pop(), dimension, srid.get()), dimension, srid.get()))
                    )
            )
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:26,代码来源:WKTParser.java

示例13: LinearRing

import org.parboiled.support.Var; //导入依赖的package包/类
Rule LinearRing() {
    Var<String> srid = new Var<String>(defaultSrid);
    return Sequence(
            Optional(Srid(), srid.set((String) pop())),
            "LINEARRING",
            Optional(Ch(' ')),
            FirstOf(
                    Sequence(
                            "EMPTY",
                            push(new LineString(new ArrayList<Coordinate>(), Dimension.Two, srid.get()))
                    ),
                    Sequence(
                            Optional("ZM", setDimension(Dimension.ThreeMeasured)),
                            Optional(Ch('Z'), setDimension(Dimension.Three)),
                            Optional(Ch('M'), setDimension(Dimension.TwoMeasured)),
                            setDimension(Dimension.Two),
                            Optional(Ch(' ')),
                            "(",
                            Coordinates(),
                            ")",
                            push(new LineString((List<Coordinate>) pop(), dimension, srid.get()))
                    )
            )
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:26,代码来源:WKTParser.java

示例14: CircularString

import org.parboiled.support.Var; //导入依赖的package包/类
Rule CircularString() {
    Var<String> srid = new Var<String>(defaultSrid);
    return Sequence(
            Optional(Srid(), srid.set((String) pop())),
            "CIRCULARSTRING",
            Optional(Ch(' ')),
            FirstOf(
                    Sequence(
                            "EMPTY",
                            push(new CircularString(new ArrayList<Coordinate>(), Dimension.Two, srid.get()))
                    ),
                    Sequence(
                            Optional("ZM", setDimension(Dimension.ThreeMeasured)),
                            Optional(Ch('Z'), setDimension(Dimension.Three)),
                            Optional(Ch('M'), setDimension(Dimension.TwoMeasured)),
                            setDimension(Dimension.Two),
                            Optional(Ch(' ')),
                            "(",
                            Coordinates(),
                            ")",
                            push(new CircularString((List<Coordinate>) pop(), dimension, srid.get()))
                    )
            )
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:26,代码来源:WKTParser.java

示例15: Coordinate

import org.parboiled.support.Var; //导入依赖的package包/类
Rule Coordinate() {
    Var<Coordinate.Builder> coordBuilder = new Var<Coordinate.Builder>(new Coordinate.Builder());
    return Sequence(
            // X
            Number(),
            setCoordinateValue("x", dimension, coordBuilder.get(), match()),
            Ch(' '),
            // Y
            Number(),
            setCoordinateValue("y", dimension, coordBuilder.get(), match()),
            Optional(Ch(' ')),
            // M or Z
            Optional(Number(), setCoordinateValue("zOrM", dimension, coordBuilder.get(), match())),
            Optional(Ch(' ')),
            // M
            Optional(Number(), setCoordinateValue("m", dimension, coordBuilder.get(), match())),
            push(coordBuilder.get().build())
    );
}
 
开发者ID:jericks,项目名称:parboiled-wkt,代码行数:20,代码来源:WKTParser.java


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