Sha256: f0c1768407815651e9b5b3d137a61da42783718fceb61d2cf6d62748d3161863

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

module LIT
  module Parser
    # @api public
    # @since 0.1.0
    module AST
      Program = ::Struct.new(:statements)
      EndpointStatement = ::Struct.new(:name, :request, :response)

      module EnumVariant
        Unit = Module.new
        Struct = ::Struct.new(:fields)
      end

      module TypeDeclarationStatement
        Struct = ::Struct.new(:name, :fields)
        Enum = ::Struct.new(:name, :variants)
        TypeAlias = ::Struct.new(:name, :type)
      end

      module Type
        Alias = ::Struct.new(:name)
        AnonymousStruct = ::Struct.new(:fields)
        AnonymousEnum = ::Struct.new(:variants)

        module Primitive
          String = Module.new
          Integer = Module.new
          Float = Module.new
          Boolean = Module.new
          Option = ::Struct.new(:type)
          Array = ::Struct.new(:type)
          Map = ::Struct.new(:key_type, :value_type)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
litl-parser-0.1.0 lib/lit/parser/ast.rb