Skip to content

Commit

Permalink
Attempt MacOS compatibility fix for old awk versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
step- committed Aug 7, 2020
1 parent 03395ad commit 7550234
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion JSON.awk
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function tokenize(a1, pq,pb,ESCAPE,CHAR,STRING,NUMBER,KEYWORD,SPACE) { #{{{1
# KEYWORD="null|false|true"
SPACE="[[:space:]]+"
# ^BOM "|" STRING "|" NUMBER "|" KEYWORD "|" SPACE "|."
gsub(/(^\xEF\xBB\xBF)|\"[^[:cntrl:]\"\\]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^[:cntrl:]\"\\]*)*\"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
gsub(/(^\xEF\xBB\xBF)|\"[^\"\\[:cntrl:]]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^\"\\[:cntrl:]]*)*\"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
gsub("\n" SPACE, "\n", a1)
# ^\n BOM?
sub(/^\n(\xEF\xBB\xBF\n)?/, "", a1)
Expand Down

0 comments on commit 7550234

Please sign in to comment.