Skip to content

Commit 73df5f0

Browse files
committed
Fable support
1 parent 9619824 commit 73df5f0

File tree

95 files changed

+7892
-3615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7892
-3615
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ artifacts/*.nupkg
191191
*.orig
192192
*.mdf
193193
*.ldf
194-
.paket/paket.exe
194+
fcs/.paket/paket.exe
195195
paket-files
196196
docsrc/tools/FSharp.Formatting.svclog
197197
src/fsharp/FSharp.Compiler.Service/pplex.fs
@@ -201,6 +201,7 @@ src/fsharp/FSharp.Compiler.Service/pppars.fsi
201201
*.cto
202202
*.vstman
203203
project.lock.json
204+
.vscode
204205

205206
src/fsharp/FSharp.Compiler.Service/FSComp.fs
206207
src/fsharp/FSharp.Compiler.Service/FSComp.resx

fcs/build.fsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ Target "BuildVersion" (fun _ ->
8080
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
8181
)
8282

83+
Target "BuildTools" (fun _ ->
84+
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
85+
)
86+
8387
Target "Build" (fun _ ->
8488
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
8589
runDotnet __SOURCE_DIRECTORY__ "build FSharp.Compiler.Service.sln -v n -c release"
@@ -98,6 +102,25 @@ Target "NuGet" (fun _ ->
98102
runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c release"
99103
)
100104

105+
Target "CodeGen.Fable" (fun _ ->
106+
let outDir = __SOURCE_DIRECTORY__ + "/fcs-fable/codegen/"
107+
108+
// run FCS codegen (except that fssrgen runs without .resx output to inline it)
109+
runDotnet outDir "run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
110+
runDotnet outDir "run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
111+
112+
// Fable-specific (comment the #line directive as it is not supported)
113+
["lex.fs"; "pplex.fs"; "illex.fs"; "ilpars.fs"; "pars.fs"; "pppars.fs"]
114+
|> Seq.map (fun fileName -> outDir + fileName)
115+
|> RegexReplaceInFilesWithEncoding @"(?<!/)# (?=\d)" "//# " Text.Encoding.UTF8
116+
117+
// prevent stack overflows on large files (make lexer rules inline)
118+
let pattern = @"(?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
119+
["lex.fs"; "pplex.fs"; "illex.fs"]
120+
|> Seq.map (fun fileName -> outDir + fileName)
121+
|> RegexReplaceInFilesWithEncoding pattern @"inline $0" Text.Encoding.UTF8
122+
)
123+
101124
Target "GenerateDocsEn" (fun _ ->
102125
executeFSIWithArgs "docsrc/tools" "generate.fsx" [] [] |> ignore
103126
)
@@ -125,6 +148,10 @@ Target "Release" DoNothing
125148
Target "GenerateDocs" DoNothing
126149
Target "TestAndNuGet" DoNothing
127150

151+
"Clean"
152+
==> "BuildTools"
153+
==> "CodeGen.Fable"
154+
128155
"Start"
129156
=?> ("BuildVersion", isAppVeyorBuild)
130157
==> "Restore"

fcs/fcs-fable/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Codegen
2+
codegen/*.fs
3+
codegen/*.fsi

0 commit comments

Comments
 (0)