@Override public JsonLocation getTokenLocation() { if (_lastEvent == null) { return JsonLocation.NA; } return _locationFor(_lastEvent.getStartMark()); }
@Override public JsonLocation getTokenLocation() { if (_lastEvent == null) { return JsonLocation.NA; } return _locationFor(_lastEvent.getStartMark()); }
/** * Reads a document from a source that contains only one document. * <p> * If the stream contains more than one document an exception is thrown. * </p> * * @return The root node of the document or <code>null</code> if no document * is available. */ public Node getSingleNode() { // Drop the STREAM-START event. parser.getEvent(); // Compose a document if the stream is not empty. Node document = null; if (!parser.checkEvent(Event.ID.StreamEnd)) { document = getNode(); } // Ensure that the stream contains no more documents. if (!parser.checkEvent(Event.ID.StreamEnd)) { Event event = parser.getEvent(); throw new ComposerException("expected a single document in the stream", document.getStartMark(), "but found another document", event.getStartMark()); } // Drop the STREAM-END event. parser.getEvent(); return document; }
Mark m = evt.getStartMark(); MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
private void end(Event evt, YsldValidateContext context) { if (state == State.STARTED) { depth--; if (depth == 0) { state = State.DONE; context.pop(); } } else { context.error( "Unexpected End of " + ((evt instanceof MappingEndEvent) ? "Mapping" : "Sequence"), evt.getStartMark()); } }
Mark m = evt.getStartMark(); MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
@Override public JsonLocation getTokenLocation() { if (_lastEvent == null) { return JsonLocation.NA; } return _locationFor(_lastEvent.getStartMark()); }
@Override public JsonLocation getTokenLocation() { if (_lastEvent == null) { return JsonLocation.NA; } return _locationFor(_lastEvent.getStartMark()); }
private void end(Event evt, YsldValidateContext context) { if (state == State.STARTED) { depth--; if (depth == 0) { state = State.DONE; context.pop(); } } else { context.error( "Unexpected End of " + ((evt instanceof MappingEndEvent) ? "Mapping" : "Sequence"), evt.getStartMark()); } }
/** * Reads a document from a source that contains only one document. * <p> * If the stream contains more than one document an exception is thrown. * </p> * * @return The root node of the document or <code>null</code> if no document * is available. */ public Node getSingleNode() { // Drop the STREAM-START event. parser.getEvent(); // Compose a document if the stream is not empty. Node document = null; if (!parser.checkEvent(Event.ID.StreamEnd)) { document = composeDocument(); } // Ensure that the stream contains no more documents. if (!parser.checkEvent(Event.ID.StreamEnd)) { Event event = parser.getEvent(); throw new ComposerException("expected a single document in the stream", document.getStartMark(), "but found another document", event.getStartMark()); } // Drop the STREAM-END event. parser.getEvent(); return document; }
/** * Reads a document from a source that contains only one document. * <p> * If the stream contains more than one document an exception is thrown. * </p> * * @return The root node of the document or <code>null</code> if no document * is available. */ public Node getSingleNode() { // Drop the STREAM-START event. parser.getEvent(); // Compose a document if the stream is not empty. Node document = null; if (!parser.checkEvent(Event.ID.StreamEnd)) { document = composeDocument(); } // Ensure that the stream contains no more documents. if (!parser.checkEvent(Event.ID.StreamEnd)) { Event event = parser.getEvent(); throw new ComposerException("expected a single document in the stream", document.getStartMark(), "but found another document", event.getStartMark()); } // Drop the STREAM-END event. parser.getEvent(); return document; }
/** * Reads a document from a source that contains only one document. * <p> * If the stream contains more than one document an exception is thrown. * </p> * * @return The root node of the document or <code>null</code> if no document * is available. */ public Node getSingleNode() { // Drop the STREAM-START event. parser.getEvent(); // Compose a document if the stream is not empty. Node document = null; if (!parser.checkEvent(Event.ID.StreamEnd)) { document = composeDocument(); } // Ensure that the stream contains no more documents. if (!parser.checkEvent(Event.ID.StreamEnd)) { Event event = parser.getEvent(); throw new ComposerException("expected a single document in the stream", document.getStartMark(), "but found another document", event.getStartMark()); } // Drop the STREAM-END event. parser.getEvent(); return document; }
@JRubyMethod public IRubyObject mark(ThreadContext context) { Ruby runtime = context.runtime; Event event = null; if (parser != null) { event = parser.peekEvent(); if (event == null) event = this.event; } if (event == null) { return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance( context, runtime.newFixnum(0), runtime.newFixnum(0), runtime.newFixnum(0), Block.NULL_BLOCK ); } Mark mark = event.getStartMark(); return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance( context, runtime.newFixnum(mark.getIndex()), runtime.newFixnum(mark.getLine()), runtime.newFixnum(mark.getColumn()), Block.NULL_BLOCK ); }
@JRubyMethod public IRubyObject mark(ThreadContext context) { Ruby runtime = context.runtime; Event event = null; if (parser != null) { event = parser.peekEvent(); if (event == null) event = this.event; } if (event == null) { return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance( context, runtime.newFixnum(0), runtime.newFixnum(0), runtime.newFixnum(0), Block.NULL_BLOCK ); } Mark mark = event.getStartMark(); return ((RubyClass)context.runtime.getClassFromPath("Psych::Parser::Mark")).newInstance( context, runtime.newFixnum(mark.getIndex()), runtime.newFixnum(mark.getLine()), runtime.newFixnum(mark.getColumn()), Block.NULL_BLOCK ); }
Mark m = evt.getStartMark(); MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
Mark m = evt.getStartMark(); MappingStartEvent map = (MappingStartEvent) evt; _currentAnchor = map.getAnchor(); Mark m = evt.getStartMark(); _currentAnchor = ((NodeEvent)evt).getAnchor(); _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());