-
Notifications
You must be signed in to change notification settings - Fork 513
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
Tag value parsing includes extra characters (": ") #1702
Comments
I don't know why ledger behaves the way you describe, but your example contains a syntax error:
There should be only one semi colon. If you fix that, it will work as expected. |
@tbm Interesting, that does indeed fix it for me. My understanding was that since Would it cause any problems to allow double semicolons before metadata tags? |
Interesting, yeah, I tend to agree that this is a bug that should be fixed. |
The current behavior isn't very consistent at all:
|
If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. ledger#1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes ledger#1702
I agree that this is confusing, but at some point we need to think about
performance. The more flexible the parser is, the slower it is. Putting
reasonable limits on syntax doesn't seem like a hardship here.
…On Sat, Feb 16, 2019 at 2:45 PM Michael Budde ***@***.***> wrote:
The current behavior isn't very consistent at all:
; Tag: Value - Allowed
;; Tag: Value - Allowed
;;; Tag: Value - Not allowed
; ; ; Tag: Value - Allowed
;; ;; Tag: Value - Not allowed
; a b c Tag: Value - Allowed
; abc Tag: Value - Not allowed
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1702 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA1rLEvTEjtjdGjAeFfxsrvmyHVUKJY2ks5vOHvygaJpZM4Z6-2n>
.
--
Craig, Corona De Tucson, AZ
[image: missile_flyout]
enderw88.wordpress.com
|
If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. ledger#1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes ledger#1702
If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. #1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes #1702
If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. ledger#1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes ledger#1702
Anywhere that I try to match the value of a tag, if I try matching e.g.
Value
, it doesn't work, but if I instead match: Value
(that's a colon and a space prepended to the value), it does. An MCVE:For ledgerfile:
running
ledger bal
works. If line 2 is changed toassert value =~ /^Bar$/
, it gives the error:The behavior is the same for
--limit
args, as well as when using direct comparison instead of a regex. I.e.:shows the correct results, while:
returns nothing.
I tested this on 863cb3b, which is the latest
next
at present.The text was updated successfully, but these errors were encountered: