clerk/journal/ast/directives.go (view raw)
Oleksandr Smirnov
Oleksandr Smirnov
olexsmir@gmail.com parser: support C conversion directive, 14 days ago
olexsmir@gmail.com parser: support C conversion directive, 14 days ago
| 1 | package ast |
| 2 | |
| 3 | import "olexsmir.xyz/clerk/journal/token" |
| 4 | |
| 5 | type AccountDirective struct { |
| 6 | Account Account |
| 7 | Comment *Comment |
| 8 | Span token.Span |
| 9 | } |
| 10 | |
| 11 | func (AccountDirective) entryNode() {} |
| 12 | |
| 13 | type CommodityDirective struct { |
| 14 | Commodity string |
| 15 | Format Amount // optional format hint: "1,000.00 UAH" |
| 16 | Comment *Comment // optional inline comment |
| 17 | Span token.Span |
| 18 | } |
| 19 | |
| 20 | func (CommodityDirective) entryNode() {} |
| 21 | |
| 22 | type PayeeDirective struct { |
| 23 | Name string |
| 24 | Comment *Comment |
| 25 | Span token.Span |
| 26 | } |
| 27 | |
| 28 | func (PayeeDirective) entryNode() {} |
| 29 | |
| 30 | type TagDirective struct { |
| 31 | Name string |
| 32 | Comment *Comment // optional inline comment |
| 33 | Span token.Span |
| 34 | } |
| 35 | |
| 36 | func (TagDirective) entryNode() {} |
| 37 | |
| 38 | type IncludeDirective struct { |
| 39 | Path string |
| 40 | Comment *Comment // optional inline comment |
| 41 | Span token.Span |
| 42 | } |
| 43 | |
| 44 | func (IncludeDirective) entryNode() {} |
| 45 | |
| 46 | type AliasDirective struct { |
| 47 | From, To string |
| 48 | Comment *Comment // optional inline comment |
| 49 | Span token.Span |
| 50 | } |
| 51 | |
| 52 | func (AliasDirective) entryNode() {} |
| 53 | |
| 54 | type YearDirective struct { |
| 55 | Year int |
| 56 | Comment *Comment // optional inline comment |
| 57 | Span token.Span |
| 58 | } |
| 59 | |
| 60 | func (YearDirective) entryNode() {} |
| 61 | |
| 62 | type DecimalMarkDirective struct { |
| 63 | Mark byte // '.' ',' |
| 64 | Comment *Comment // optional inline comment |
| 65 | Span token.Span |
| 66 | } |
| 67 | |
| 68 | func (DecimalMarkDirective) entryNode() {} |
| 69 | |
| 70 | type DefaultCommodityDirective struct { |
| 71 | Amount Amount |
| 72 | Comment *Comment // optional inline comment |
| 73 | Span token.Span |
| 74 | } |
| 75 | |
| 76 | func (DefaultCommodityDirective) entryNode() {} |
| 77 | |
| 78 | type MarketPriceDirective struct { |
| 79 | DateTime DateTime |
| 80 | Commodity string |
| 81 | Amount Amount |
| 82 | Comment *Comment // optional inline comment |
| 83 | Span token.Span |
| 84 | } |
| 85 | |
| 86 | func (MarketPriceDirective) entryNode() {} |
| 87 | |
| 88 | type ConversionDirective struct { |
| 89 | From Amount |
| 90 | To Amount |
| 91 | Comment *Comment // optional inline comment |
| 92 | Span token.Span |
| 93 | } |
| 94 | |
| 95 | func (ConversionDirective) entryNode() {} |
| 96 | |
| 97 | type ApplyDirective struct { |
| 98 | Expr string // text after apply e.g "tag foo" |
| 99 | Comment *Comment |
| 100 | Span token.Span |
| 101 | } |
| 102 | |
| 103 | func (ApplyDirective) entryNode() {} |
| 104 | |
| 105 | type EndDirective struct { |
| 106 | Expr string // text after end e.g "tag" |
| 107 | Comment *Comment // optional inline comment |
| 108 | Span token.Span |
| 109 | } |
| 110 | |
| 111 | func (EndDirective) entryNode() {} |
| 112 | |
| 113 | type CommentBlockDirective struct { |
| 114 | Header string // text after "comment" on the same line |
| 115 | Content string |
| 116 | Comment *Comment // optional inline comment |
| 117 | Span token.Span |
| 118 | } |
| 119 | |
| 120 | func (CommentBlockDirective) entryNode() {} |
| 121 | |
| 122 | type IgnoredDirective struct { |
| 123 | Comment *Comment // optional inline comment |
| 124 | Span token.Span |
| 125 | } |
| 126 | |
| 127 | func (IgnoredDirective) entryNode() {} |