<div dir="ltr">Hi List,<div><br></div><div>I am trying to implement a parser for Ledger (<a href="http://www.ledger-cli.org/">http://www.ledger-cli.org/</a>) journal files.</div><div>Here is an example of such a journal:</div><div><br></div><div><div><br></div><div>2015/10/12 Exxon</div><div>    Expenses:Auto:Gas         10.00 EUR</div><div>    Liabilities:MasterCard      -10.00 EUR</div><div><br></div><div>P 2015/11/21 02:18:02 USD 1.1 EUR</div></div><div><br></div><div>Here is my the current implementation: <a href="https://github.com/loxs/ledgerparse">https://github.com/loxs/ledgerparse</a></div><div>My plan is to do lexing and parsing line by line and write my own combinator to generate larger structures (as is in the example, one transaction is more than one line)</div><div><br></div><div>So I am now starting to implement the various possible lines and I am stuck at trying to implement the price definition (the line which is  "P 2015/11/21 02:18:02 USD 1.1 EUR")</div><div><br></div><div>Leex does not support ^ for beginning of line and I somehow need to instruct the lexer to parse the leading "P" as a "pricetag token" instead of just a "word" which can occur in various other places of the journal.</div><div><br></div><div>So my question is: How do I tackle this? Do I just accept "P" as a WORD token and somehow instruct yecc to parse based on the WORD's value? Is it even possible to do?</div><div><br></div><div>Any ideas are very welcome, thanks in advance!</div><div><br></div></div>