From 986616c4586148ee7834b3bc9dbcd25559cc1a20 Mon Sep 17 00:00:00 2001 From: 0xBora <133051383+0xBora@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:13:30 +0100 Subject: [PATCH 1/2] update aiken language definition in prism --- src/aiken.prism.lang.js | 93 ++++++++++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 24 deletions(-) diff --git a/src/aiken.prism.lang.js b/src/aiken.prism.lang.js index 2e2fcdff65..5221e4983c 100644 --- a/src/aiken.prism.lang.js +++ b/src/aiken.prism.lang.js @@ -1,26 +1,71 @@ +/** + * Prism language definition for Aiken + * Converted from aiken.tmLanguage.json (https://github.com/aiken-lang/site/blob/main/aiken.tmLanguage.json) + */ + Prism.languages.aiken = { - 'string': /".*"/, - 'comment': /\/\/.*/, - 'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i, - 'boolean': /\btrue|false\b/, - 'class-name': /\b[A-Z]\w*\b/, - 'punctuation': /\./, - 'function-definition': { - pattern: /\b(fn|test\s)[^(]*/, - alias: 'function', - lookbehind: true - }, - 'variable': { - pattern: /\b(let\s)[^=]*/, - lookbehind: true - }, - 'keyword': /\b(if|else|fn|let|when|is|use|pub|type|opaque|const|todo|assert|check|test)\b/, - 'operator': [ - /&&|\\|\|/, - /\+|\-|\/|\*|%/, - /<=|>=|==|!=|<|>/, - /\.\./, - /\|>/, - /->/ - ] + // Comments (single-line only) + 'comment': { + pattern: /\/\/.*/, + greedy: true + }, + + // Strings (double-quoted with escape sequences) + 'string': { + pattern: /"(?:\\.|[^"\\])*"/, + greedy: true + }, + + // Booleans (must come before class-name to take precedence) + 'boolean': /\b(?:True|False)\b/, + + // Numbers + 'number': [ + // Binary + /\b0b[01]+\b/, + // Octal + /\b0o[0-7]+\b/, + // Hexadecimal + /\b0x[\da-fA-F]+\b/, + // Decimal (with optional decimal point) + /\b\d[\d_]*(?:\.\d*)?\b/ + ], + + // Keywords + 'keyword': /\b(?:if|else|when|is|fn|use|let|pub|type|opaque|const|todo|expect|test|bench|trace|fail|validator|and|or|as|via)\b/, + + // Type names (PascalCase identifiers) + 'class-name': /\b[A-Z][a-zA-Z0-9_]*\b/, + + // Function calls + 'function': /\b[a-z][a-zA-Z0-9_]*(?=\s*\()/, + + // Namespace/module prefix (e.g., `module:`) + 'namespace': /\b[a-z][a-zA-Z0-9_]*(?=:)/, + + // Operators + 'operator': [ + // Arrow operators + /->|<-/, + // Pipe operator + /\|>/, + // Spread/splat + /\.\./, + // Comparison + /<=|>=|==|!=|<|>/, + // Logical + /&&|\|\|/, + // Arithmetic + /[+\-*/%]/, + // Assignment + /=/, + // Pipe/union + /\|/ + ], + + // Punctuation + 'punctuation': /[{}[\](),.:]/ }; + +// Aliases +Prism.languages.ak = Prism.languages.aiken; From 5eaa673051d7e1f59aeb0a138c1a1aa7226f816b Mon Sep 17 00:00:00 2001 From: 0xBora <133051383+0xBora@users.noreply.github.com> Date: Thu, 11 Dec 2025 14:06:00 +0300 Subject: [PATCH 2/2] enable light code blocks --- docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index a19c12b454..9c19226e91 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -45,7 +45,7 @@ module.exports = { // Additional Language Syntax Highlighting prism: { - //theme: prismThemes.github, // uncomment for light mode in code boxes + theme: prismThemes.github, darkTheme: prismThemes.dracula, additionalLanguages: ['csharp', 'php', 'bash', 'json', 'typescript', 'yaml', 'diff'], },