本文整理汇总了Java中org.yaml.snakeyaml.error.Mark类的典型用法代码示例。如果您正苦于以下问题:Java Mark类的具体用法?Java Mark怎么用?Java Mark使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Mark类属于org.yaml.snakeyaml.error包,在下文中一共展示了Mark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: produce
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public Event produce() {
// Parse the document end.
Token token = scanner.peekToken();
Mark startMark = token.getStartMark();
Mark endMark = startMark;
boolean explicit = false;
if (scanner.checkToken(Token.ID.DocumentEnd)) {
token = scanner.getToken();
endMark = token.getEndMark();
explicit = true;
}
Event event = new DocumentEndEvent(startMark, endMark, explicit);
// Prepare the next state.
state = new ParseDocumentStart();
return event;
}
示例2: fetchStreamEnd
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
private void fetchStreamEnd() {
// Set the current intendation to -1.
unwindIndent(-1);
// Reset simple keys.
removePossibleSimpleKey();
this.allowSimpleKey = false;
this.possibleSimpleKeys.clear();
// Read the token.
Mark mark = reader.getMark();
// Add STREAM-END.
Token token = new StreamEndToken(mark, mark);
this.tokens.add(token);
// The stream is finished.
this.done = true;
}
示例3: scanDirectiveIgnoredLine
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
private String scanDirectiveIgnoredLine(Mark startMark) {
// See the specification for details.
while (reader.peek() == ' ') {
reader.forward();
}
if (reader.peek() == '#') {
while (Constant.NULL_OR_LINEBR.hasNo(reader.peek())) {
reader.forward();
}
}
int c = reader.peek();
String lineBreak = scanLineBreak();
if (lineBreak.length() == 0 && c != '\0') {
final String s = String.valueOf(Character.toChars(c));
throw new ScannerException("while scanning a directive", startMark,
"expected a comment or a line break, but found " + s + "(" + c + ")",
reader.getMark());
}
return lineBreak;
}
示例4: scanTagDirectiveValue
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
/**
* <p>
* Read a %TAG directive value:
*
* <pre>
* s-ignored-space+ c-tag-handle s-ignored-space+ ns-tag-prefix s-l-comments
* </pre>
*
* </p>
*
* @see <a href="http://www.yaml.org/spec/1.1/#id896044"></a>
*/
private List<String> scanTagDirectiveValue(Mark startMark) {
// See the specification for details.
while (reader.peek() == ' ') {
reader.forward();
}
String handle = scanTagDirectiveHandle(startMark);
while (reader.peek() == ' ') {
reader.forward();
}
String prefix = scanTagDirectivePrefix(startMark);
List<String> result = new ArrayList<String>(2);
result.add(handle);
result.add(prefix);
return result;
}
示例5: scanFlowScalarBreaks
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
private String scanFlowScalarBreaks(Mark startMark) {
// See the specification for details.
StringBuilder chunks = new StringBuilder();
while (true) {
// Instead of checking indentation, we check for document
// separators.
String prefix = reader.prefix(3);
if (("---".equals(prefix) || "...".equals(prefix))
&& Constant.NULL_BL_T_LINEBR.has(reader.peek(3))) {
throw new ScannerException("while scanning a quoted scalar", startMark,
"found unexpected document separator", reader.getMark());
}
// Scan past any number of spaces and tabs, ignoring them
while (" \t".indexOf(reader.peek()) != -1) {
reader.forward();
}
// If we stopped at a line break, add that; otherwise, return the
// assembled set of scalar breaks.
String lineBreak = scanLineBreak();
if (lineBreak.length() != 0) {
chunks.append(lineBreak);
} else {
return chunks.toString();
}
}
}
示例6: ParserImpl
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public ParserImpl(Scanner scanner) {
this.scanner = scanner;
currentEvent = null;
directives = new VersionTagsTuple(null, new HashMap<String, String>(DEFAULT_TAGS));
states = new ArrayStack<Production>(100);
marks = new ArrayStack<Mark>(10);
state = new ParseStreamStart();
}
示例7: DirectiveToken
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public DirectiveToken(String name, List<T> value, Mark startMark, Mark endMark) {
super(startMark, endMark);
this.name = name;
if (value != null && value.size() != 2) {
throw new YAMLException("Two strings must be provided instead of "
+ String.valueOf(value.size()));
}
this.value = value;
}
示例8: SequenceNode
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public SequenceNode(Tag tag, boolean resolved, List<Node> value, Mark startMark, Mark endMark,
Boolean flowStyle) {
super(tag, startMark, endMark, flowStyle);
if (value == null) {
throw new NullPointerException("value in a Node is required.");
}
this.value = value;
this.resolved = resolved;
}
示例9: ScalarNode
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public ScalarNode(Tag tag, boolean resolved, String value, Mark startMark, Mark endMark,
Character style) {
super(tag, startMark, endMark);
if (value == null) {
throw new NullPointerException("value in a Node is required.");
}
this.value = value;
this.style = style;
this.resolved = resolved;
}
示例10: Node
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public Node(Tag tag, Mark startMark, Mark endMark) {
setTag(tag);
this.startMark = startMark;
this.endMark = endMark;
this.type = Object.class;
this.twoStepsConstruction = false;
this.resolved = true;
this.useClassConstructor = null;
}
示例11: MappingNode
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public MappingNode(Tag tag, boolean resolved, List<NodeTuple> value, Mark startMark,
Mark endMark, Boolean flowStyle) {
super(tag, startMark, endMark, flowStyle);
if (value == null) {
throw new NullPointerException("value in a Node is required.");
}
this.value = value;
this.resolved = resolved;
}
示例12: DocumentStartEvent
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public DocumentStartEvent(Mark startMark, Mark endMark, boolean explicit, Version version,
Map<String, String> tags) {
super(startMark, endMark);
this.explicit = explicit;
this.version = version;
// TODO enforce not null
// if (tags == null) {
// throw new NullPointerException("Tags must be provided.");
// }
this.tags = tags;
}
示例13: fetchBlockEntry
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
/**
* Fetch an entry in the block style.
*
* @see <a href="http://www.yaml.org/spec/1.1/#id863975"></a>
*/
private void fetchBlockEntry() {
// Block context needs additional checks.
if (this.flowLevel == 0) {
// Are we allowed to start a new entry?
if (!this.allowSimpleKey) {
throw new ScannerException(null, null, "sequence entries are not allowed here",
reader.getMark());
}
// We may need to add BLOCK-SEQUENCE-START.
if (addIndent(this.reader.getColumn())) {
Mark mark = reader.getMark();
this.tokens.add(new BlockSequenceStartToken(mark, mark));
}
} else {
// It's an error for the block entry to occur in the flow
// context,but we let the parser detect this.
}
// Simple keys are allowed after '-'.
this.allowSimpleKey = true;
// Reset possible simple key on the current level.
removePossibleSimpleKey();
// Add BLOCK-ENTRY.
Mark startMark = reader.getMark();
reader.forward();
Mark endMark = reader.getMark();
Token token = new BlockEntryToken(startMark, endMark);
this.tokens.add(token);
}
示例14: fetchKey
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
/**
* Fetch a key in a block-style mapping.
*
* @see <a href="http://www.yaml.org/spec/1.1/#id863975"></a>
*/
private void fetchKey() {
// Block context needs additional checks.
if (this.flowLevel == 0) {
// Are we allowed to start a key (not necessary a simple)?
if (!this.allowSimpleKey) {
throw new ScannerException(null, null, "mapping keys are not allowed here",
reader.getMark());
}
// We may need to add BLOCK-MAPPING-START.
if (addIndent(this.reader.getColumn())) {
Mark mark = reader.getMark();
this.tokens.add(new BlockMappingStartToken(mark, mark));
}
}
// Simple keys are allowed after '?' in the block context.
this.allowSimpleKey = this.flowLevel == 0;
// Reset possible simple key on the current level.
removePossibleSimpleKey();
// Add KEY.
Mark startMark = reader.getMark();
reader.forward();
Mark endMark = reader.getMark();
Token token = new KeyToken(startMark, endMark);
this.tokens.add(token);
}
示例15: CollectionStartEvent
import org.yaml.snakeyaml.error.Mark; //导入依赖的package包/类
public CollectionStartEvent(String anchor, String tag, boolean implicit, Mark startMark,
Mark endMark, Boolean flowStyle) {
super(anchor, startMark, endMark);
this.tag = tag;
this.implicit = implicit;
this.flowStyle = flowStyle;
}