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

Error: Unexpected date period token '1000' (BZ#554) #1626

Closed
tbm opened this issue Oct 8, 2011 · 2 comments
Closed

Error: Unexpected date period token '1000' (BZ#554) #1626

tbm opened this issue Oct 8, 2011 · 2 comments
Labels
bug Something isn't working P3 Average priority

Comments

@tbm
Copy link
Contributor

tbm commented Oct 8, 2011

Note: the issue was created automatically with bugzilla2github

Bugzilla bug ID: BZ#554
From: seanh
CC: @tbm

@tbm
Copy link
Contributor Author

tbm commented Oct 8, 2011

Comment author: seanh

With a budget entry starting:

~ Every 1000 years from 1 Sep 2011 to 30 May 2012

ledger gives "Error: Unexpected date period token '1000'". Reducing it to 100 years gets rid of the error.

@tbm
Copy link
Contributor Author

tbm commented May 12, 2014

Comment author: Martin Michlmayr (@tbm)

$ cat b

~ Every 1000 years from 1 Sep 2011 to 30 May 2012
$ ledger -f b --budget bal
While parsing file "/home/tbm/tmp/src/b/ledger/b", line 2:
While parsing periodic transaction:
> ~ Every 1000 years from 1 Sep 2011 to 30 May 2012
Error: Unexpected date period token '1000'

@tbm tbm added P3 Average priority bug Something isn't working labels May 18, 2018
Christoph-D added a commit to Christoph-D/ledger that referenced this issue Jun 10, 2018
This fixes issue ledger#1626.

The tokenizer eagerly classifies 4-digit integers as TOK_A_YEAR
tokens.  In some contexts such as "every 1000 years", this causes
errors.

I think the tokenizer does not have enough information available to
distinguish between integers and years.

After this patch, the tokenizer will always classify integers as
TOK_INT tokens.  The "has 4 digits" heuristic to determine if an
integer is a year is moved to the place where it's actually
needed (and it can be slightly more generic there, too).
Christoph-D added a commit to Christoph-D/ledger that referenced this issue Jun 10, 2018
This fixes ledger#1626.

The tokenizer eagerly classifies 4-digit integers as TOK_A_YEAR
tokens.  In some contexts such as "every 1000 years", this causes
errors.

I think the tokenizer does not have enough information available to
distinguish between integers and years.

After this patch, the tokenizer will always classify integers as
TOK_INT tokens.  The "has 4 digits" heuristic to determine if an
integer is a year is moved to the place where it's actually
needed (and it can be slightly more generic there, too).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 Average priority
Projects
None yet
Development

No branches or pull requests

1 participant