Skip to content

There no way to use End inside rules #151

@kant2002

Description

@kant2002

Describe the bug
I try to declare language which is somewhat whitespace sensetive. For now I need only empty line as separator, definitions below.

public enum EngLangTokenType
{
    [Error] Error,
    [End] End,
    [Ignore] [Regex("([ \t]+((\r\n|\n|\r)[ \t]*)?|(\r\n|\n|\r))")] Whitespace,
    [Regex("(\r\n|\n|\r){2,}")] Multiline,
}

And now I'm in situation where that Multiline separator can be missing in the end of file, which lead to fact that some statements may go missing.I did try to do following

[Rule("paragraph : statement_list Multiline+")]
private static BlockStatement MakeParagraph(
    BlockStatement statement,
    IReadOnlyList<IToken<EngLangTokenType>> paragraphToken)
    => statement;

[Rule("paragraph : statement_list End")]
private static BlockStatement MakeParagraph(
    BlockStatement statement,
    IToken<EngLangTokenType> paragraphToken)
    => statement;

but if I add this rule, I have infinite bug. So I would like to hear what I can do about that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions