1 using System.Net.Http;
2 using HttpTokens;
3
4 parser HttpChunkHeaderParser
5 {
6 uselexer HttpLexer;
7 main;
8
9 using Http.token;
10 using Http.quoted_string;
11
12 ChunkHeader(var string s, ulong* chunkSize, ChunkExtensionAdder* adder)
13 ::= ((DIGIT{ s.Append(lexer.GetChar(pos)); } | HEX{ s.Append(lexer.GetChar(pos)); })+){ *chunkSize = ParseHexULong(s); } ChunkExtensions(adder):cexts?
14 ;
15
16 ChunkExtensions(ChunkExtensionAdder* adder)
17 ::= (SEMICOLON (ChunkExtName:cn ('=' ChunkExtVal:cv)?){ adder->AddChunkExtension(cn, cv); })*
18 ;
19
20 ChunkExtName : string
21 ::= token:t{ return t; }
22 ;
23
24 ChunkExtVal : string
25 ::= token:t{ return t; } | quoted_string:qs{ return qs; }
26 ;
27 }