public int getLine() { return _source.getLine(); }
public int getLine() { return _source.getLine(); }
@Override public String toString() { StringBuilder lines = new StringBuilder(); if (context != null) { lines.append(context); lines.append("\n"); } if (contextMark != null && (problem == null || problemMark == null || contextMark.getName().equals(problemMark.getName()) || (contextMark.getLine() != problemMark.getLine()) || (contextMark .getColumn() != problemMark.getColumn()))) { lines.append(contextMark.toString()); lines.append("\n"); } if (problem != null) { lines.append(problem); lines.append("\n"); } if (problemMark != null) { lines.append(problemMark.toString()); lines.append("\n"); } if (note != null) { lines.append(note); lines.append("\n"); } return lines.toString(); }
protected JsonLocation _locationFor(Mark m) { if (m == null) { return new JsonLocation(_ioContext.getSourceReference(), -1, -1, -1); } return new JsonLocation(_ioContext.getSourceReference(), -1, m.getLine() + 1, // from 0- to 1-based m.getColumn() + 1); // ditto }
private Origin getOrigin(Node node) { Mark mark = node.getStartMark(); Location location = new Location(mark.getLine(), mark.getColumn()); return new TextResourceOrigin(OriginTrackedYamlLoader.this.resource, location); }
protected JsonLocation _locationFor(Mark m) { if (m == null) { return new JsonLocation(_ioContext.getSourceReference(), -1, -1, -1); } return new JsonLocation(_ioContext.getSourceReference(), -1, m.getLine() + 1, // from 0- to 1-based m.getColumn() + 1); // ditto }
MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); _parsingContext = _parsingContext.createChildObjectContext(m.getLine(), m.getColumn()); return (_currToken = JsonToken.START_OBJECT); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn()); return (_currToken = JsonToken.START_ARRAY);
MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); _parsingContext = _parsingContext.createChildObjectContext(m.getLine(), m.getColumn()); return (_currToken = JsonToken.START_OBJECT); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn()); return (_currToken = JsonToken.START_ARRAY);
@Test public void testMalformed() throws Exception { String ysld = "foo:\n" + " foo: bar\n" + " foo: bar\n"; List<MarkedYAMLException> errors = validate(ysld); assertEquals(1, errors.size()); MarkedYAMLException e = errors.get(0); assertEquals(2, e.getProblemMark().getLine()); }
@Override public int getLine() { return mark.getLine(); }
@Test public void testColor() throws Exception { String ysld = "fill-color: 21xyz"; List<MarkedYAMLException> errors = validate(ysld); assertEquals(1, errors.size()); MarkedYAMLException e = errors.get(0); assertEquals(0, e.getProblemMark().getLine()); assertEquals(12, e.getProblemMark().getColumn()); }
/** * Constructor * * @param content the YAML content to highlight * @param mark a mark to be pointed to (and certainly highlighted) in the YAML code */ YamlLocation(String content, Mark mark) { this(content, mark.getLine() + 1, mark.getColumn() + 1, mark.getPointer()); }
public IncludeInfo(Mark startMark, Mark endMark, String includeName) { this(startMark.getLine(), startMark.getColumn(), endMark.getColumn(), includeName); }
private int getLineOffset(ScalarNode schemaNode) { boolean isInclude = schemaNode.getTag().startsWith(INCLUDE_APPLIED_TAG); return isInclude ? -1 : schemaNode.getStartMark().getLine(); }
private int getLineOffset(ScalarNode schemaNode) { boolean isInclude = schemaNode.getTag().startsWith(INCLUDE_APPLIED_TAG); return isInclude ? -1 : schemaNode.getStartMark().getLine(); }
public static ValidationResult createErrorResult(String message, Mark startMark, Mark endMark) { int line = startMark == null ? UNKNOWN : startMark.getLine(); int startColumn = startMark == null ? UNKNOWN : startMark.getColumn(); int endColumn = endMark == null ? UNKNOWN : endMark.getColumn(); return createErrorResult(message, line, startColumn, endColumn); }
public YAMLException(ScannerException e, VirtualFile yaml) { super(e.getMessage() + " (in file " + yaml.relativePath() + " line " + (e.getProblemMark().getLine() + 1) + ", column " + (e.getProblemMark().getColumn() + 1) + ")", e); this.e = e; this.yaml = yaml; }
public static ValidationResult createWarnResult(String message, Node node) { return new ValidationResult(Level.WARN, message, node.getStartMark().getLine(), node.getStartMark().getColumn(), node.getEndMark().getColumn()); }
public static ValidationResult createWarnResult(String message, Node node) { return new ValidationResult(Level.WARN, message, node.getStartMark().getLine(), node.getStartMark().getColumn(), node.getEndMark().getColumn()); }
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; }