Copyright | (c) axionbuster 2025 |
---|---|
License | BSD-3-Clause |
Safe Haskell | None |
Language | GHC2021 |
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
- data ParserStates = ParserStates {}
- states :: QuasiQuoter
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.