本文整理汇总了Java中org.parboiled.support.StringBuilderVar类的典型用法代码示例。如果您正苦于以下问题:Java StringBuilderVar类的具体用法?Java StringBuilderVar怎么用?Java StringBuilderVar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringBuilderVar类属于org.parboiled.support包,在下文中一共展示了StringBuilderVar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlockRule
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
Rule BlockRule() {
StringBuilderVar style = new StringBuilderVar();
StringBuilderVar body = new StringBuilderVar();
return NodeSequence(
StartMarker(),
Optional(
String("style="),
Sequence(OneOrMore(Letter()), style.append(match()), Spn1())),
Sequence(Body(), body.append(match())),
EndMarker(),
push(
new ExpImageNode("title",
createWebsequenceUrl(style.getString(), body.getString()),
new TextNode("")))
);
}
示例2: BlockRule
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
Rule BlockRule() {
ParamVar<String, String> params = new ParamVar<String, String>();
StringBuilderVar name = new StringBuilderVar();
StringBuilderVar value = new StringBuilderVar();
StringBuilderVar body = new StringBuilderVar();
return NodeSequence(
StartMarker(),
ZeroOrMore(
Sequence(
ParameterName(), name.append(match()),
String("="),
OneOrMore(Alphanumeric()), value.append(match())),
Sp(),
params.put(name.getString(), value.getString()),
name.clear(), value.clear()),
Body(),
body.append(match()),
EndMarker(),
push(
new ExpImageNode(
"title", createYumlUrl(params.get(), body.getString()), new TextNode("")))
);
}
示例3: Box
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
public Rule Box() {
StringBuilderVar inner = new StringBuilderVar();
return NodeSequence(
OneOrMore(
xcrossedOut(Sequence('G', '>', Optional(' ')), inner),
Line(inner)
),
// trigger a recursive parsing run on the inner source we just built
// and attach the root of the inner parses AST
push(new GenericBoxNode(
xwithIndicesShifted(
delegate.get().parseInternal(inner),
(Integer) peek()
).getChildren()))
);
}
示例4: parseInternal
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
public DocumentNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to
// original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
// for (int i = 0; i < chars.length; i++) {
// char c = chars[i];
// if (c != CROSSED_OUT) {
// ixMap[clean.length()] = i;
// clean.append(c);
// }
// }
ixMap[clean.length()] = chars.length;
// run inner parse
char[] cleaned = new char[clean.length()];
clean.getChars(0, cleaned.length, cleaned, 0);
DocumentNode rootNode = parseInternal(cleaned);
// correct AST indices with index map
fixIndices(rootNode, ixMap);
return rootNode;
}
示例5: attributesRules
import org.parboiled.support.StringBuilderVar; //导入依赖的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()))
);
}
示例6: FootnoteContent
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
public Rule FootnoteContent() {
StringBuilderVar ref = new StringBuilderVar();
StringBuilderVar txt = new StringBuilderVar();
return NodeSequence(
'[',
OneOrMore(TestNot(']'), ANY, ref.append(matchedChar())),
']', ':', Sp(),
ZeroOrMore(TestNot(BlankLine()), ANY, txt.append(matchedChar())),
FirstOf(BlankLine(), EOI),
push(new LinkContentNode(ref.getString(), txt.getString())));
}
示例7: Name
import org.parboiled.support.StringBuilderVar; //导入依赖的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())
);
}
示例8: Value
import org.parboiled.support.StringBuilderVar; //导入依赖的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())
);
}
示例9: asciiFenceRule
import org.parboiled.support.StringBuilderVar; //导入依赖的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()
);
}
示例10: BlockBeginMarker
import org.parboiled.support.StringBuilderVar; //导入依赖的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());
}
示例11: BlockEndMarker
import org.parboiled.support.StringBuilderVar; //导入依赖的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());
}
示例12: BlockBeginMarker
import org.parboiled.support.StringBuilderVar; //导入依赖的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());
}
示例13: DoubleQuoteString
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
Rule DoubleQuoteString() {
StringBuilderVar str = new StringBuilderVar();
return Sequence('"', ZeroOrMore(FirstOf(Escape(str),
Sequence(TestNot(AnyOf("\r\n\"\\")), ANY, str.append(match())))).suppressSubnodes(), '"',
push(str.getString()));
}
示例14: SingleQuoteString
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
Rule SingleQuoteString() {
StringBuilderVar str = new StringBuilderVar();
return Sequence('\'', ZeroOrMore(FirstOf(Escape(str),
Sequence(TestNot(AnyOf("\r\n'\\")), ANY, str.append(match())))).suppressSubnodes(), '\'',
push(str.getString()));
}
示例15: Escape
import org.parboiled.support.StringBuilderVar; //导入依赖的package包/类
Rule Escape(StringBuilderVar str) {
return Sequence('\\', FirstOf(AnyOf("btnfr\"\'\\"), OctalEscape(), UnicodeEscape()), str.append(match()));
}