Add ~ flag and repeat clause for repeating transactions #2

Open
opened 2026-08-07 14:24:27 +00:00 by hum3 · 0 comments
Owner

Summary

Extend grammar.js to support repeating transactions using ~ as a third flag alongside * and !, followed by a repeat clause.

Proposed grammar changes

flag           = (%s"*" / %s"!" / %s"~")
repeat_clause  = %s"repeat" _sp (count_repeat / until_repeat)
count_repeat   = count _sp interval
until_repeat   = interval _sp %s"until" _sp datetime
count          = @pattern("[1-9][0-9]*")
interval       = %s"daily" / %s"weekly" / %s"monthly" / %s"yearly"

The header rule becomes:

header = datetime [knowledge_datetime] _sp flag [_sp repeat_clause] [_sp payee] %s"\n"

The repeat clause is only valid when flag is ~.

Syntax examples

; Count-based
2024-01-15 ~ repeat 26 daily Interest accrual
  Assets:Bank:Current -> Income:Interest "Daily interest" 0.38 GBP

; Until-based
2024-01-15 ~ repeat monthly until 2024-12-15 Monthly interest
  Assets:Bank:Current -> Income:Interest "Monthly interest" 10.00 GBP

; Count + monthly
2024-01-01 ~ repeat 28 monthly Mortgage payment
  Assets:Bank:Current -> Liabilities:Mortgage "Monthly repayment" 850.00 GBP

Background

Research doc: https://h3-pta-formats.statichost.eu/research/repeating-transactions.html


Migrated from Codeberg: originally #2, opened 2026-03-27.

## Summary Extend `grammar.js` to support repeating transactions using `~` as a third flag alongside `*` and `!`, followed by a repeat clause. ## Proposed grammar changes ```abnf flag = (%s"*" / %s"!" / %s"~") repeat_clause = %s"repeat" _sp (count_repeat / until_repeat) count_repeat = count _sp interval until_repeat = interval _sp %s"until" _sp datetime count = @pattern("[1-9][0-9]*") interval = %s"daily" / %s"weekly" / %s"monthly" / %s"yearly" ``` The header rule becomes: ```abnf header = datetime [knowledge_datetime] _sp flag [_sp repeat_clause] [_sp payee] %s"\n" ``` The repeat clause is only valid when flag is `~`. ## Syntax examples ```goluca ; Count-based 2024-01-15 ~ repeat 26 daily Interest accrual Assets:Bank:Current -> Income:Interest "Daily interest" 0.38 GBP ; Until-based 2024-01-15 ~ repeat monthly until 2024-12-15 Monthly interest Assets:Bank:Current -> Income:Interest "Monthly interest" 10.00 GBP ; Count + monthly 2024-01-01 ~ repeat 28 monthly Mortgage payment Assets:Bank:Current -> Liabilities:Mortgage "Monthly repayment" 850.00 GBP ``` ## Background Research doc: https://h3-pta-formats.statichost.eu/research/repeating-transactions.html --- *Migrated from Codeberg: originally [#2](https://codeberg.org/hum3/tree-sitter-goluca/issues/2), opened 2026-03-27.*
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hum3/tree-sitter-goluca#2
No description provided.