idea grammar-kit recoverWhile beaks the parser on the first element in list
up vote
0
down vote
favorite
I have a bnf grammar:
{
tokens = [
COLON = ":"
space=' '
word = 'regexp:[^rnst@${}()|#:<>]+'
nl = 'regexp:r|n|(rn)'
]
}
root ::= nlsp book_keyword COLON [space] book_title sections
book_keyword ::= 'Journal Book' | 'Fiction Book'
book_title ::= (! section (word | string) space?)+
sections ::= section+
section ::= nlsp section_keyword COLON [space] section_title {recoverWhile='sectionRecover'}
section_keyword ::= 'Section' | 'Content'
section_title ::= (!section (word | space | COLON))+
sectionRecover ::= !(nlsp| section_keyword)
nlsp ::= (NL| space)*
Text to test:
Fiction Book: Some Fiction
Section: Chapter One
Section: Chapter Two Section
Content: Chapter Three
If I make an error in second or later element all be ok, but if in the first Sectio: Chapter One all psi tree will be broken.

parsing grammar intellij-plugin bnf grammar-kit
add a comment |
up vote
0
down vote
favorite
I have a bnf grammar:
{
tokens = [
COLON = ":"
space=' '
word = 'regexp:[^rnst@${}()|#:<>]+'
nl = 'regexp:r|n|(rn)'
]
}
root ::= nlsp book_keyword COLON [space] book_title sections
book_keyword ::= 'Journal Book' | 'Fiction Book'
book_title ::= (! section (word | string) space?)+
sections ::= section+
section ::= nlsp section_keyword COLON [space] section_title {recoverWhile='sectionRecover'}
section_keyword ::= 'Section' | 'Content'
section_title ::= (!section (word | space | COLON))+
sectionRecover ::= !(nlsp| section_keyword)
nlsp ::= (NL| space)*
Text to test:
Fiction Book: Some Fiction
Section: Chapter One
Section: Chapter Two Section
Content: Chapter Three
If I make an error in second or later element all be ok, but if in the first Sectio: Chapter One all psi tree will be broken.

parsing grammar intellij-plugin bnf grammar-kit
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a bnf grammar:
{
tokens = [
COLON = ":"
space=' '
word = 'regexp:[^rnst@${}()|#:<>]+'
nl = 'regexp:r|n|(rn)'
]
}
root ::= nlsp book_keyword COLON [space] book_title sections
book_keyword ::= 'Journal Book' | 'Fiction Book'
book_title ::= (! section (word | string) space?)+
sections ::= section+
section ::= nlsp section_keyword COLON [space] section_title {recoverWhile='sectionRecover'}
section_keyword ::= 'Section' | 'Content'
section_title ::= (!section (word | space | COLON))+
sectionRecover ::= !(nlsp| section_keyword)
nlsp ::= (NL| space)*
Text to test:
Fiction Book: Some Fiction
Section: Chapter One
Section: Chapter Two Section
Content: Chapter Three
If I make an error in second or later element all be ok, but if in the first Sectio: Chapter One all psi tree will be broken.

parsing grammar intellij-plugin bnf grammar-kit
I have a bnf grammar:
{
tokens = [
COLON = ":"
space=' '
word = 'regexp:[^rnst@${}()|#:<>]+'
nl = 'regexp:r|n|(rn)'
]
}
root ::= nlsp book_keyword COLON [space] book_title sections
book_keyword ::= 'Journal Book' | 'Fiction Book'
book_title ::= (! section (word | string) space?)+
sections ::= section+
section ::= nlsp section_keyword COLON [space] section_title {recoverWhile='sectionRecover'}
section_keyword ::= 'Section' | 'Content'
section_title ::= (!section (word | space | COLON))+
sectionRecover ::= !(nlsp| section_keyword)
nlsp ::= (NL| space)*
Text to test:
Fiction Book: Some Fiction
Section: Chapter One
Section: Chapter Two Section
Content: Chapter Three
If I make an error in second or later element all be ok, but if in the first Sectio: Chapter One all psi tree will be broken.

parsing grammar intellij-plugin bnf grammar-kit
parsing grammar intellij-plugin bnf grammar-kit
asked Nov 19 at 4:28
Viktor Sidochenko
137114
137114
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I see several problems:
1) you should have whitespace token. Something like this:
WHITESPACE="regexp:[ nrtf]"
as a consequence, you don't need space and npsp anymore
2) recoverWhile rule should be specified without quotes
3) sectionRecover matching whitespaces which most likely is incorrect
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I see several problems:
1) you should have whitespace token. Something like this:
WHITESPACE="regexp:[ nrtf]"
as a consequence, you don't need space and npsp anymore
2) recoverWhile rule should be specified without quotes
3) sectionRecover matching whitespaces which most likely is incorrect
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
add a comment |
up vote
0
down vote
I see several problems:
1) you should have whitespace token. Something like this:
WHITESPACE="regexp:[ nrtf]"
as a consequence, you don't need space and npsp anymore
2) recoverWhile rule should be specified without quotes
3) sectionRecover matching whitespaces which most likely is incorrect
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
add a comment |
up vote
0
down vote
up vote
0
down vote
I see several problems:
1) you should have whitespace token. Something like this:
WHITESPACE="regexp:[ nrtf]"
as a consequence, you don't need space and npsp anymore
2) recoverWhile rule should be specified without quotes
3) sectionRecover matching whitespaces which most likely is incorrect
I see several problems:
1) you should have whitespace token. Something like this:
WHITESPACE="regexp:[ nrtf]"
as a consequence, you don't need space and npsp anymore
2) recoverWhile rule should be specified without quotes
3) sectionRecover matching whitespaces which most likely is incorrect
answered Nov 20 at 11:48
Argb32
71247
71247
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
add a comment |
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
It is space care grammar, so I've disabled whitespace feature. BTW, it is not fixes scope mess. As I can see the first section element is covered only by root level and not entered in sections anymore. This behavior is valid for only 1st element in sections.
– Viktor Sidochenko
Nov 21 at 8:33
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53368325%2fidea-grammar-kit-recoverwhile-beaks-the-parser-on-the-first-element-in-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown