File: errors.sed

package info (click to toggle)
grcompiler 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,076 kB
  • sloc: cpp: 48,200; ansic: 7,669; sh: 4,427; makefile: 198; xml: 190; perl: 127; sed: 21
file content (36 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (4)
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
#!/bin/sed -rf

# Dump comments
\%//% d

# Single line invocations of Add{Error,Warning}
/g_errorList.Add\w+\([^)]+\)/ b munge

# Multiline invocations of the same
/g_errorList.Add\w+\(/,/\)/ {
    H
    d
}

# Everything not a multiline invocation
//,// ! {
    g
    /^$/ d          # If no multiline waiting in hold buffer delete
    s/\s*\n\s*/ /g
    x;z;x           # Clear hold buffer
    b munge
}

# Extract parameters of interest
:munge
s/(\s+,|,\s+)/,/g
s/","/ /g
s/.*Add(\w+)\(([[:digit:]]+),[^,]+,(.+)\).*/\1\t\2\t\3/

# Remove any remining lines
/g_errorList/ d

# Fixup strings
:polish
s/",/" + /g
s/,"/ + "/g