@@ -11,29 +11,30 @@ function cb_jpaths (ary, size, i) {
11
11
12
12
# Print ary - array of size jpaths.
13
13
for (i= 1 ; i <= size; i++ ) {
14
- print " callback " , ary[ i]
14
+ print " cb_jpaths " , ary[ i]
15
15
}
16
16
}
17
17
18
- # cb_fails - call back for processing errors after parsing has completed
19
- # Called in JSON.awk's END action when STREAM=0 only.
18
+ # cb_fails - call back for processing all error messages at once after parsing
19
+ # has completed. Called in JSON.awk's END action when STREAM=0 only.
20
20
# This example illustrates printing parsing errors to stdout,
21
21
function cb_fails (ary, size, k) {
22
22
23
23
# Print ary - associative array of parsing failures.
24
24
# ary's keys are the size input file names that JSON.awk read.
25
25
for (k in ary) {
26
- print " callback : invalid input file:" , k
26
+ print " cb_fails : invalid input file:" , k
27
27
print FAILS[ k]
28
28
}
29
29
}
30
30
31
- # cb_fail1 - call back for processing a parse error immediately
32
- # Called in JSON.awk's main loop when STREAM=0 only.
33
- # This example illustrates printing the error message to stdout.
34
- function cb_fails1 (message) {
31
+ # cb_fail1 - call back for processing a single parse error as soon as it is
32
+ # encountered. Called in JSON.awk's main loop when STREAM=0 only.
33
+ # Return non-zero to let JSON.awk also print the message to stderr.
34
+ # This example illustrates printing the error message to stdout only.
35
+ function cb_fail1 (message) {
35
36
36
- print " callback : invalid input file:" , FILENAME
37
+ print " cb_fail1 : invalid input file:" , FILENAME
37
38
print message
38
39
}
39
40
0 commit comments