Skip to content

Commit 70b3442

Browse files
author
Brenton Bostick
committed
Rename Format -> CodeFormatter
1 parent 691c5da commit 70b3442

17 files changed

Lines changed: 3621 additions & 22238 deletions

.WolframResources

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Resources[
22
Version[1],
3-
ExecutionBuildCommand["<<Format`"],
3+
ExecutionBuildCommand["<<CodeFormatter`"],
44
Paclet[
5-
PacletFolder["Format"],
5+
PacletFolder["CodeFormatter"],
66
FunctionPaclet[False]
77
]
88
]

.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>Format</name>
3+
<name>CodeFormatter</name>
44
<comment></comment>
55
<projects>
66
</projects>

CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

22
cmake_minimum_required(VERSION 3.0)
33

4-
project(format)
4+
project(codeformatter)
55

66
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
7+
include(WolframKernel)
78

8-
set(PACLET "Format")
9-
set(WOLFRAMKERNEL /Applications/Mathematica.app/Contents/MacOS/WolframKernel CACHE FILEPATH "Path to WolframKernel")
9+
set(PACLET "CodeFormatter")
10+
set(WOLFRAMKERNEL ${WOLFRAMKERNEL_DEFAULT} CACHE FILEPATH "Path to WolframKernel")
1011
set(BUILD_DOCS OFF CACHE BOOL "Build documentation")
1112
set(LOCAL_BUILD OFF CACHE BOOL "Local build")
1213

@@ -16,17 +17,17 @@ message(STATUS "BUILD_DOCS: ${BUILD_DOCS}")
1617
message(STATUS "LOCAL_BUILD: ${LOCAL_BUILD}")
1718

1819
set(WL_PACLET_SOURCES
19-
${CMAKE_SOURCE_DIR}/Format/Kernel/AggregateRules.wl
20-
${CMAKE_SOURCE_DIR}/Format/Kernel/Format.wl
21-
${CMAKE_SOURCE_DIR}/Format/Kernel/Utils.wl
20+
${CMAKE_SOURCE_DIR}/CodeFormatter/Kernel/AggregateRules.wl
21+
${CMAKE_SOURCE_DIR}/CodeFormatter/Kernel/CodeFormatter.wl
22+
${CMAKE_SOURCE_DIR}/CodeFormatter/Kernel/Utils.wl
2223
)
2324

2425
set(WL_GENERATE_PACKPACLET_SOURCES
25-
${CMAKE_SOURCE_DIR}/Format/Generate/PackPaclet.wl
26+
${CMAKE_SOURCE_DIR}/CodeFormatter/Generate/PackPaclet.wl
2627
)
2728

2829
set(PACLETINFO_SOURCE
29-
${CMAKE_SOURCE_DIR}/Format/PacletInfo.m
30+
${CMAKE_SOURCE_DIR}/CodeFormatter/PacletInfo.m
3031
)
3132

3233
set(DOCUMENTATION_NOTEBOOK_PATHS
@@ -48,7 +49,6 @@ endforeach()
4849
#
4950
# Set VERSION_NUMBER, SYSTEMID, and PACLET_VERSION
5051
#
51-
include(WolframKernel)
5252
CheckWolframKernel()
5353

5454

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BeginPackage["Format`Generate`PackPaclet`"]
1+
BeginPackage["CodeFormatter`Generate`PackPaclet`"]
22

33
Begin["`Private`"]
44

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
BeginPackage["Format`AggregateRules`"]
1+
BeginPackage["CodeFormatter`AggregateRules`"]
22

33
$DefaultAggregateRules
44

55

66
Begin["`Private`"]
77

8-
Needs["Format`"]
9-
Needs["AST`Utils`"]
10-
Needs["AST`"]
8+
Needs["CodeFormatter`"]
9+
Needs["CodeParser`Utils`"]
10+
Needs["CodeParser`"]
1111

1212

1313

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
BeginPackage["Format`"]
1+
BeginPackage["CodeFormatter`"]
22

33
(*
44
Functions
55
*)
6-
FormatFile
7-
8-
FormatString
9-
10-
FormatBytes
6+
CodeFormat
117

128

139
(*
@@ -22,12 +18,12 @@ CodeTextAction
2218

2319
Begin["`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

7470
formatFile[File[file_String], opts:OptionsPattern[]] :=
7571
Catch[
@@ -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

214198
formatString[strIn_String, opts:OptionsPattern[]] :=
215199
Module[{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

325297
formatBytes[bytesIn_List, opts:OptionsPattern[]] :=
326298
Catch[
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BeginPackage["Format`Utils`"]
1+
BeginPackage["CodeFormatter`Utils`"]
22

33
SourceTake
44

@@ -8,9 +8,9 @@ shadows
88

99
Begin["`Private`"]
1010

11-
Needs["Format`"]
12-
Needs["AST`"]
13-
Needs["AST`Utils`"]
11+
Needs["CodeFormatter`"]
12+
Needs["CodeParser`"]
13+
Needs["CodeParser`Utils`"]
1414

1515

1616
(*
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
Paclet[
3-
Name -> "Format",
4-
Version -> "0.16",
3+
Name -> "CodeFormatter",
4+
Version -> "1.0",
55
WolframVersion -> "11.0+",
66
Creator -> "Brenton Bostick <brenton@wolfram.com>",
77
Extensions -> {
8-
{"Kernel", Root -> "Kernel", Context -> "Format`"},
8+
{"Kernel", Root -> "Kernel", Context -> "CodeFormatter`"},
99
{"Documentation", Language -> "English"}
1010
}
1111
]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# CodeFormatter

Tests/Format.mt renamed to Tests/CodeFormatter.mt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(* Wolfram Language Test file *)
22

3-
Needs["Format`"]
3+
Needs["CodeFormatter`"]
44

55

66

0 commit comments

Comments
 (0)