moonrockz/krueger/scanner does not have a README file

    Scanner

    pub trait Scanner {
    fn tokenize(Self, SourceText) -> Result[TokenStream, ScanErrorList]
    }

    Block

    pub(all) enum Block {
    Text(Array[Chunk])
    Excerpt(context~ : Span, highlight~ : Span)
    Hint(Array[Chunk])
    Note(Array[Chunk])
    Example(String)
    } derive(Eq,
    Debug
    )

    One block of a report. Excerpt shows the source lines of context with markers under highlight; renderers read the lines from the source.

    Chunk

    pub(all) enum Chunk {
    Plain(String)
    Styled(text~ : String, color~ : Color?, bold~ : Bool, underline~ : Bool)
    } derive(Eq,
    Debug
    )

    A piece of report text: plain, or styled like elm make styles code and keywords.

    Chunk::code

    fn Chunk::code(text : String) -> Chunk

    Elm code inside a paragraph, in yellow as elm make shows it.

    Chunk::keyword

    fn Chunk::keyword(text : String) -> Chunk

    An Elm keyword inside a paragraph, in bright cyan as elm make shows it.

    Color

    pub(all) enum Color {
    Red
    Yellow
    Green
    Cyan
    Magenta
    Blue
    Black
    White
    VividRed
    VividYellow
    VividGreen
    VividCyan
    VividMagenta
    VividBlue
    VividBlack
    VividWhite
    } derive(Eq,
    Debug
    )

    Colours of elm make reports. Vivid* are the bright variants; in the --report=json output they are upper case ("RED"), the others lower case.

    Color::json_name

    fn Color::json_name(self : Color) -> String

    The colour name in elm make --report=json output.

    Comment

    pub(all) struct Comment {
    kind : CommentKind
    text : String
    span : Span
    } derive(Eq,
    Debug
    )

    CommentKind

    pub(all) enum CommentKind {
    Line
    Block
    Doc
    } derive(Eq,
    Debug
    )

    DefaultScanner

    pub struct DefaultScanner {
    dialect :
    Dialect

    }

    DefaultScanner::new

    A scanner for dialect (reserved words and operator symbols).

    DefaultScanner::tokenize

    fn DefaultScanner::tokenize(self : DefaultScanner, _source : SourceText) -> Result[TokenStream, ScanErrorList]

    Diagnostic

    pub(all) struct Diagnostic {
    code : String
    severity : Severity
    message : String
    span : Span
    title : String
    report : Array[Block]
    } derive(Eq,
    Debug
    )

    KeywordKind

    pub(all) enum KeywordKind {
    Module
    Exposing
    Import
    As
    Type
    If
    Then
    Else
    Let
    In
    Case
    Of
    Port
    Where
    Custom(String)
    } derive(Eq,
    Debug
    )

    Reserved words of Elm 0.19.1 as elm-syntax 7.3.9 treats them. alias, infix and effect are not reserved; they are identifiers.

    Position

    pub(all) struct Position {
    offset : Int
    line : Int
    column : Int
    } derive(Eq,
    Debug
    )

    RawToken

    pub(all) struct RawToken {
    kind : RawTokenKind
    lexeme : String
    span : Span
    } derive(Eq,
    Debug
    )

    RawTokenKind

    pub(all) enum RawTokenKind {
    Significant(TokenKind)
    Whitespace
    Newline
    LineComment
    BlockComment
    DocComment
    } derive(Eq,
    Debug
    )

    A lexical unit before trivia is attached: a significant token or trivia.

    ScanErrorList

    pub(all) struct ScanErrorList {
    diagnostics : Array[Diagnostic]
    } derive(Eq,
    Debug
    )

    Severity

    pub(all) enum Severity {
    Error
    Warning
    Info
    } derive(Eq,
    Debug
    )

    SourceText

    pub(all) struct SourceText {
    module_name : String?
    text : String
    } derive(Eq,
    Debug
    )

    Span

    pub(all) struct Span {
    start : Position
    end : Position
    } derive(Eq,
    Debug
    )

    Token

    pub(all) struct Token {
    kind : TokenKind
    lexeme : String
    span : Span
    trivia_before : Array[Trivia]
    trivia_after : Array[Trivia]
    } derive(Eq,
    Debug
    )

    TokenKind

    pub(all) enum TokenKind {
    Keyword(KeywordKind)
    Identifier
    IntLiteral
    FloatLiteral
    StringLiteral
    CharLiteral
    Glsl
    LParen
    RParen
    LBracket
    RBracket
    LBrace
    RBrace
    Comma
    Equals
    Dot
    DotDot
    Colon
    Pipe
    Arrow
    Backslash
    Underscore
    Operator(String)
    } derive(Eq,
    Debug
    )

    TokenKind::as_kw

    fn TokenKind::as_kw() -> TokenKind

    TokenKind::case_kw

    fn TokenKind::case_kw() -> TokenKind

    TokenKind::else_kw

    fn TokenKind::else_kw() -> TokenKind

    TokenKind::exposing_kw

    fn TokenKind::exposing_kw() -> TokenKind

    TokenKind::if_kw

    fn TokenKind::if_kw() -> TokenKind

    TokenKind::import_kw

    fn TokenKind::import_kw() -> TokenKind

    TokenKind::in_kw

    fn TokenKind::in_kw() -> TokenKind

    TokenKind::keyword

    fn TokenKind::keyword(kind : KeywordKind) -> TokenKind

    TokenKind::let_kw

    fn TokenKind::let_kw() -> TokenKind

    TokenKind::module_kw

    fn TokenKind::module_kw() -> TokenKind

    TokenKind::of_kw

    fn TokenKind::of_kw() -> TokenKind

    TokenKind::port_kw

    fn TokenKind::port_kw() -> TokenKind

    TokenKind::then_kw

    fn TokenKind::then_kw() -> TokenKind

    TokenKind::type_kw

    fn TokenKind::type_kw() -> TokenKind

    TokenKind::where_kw

    fn TokenKind::where_kw() -> TokenKind

    TokenStream

    pub(all) struct TokenStream {
    tokens : Array[Token]
    trivia : Array[Trivia]
    } derive(Eq,
    Debug
    )

    Trivia

    pub(all) enum Trivia {
    Whitespace(String, Span)
    Newline(String, Span)
    Comment(Comment)
    } derive(Eq,
    Debug
    )

    invalid_sequence

    fn invalid_sequence(span : Span) -> Diagnostic

    A character Elm does not allow here.

    is_lower_start

    fn is_lower_start(c : Char) -> Bool

    Whether c can start a lower-case name (a Unicode lower-case letter).

    is_name_part

    fn is_name_part(c : Char) -> Bool

    Whether c can continue a name: a Unicode letter or number, or _.

    is_upper_start

    fn is_upper_start(c : Char) -> Bool

    Whether c can start an upper-case name (a Unicode upper-case or title-case letter).

    lex_raw

    Split Elm source into significant tokens and trivia. Diagnostics: KR-SCAN-001 unterminated block comment, KR-SCAN-002 malformed doc comment, KR-SCAN-003 a character Elm does not allow here, KR-SCAN-004 an unterminated string, char or GLSL literal.

    malformed_doc_comment

    fn malformed_doc_comment(span : Span) -> Diagnostic

    A doc comment with no end. span runs from {-| to the end of the input.

    normalize_tokens

    fn normalize_tokens(raw_tokens : Array[RawToken]) -> TokenStream

    raw_to_trivia

    fn raw_to_trivia(raw : RawToken) -> Trivia?

    tab_character

    fn tab_character(span : Span) -> Diagnostic

    A tab character.

    unexpected_character

    fn unexpected_character(span : Span) -> Diagnostic

    A character that is not a symbol and is not used in Elm, such as a backtick or a non-ASCII letter outside a string.

    unexpected_semicolon

    fn unexpected_semicolon(span : Span) -> Diagnostic

    A semicolon.

    unterminated_block_comment

    fn unterminated_block_comment(span : Span) -> Diagnostic

    A block comment with no end. span runs from {- to the end of the input.

    unterminated_char

    fn unterminated_char(span : Span) -> Diagnostic

    A character literal with no closing quote.

    unterminated_glsl

    fn unterminated_glsl(span : Span) -> Diagnostic

    A GLSL block with no closing |].

    unterminated_multiline_string

    fn unterminated_multiline_string(span : Span) -> Diagnostic

    A multi-line string with no closing """.

    unterminated_string

    fn unterminated_string(span : Span) -> Diagnostic

    A string with no closing quote. span runs from the opening quote to where the scanner stopped (the end of the line, or of the input).

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io