Basename stem (no directory, no extension) of a path, into an arena string. * A Chialisp `(mod ...)` has no name of its own — the file IS the puzzle — so * the module entry point is named after the file that holds it. */
| 11903 | * A Chialisp `(mod ...)` has no name of its own — the file IS the puzzle — so |
| 11904 | * the module entry point is named after the file that holds it. */ |
| 11905 | static char *lisp_path_stem(CBMArena *a, const char *path) { |
| 11906 | if (!path) { |
| 11907 | return NULL; |
| 11908 | } |
| 11909 | const char *slash = strrchr(path, '/'); |
| 11910 | const char *base = slash ? slash + SKIP_CHAR : path; |
| 11911 | const char *dot = strrchr(base, '.'); |
| 11912 | size_t len = (dot && dot != base) ? (size_t)(dot - base) : strlen(base); |
| 11913 | return cbm_arena_strndup(a, base, len); |
| 11914 | } |
| 11915 | |
| 11916 | static void extract_lisp_def(CBMExtractCtx *ctx, TSNode node) { |
| 11917 | CBMArena *a = ctx->arena; |
no test coverage detected