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

Consistent errors formatting awk scripts on macos

Open Monty opened this issue 4 months ago • 1 comments

$ npm list [email protected] /Users/monty/prettier-plugin-awk-test ├── [email protected] └── [email protected]

/^Title/ {                                                                            
    printf ("%s\t%s\t%s\t%s\tAvg Len\t%s\t%s\t%s\t%s\t%s\n",                          
            $1,$2,$3,$4,$5,$6,$7,$8,$9)                                               
}                                                                                     
                                                                                      
/=HYPERLINK/ {                                                                        
    dur=$4                                                                            
    split (dur,fld," ")                                                               
    eplen = (fld[1]*60+fld[2])/$3                                                     
    printf ("%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\n",                               
            $1,$2,$3,$4,eplen,$5,$6,$7,$8,$9)                                         
} 

Other failing awk scripts at This repo

I consistently get these same errors

$ npx prettier --write test-01.awk [error] test-01.awk: Error: Document has syntax error [error] at printAwk (/Users/monty/prettier-plugin-awk-test/node_modules/prettier-plugin-awk/out/printer/printer.js:14:15) [error] at /Users/monty/prettier-plugin-awk-test/node_modules/prettier-plugin-awk/out/printer/wrappers.js:22:24 [error] at /Users/monty/prettier-plugin-awk-test/node_modules/prettier-plugin-awk/out/printer/wrappers.js:48:24 [error] at Object.print (/Users/monty/prettier-plugin-awk-test/node_modules/prettier-plugin-awk/out/printer/wrappers.js:70:24) [error] at callPluginPrintFunction (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:8601:26) [error] at mainPrintInternal (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:8550:22) [error] at mainPrint (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:8537:18) [error] at printAstToDoc (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:8529:18) [error] at coreFormat (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:8837:20) [error] at formatWithCursor2 (/Users/monty/prettier-plugin-awk-test/node_modules/prettier/index.js:9021:18)

Monty avatar Feb 15 '24 22:02 Monty