Skip to content

Commit 099be25

Browse files
committed
Fable support
1 parent 7a49017 commit 099be25

File tree

95 files changed

+7892
-3614
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
-3614
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
@@ -87,6 +87,10 @@ Target "BuildVersion" (fun _ ->
8787
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
8888
)
8989

90+
Target "BuildTools" (fun _ ->
91+
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
92+
)
93+
9094
Target "Build" (fun _ ->
9195
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
9296
runDotnet __SOURCE_DIRECTORY__ "build FSharp.Compiler.Service.sln -v n -c release"
@@ -105,6 +109,25 @@ Target "NuGet" (fun _ ->
105109
runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c release"
106110
)
107111

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

158+
"Clean"
159+
==> "BuildTools"
160+
==> "CodeGen.Fable"
161+
135162
"Start"
136163
=?> ("BuildVersion", isAppVeyorBuild)
137164
==> "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)