Java 类org.yaml.snakeyaml.events.DocumentEndEvent 实例源码

项目:AndroidApktool    文件:ParserImpl.java   
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;
}
项目:AndroidApktool    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
}
项目:AndroidApktool    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:5zig-TIMV-Plugin    文件:ParserImpl.java   
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;
}
项目:5zig-TIMV-Plugin    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
}
项目:5zig-TIMV-Plugin    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:diorite-configs-java8    文件:ExpectDocumentEnd.java   
@Override
public void expect(Emitter emitter) throws IOException
{
    if (emitter.event instanceof DocumentEndEvent)
    {
        emitter.writeIndent();
        if (((DocumentEndEvent) emitter.event).getExplicit())
        {
            emitter.writeIndicator("...", true, false, false);
            emitter.writeIndent();
        }
        emitter.flushStream();
        emitter.state = new ExpectDocumentStart(false);
    }
    else
    {
        throw new EmitterException("expected DocumentEndEvent, but got " + emitter.event);
    }
}
项目:snake-yaml    文件:ParserImpl.java   
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;
}
项目:snake-yaml    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
}
项目:snake-yaml    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:snake-yaml    文件:ParserImplTest.java   
public void testGetEvent() {
    String data = "string: abcd";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    check(etalonEvents, parser);
}
项目:snake-yaml    文件:ParserImplTest.java   
public void testGetEvent2() {
    String data = "american:\n  - Boston Red Sox";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents
            .add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
            "Boston Red Sox", dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    check(etalonEvents, parser);
}
项目:SubServers-2    文件:ParserImpl.java   
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;
}
项目:SubServers-2    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
}
项目:SubServers-2    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:Diorite    文件:ExpectDocumentEnd.java   
@Override
public void expect(Emitter emitter) throws IOException
{
    if (emitter.event instanceof DocumentEndEvent)
    {
        emitter.writeIndent();
        if (((DocumentEndEvent) emitter.event).getExplicit())
        {
            emitter.writeIndicator("...", true, false, false);
            emitter.writeIndent();
        }
        emitter.flushStream();
        emitter.state = new ExpectDocumentStart(false);
    }
    else
    {
        throw new EmitterException("expected DocumentEndEvent, but got " + emitter.event);
    }
}
项目:snakeyaml    文件:ParserImpl.java   
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;
}
项目:snakeyaml    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
    this.lastAnchorId = 0;
}
项目:snakeyaml    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:snakeyaml    文件:ParserImplTest.java   
public void testGetEvent() {
    String data = "string: abcd";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    while (parser.checkEvent(null)) {
        Event event = parser.getEvent();
        if (etalonEvents.isEmpty()) {
            fail("unexpected event: " + event);
        }
        assertEquals(etalonEvents.removeFirst(), event);
    }
    assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
项目:TestTheTeacher    文件:ParserImpl.java   
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;
}
项目:TestTheTeacher    文件:Serializer.java   
public void serialize(Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion,
            useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
    this.lastAnchorId = 0;
}
项目:TestTheTeacher    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:org.openntf.domino    文件:ParserImpl.java   
@Override
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;
}
项目:org.openntf.domino    文件:Serializer.java   
public void serialize(final Node node) throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (closed) {
        throw new SerializerException("serializer is closed");
    }
    this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion, useTags));
    anchorNode(node);
    if (explicitRoot != null) {
        node.setTag(explicitRoot);
    }
    serializeNode(node, null);
    this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
    this.serializedNodes.clear();
    this.anchors.clear();
    this.lastAnchorId = 0;
}
项目:org.openntf.domino    文件:Emitter.java   
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
项目:AndroidApktool    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("需要 DocumentEndEvent 事件, 但却得到了 " + event);
    }
}
项目:5zig-TIMV-Plugin    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}
项目:diorite-configs-java8    文件:Emitter.java   
private boolean needEvents(int count)
{
    int level = 0;
    Iterator<Event> iter = this.events.iterator();
    iter.next();
    while (iter.hasNext())
    {
        Event event = iter.next();
        if ((event instanceof DocumentStartEvent) || (event instanceof CollectionStartEvent))
        {
            level++;
        }
        else if ((event instanceof DocumentEndEvent) || (event instanceof CollectionEndEvent))
        {
            level--;
        }
        else if (event instanceof StreamEndEvent)
        {
            level = - 1;
        }
        if (level < 0)
        {
            return false;
        }
    }
    return this.events.size() < (count + 1);
}
项目:diorite-configs-java8    文件:Serializer.java   
public void serialize(Node node) throws IOException
    {
        if (this.closed == null)
        {
            throw new SerializerException("serializer is not opened");
        }
        if (this.closed)
        {
            throw new SerializerException("serializer is closed");
        }
//        if (this.explicitRoot != null)
//        {
//            if (this.explicitRoot.getValue().startsWith(Tag.PREFIX))
//            {
//                try
//                {
//                    Class<?> type = Class.forName(this.explicitRoot.getClassName(), false, Thread.currentThread().getContextClassLoader());
//                    node.setType(type);
//                }
//                catch (Exception ignored)
//                {
//                }
//            }
//        }
        this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion, this.useTags));
        this.anchorNode(node);
        if (this.explicitRoot != null)
        {
            node.setTag(this.explicitRoot);
        }

        this.emitter.writeComment(this.comments.getHeader(), 0, 1);
        this.serializeNode(node, null, new LinkedList<>(), false);
        this.emitter.writeComment(this.comments.getFooter(), 2, 0);

        this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
        this.serializedNodes.clear();
        this.anchors.clear();
    }
