Skip to content

Better document the grammar of the test format #56

Open
@gsnedders

Description

@gsnedders

We sorta document it as a tree-construction specific format. We should give the generic definition most people use.

It's something like the state machine below:

HEADER: "#([^\n]+)"
BODY: "([^#][^\n]*)"
LF: "\n"

start:
  HEADER -> after_header

after_header:
  LF -> body
  EOF

body:
  LF -> after_lf
  BODY -> body
  EOF

after_lf:
  LF -> after_lf_lf
  BODY -> body
  EOF

after_lf_lf:
  LF -> after_lf_lf {add "\n" to body}
  BODY -> body {add "\n\n" to body}
  HEADER -> after_header
  EOF {add "\n" to body}

This shouldn't be much effort to convert into an LR(2) grammar; the LR(1) grammar equivalent may be hell.

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