summaryrefslogtreecommitdiff
path: root/stream.sml
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-05-17 14:45:50 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-05-17 14:45:50 +0200
commit5edd85474d6d8f3a0cc06cc0250ed3db8b26fcfa (patch)
treebd7ad914025858b4389b1801216ac7d41a0c1f45 /stream.sml
parent1f31e550385cfa64a36167a5f3f9ec780baaad86 (diff)
Function-like macros
Diffstat (limited to 'stream.sml')
-rw-r--r--stream.sml9
1 files changed, 5 insertions, 4 deletions
diff --git a/stream.sml b/stream.sml
index ff4a6ad..fd5932a 100644
--- a/stream.sml
+++ b/stream.sml
@@ -28,12 +28,13 @@ structure Stream :> STREAM = struct
end
z
- fun pos2str (Pos (pos, line, col)) =
+ val Ppos = fn z =>
let
- val % = Int.toString
+ fun p (out, Pos (fname, line, col)) =
+ Printf out `fname `":" I line `":" I col %
in
- pos ^ ":" ^ %line ^ ":" ^ %col
- end
+ bind A1 p
+ end z
fun getcharSure (S as { contents, off, ... }: t) =
(String.sub (contents, off), updateStream S s#off (off + 1) %)