summaryrefslogtreecommitdiff
path: root/ppc.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-06-04 20:45:08 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-06-04 20:45:08 +0200
commit9ccb3fce8e390f09fa5b812a77f7a65c10c5e4b1 (patch)
treebdbbce79c18fdb2e68592ed828f43da0b03ecf8f /ppc.fun
parent546a5861526192a908f2aa2bfc3cfe4f3f3baf43 (diff)
Registration of declarations
Diffstat (limited to 'ppc.fun')
-rw-r--r--ppc.fun15
1 files changed, 9 insertions, 6 deletions
diff --git a/ppc.fun b/ppc.fun
index 27edf9a..65c1a27 100644
--- a/ppc.fun
+++ b/ppc.fun
@@ -255,8 +255,9 @@ struct
fun handleMacroEnd id ppc =
let
- val f = fn (_, pos, macro) => (SOME (false, pos, macro), ())
- val ((), tree) = macrosLookup (#macros ppc) id (f, ())
+ fun f NONE = (raise Unreachable, NONE)
+ | f (SOME (_, pos, macro)) = ((), SOME (false, pos, macro))
+ val ((), tree) = macrosLookup (#macros ppc) id f
in
updatePpc ppc s#macros tree %
end
@@ -923,10 +924,12 @@ struct
and handleRegularToken tk pos ppc =
let
- fun checkAndMark (true, _, _) = (NONE, NONE)
- | checkAndMark (false, pos, macro) =
- (SOME (true, pos, macro), SOME macro)
- fun getMacro tree id = macrosLookup tree id (checkAndMark, NONE)
+ fun checkAndMark NONE = (NONE, NONE)
+ | checkAndMark (SOME (true, _, _)) = (NONE, NONE)
+ | checkAndMark (SOME (false, pos, macro)) =
+ (SOME macro, SOME (true, pos, macro))
+
+ fun getMacro tree id = macrosLookup tree id checkAndMark
fun def () = (tk, pos, ppc)
fun handleMacro id =