tree-sitter-awk icon indicating copy to clipboard operation
tree-sitter-awk copied to clipboard

Add support for `@variable.builtin`

Open lmburns opened this issue 1 year ago • 1 comments

Detect things like the following as @variable.builtin:

ARGC
ARGV
CONVFMT
ENVIRON
FILENAME
FS
NF
NR
FNR
OFMT
OFS
ORS
RLENGTH
RS
RSTART
SUBSEP
$0
$1 .. $n

Also, GNU awk specific variables like:

ARGIND
BINMODE
ERRNO
FIELDWIDTHS
IGNORECASE
LINT
PROCINFO
TEXTDOMAIN

Edit: Could also add more builtin functions for @function.builtin. Right now, the only ones that I see that are detected as builtin are getline and printf().

Arithmetic

atan2(y, x)
cos(expr)
exp(expr)
int(expr)
log(expr)
rand()
sin(expr)
sqrt(expr)
srand([expr])

String

asort(arr [, d [, how] ])
asorti(arr [, d [, how] ])
gsub(regex, sub, string)
index(str, sub)
length(str)
match(str, regex)
split(str, arr, regex)
printf(format, expr-list)
strtonum(str)
sub(regex, sub, string)
substr(str, start, l)
tolower(str)
toupper(str)

Time

systime()
mktime(datespec)
strftime([format [, timestamp[, utc-flag]]])

Bit Manipulation

and(n1, n2)
compl(n)
lshift(n1, n)
rshift(n1, n)
or(n1, n2)
xor(n1, n2)

Miscellaneous

close(expr)
fflush([out-expr])
getline
nextfile
system(fn)

lmburns avatar Feb 15 '23 16:02 lmburns