File: sdp_parser.jspeg

package info (click to toggle)
cloc 2.06-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,064 kB
  • sloc: perl: 30,146; cpp: 1,219; python: 623; ansic: 334; asm: 267; makefile: 244; sh: 186; sql: 144; java: 136; ruby: 111; cs: 104; pascal: 52; lisp: 50; haskell: 35; f90: 35; cobol: 35; objc: 25; php: 22; javascript: 15; fortran: 9; ml: 8; xml: 7; tcl: 2
file content (55 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Exerpt from
  https://github.com/StoneCypher/short_offer/raw/main/src/peg/sdp_parser.pegjs
*/
{



  function not_null(n) {
    return n === null? '' : n;
  }



  function ast(kind, value) {

    const uses_short_nl = false; // todo

    let retval = {
      kind,
      value,
      uses_short_nl,
      loc: location()
    };

    if (kind === 'standard_moz_origin') {
      retval.moz_ver = value[0].value;
      retval.sess    = value[1];
      value          = '';
    }

    if (['standard_origin',
         'standard_local_candidate',
         'standard_guid_local_candidate',
         'standard_guid_local_candidate_ffus',
         'standard_remote_candidate',
         'standard_remote_candidate_ffus',
         'standard_agen_tcp_candidate',
         'standard_agen_tcp6_candidate',
         'standard_agen_udp4_candidate',
         'standard_agen_udp6_host_candidate'
        ].includes(kind)) {
      retval.items = value;
      retval.value = '';
    }

    return retval;

  }



}

// truncated