Skip to content

Best way to handle embedded sub expressions / language #194

@vikigenius

Description

@vikigenius

I am struggling with why Rowan does not allow payloads in the SyntaxKind

Consider this language Yuck, it's based on lisp, but it has an embedded sub language https://elkowar.github.io/eww/expression_language.html
You can only put this within Curly Braces something like: (box {button_active ? "disable": "enable"})

if payloads were allowed you could easily do something like

enum TokenKind {
    // snip
    SimpleExpr(Vec<SimpleExprTokenKind>)
}

But since Rowan can't allow that we just have

enum TokenKind {
    // snip
    SimpleExpr
}

You would have a separate stage to lex and parse the embedded SimpleExpr, but what if there is a missing closing brace? How would I handle lexer errors in the sub language?

I would appreciate any suggestions/ideas on how to best handle this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions