Sha256: 2db7adf6a63c0b700218ce1e637d762ffafc6366623fd5f31b7456a0be356a80

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 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
          Unit = 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.1 lib/lit/parser/ast.rb