/* * syntax.hpp * Syntax highlighting core: token types, state, shared scanners * Shared by the MontaukOS text editor (GUI) and edit.elf (CLI) * Copyright (c) 2026 Daniel Hammer */ // The highlighter turns one line of text into a SynToken per character while // carrying multi-line state (block comments, HTML tag context, ...) forward // in a SynState. Frontends map SynToken to their own colors: the GUI editor // to a Color, edit.elf to an ANSI escape. // // Callers include THIS header only; the per-language lang_*.hpp files below // are not standalone (they rely on the declarations above their include). #pragma once #include // ============================================================================ // Token types // ============================================================================ enum SynLanguage : uint8_t { SYN_LANG_NONE, SYN_LANG_C, SYN_LANG_CPP, SYN_LANG_LUA, SYN_LANG_HTML, SYN_LANG_CSS, SYN_LANG_JS, }; enum SynToken : uint8_t { SYN_NORMAL, SYN_KEYWORD, SYN_TYPE, SYN_PREPROCESSOR, SYN_STRING, SYN_CHAR, SYN_COMMENT, SYN_NUMBER, SYN_OPERATOR, }; #define SYN_RAW_DELIM_MAX 16 // Where an HTML line starts: plain text, inside a tag, inside a comment, or // inside a