11// The Swift Programming Language
22// https://docs.swift.org/swift-book
33
4- import BinaryParseKitCommons
4+ @ _exported public import BinaryParseKitCommons
55public import BinaryParsing
66
77// MARK: - Skip Parsing
@@ -32,7 +32,7 @@ public import BinaryParsing
3232@attached ( peer)
3333public macro skip( byteCount: ByteCount , because: String ) = #externalMacro(
3434 module: " BinaryParseKitMacros " ,
35- type: " SkipParsingMacro " ,
35+ type: " EmptyPeerMacro " ,
3636)
3737
3838// MARK: - Field Parsing
@@ -53,7 +53,7 @@ public macro skip(byteCount: ByteCount, because: String) = #externalMacro(
5353/// }
5454/// ```
5555@attached ( peer)
56- public macro parse( ) = #externalMacro( module: " BinaryParseKitMacros " , type: " ByteParsingMacro " )
56+ public macro parse( ) = #externalMacro( module: " BinaryParseKitMacros " , type: " EmptyPeerMacro " )
5757
5858/// Parses a field with a specific endianness.
5959///
@@ -76,7 +76,7 @@ public macro parse() = #externalMacro(module: "BinaryParseKitMacros", type: "Byt
7676/// }
7777/// ```
7878@attached ( peer)
79- public macro parse( endianness: Endianness ) = #externalMacro( module: " BinaryParseKitMacros " , type: " ByteParsingMacro " )
79+ public macro parse( endianness: Endianness ) = #externalMacro( module: " BinaryParseKitMacros " , type: " EmptyPeerMacro " )
8080
8181/// Parses a field with a specific byte count.
8282///
@@ -101,7 +101,7 @@ public macro parse(endianness: Endianness) = #externalMacro(module: "BinaryParse
101101@attached ( peer)
102102public macro parse( byteCount: ByteCount ) = #externalMacro(
103103 module: " BinaryParseKitMacros " ,
104- type: " ByteParsingMacro " ,
104+ type: " EmptyPeerMacro " ,
105105)
106106
107107/// Parses a field with a byte count determined by another field's value.
@@ -128,7 +128,7 @@ public macro parse(byteCount: ByteCount) = #externalMacro(
128128@attached ( peer)
129129public macro parse< R, V: BinaryInteger > ( byteCountOf: KeyPath < R , V > ) = #externalMacro(
130130 module: " BinaryParseKitMacros " ,
131- type: " ByteParsingMacro " ,
131+ type: " EmptyPeerMacro " ,
132132)
133133
134134/// Parses a field with both specific byte count and endianness.
@@ -153,7 +153,7 @@ public macro parse<R, V: BinaryInteger>(byteCountOf: KeyPath<R, V>) = #externalM
153153@attached ( peer)
154154public macro parse( byteCount: ByteCount , endianness: Endianness ) = #externalMacro(
155155 module: " BinaryParseKitMacros " ,
156- type: " ByteParsingMacro " ,
156+ type: " EmptyPeerMacro " ,
157157)
158158
159159/// Parses a field with byte count from another field and specific endianness.
@@ -182,7 +182,7 @@ public macro parse(byteCount: ByteCount, endianness: Endianness) = #externalMacr
182182@attached ( peer)
183183public macro parse< R, V: BinaryInteger > ( byteCountOf: KeyPath < R , V > , endianness: Endianness ) = #externalMacro(
184184 module: " BinaryParseKitMacros " ,
185- type: " ByteParsingMacro " ,
185+ type: " EmptyPeerMacro " ,
186186)
187187
188188/// Parses all remaining bytes in the data stream.
@@ -208,7 +208,7 @@ public macro parse<R, V: BinaryInteger>(byteCountOf: KeyPath<R, V>, endianness:
208208@attached ( peer)
209209public macro parseRest( ) = #externalMacro(
210210 module: " BinaryParseKitMacros " ,
211- type: " ByteParsingMacro " ,
211+ type: " EmptyPeerMacro " ,
212212)
213213
214214/// Parses all remaining bytes with a specific endianness.
@@ -235,7 +235,7 @@ public macro parseRest() = #externalMacro(
235235@attached ( peer)
236236public macro parseRest( endianness: Endianness ) = #externalMacro(
237237 module: " BinaryParseKitMacros " ,
238- type: " ByteParsingMacro " ,
238+ type: " EmptyPeerMacro " ,
239239)
240240
241241// MARK: - Struct Parsing
@@ -278,3 +278,55 @@ public macro ParseStruct() = #externalMacro(
278278 module: " BinaryParseKitMacros " ,
279279 type: " ConstructStructParseMacro " ,
280280)
281+
282+ // MARK: - Parse Enum
283+
284+ @attached ( extension, conformances: BinaryParseKit . Parsable, names: arbitrary)
285+ public macro ParseEnum( ) = #externalMacro(
286+ module: " BinaryParseKitMacros " ,
287+ type: " ConstructEnumParseMacro " ,
288+ )
289+
290+ // MARK: - Enum Case Parsing
291+
292+ @attached ( peer)
293+ public macro match( ) = #externalMacro(
294+ module: " BinaryParseKitMacros " ,
295+ type: " EmptyPeerMacro " ,
296+ )
297+
298+ @attached ( peer)
299+ public macro match( byte: UInt8 ) = #externalMacro(
300+ module: " BinaryParseKitMacros " ,
301+ type: " EmptyPeerMacro " ,
302+ )
303+
304+ @attached ( peer)
305+ public macro match( bytes: [ UInt8 ] ) = #externalMacro(
306+ module: " BinaryParseKitMacros " ,
307+ type: " EmptyPeerMacro " ,
308+ )
309+
310+ @attached ( peer)
311+ public macro matchAndTake( ) = #externalMacro(
312+ module: " BinaryParseKitMacros " ,
313+ type: " EmptyPeerMacro " ,
314+ )
315+
316+ @attached ( peer)
317+ public macro matchAndTake( byte: UInt8 ) = #externalMacro(
318+ module: " BinaryParseKitMacros " ,
319+ type: " EmptyPeerMacro " ,
320+ )
321+
322+ @attached ( peer)
323+ public macro matchAndTake( bytes: [ UInt8 ] ) = #externalMacro(
324+ module: " BinaryParseKitMacros " ,
325+ type: " EmptyPeerMacro " ,
326+ )
327+
328+ @attached ( peer)
329+ public macro matchDefault( ) = #externalMacro(
330+ module: " BinaryParseKitMacros " ,
331+ type: " EmptyPeerMacro " ,
332+ )
0 commit comments