Package org.yaml.snakeyaml.events

Examples of org.yaml.snakeyaml.events.ScalarEvent


        return '"';
    }

    @SuppressWarnings("deprecation")
    private void processScalar() throws IOException {
        ScalarEvent ev = (ScalarEvent) event;
        if (analysis == null) {
            analysis = analyzeScalar(ev.getValue());
        }
        if (style == null) {
            style = chooseScalarStyle();
        }
        // TODO the next line should be removed
View Full Code Here


                    } else if (tag == null) {
                        implicitValues = new ImplicitTuple(false, true);
                    } else {
                        implicitValues = new ImplicitTuple(false, false);
                    }
                    event = new ScalarEvent(anchor, tag, implicitValues, token.getValue(),
                            startMark, endMark, token.getStyle());
                    state = states.pop();
                } else if (scanner.checkToken(Token.ID.FlowSequenceStart)) {
                    endMark = scanner.peekToken().getEndMark();
                    event = new SequenceStartEvent(anchor, tag, implicit, startMark, endMark,
                            Boolean.TRUE);
                    state = new ParseFlowSequenceFirstEntry();
                } else if (scanner.checkToken(Token.ID.FlowMappingStart)) {
                    endMark = scanner.peekToken().getEndMark();
                    event = new MappingStartEvent(anchor, tag, implicit, startMark, endMark,
                            Boolean.TRUE);
                    state = new ParseFlowMappingFirstKey();
                } else if (block && scanner.checkToken(Token.ID.BlockSequenceStart)) {
                    endMark = scanner.peekToken().getStartMark();
                    event = new SequenceStartEvent(anchor, tag, implicit, startMark, endMark,
                            Boolean.FALSE);
                    state = new ParseBlockSequenceFirstEntry();
                } else if (block && scanner.checkToken(Token.ID.BlockMappingStart)) {
                    endMark = scanner.peekToken().getStartMark();
                    event = new MappingStartEvent(anchor, tag, implicit, startMark, endMark,
                            Boolean.FALSE);
                    state = new ParseBlockMappingFirstKey();
                } else if (anchor != null || tag != null) {
                    // Empty scalars are allowed even if a tag or an anchor is
                    // specified.
                    event = new ScalarEvent(anchor, tag, new ImplicitTuple(implicit, false), "",
                            startMark, endMark, (char) 0);
                    state = states.pop();
                } else {
                    String node;
                    if (block) {
View Full Code Here

     *           (VALUE block_node_or_indentless_sequence?)?)*
     *           BLOCK-END
     * </pre>
     */
    private Event processEmptyScalar(Mark mark) {
        return new ScalarEvent(null, null, new ImplicitTuple(true, false), "", mark, mark, (char) 0);
    }
View Full Code Here

                    event.getStartMark().getColumn());
        }


        if (anchor.isValueAnchor()) {
            ScalarEvent scalarEvent = (ScalarEvent) anchor.getEvents().get(0);

            addValueEvent(scalarEvent, name, scalarEvent.getValue(), false);
        } else {
            contentHandler.startElementStructure(name, getAnchorName(event), false);

            eventStreamParser.handle(this, anchor.getEvents());
View Full Code Here

      if(e.is(ID.DocumentStart)) {
        elementNameStack.push(documentName);

        outputStructAsElement = true;
      } else if(e.is(ID.Scalar)) {
        ScalarEvent es = (ScalarEvent) e;

        if(isNextElementName && !lastTypeIsArray(typeStack)) {
          String name = nameFormatter.format(es.getValue());

          if(logger.isTraceEnabled()) {
                logger.trace("Element name: " + name);
              }

          elementNameStack.push(name);

          eventHandler.addNameEvent(es, name);

          isNextElementName = false;
        } else {
          String elementName = typeStack.peek() == Type.SEQUENCE ? arrayElementName : elementNameStack.pop();

            eventHandler.addValueEvent(es, elementName, es.getValue());

            isNextElementName = true;
        }
      } else if(e.is(ID.MappingStart) || e.is(ID.SequenceStart)) {
        CollectionStartEvent cse = (CollectionStartEvent) e;
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.events.ScalarEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.