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

bug here #26

Closed
Jaschenn opened this issue Dec 6, 2022 · 2 comments
Closed

bug here #26

Jaschenn opened this issue Dec 6, 2022 · 2 comments

Comments

@Jaschenn
Copy link

Jaschenn commented Dec 6, 2022

hi, i have tried pydbml and it has a bug here:
once you try to parse this snippet using pddbml,

enum business_type {
  Repaid [note: ""]
  Refund [note: ""]
  Rebalance [note: ""]
}

the error occus:

  File ".../lib/python3.9/site-packages/pydbml/tools.py", line 44, in strip_empty_lines
    while not lines[first_line] or lines[first_line].isspace():
IndexError: list index out of range

the reason is note: "" , the empty note was passed to strip_empty_lines function.

the related code in tools.py:

// the passed param source is ""
def strip_empty_lines(source: str) -> str:
    """Remove empty lines or lines with just spaces from beginning and end."""
    first_line = 0
    lines = source.split('\n')
    last_line = len(lines) - 1
    while not lines[first_line] or lines[first_line].isspace():
        first_line += 1
    while not lines[last_line] or lines[last_line].isspace():
        last_line -= 1
    return '\n'.join(lines[first_line: last_line + 1])

hope you can fix this issue, thx

@Vanderhoof
Copy link
Owner

Thanks for the report! I'll fix it

Vanderhoof added a commit that referenced this issue Dec 11, 2022
@Vanderhoof
Copy link
Owner

Vanderhoof commented Dec 11, 2022

Fixed in 1.0.6
oops, fixed in 1.0.7

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

2 participants