File: awk

package info (click to toggle)
dte 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,152 kB
  • sloc: ansic: 28,421; sh: 94; awk: 56; makefile: 13; sed: 1
file content (101 lines) | stat: -rw-r--r-- 2,053 bytes parent folder | download | duplicates (2)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Escapes common to string and regexp
syntax .awk-esc

state special
    char 0-3 oct1
    char 4-7 oct2
    char x hex0
    # Anything but \n
    char -n "\n" END error
    # Don't eat \n
    noeat END

state oct1 special
    char 0-7 oct2
    noeat END

state oct2 special
    char 0-7 END special
    noeat END

state hex0 special
    char 0-9a-fA-F hex1
    noeat END

state hex1 special
    char 0-9a-fA-F hex2
    noeat END

# "\xaff" is an error but "\xafg" is not
state hex2 special
    char 0-9a-fA-F END error
    noeat END

syntax awk

state code
    char \" string
    char / regexp
    char # comment
    char -b a-zA-Z_ ident
    eat this

state string
    char \\ dqescape
    char \" code string
    # Avoid highlighting rest of the file again
    char "\n" code
    eat this

state regexp
    char \\ regexpescape
    char / code regexp
    # Avoid highlighting rest of the file again
    char "\n" code
    eat this

state dqescape special
    char abfnrtv\\\" string special
    noeat .awk-esc:string

state regexpescape special
    char abfnrtv.[({*+?|^/\\\$ regexp special
    noeat .awk-esc:regexp

state comment
    char "\n" code
    eat this

state ident
    char -b a-zA-Z0-9_ this
    inlist keyword code
    inlist builtin code
    inlist pattern code
    inlist variable code
    noeat code

# gawk reserved words are separated by an empty line

list keyword \
    break continue delete do else exit for function getline if next \
    print printf return while \
\
    func nextfile

list builtin \
    atan2 close cos exp fflush gsub index int length log match rand sin \
    split sprintf sqrt srand sub substr system \
\
    and asort bindtextdomain compl dcgettext gensub lshift mktime or \
    rshift strftime strtonum systime tolower toupper xor

list pattern BEGIN END

list variable \
    ARGC ARGV FILENAME FNR FS NF NR OFMT OFS ORS RLENGTH RS RSTART SUBSEP \
\
    ARGIND BINMODE CONVFMT ENVIRON ERRNO FIELDWIDTHS IGNORECASE LINT \
    PROCINFO RLENGTH RT TEXTDOMAIN

default string regexp
default keyword pattern