From 9ccb3fce8e390f09fa5b812a77f7a65c10c5e4b1 Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Wed, 4 Jun 2025 20:45:08 +0200 Subject: Registration of declarations --- ppc.fun | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ppc.fun') 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 = -- cgit v1.2.3