summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:12:24 +0100
committerGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:12:24 +0100
commit028f15cce127360f29afa41754aab3816718492f (patch)
tree16f3c5463b3b3e07dff6d62bb742df3988025f53
parentd7ca451f01595ced7cfe70f43714ac2a1150915d (diff)
Fixed smaller review remarks
-rw-r--r--src/getinfo.sml8
-rw-r--r--src/lspspec.sml4
2 files changed, 5 insertions, 7 deletions
diff --git a/src/getinfo.sml b/src/getinfo.sml
index d84f792b..5a0fe752 100644
--- a/src/getinfo.sml
+++ b/src/getinfo.sml
@@ -37,7 +37,7 @@ fun isPosIn (file: string) (row: int) (col: int) (span: ErrorMsg.span) =
val start = #first span
val end_ = #last span
in
- String.isSuffix file (#file span)
+ OS.Path.base file = OS.Path.base (#file span)
andalso
(#line start < row orelse
#line start = row andalso #char start <= col)
@@ -281,7 +281,7 @@ fun getInfo env str fileName {line = row, character = col} =
let
val distanceFromRow = Int.abs (#line (#first (#2 (#3 decl))) - row)
val accDistanceFromRow = case accO of
- NONE => 999
+ NONE => Option.getOpt (Int.maxInt, 99999)
| SOME acc => Int.abs (#line (#first (#2 (#3 acc))) - row)
in
if distanceFromRow < accDistanceFromRow andalso distanceFromRow <= 1
@@ -368,10 +368,10 @@ fun getInfo env str fileName {line = row, character = col} =
{ smallestgoodpart = NONE
, smallest = { item = Str (str, { file = fileName
, first = { line = 0, char = 0}
- , last = { line = 99999, char = 0} })
+ , last = { line = Option.getOpt (Int.maxInt, 99999), char = 0} })
, span = { file = fileName
, first = { line = 0, char = 0}
- , last = { line = 99999, char = 0} }
+ , last = { line = Option.getOpt (Int.maxInt, 99999), char = 0} }
, env = env }
}
( L.DStr (Compiler.moduleOf "fileName", 0, (L.SgnError, ErrorMsg.dummySpan), (str, {file = fileName, first = ErrorMsg.dummyPos, last = ErrorMsg.dummyPos}))
diff --git a/src/lspspec.sml b/src/lspspec.sml
index bbc78606..0d766056 100644
--- a/src/lspspec.sml
+++ b/src/lspspec.sml
@@ -8,9 +8,7 @@ structure LspSpec = struct
(TextIO.output (TextIO.stdErr, str ^ "\n\n"); TextIO.flushOut TextIO.stdErr)
fun trim (s: substring): substring =
- Substring.dropr
- (fn c => c = #" " orelse c = #"\n" orelse c = #"\r")
- (Substring.dropl (fn c => c = #" " orelse c = #"\n" orelse c = #"\r") s)
+ Substring.dropr Char.isSpace (Substring.dropl Char.isSpace s)
fun readHeader (): (string * string) option =
let