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

Ini example only works if the INI file has a newline after final entry. #19

Open
cianoc opened this issue Sep 11, 2019 · 2 comments
Open

Comments

@cianoc
Copy link

cianoc commented Sep 11, 2019

This should be made explicit in the chapter, or the parser should be changed to solve this problem.

@cianoc cianoc mentioned this issue Sep 11, 2019
@IronThread
Copy link

IronThread commented Mar 26, 2022

I tried this grammar to solve the problem:

file = {
    SOI ~
    ((section | property)? ~ (NEWLINE | EOI))*
}

But the program crash when I try to run it.

@reivilibre
Copy link
Contributor

reivilibre commented Feb 25, 2023

I tried this grammar to solve the problem:

file = {
    SOI ~
    ((section | property)? ~ (NEWLINE | EOI))*
}

But the program crash when I try to run it.

This is probably because EOI is a zero-length match, so you get infinite matches here.

A workaround I've been using for this case is e.g.

file = {
    SOI ~
    (!EOI ~ (section | property)? ~ (NEWLINE | EOI))*
}

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

3 participants