forked from ledger/ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
1 parent
adc221f
commit 86a23cd
Showing
4 changed files
with
38 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
test period every 1000 years from 1 Sep 2011 to 30 May 2012 --now=2018-06-10 | ||
--- Period expression tokens --- | ||
TOK_EVERY: every | ||
TOK_INT: 1000 | ||
TOK_YEARS: years | ||
TOK_SINCE: since | ||
TOK_INT: 1 | ||
TOK_A_MONTH: Sep | ||
TOK_INT: 2011 | ||
TOK_UNTIL: until | ||
TOK_INT: 30 | ||
TOK_A_MONTH: May | ||
TOK_INT: 2012 | ||
END_REACHED: <EOF> | ||
|
||
--- Before stabilization --- | ||
range: from day 1 to day 30 | ||
duration: 1000 years | ||
|
||
--- After stabilization --- | ||
range: from day 1 to day 30 | ||
start: 18-Jan-01 | ||
finish: 18-Jan-30 | ||
duration: 1000 years | ||
|
||
--- Sample dates in range (max. 20) --- | ||
1: 18-Jan-01 -- 18-Jan-29 | ||
end test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters