summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:11:45 +0100
committerGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:11:45 +0100
commitd7ca451f01595ced7cfe70f43714ac2a1150915d (patch)
tree08b9afdfeedc319500a85398e9f41c2d21830239
parent7ebc4f3ff8081424f0e227142ac76bb3f7fc4a20 (diff)
Allow simple .ur files to double as .urs files for LSP
-rw-r--r--src/lsp.sml22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/lsp.sml b/src/lsp.sml
index d11aab3f..856b7ab8 100644
--- a/src/lsp.sml
+++ b/src/lsp.sml
@@ -180,18 +180,16 @@ fun elabFile (state: state) (fileName: string): ({ decls: Elab.decl list, envBef
else raise LspSpec.LspError (LspSpec.InternalError ("Couldn't find file " ^ fileName ^ " referenced in .urp file at " ^ (#urpPath state)))
(* Parsing .urs files of previous modules *)
val parsedUrss = List.map (fn entry =>
- let
- val fileName = entry ^ ".urs"
- in
- { fileName = fileName
- , parsed =
- if OS.FileSys.access (fileName, [])
- then case C.run (C.transform C.parseUrs "parseUrs") fileName of
- NONE => raise LspSpec.LspError (LspSpec.InternalError ("Failed to parse .urs file at " ^ fileName))
- | SOME a => a
- else raise LspSpec.LspError (LspSpec.InternalError ("Couldn't find an .urs file for " ^ fileName))
- }
- end)
+ if OS.FileSys.access (entry ^ ".urs", [])
+ then case C.run (C.transform C.parseUrs "parseUrs") (entry ^ ".urs") of
+ NONE => raise LspSpec.LspError (LspSpec.InternalError ("Failed to parse .urs file at " ^ entry))
+ | SOME a => { fileName = entry ^ ".urs", parsed = a}
+ else
+ if OS.FileSys.access (entry ^ ".ur", [])
+ then case C.run (C.transform C.parseUrs "parseUrs") (entry ^ ".ur") of
+ NONE => raise LspSpec.LspError (LspSpec.InternalError ("No .urs file found for " ^ entry ^ " and couldn't parse .ur as .urs file"))
+ | SOME a => { fileName = entry ^ ".ur" , parsed = a}
+ else raise LspSpec.LspError (LspSpec.InternalError ("Couldn't find an .ur or .urs file for " ^ entry)))
modulesBeforeThisFile
(* Parsing Basis and Top *)
val basisF = Settings.libFile "basis.urs"