Debian Codegraph @

tests/inputs/sdp_parser.jspeg

raw
1 /*
2 Exerpt from
3 https://github.com/StoneCypher/short_offer/raw/main/src/peg/sdp_parser.pegjs
4 */
5 {
6
7
8
9 function not_null(n) {
10 return n === null? '' : n;
11 }
12
13
14
15 function ast(kind, value) {
16
17 const uses_short_nl = false; // todo
18
19 let retval = {
20 kind,
21 value,
22 uses_short_nl,
23 loc: location()
24 };
25
26 if (kind === 'standard_moz_origin') {
27 retval.moz_ver = value[0].value;
28 retval.sess = value[1];
29 value = '';
30 }
31
32 if (['standard_origin',
33 'standard_local_candidate',
34 'standard_guid_local_candidate',
35 'standard_guid_local_candidate_ffus',
36 'standard_remote_candidate',
37 'standard_remote_candidate_ffus',
38 'standard_agen_tcp_candidate',
39 'standard_agen_tcp6_candidate',
40 'standard_agen_udp4_candidate',
41 'standard_agen_udp6_host_candidate'
42 ].includes(kind)) {
43 retval.items = value;
44 retval.value = '';
45 }
46
47 return retval;
48
49 }
50
51
52
53 }
54
55 // truncated