Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let parser work without section headers #6

Open
Hubro opened this issue Aug 16, 2023 · 0 comments
Open

Let parser work without section headers #6

Hubro opened this issue Aug 16, 2023 · 0 comments

Comments

@Hubro
Copy link
Owner

Hubro commented Aug 16, 2023

Currently the parser is strict about section headers. This is fine for Robot files, since they are invalid without section headers anyway.

However, it would be nice if the parser could be used for quick snippets as well. For example, currently the parser would be unable to parse this snippet:

Test Something
    Hello World

Because it's missing a section header.

The parser should probably be updated to allow a raw list of test cases if there are no section headers.

Something like (pseudo code):

{
  rules: {
    // ...

    source_file: $ => seq(
      optional(/\s+/), // Allows whitespace before the first section
      choice(
        repeat($.section),
        repeat($.keyword_definition),
      )
    ),

    // ...
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant