github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/sql/parser/reserved_keywords.awk (about) 1 /^col_name_keyword:/ { 2 reserved_keyword = 1 3 next 4 } 5 6 /^type_func_name_(no_crdb_extra|crdb_extra)?_keyword:/ { 7 reserved_keyword = 1 8 next 9 } 10 11 /^(cockroachdb_extra_)?reserved_keyword:/ { 12 reserved_keyword = 1 13 next 14 } 15 16 /^$/ { 17 reserved_keyword = 0 18 } 19 20 BEGIN { 21 print "// Code generated by reserved_keywords.awk. DO NOT EDIT." 22 print "// GENERATED FILE DO NOT EDIT" 23 print 24 print "package lexbase" 25 print 26 print "var reservedKeywords = map[string]struct{}{" 27 28 # This variable will be associated with a pipe for intermediate output. 29 sort = "env LC_ALL=C sort" 30 } 31 32 { 33 if (reserved_keyword && $NF != "") { 34 printf("\"%s\": {},\n", tolower($NF)) | sort 35 } 36 } 37 38 END { 39 # Flush the intermediate output by closing the pipe. 40 close(sort) 41 print "}" 42 }