Skip to content

Commit 0792a6c

Browse files
committed
SDCC language tag for bot
1 parent 78a46b6 commit 0792a6c

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

apps/mastodon-bot/src/directives.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
// Hashtag directives a user can add to a toot to steer rendering.
22
const MACHINE_TAGS: Record<string, number> = { '128': 128, '48': 48 };
3-
const LANG_TAGS: Record<string, string> = { asm: 'asm', zxbasic: 'zxbasic' };
3+
// #c → z88dk C, #sdcc → SDCC; plus the assemblers and the alt BASIC. (Inline
4+
// source with no language tag defaults to Sinclair BASIC / zmakebas.)
5+
const LANG_TAGS: Record<string, string> = {
6+
asm: 'asm',
7+
zxbasic: 'zxbasic',
8+
c: 'c',
9+
sdcc: 'sdcc',
10+
zmac: 'zmac',
11+
bas2tap: 'bas2tap',
12+
};
413

514
export interface Directives {
615
machineType?: number; // from #128 / #48
@@ -12,10 +21,10 @@ export interface Directives {
1221
* Pull rendering directives out of plain-text toot content (the output of
1322
* htmlToBasic) and return the remaining source.
1423
*
15-
* Only the exact recognised tags (#128, #48, #asm, #zxbasic) are stripped;
16-
* every other `#token` is left in place — Sinclair BASIC uses # for stream
17-
* numbers (PRINT #2) and Boriel uses #include / #define, so blanket stripping
18-
* would corrupt valid programs.
24+
* Only the exact recognised tags (#128, #48, and the language tags below) are
25+
* stripped; every other `#token` is left in place — Sinclair BASIC uses # for
26+
* stream numbers (PRINT #2) and Boriel/C use #include / #define, so blanket
27+
* stripping would corrupt valid programs.
1928
*/
2029
export function parseDirectives(text: string): Directives {
2130
let machineType: number | undefined;

0 commit comments

Comments
 (0)