New issue 143: full-line comments not allowed within transactions
https://bitbucket.org/blais/beancount/issues/143/full-line-comments-not-allowed-within

Stefano Zacchiroli:

According to my reading of the syntax reference, comment should be allowed 
everywhere in a beancount file, no matter if they are in-line comments or 
entire-line comments.

According to bean-check this is not the case though. While the following passes 
bean-check just fine:
```
#!beancount

2014-04-23 * "Flight to Berlin" #berlin-trip-2014
  foo: "bar"
  Expenses:Flights                                                    -1230.27 
USD
    foo: "baz"   ; in-line comment 1
  Liabilities:CreditCard   ; in-line comment 2
    foo: "qux"
```
the following (note the addition of "; full-line comment 3") does not:
```
#!beancount

2014-04-23 * "Flight to Berlin" #berlin-trip-2014
  foo: "bar"
  Expenses:Flights                                                    -1230.27 
USD
    ; full-line comment 3
    foo: "baz"   ; comment 1
  Liabilities:CreditCard   ; comment 2
    foo: "qux"
```
with bean-check failing like this:
```
#!

/tmp/foo.beancount:8:       syntax error, unexpected KEY

/tmp/foo.beancount:9:       syntax error, unexpected ACCOUNT

/tmp/foo.beancount:10:      syntax error, unexpected KEY

/tmp/foo.beancount:4:       Transaction does not balance: (-1230.27 USD)

   2014-04-23 * "Flight to Berlin" #berlin-trip-2014
     foo: "bar"
     Expenses:Flights  -1230.27 USD
```

According to some additional experiments I've made:
* no placement of full-line comments within a transaction works
* full-line comments to work between transactions though
* in-line comments work everywhere within transactions
* removing the leading whitespace (i.e., moving the ";" to column 0) does not 
fix the issue

I've only briefly looked at the yacc grammer, and it is not immediately clear 
why this does not work, as "posting_or_kv_list" entries are made of 
"key_value_line", which are properly terminated by "eol", which in turn can 
contain comments. I haven't debugged it any further though.


-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20161104124129.34247.55644%40celery-worker-105.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to