feat: add greedy newline tokenizer#25
Conversation
9adefc0 to
2beccd0
Compare
|
@byCedric in general this looks great to me. One question it begs, is do we consider footers part of the body, where this complicates things a bit is that we end up with the newline token between the body and first footer. Thinking out loud, how hard would it be to pull the footer and dividing newline up to the same level as message. |
|
It's a little bit uglier of a grammar, but does this get the point across and give a better tree structure? <message> ::= <summary>, <newline>*, <body>, <newline>*, <footer>*
| <summary>
<body> ::= <any text except footer*>, <newline>, <body>
| <any text except footer*> |
Yes, I think so! Although I think we need to use the Both |
|
@byCedric what about: should we do this in a separate PR. |
d4c8cf7 to
1529eb1
Compare
2beccd0 to
c9eee03
Compare
This comment has been minimized.
This comment has been minimized.
Prior to this, footer was a child node of body which feels off conceptually. This also makes it more difficult to add a newline node that falls between the body and footer. Refs: #25
Prior to this, footer was a child node of body which feels off conceptually. This also makes it more difficult to add a newline node that falls between the body and footer. Refs: #25
I think we're pretty much on the same page conceptually, I opened up #26 as a potential approach.
The problem with including the i.e., they explicitly don't contain a |
Prior to this, footer was a child node of body which feels off conceptually. This also makes it more difficult to add a newline node that falls between the body and footer. Refs: #25
wesleytodd
left a comment
There was a problem hiding this comment.
Nothing to add for me, but I am following along on the other conversations which I think are good to figure out.
As for adding a note that you need to add a newline which would not be represented in the tree, I think this is not a desirable solution. I also think that we should not say "anything but a new line" and also, "you need to add a new line". So I am not sure where I land on this yet.
c9eee03 to
9dcc412
Compare
|
@bcoe @wesleytodd I just updated the PR to include the latest I agree with your comments about concatenating the newlines in |
bcoe
left a comment
There was a problem hiding this comment.
nit: in the grammar in the README, there are a few places where we have <newline>, I think this should always be <newline>+, or <newline>*, depending on whether it's optional.

Part of #16 and building on top of #24, using the same greedy principle as
whitespacenodes.It's still a draft, at least until we decided to merge or change #24. Also running into this issue where we trim the outer newlines/whitespaces. Might be better to either not-do that, to maintain positioning within the raw input.