mmm-0.1.0.0: Minecraft 1.21.4 implementation in Haskell
Copyright(c) axionbuster 2025
LicenseBSD-3-Clause
Safe HaskellNone
LanguageGHC2021

M.IO.TH

Description

This module provides Template Haskell functionality to generate parser states for client-server packet handling. It uses a simple grammar to define packet mappings and their associated codes.

Usage

Define parser states using the states quasi-quoter:

-- creates mystatepair :: ParserStates
[states|
  mystatepair
  Login:1f:2f     -- Login packet: recv=0x1f, send=0x2f
  Handshake::3f   -- Handshake packet: send=0x3f only
  |]

See: ParserStates, forserver, and forclient.

Note

All numerals are hexadecimal.

Synopsis

Documentation

data ParserStates Source #

Represents a pair of parser states - one for server-side parsing and one for client-side. The states contain mappings between packet types, codes and identifiers.

states :: QuasiQuoter Source #

A quasi-quoter for generating parser states. Parses the input grammar and generates appropriate ParserState pairs.