# configuration/constants/syntax.constants.ts

> 106 lines of code and 23 definitions.

Tree: Site tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/tree#file-configuration-constants-syntax-constants-ts
Source text: https://banes-lab.com/assets/sources/source.f1fe4fd50fae92f5f926b9674e4ff5fd35b4926f3931df7a446f5b38488bf403.generated.txt

## Definitions

- `SYNTAX_CLASS_PREFIX` (lexical_declaration, line 12, exported)
- `CODE_LINE_CLASS` (lexical_declaration, line 14, exported)
- `CODE_LINE_ATTRIBUTE` (lexical_declaration, line 16, exported)
- `CODE_LINE_MARKED_CLASS` (lexical_declaration, line 18, exported)
- `LETTERS` (lexical_declaration, line 20, exported)
- `DIGITS` (lexical_declaration, line 22, exported)
- `WORD_CHARS` (lexical_declaration, line 24, exported)
- `QUOTES` (lexical_declaration, line 26, exported)
- `ESCAPE` (lexical_declaration, line 28, exported)
- `LINE_BREAK` (lexical_declaration, line 30, exported)
- `ANGLE_OPEN` (lexical_declaration, line 32, exported)
- `ANGLE_CLOSE` (lexical_declaration, line 34, exported)
- `DOUBLE_SLASH` (lexical_declaration, line 36)
- `HASH` (lexical_declaration, line 38, exported)
- `DOUBLE_PERCENT` (lexical_declaration, line 40)
- `SCRIPT_KEYWORDS` (lexical_declaration, line 42)
- `MERMAID_KEYWORDS` (lexical_declaration, line 93)
- `JSON_KEYWORDS` (lexical_declaration, line 108)
- `KEYWORDS_BY_LANGUAGE` (lexical_declaration, line 110, exported)
- `LINE_COMMENT_BY_LANGUAGE` (lexical_declaration, line 118, exported)
- `HEADING_LANGUAGES` (lexical_declaration, line 125, exported)
- `NONTERMINAL_LANGUAGES` (lexical_declaration, line 127, exported)
- `SHOUT_LANGUAGES` (lexical_declaration, line 129, exported)

## Source

```typescript
import {
    BNF_LANGUAGE,
    JAVASCRIPT_LANGUAGE,
    JSON_LANGUAGE,
    MARKDOWN_LANGUAGE,
    MERMAID_LANGUAGE,
    PAG_LANGUAGE,
    TYPESCRIPT_LANGUAGE,
    YAML_LANGUAGE,
} from "#configuration/constants/code.constants";

export const SYNTAX_CLASS_PREFIX = "syntax-";

export const CODE_LINE_CLASS = "code-line";

export const CODE_LINE_ATTRIBUTE = "data-line";

export const CODE_LINE_MARKED_CLASS = "marked";

export const LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";

export const DIGITS = "0123456789";

export const WORD_CHARS = `${LETTERS + DIGITS}-`;

export const QUOTES = "\"'`";

export const ESCAPE = "\\";

export const LINE_BREAK = "\n";

export const ANGLE_OPEN = "<";

export const ANGLE_CLOSE = ">";

const DOUBLE_SLASH = "//";

export const HASH = "#";

const DOUBLE_PERCENT = "%%";

const SCRIPT_KEYWORDS = [
    "as",
    "async",
    "await",
    "break",
    "case",
    "catch",
    "class",
    "const",
    "continue",
    "default",
    "delete",
    "do",
    "else",
    "enum",
    "export",
    "extends",
    "false",
    "finally",
    "for",
    "from",
    "function",
    "if",
    "implements",
    "import",
    "in",
    "instanceof",
    "interface",
    "let",
    "new",
    "null",
    "of",
    "readonly",
    "return",
    "satisfies",
    "static",
    "super",
    "switch",
    "this",
    "throw",
    "true",
    "try",
    "type",
    "typeof",
    "undefined",
    "var",
    "void",
    "while",
    "yield",
];

const MERMAID_KEYWORDS = [
    "flowchart",
    "graph",
    "subgraph",
    "end",
    "direction",
    "TB",
    "LR",
    "RL",
    "BT",
    "classDef",
    "class",
    "style",
];

const JSON_KEYWORDS = ["true", "false", "null"];

export const KEYWORDS_BY_LANGUAGE: ReadonlyMap<string, ReadonlySet<string>> = new Map([
    [TYPESCRIPT_LANGUAGE, new Set(SCRIPT_KEYWORDS)],
    [JAVASCRIPT_LANGUAGE, new Set(SCRIPT_KEYWORDS)],
    [MERMAID_LANGUAGE, new Set(MERMAID_KEYWORDS)],
    [JSON_LANGUAGE, new Set(JSON_KEYWORDS)],
    [YAML_LANGUAGE, new Set(JSON_KEYWORDS)],
]);

export const LINE_COMMENT_BY_LANGUAGE: ReadonlyMap<string, string> = new Map([
    [TYPESCRIPT_LANGUAGE, DOUBLE_SLASH],
    [JAVASCRIPT_LANGUAGE, DOUBLE_SLASH],
    [YAML_LANGUAGE, HASH],
    [MERMAID_LANGUAGE, DOUBLE_PERCENT],
]);

export const HEADING_LANGUAGES: ReadonlySet<string> = new Set([MARKDOWN_LANGUAGE, PAG_LANGUAGE]);

export const NONTERMINAL_LANGUAGES: ReadonlySet<string> = new Set([BNF_LANGUAGE, PAG_LANGUAGE]);

export const SHOUT_LANGUAGES: ReadonlySet<string> = new Set([PAG_LANGUAGE, BNF_LANGUAGE, MERMAID_LANGUAGE]);
```
