1 using System.Net.Http;
2 using HttpTokens;
3
4 parser HttpHeaderParser
5 {
6 uselexer HttpLexer;
7 main;
8
9 using Http.text;
10 using Http.chr;
11 using Http.ctl;
12 using Http.tspecial;
13 using Http.ctext;
14 using Http.token;
15 using Http.lws;
16
17 message_header : HttpHeader
18 ::= (field_name:fn COLON field_value:fv?){ return HttpHeader(fn, fv); }
19 ;
20
21 field_name : string
22 ::= token:tk{ return tk; }
23 ;
24
25 field_value(var string s) : string
26 ::= ((lws:lws1{ s.Append(' '); } | field_content:fc{ s.Append(fc); })+){ return s; }
27 ;
28
29 field_content(var string s) : string
30 ::= ((text:t{ s.Append(t); })+){ return s; }
31 ;
32 }