1 using System.Net.Http;
2 using HttpTokens;
3
4 parser HttpFieldValueParser
5 {
6 uselexer HttpLexer;
7 main;
8
9 using Http.token;
10 using Http.attribute;
11 using Http.attrval;
12 using Http.lws;
13
14 CommaSeparatedFieldValue(List<HttpFieldValue>* values)
15 ::= GeneralFieldValue(values):gfv1 (lws:lws1? COMMA lws:lws2? GeneralFieldValue(values):gfv2)*
16 ;
17
18 GeneralFieldValue(List<HttpFieldValue>* values, var HttpFieldValue fieldValue)
19 ::= (token:t{ fieldValue.SetFieldValue(t); } (SEMICOLON lws:lws1? GeneralParameter(&fieldValue):gp)*){ values->Add(fieldValue); }
20 ;
21
22 GeneralParameter(HttpFieldValue* fieldValue)
23 ::= (attribute:a (EQ attrval:av)?){ fieldValue->SetParameter(a, av); }
24 ;
25 }