项目:snake-yaml    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}
项目:snake-yaml    文件:CanonicalParser.java   
private void parseDocument() {
    if (scanner.checkToken(Token.ID.Directive)) {
        scanner.getToken(Token.ID.Directive);
    }
    scanner.getToken(Token.ID.DocumentStart);
    events.add(new DocumentStartEvent(null, null, true, Version.V1_1, null));
    parseNode();
    events.add(new DocumentEndEvent(null, null, true));
}
项目:SubServers-2    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}
项目:Diorite    文件:Emitter.java   
private boolean needEvents(int count)
{
    int level = 0;
    Iterator<Event> iter = this.events.iterator();
    iter.next();
    while (iter.hasNext())
    {
        Event event = iter.next();
        if ((event instanceof DocumentStartEvent) || (event instanceof CollectionStartEvent))
        {
            level++;
        }
        else if ((event instanceof DocumentEndEvent) || (event instanceof CollectionEndEvent))
        {
            level--;
        }
        else if (event instanceof StreamEndEvent)
        {
            level = - 1;
        }
        if (level < 0)
        {
            return false;
        }
    }
    return this.events.size() < (count + 1);
}
项目:Diorite    文件:Serializer.java   
public void serialize(Node node) throws IOException
    {
        if (this.closed == null)
        {
            throw new SerializerException("serializer is not opened");
        }
        if (this.closed)
        {
            throw new SerializerException("serializer is closed");
        }
//        if (this.explicitRoot != null)
//        {
//            if (this.explicitRoot.getValue().startsWith(Tag.PREFIX))
//            {
//                try
//                {
//                    Class<?> type = Class.forName(this.explicitRoot.getClassName(), false, Thread.currentThread().getContextClassLoader());
//                    node.setType(type);
//                }
//                catch (Exception ignored)
//                {
//                }
//            }
//        }
        this.emitter.emit(new DocumentStartEvent(null, null, this.explicitStart, this.useVersion, this.useTags));
        this.anchorNode(node);
        if (this.explicitRoot != null)
        {
            node.setTag(this.explicitRoot);
        }

        this.emitter.writeComment(this.comments.getHeader(), 0, 1);
        this.serializeNode(node, null, new LinkedList<>(), false);
        this.emitter.writeComment(this.comments.getFooter(), 2, 0);

        this.emitter.emit(new DocumentEndEvent(null, null, this.explicitEnd));
        this.serializedNodes.clear();
        this.anchors.clear();
    }
项目:snakeyaml    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}
项目:snakeyaml    文件:ParserImplTest.java   
public void testGetEvent2() {
    String data = "american:\n  - Boston Red Sox";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents
            .add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
            "Boston Red Sox", dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    while (parser.checkEvent(null)) {
        Event event = parser.getEvent();
        if (etalonEvents.isEmpty()) {
            fail("unexpected event: " + event);
        }
        assertEquals(etalonEvents.removeFirst(), event);
    }
    assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
项目:snakeyaml    文件:CanonicalParser.java   
private void parseDocument() {
    if (scanner.checkToken(Token.ID.Directive)) {
        scanner.getToken(Token.ID.Directive);
    }
    scanner.getToken(Token.ID.DocumentStart);
    events.add(new DocumentStartEvent(null, null, true, Version.V1_1, null));
    parseNode();
    events.add(new DocumentEndEvent(null, null, true));
}
项目:TestTheTeacher    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}
项目:org.openntf.domino    文件:Emitter.java   
public void expect() throws IOException {
    if (event instanceof DocumentEndEvent) {
        writeIndent();
        if (((DocumentEndEvent) event).getExplicit()) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        flushStream();
        state = new ExpectDocumentStart(false);
    } else {
        throw new EmitterException("expected DocumentEndEvent, but got " + event);
    }
}