1- BeginPackage ["Format `" ]
1+ BeginPackage ["CodeFormatter `" ]
22
33(*
44Functions
55*)
6- FormatFile
7-
8- FormatString
9-
10- FormatBytes
6+ CodeFormat
117
128
139(*
@@ -22,12 +18,12 @@ CodeTextAction
2218
2319Begin ["`Private`" ]
2420
25- Needs ["Format `AggregateRules`" ]
26- Needs ["Format `Utils`" ]
27- Needs ["AST `" ]
28- Needs ["AST `Abstract`" ]
29- Needs ["AST `CodeAction`" ]
30- Needs ["AST `Utils`" ]
21+ Needs ["CodeFormatter `AggregateRules`" ]
22+ Needs ["CodeFormatter `Utils`" ]
23+ Needs ["CodeParser `" ]
24+ Needs ["CodeParser `Abstract`" ]
25+ Needs ["CodeParser `CodeAction`" ]
26+ Needs ["CodeParser `Utils`" ]
3127
3228
3329
@@ -51,25 +47,25 @@ $existsTest = Not @* KeyExistsQ[AirynessLevel]
5147
5248
5349
54- FormatFile ::usage = "FormatFile[file ] formats the WL input file ."
50+ CodeFormat ::usage = "CodeFormat[code ] formats the WL code ."
5551
56- FormatFile ::long = "File `1` is long. Formatting will be truncated."
52+ CodeFormat ::long = "File `1` is long. Formatting will be truncated."
5753
58- FormatFile ::longlines = "File `1` has long lines. Formatting will be truncated."
54+ CodeFormat ::longlines = "File `1` has long lines. Formatting will be truncated."
5955
60- Options [FormatFile ] = {
56+ Options [CodeFormat ] = {
6157 AirynessLevel :> $AirynessLevel ,
6258 "DryRun" -> False ,
6359 PerformanceGoal -> "Speed" ,
6460 "Tau" -> 2
6561}
6662
67- FormatFile [f :File [_ String ], opts :OptionsPattern []] :=
63+ CodeFormat [f :File [_ String ], opts :OptionsPattern []] :=
6864 formatFile [f , opts ]
6965
7066
7167
72- Options [formatFile ] = Options [FormatFile ]
68+ Options [formatFile ] = Options [CodeFormat ]
7369
7470formatFile [File [file_ String ], opts :OptionsPattern []] :=
7571Catch [
@@ -193,23 +189,11 @@ Module[{cst, cstAndIssues, issues, last, lastSrc, lastSrcLine, actions, str, byt
193189
194190
195191
196- FormatString ::usage = "FormatString[string] formats the WL input string."
197-
198- FormatString ::long = "String is long. Formatting will be truncated."
199-
200- FormatString ::longlines = "String has long lines. Formatting will be truncated."
201-
202- Options [FormatString ] = {
203- AirynessLevel :> $AirynessLevel ,
204- PerformanceGoal -> "Speed" ,
205- "Tau" -> 2
206- }
207-
208- FormatString [str_ String , opts :OptionsPattern []] :=
192+ CodeFormat [str_ String , opts :OptionsPattern []] :=
209193 formatString [str , opts ]
210194
211195
212- Options [formatString ] = Options [FormatString ]
196+ Options [formatString ] = Options [CodeFormat ]
213197
214198formatString [strIn_ String , opts :OptionsPattern []] :=
215199Module [{cst , cstAndIssues , issues , actions , str ,
@@ -304,23 +288,11 @@ Module[{cst, cstAndIssues, issues, actions, str,
304288
305289
306290
307- FormatBytes ::usage = "FormatBytes[bytes] formats the WL input bytes."
308-
309- FormatBytes ::long = "Bytes is long. Formatting will be truncated."
310-
311- FormatBytes ::longlines = "Bytes has long lines. Formatting will be truncated."
312-
313- Options [FormatBytes ] = {
314- AirynessLevel :> $AirynessLevel ,
315- PerformanceGoal -> "Speed" ,
316- "Tau" -> 2
317- }
318-
319- FormatBytes [bytes_ List , opts :OptionsPattern []] :=
291+ CodeFormat [bytes_ List , opts :OptionsPattern []] :=
320292 formatBytes [bytes , opts ]
321293
322294
323- Options [formatBytes ] = Options [FormatBytes ]
295+ Options [formatBytes ] = Options [CodeFormat ]
324296
325297formatBytes [bytesIn_ List , opts :OptionsPattern []] :=
326298Catch [
0 commit comments