diff options
author | Camil Staps | 2023-03-05 19:47:49 +0100 |
---|---|---|
committer | Camil Staps | 2023-03-05 19:47:49 +0100 |
commit | 4349838a315de8ac9ad51ca2e0fa6f80f24f9241 (patch) | |
tree | d030b1fee063cdef58c1e4cf294e3444f167e721 /snug-clean/src/Snug/Compile/ABI.icl | |
parent | Refactor, return MaybeError from lookupFunction and lookupConstructor (diff) |
Implement ap
Diffstat (limited to 'snug-clean/src/Snug/Compile/ABI.icl')
-rw-r--r-- | snug-clean/src/Snug/Compile/ABI.icl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/snug-clean/src/Snug/Compile/ABI.icl b/snug-clean/src/Snug/Compile/ABI.icl index 66a8d5c..225f09c 100644 --- a/snug-clean/src/Snug/Compile/ABI.icl +++ b/snug-clean/src/Snug/Compile/ABI.icl @@ -20,11 +20,15 @@ where e = case entry_point of NodeEntry -> 'n' +closureLabel :: !Namespace !SymbolIdent !Int -> Label +closureLabel ns id nargs = constructorLabel ns (concat3 id "@" (toString nargs)) + escapeLabel :: !String -> String escapeLabel s = {#c \\ c <- escape [c \\ c <-: s]} where escape [] = [] escape [c:cs] | isAlphanum c = [c:escape cs] + // Symbols allowed in snug but not in symbol names: escape ['_':cs] = ['__':escape cs] escape ['`':cs] = ['_B':escape cs] escape [':':cs] = ['_C':escape cs] @@ -36,3 +40,5 @@ where escape ['+':cs] = ['_P':escape cs] escape ['\'':cs] = ['_Q':escape cs] escape ['~':cs] = ['_T':escape cs] + // Symbols not allowed in snug but used internally: + escape ['@':cs] = ['_c':escape cs] // see closureLabel |