com.hazelcast.org.snakeyaml.engine.v1.parser

## Class ParserImpl

- java.lang.Object
- - com.hazelcast.org.snakeyaml.engine.v1.parser.ParserImpl

- All Implemented Interfaces:
    Parser, Iterator<Event>

      public class ParserImpl
      extends Object
      implements Parser

       # The following YAML grammar is LL(1) and is parsed by a recursive descent
       parser.
       stream            ::= STREAM-START implicit_document? explicit_document* STREAM-END
       implicit_document ::= block_node DOCUMENT-END*
       explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
       block_node_or_indentless_sequence ::=
                             ALIAS
                             | properties (block_content | indentless_block_sequence)?
                             | block_content
                             | indentless_block_sequence
       block_node        ::= ALIAS
                             | properties block_content?
                             | block_content
       flow_node         ::= ALIAS
                             | properties flow_content?
                             | flow_content
       properties        ::= TAG ANCHOR? | ANCHOR TAG?
       block_content     ::= block_collection | flow_collection | SCALAR
       flow_content      ::= flow_collection | SCALAR
       block_collection  ::= block_sequence | block_mapping
       flow_collection   ::= flow_sequence | flow_mapping
       block_sequence    ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
       indentless_sequence   ::= (BLOCK-ENTRY block_node?)+
       block_mapping     ::= BLOCK-MAPPING_START
                             ((KEY block_node_or_indentless_sequence?)?
                             (VALUE block_node_or_indentless_sequence?)?)*
                             BLOCK-END
       flow_sequence     ::= FLOW-SEQUENCE-START
                             (flow_sequence_entry FLOW-ENTRY)*
                             flow_sequence_entry?
                             FLOW-SEQUENCE-END
       flow_sequence_entry   ::= flow_node | KEY flow_node? (VALUE flow_node?)?
       flow_mapping      ::= FLOW-MAPPING-START
                             (flow_mapping_entry FLOW-ENTRY)*
                             flow_mapping_entry?
                             FLOW-MAPPING-END
       flow_mapping_entry    ::= flow_node | KEY flow_node? (VALUE flow_node?)?
       FIRST sets:
       stream: { STREAM-START }
       explicit_document: { DIRECTIVE DOCUMENT-START }
       implicit_document: FIRST(block_node)
       block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START }
       flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START }
       block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR }
       flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR }
       block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START }
       flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START }
       block_sequence: { BLOCK-SEQUENCE-START }
       block_mapping: { BLOCK-MAPPING-START }
       block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START BLOCK-ENTRY }
       indentless_sequence: { ENTRY }
       flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START }
       flow_sequence: { FLOW-SEQUENCE-START }
       flow_mapping: { FLOW-MAPPING-START }
       flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY }
       flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY }

  Since writing a recursive-descendant parser is a straightforward task, we do not give many comments here.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Scanner` | `scanner`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParserImpl(Scanner scanner, LoadSettings settings)`
    `ParserImpl(StreamReader reader, LoadSettings settings)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkEvent(Event.ID choice)` Check the type of the next event.
    `boolean` | `hasNext()`
    `Event` | `next()` Get the next event and proceed further.
    `Event` | `peekEvent()` Get the next event.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, remove`

- - ### Field Detail

    - #### scanner

          protected final Scanner scanner

  - ### Constructor Detail

    - #### ParserImpl

          public ParserImpl(StreamReader reader,
                            LoadSettings settings)

    - #### ParserImpl

          public ParserImpl(Scanner scanner,
                            LoadSettings settings)

  - ### Method Detail

    - #### checkEvent

          public boolean checkEvent(Event.ID choice)

      Check the type of the next event.
      Specified by:
        `checkEvent` in interface `Parser`
      Parameters:
        `choice` - Event ID.
      Returns:
        `true` if the next event can be assigned to a variable of the given type. Returns `false` if no more events are available.

    - #### peekEvent

          public Event peekEvent()

      Get the next event.
      Specified by:
        `peekEvent` in interface `Parser`
      Returns:
        The event that will be returned on the next call to `Parser.next()`

    - #### next

          public Event next()

      Get the next event and proceed further.
      Specified by:
        `next` in interface `Parser`
      Specified by:
        `next` in interface `Iterator<Event>`
      Returns:
        the next parsed event

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<Event>`

Copyright © 2019. All rights reserved.