本文整理了Java中org.yaml.snakeyaml.error.Mark.getIndex()
方法的一些代码示例,展示了Mark.getIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mark.getIndex()
方法的具体详情如下:
包路径:org.yaml.snakeyaml.error.Mark
类名称:Mark
方法名:getIndex
[英]starts with 0
[中]
代码示例来源:origin: redisson/redisson
public int getIndex() {
return _source.getIndex();
}
}
代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
public int getIndex() {
return _source.getIndex();
}
}
代码示例来源:origin: FasterXML/jackson-dataformat-yaml
public int getIndex() {
return _source.getIndex();
}
}
代码示例来源:origin: raml-org/raml-java-parser
@Override
public int getIndex()
{
return mark.getIndex();
}
代码示例来源:origin: harbby/presto-connectors
public int getIndex() {
return _source.getIndex();
}
}
代码示例来源:origin: com.sap.cloud.yaas.raml-parser/raml-parser
private boolean validateOffset(Node valueNode)
{
return valueNode != null && valueNode.getEndMark().getIndex() < offset;
}
代码示例来源:origin: org.raml/raml-parser
private boolean validateOffset(Node valueNode)
{
return valueNode != null && valueNode.getEndMark().getIndex() < offset;
}
代码示例来源:origin: spring-projects/sts4
public static int getEnd(Node node) {
return node.getEndMark().getIndex();
}
代码示例来源:origin: spring-projects/sts4
public static int getStart(Node node) {
return node.getStartMark().getIndex();
}
代码示例来源:origin: spring-projects/sts4
public static ReconcileProblem schemaProblem(String msg, Node node) {
int start = node.getStartMark().getIndex();
int end = node.getEndMark().getIndex();
return new ReconcileProblemImpl(SCHEMA_PROBLEM, msg, start, end-start);
}
代码示例来源:origin: spring-projects/sts4
public static ReconcileProblem problem(ProblemType problemType, String msg, Node node) {
int start = node.getStartMark().getIndex();
int end = node.getEndMark().getIndex();
return new ReconcileProblemImpl(problemType, msg, start, end-start);
}
代码示例来源:origin: spring-projects/sts4
public static DocumentRegion region(IDocument doc, Node node) {
return new DocumentRegion(doc, node.getStartMark().getIndex(), node.getEndMark().getIndex());
}
代码示例来源:origin: spring-projects/sts4
protected DocumentRegion getRegion(Exception e, IDocument doc, Node node) {
DocumentRegion region = new DocumentRegion(doc, node.getStartMark().getIndex(), node.getEndMark().getIndex());
if (e instanceof ValueParseException) {
ValueParseException parseException = (ValueParseException) e;
int start = parseException.getStartIndex() >= 0
? Math.min(node.getStartMark().getIndex() + parseException.getStartIndex(),
node.getEndMark().getIndex())
: node.getStartMark().getIndex();
int end = parseException.getEndIndex() >= 0
? Math.min(node.getStartMark().getIndex() + parseException.getEndIndex(),
node.getEndMark().getIndex())
: node.getEndMark().getIndex();
region = new DocumentRegion(doc, start, end);
}
return region;
}
代码示例来源:origin: spring-projects/sts4
private DocumentRegion allOf(YamlFileAST ast, Node node) {
return new DocumentRegion(ast.getDocument(), node.getStartMark().getIndex(), node.getEndMark().getIndex());
}
代码示例来源:origin: spring-projects/sts4
private IRegion getHoverRegion(YamlFileAST ast, int offset) {
if (ast != null) {
Node n = ast.findNode(offset);
if (n != null && n.getNodeId() == NodeId.scalar) {
int start = n.getStartMark().getIndex();
int end = n.getEndMark().getIndex();
return new Region(start, end - start);
}
}
return null;
}
代码示例来源:origin: org.raml/raml-parser
/**
* @return true if two mapping nodes in the same file
* have the same start mark index
*/
private boolean checkLoop(Node node)
{
if (node.getStartMark() == null)
{
return false;
}
String index = contextPath.peek().getIncludeName() + node.getStartMark().getIndex();
if (loopDetector.contains(index))
{
return true;
}
loopDetector.push(index);
return false;
}
代码示例来源:origin: com.sap.cloud.yaas.raml-parser/raml-parser
/**
* @return true if two mapping nodes in the same file
* have the same start mark index
*/
private boolean checkLoop(Node node)
{
if (node.getStartMark() == null)
{
return false;
}
String index = contextPath.peek().getIncludeName() + node.getStartMark().getIndex();
if (loopDetector.contains(index))
{
return true;
}
loopDetector.push(index);
return false;
}
代码示例来源:origin: spring-projects/sts4
private DocumentRegion dashesAtStartOf(YamlFileAST ast, Node node) {
try {
int start = node.getStartMark().getIndex();
DocumentRegion textBefore = new DocumentRegion(ast.getDocument(), 0, start)
.trimEnd(Pattern.compile("\\s*"));
DocumentRegion dashes = textBefore.subSequence(textBefore.getLength()-3);
if (dashes.toString().equals("---")) {
return dashes;
}
} catch (Exception e) {
Log.log(e);
}
//something unexpected... we couldn't find the '---'. So just mark the entire node.
return allOf(ast, node);
}
代码示例来源:origin: raml-org/raml-java-parser
private static Node buildYamlErrorNode(MarkedYAMLException e, String resourcePath)
{
final ErrorNode errorNode = new ErrorNode("Underlying error while parsing YAML syntax: '" + e.getMessage() + "'");
final Mark problemMark = e.getProblemMark();
errorNode.setStartPosition(new DefaultPosition(problemMark.getIndex(), problemMark.getLine(), 0, resourcePath, new DefaultResourceLoader()));
errorNode.setEndPosition(new DefaultPosition(problemMark.getIndex() + 1, problemMark.getLine(), problemMark.getColumn(), resourcePath, new DefaultResourceLoader()));
return errorNode;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static void raiseParserException(ThreadContext context, IRubyObject yaml, MarkedYAMLException mye, IRubyObject rbPath) {
Ruby runtime;
Mark mark;
RubyClass se;
IRubyObject exception;
runtime = context.runtime;
se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError");
mark = mye.getProblemMark();
exception = se.newInstance(context,
new IRubyObject[] {
rbPath,
runtime.newFixnum(mark.getLine() + 1),
runtime.newFixnum(mark.getColumn() + 1),
runtime.newFixnum(mark.getIndex()),
(null == mye.getProblem() ? runtime.getNil() : runtime.newString(mye.getProblem())),
(null == mye.getContext() ? runtime.getNil() : runtime.newString(mye.getContext()))
},
Block.NULL_BLOCK);
RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK);
}
内容来源于网络,如有侵权,请联系作者删除!