# Path: fastavro/io/symbols.py
# class _NoDefault:
# class Symbol:
# class Root(Symbol):
# class Terminal(Symbol):
# class Sequence(Symbol):
# class Repeater(Symbol):
# class Alternative(Symbol):
# class Action(Symbol):
# class EnumLabels(Action):
# class UnionEnd(Action):
# class RecordStart(Action):
# class RecordEnd(Action):
# class FieldStart(Action):
# class FieldEnd(Action):
# NO_DEFAULT = _NoDefault()
#     def __init__(self, production=None, default=NO_DEFAULT):
#     def get_default(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, *symbols, default=NO_DEFAULT):
#     def __init__(self, end, *symbols, default=NO_DEFAULT):
#     def __init__(self, symbols, labels, default=NO_DEFAULT):
#     def get_symbol(self, index):
#     def get_label(self, index):
#     def __init__(self, labels):
#     def __init__(self, field_name):
# 
# Path: fastavro/schema.py
# FINGERPRINT_ALGORITHMS = _schema.FINGERPRINT_ALGORITHMS


from .symbols import (
    Root,
    Terminal,
    Boolean,
    Sequence,
    Repeater,
    Action,
    RecordStart,
    RecordEnd,
    FieldStart,
    FieldEnd,
    Int,
    Null,
    String,
    Alternative,
    Union,
    Long,
    Float,
    Double,
    Bytes,
    MapEnd,
    MapStart,
    MapKeyMarker,
    Enum,
    EnumLabels,
    Fixed,
    ArrayStart,
    ArrayEnd,
    ItemEnd,
    NO_DEFAULT,
)
from ..schema import extract_record_type
    def _parse(self, schema, default=NO_DEFAULT):
        record_type = extract_record_type(schema)

        if record_type == "record":
            production = []

            production.append(RecordStart(default=default))
            for field in schema["fields"]:
                production.insert(0, FieldStart(field["name"]))
                production.insert(
                    0, self._parse(field["type"], field.get("default", NO_DEFAULT))
                )
                production.insert(0, FieldEnd())
            production.insert(0, RecordEnd())

            seq = Sequence(*production)
            return seq

        elif record_type == "union":
            symbols = []
            labels = []
            for candidate_schema in schema:
                symbols.append(self._parse(candidate_schema))
                if isinstance(candidate_schema, dict):
                    labels.append(
                        candidate_schema.get("name", candidate_schema.get("type"))
                    )
                else:
                    labels.append(candidate_schema)


# Path: fastavro/io/symbols.py
# class _NoDefault:
# class Symbol:
# class Root(Symbol):
# class Terminal(Symbol):
# class Sequence(Symbol):
# class Repeater(Symbol):
# class Alternative(Symbol):
# class Action(Symbol):
# class EnumLabels(Action):
# class UnionEnd(Action):
# class RecordStart(Action):
# class RecordEnd(Action):
# class FieldStart(Action):
# class FieldEnd(Action):
# NO_DEFAULT = _NoDefault()
#     def __init__(self, production=None, default=NO_DEFAULT):
#     def get_default(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __init__(self, *symbols, default=NO_DEFAULT):
#     def __init__(self, end, *symbols, default=NO_DEFAULT):
#     def __init__(self, symbols, labels, default=NO_DEFAULT):
#     def get_symbol(self, index):
#     def get_label(self, index):
#     def __init__(self, labels):
#     def __init__(self, field_name):
# 
# Path: fastavro/schema.py
# FINGERPRINT_ALGORITHMS = _schema.FINGERPRINT_ALGORITHMS


# Path: fastavro/io/parser.py
from .symbols import (
    Root,
    Terminal,
    Boolean,
    Sequence,
    Repeater,
    Action,
    RecordStart,
    RecordEnd,
    FieldStart,
    FieldEnd,
    Int,
    Null,
    String,
    Alternative,
    Union,
    Long,
    Float,
    Double,
    Bytes,
    MapEnd,
    MapStart,
    MapKeyMarker,
    Enum,
    EnumLabels,
    Fixed,
    ArrayStart,
    ArrayEnd,
    ItemEnd,
    NO_DEFAULT,
)
from ..schema import extract_record_type

    def _parse(self, schema, default=NO_DEFAULT):
        record_type = extract_record_type(schema)

        if record_type == "record":
            production = []

            production.append(RecordStart(default=default))
            for field in schema["fields"]:
                production.insert(0, FieldStart(field["name"]))
                production.insert(
                    0, self._parse(field["type"], field.get("default", NO_DEFAULT))
                )
                production.insert(0, FieldEnd())
            production.insert(0, RecordEnd())

            seq = Sequence(*production)
            return seq

        elif record_type == "union":
            symbols = []
            labels = []
            for candidate_schema in schema:
                symbols.append(self._parse(candidate_schema))
                if isinstance(candidate_schema, dict):
                    labels.append(
                        candidate_schema.get("name", candidate_schema.get("type"))
                    )
                else:
                    labels.append(candidate_schema)


            return Sequence(Alternative(symbols, labels, default=default), Union())