tree-sitter-beancount 2.0.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +20 -0
- package/.envrc +1 -0
- package/.github/workflows/cicd.yml +30 -0
- package/.github/workflows/release.yml +72 -0
- package/CHANGELOG.md +31 -0
- package/Cargo.lock +59 -0
- package/Cargo.toml +26 -0
- package/README.md +5 -1
- package/binding.gyp +2 -1
- package/{src → bindings/node}/binding.cc +0 -0
- package/bindings/node/index.js +19 -0
- package/bindings/rust/build.rs +38 -0
- package/bindings/rust/lib.rs +52 -0
- package/flake.lock +67 -0
- package/flake.nix +123 -0
- package/grammar.js +238 -202
- package/package.json +6 -5
- package/shell.nix +13 -0
- package/src/grammar.json +569 -485
- package/src/node-types.json +465 -432
- package/src/parser.c +13350 -4930
- package/src/scanner.cc +163 -0
- package/src/tree_sitter/parser.h +73 -84
- package/test/corpus/arithmetic.txt +71 -53
- package/test/corpus/comment.txt +12 -17
- package/test/corpus/currencies.txt +10 -12
- package/test/corpus/entry_types.txt +17 -31
- package/test/corpus/markdown_orgmode.txt +60 -0
- package/test/corpus/metadata.txt +95 -104
- package/test/corpus/multi_line.txt +2 -4
- package/test/corpus/orgmode_sections.txt +53 -0
- package/test/corpus/parse_lots.txt +31 -87
- package/test/corpus/parser_links.txt +4 -6
- package/test/corpus/push_pop_meta.txt +5 -6
- package/test/corpus/transaction.txt +54 -47
- package/test/corpus/ugly_bugs.txt +4 -4
- package/index.js +0 -13
- package/tree-sitter-beancount.wasm +0 -0
package/src/scanner.cc
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#include <cwctype>
|
|
2
|
+
#include <tree_sitter/parser.h>
|
|
3
|
+
#include <vector>
|
|
4
|
+
|
|
5
|
+
namespace {
|
|
6
|
+
|
|
7
|
+
using std::iswspace;
|
|
8
|
+
using std::vector;
|
|
9
|
+
|
|
10
|
+
enum TokenType {
|
|
11
|
+
HL_STARS,
|
|
12
|
+
SECTIONEND,
|
|
13
|
+
END_OF_FILE,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
struct Scanner {
|
|
17
|
+
vector<int16_t> indent_length_stack;
|
|
18
|
+
vector<int16_t> org_section_stack;
|
|
19
|
+
|
|
20
|
+
Scanner() {
|
|
21
|
+
deserialize(NULL, 0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
unsigned serialize(char *buffer) {
|
|
25
|
+
size_t i = 0;
|
|
26
|
+
|
|
27
|
+
size_t indent_count = indent_length_stack.size() - 1;
|
|
28
|
+
if (indent_count > UINT8_MAX)
|
|
29
|
+
indent_count = UINT8_MAX;
|
|
30
|
+
buffer[i++] = indent_count;
|
|
31
|
+
|
|
32
|
+
vector<int16_t>::iterator iter = indent_length_stack.begin() + 1,
|
|
33
|
+
end = indent_length_stack.end();
|
|
34
|
+
|
|
35
|
+
for (; iter != end && i < TREE_SITTER_SERIALIZATION_BUFFER_SIZE;
|
|
36
|
+
++iter) {
|
|
37
|
+
buffer[i++] = *iter;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
iter = org_section_stack.begin() + 1;
|
|
41
|
+
end = org_section_stack.end();
|
|
42
|
+
|
|
43
|
+
for (; iter != end && i < TREE_SITTER_SERIALIZATION_BUFFER_SIZE;
|
|
44
|
+
++iter) {
|
|
45
|
+
buffer[i++] = *iter;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return i;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void deserialize(const char *buffer, unsigned length) {
|
|
52
|
+
org_section_stack.clear();
|
|
53
|
+
org_section_stack.push_back(0);
|
|
54
|
+
indent_length_stack.clear();
|
|
55
|
+
indent_length_stack.push_back(-1);
|
|
56
|
+
|
|
57
|
+
if (length == 0)
|
|
58
|
+
return;
|
|
59
|
+
|
|
60
|
+
size_t i = 0;
|
|
61
|
+
|
|
62
|
+
size_t indent_count = (uint8_t)buffer[i++];
|
|
63
|
+
|
|
64
|
+
for (; i <= indent_count; i++)
|
|
65
|
+
indent_length_stack.push_back(buffer[i]);
|
|
66
|
+
for (; i < length; i++)
|
|
67
|
+
org_section_stack.push_back(buffer[i]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void advance(TSLexer *lexer) {
|
|
71
|
+
lexer->advance(lexer, false);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
void skip(TSLexer *lexer) {
|
|
75
|
+
lexer->advance(lexer, true);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
bool scan(TSLexer *lexer, const bool *valid_symbols) {
|
|
79
|
+
|
|
80
|
+
// - Section ends
|
|
81
|
+
int16_t indent_length = 0;
|
|
82
|
+
lexer->mark_end(lexer);
|
|
83
|
+
for (;;) {
|
|
84
|
+
if (lexer->lookahead == ' ') {
|
|
85
|
+
indent_length++;
|
|
86
|
+
} else if (lexer->lookahead == '\t') {
|
|
87
|
+
indent_length += 8;
|
|
88
|
+
} else if (lexer->lookahead == '\0') {
|
|
89
|
+
|
|
90
|
+
if (valid_symbols[SECTIONEND]) {
|
|
91
|
+
lexer->result_symbol = SECTIONEND;
|
|
92
|
+
} else if (valid_symbols[END_OF_FILE]) {
|
|
93
|
+
lexer->result_symbol = END_OF_FILE;
|
|
94
|
+
} else {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return true;
|
|
99
|
+
} else {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
skip(lexer);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (indent_length == 0 && lexer->lookahead == '*') {
|
|
106
|
+
lexer->mark_end(lexer);
|
|
107
|
+
int16_t stars = 1;
|
|
108
|
+
skip(lexer);
|
|
109
|
+
while (lexer->lookahead == '*') {
|
|
110
|
+
stars++;
|
|
111
|
+
skip(lexer);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (valid_symbols[SECTIONEND] && iswspace(lexer->lookahead)
|
|
115
|
+
&& stars > 0 && stars <= org_section_stack.back()) {
|
|
116
|
+
org_section_stack.pop_back();
|
|
117
|
+
lexer->result_symbol = SECTIONEND;
|
|
118
|
+
return true;
|
|
119
|
+
} else if (valid_symbols[HL_STARS] && iswspace(lexer->lookahead)) {
|
|
120
|
+
org_section_stack.push_back(stars);
|
|
121
|
+
lexer->result_symbol = HL_STARS;
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return false; // default
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
} // namespace
|
|
132
|
+
|
|
133
|
+
extern "C" {
|
|
134
|
+
|
|
135
|
+
void *tree_sitter_beancount_external_scanner_create() {
|
|
136
|
+
return new Scanner();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
bool tree_sitter_beancount_external_scanner_scan(void *payload,
|
|
140
|
+
TSLexer *lexer,
|
|
141
|
+
const bool *valid_symbols) {
|
|
142
|
+
Scanner *scanner = static_cast<Scanner *>(payload);
|
|
143
|
+
return scanner->scan(lexer, valid_symbols);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
unsigned tree_sitter_beancount_external_scanner_serialize(void *payload,
|
|
147
|
+
char *buffer) {
|
|
148
|
+
Scanner *scanner = static_cast<Scanner *>(payload);
|
|
149
|
+
return scanner->serialize(buffer);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
void tree_sitter_beancount_external_scanner_deserialize(void *payload,
|
|
153
|
+
const char *buffer,
|
|
154
|
+
unsigned length) {
|
|
155
|
+
Scanner *scanner = static_cast<Scanner *>(payload);
|
|
156
|
+
scanner->deserialize(buffer, length);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
void tree_sitter_beancount_external_scanner_destroy(void *payload) {
|
|
160
|
+
Scanner *scanner = static_cast<Scanner *>(payload);
|
|
161
|
+
delete scanner;
|
|
162
|
+
}
|
|
163
|
+
}
|
package/src/tree_sitter/parser.h
CHANGED
|
@@ -13,6 +13,8 @@ extern "C" {
|
|
|
13
13
|
#define ts_builtin_sym_end 0
|
|
14
14
|
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
|
15
15
|
|
|
16
|
+
typedef uint16_t TSStateId;
|
|
17
|
+
|
|
16
18
|
#ifndef TREE_SITTER_API_H_
|
|
17
19
|
typedef uint16_t TSSymbol;
|
|
18
20
|
typedef uint16_t TSFieldId;
|
|
@@ -30,11 +32,10 @@ typedef struct {
|
|
|
30
32
|
uint16_t length;
|
|
31
33
|
} TSFieldMapSlice;
|
|
32
34
|
|
|
33
|
-
typedef uint16_t TSStateId;
|
|
34
|
-
|
|
35
35
|
typedef struct {
|
|
36
|
-
bool visible
|
|
37
|
-
bool named
|
|
36
|
+
bool visible;
|
|
37
|
+
bool named;
|
|
38
|
+
bool supertype;
|
|
38
39
|
} TSSymbolMetadata;
|
|
39
40
|
|
|
40
41
|
typedef struct TSLexer TSLexer;
|
|
@@ -56,21 +57,21 @@ typedef enum {
|
|
|
56
57
|
TSParseActionTypeRecover,
|
|
57
58
|
} TSParseActionType;
|
|
58
59
|
|
|
59
|
-
typedef
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
60
|
+
typedef union {
|
|
61
|
+
struct {
|
|
62
|
+
uint8_t type;
|
|
63
|
+
TSStateId state;
|
|
64
|
+
bool extra;
|
|
65
|
+
bool repetition;
|
|
66
|
+
} shift;
|
|
67
|
+
struct {
|
|
68
|
+
uint8_t type;
|
|
69
|
+
uint8_t child_count;
|
|
70
|
+
TSSymbol symbol;
|
|
71
|
+
int16_t dynamic_precedence;
|
|
72
|
+
uint16_t production_id;
|
|
73
|
+
} reduce;
|
|
74
|
+
uint8_t type;
|
|
74
75
|
} TSParseAction;
|
|
75
76
|
|
|
76
77
|
typedef struct {
|
|
@@ -82,7 +83,7 @@ typedef union {
|
|
|
82
83
|
TSParseAction action;
|
|
83
84
|
struct {
|
|
84
85
|
uint8_t count;
|
|
85
|
-
bool reusable
|
|
86
|
+
bool reusable;
|
|
86
87
|
} entry;
|
|
87
88
|
} TSParseActionEntry;
|
|
88
89
|
|
|
@@ -92,13 +93,24 @@ struct TSLanguage {
|
|
|
92
93
|
uint32_t alias_count;
|
|
93
94
|
uint32_t token_count;
|
|
94
95
|
uint32_t external_token_count;
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
uint32_t state_count;
|
|
97
|
+
uint32_t large_state_count;
|
|
98
|
+
uint32_t production_id_count;
|
|
99
|
+
uint32_t field_count;
|
|
100
|
+
uint16_t max_alias_sequence_length;
|
|
97
101
|
const uint16_t *parse_table;
|
|
102
|
+
const uint16_t *small_parse_table;
|
|
103
|
+
const uint32_t *small_parse_table_map;
|
|
98
104
|
const TSParseActionEntry *parse_actions;
|
|
99
|
-
const
|
|
105
|
+
const char * const *symbol_names;
|
|
106
|
+
const char * const *field_names;
|
|
107
|
+
const TSFieldMapSlice *field_map_slices;
|
|
108
|
+
const TSFieldMapEntry *field_map_entries;
|
|
109
|
+
const TSSymbolMetadata *symbol_metadata;
|
|
110
|
+
const TSSymbol *public_symbol_map;
|
|
111
|
+
const uint16_t *alias_map;
|
|
100
112
|
const TSSymbol *alias_sequences;
|
|
101
|
-
|
|
113
|
+
const TSLexMode *lex_modes;
|
|
102
114
|
bool (*lex_fn)(TSLexer *, TSStateId);
|
|
103
115
|
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
|
104
116
|
TSSymbol keyword_capture_token;
|
|
@@ -111,14 +123,7 @@ struct TSLanguage {
|
|
|
111
123
|
unsigned (*serialize)(void *, char *);
|
|
112
124
|
void (*deserialize)(void *, const char *, unsigned);
|
|
113
125
|
} external_scanner;
|
|
114
|
-
|
|
115
|
-
const TSFieldMapSlice *field_map_slices;
|
|
116
|
-
const TSFieldMapEntry *field_map_entries;
|
|
117
|
-
const char **field_names;
|
|
118
|
-
uint32_t large_state_count;
|
|
119
|
-
const uint16_t *small_parse_table;
|
|
120
|
-
const uint32_t *small_parse_table_map;
|
|
121
|
-
const TSSymbol *public_symbol_map;
|
|
126
|
+
const TSStateId *primary_state_ids;
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
/*
|
|
@@ -167,66 +172,50 @@ struct TSLanguage {
|
|
|
167
172
|
|
|
168
173
|
#define ACTIONS(id) id
|
|
169
174
|
|
|
170
|
-
#define SHIFT(state_value)
|
|
171
|
-
{
|
|
172
|
-
{
|
|
173
|
-
.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}, \
|
|
178
|
-
.type = TSParseActionTypeShift \
|
|
179
|
-
} \
|
|
180
|
-
}
|
|
175
|
+
#define SHIFT(state_value) \
|
|
176
|
+
{{ \
|
|
177
|
+
.shift = { \
|
|
178
|
+
.type = TSParseActionTypeShift, \
|
|
179
|
+
.state = state_value \
|
|
180
|
+
} \
|
|
181
|
+
}}
|
|
181
182
|
|
|
182
183
|
#define SHIFT_REPEAT(state_value) \
|
|
183
|
-
{
|
|
184
|
-
{
|
|
185
|
-
.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.repetition = true \
|
|
189
|
-
} \
|
|
190
|
-
}, \
|
|
191
|
-
.type = TSParseActionTypeShift \
|
|
184
|
+
{{ \
|
|
185
|
+
.shift = { \
|
|
186
|
+
.type = TSParseActionTypeShift, \
|
|
187
|
+
.state = state_value, \
|
|
188
|
+
.repetition = true \
|
|
192
189
|
} \
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
#define RECOVER() \
|
|
196
|
-
{ \
|
|
197
|
-
{ .type = TSParseActionTypeRecover } \
|
|
198
|
-
}
|
|
190
|
+
}}
|
|
199
191
|
|
|
200
192
|
#define SHIFT_EXTRA() \
|
|
201
|
-
{
|
|
202
|
-
{
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
.extra = true \
|
|
206
|
-
} \
|
|
207
|
-
}, \
|
|
208
|
-
.type = TSParseActionTypeShift \
|
|
193
|
+
{{ \
|
|
194
|
+
.shift = { \
|
|
195
|
+
.type = TSParseActionTypeShift, \
|
|
196
|
+
.extra = true \
|
|
209
197
|
} \
|
|
210
|
-
}
|
|
198
|
+
}}
|
|
211
199
|
|
|
212
200
|
#define REDUCE(symbol_val, child_count_val, ...) \
|
|
213
|
-
{
|
|
214
|
-
{
|
|
215
|
-
.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
201
|
+
{{ \
|
|
202
|
+
.reduce = { \
|
|
203
|
+
.type = TSParseActionTypeReduce, \
|
|
204
|
+
.symbol = symbol_val, \
|
|
205
|
+
.child_count = child_count_val, \
|
|
206
|
+
__VA_ARGS__ \
|
|
207
|
+
}, \
|
|
208
|
+
}}
|
|
209
|
+
|
|
210
|
+
#define RECOVER() \
|
|
211
|
+
{{ \
|
|
212
|
+
.type = TSParseActionTypeRecover \
|
|
213
|
+
}}
|
|
214
|
+
|
|
215
|
+
#define ACCEPT_INPUT() \
|
|
216
|
+
{{ \
|
|
217
|
+
.type = TSParseActionTypeAccept \
|
|
218
|
+
}}
|
|
230
219
|
|
|
231
220
|
#ifdef __cplusplus
|
|
232
221
|
}
|
|
@@ -11,9 +11,8 @@ expr add
|
|
|
11
11
|
(file
|
|
12
12
|
(transaction
|
|
13
13
|
(date)
|
|
14
|
-
(
|
|
15
|
-
(
|
|
16
|
-
(postings
|
|
14
|
+
(txn)
|
|
15
|
+
(narration)
|
|
17
16
|
(posting
|
|
18
17
|
(account)
|
|
19
18
|
(incomplete_amount
|
|
@@ -28,7 +27,6 @@ expr add
|
|
|
28
27
|
(currency)
|
|
29
28
|
)
|
|
30
29
|
)
|
|
31
|
-
)
|
|
32
30
|
)
|
|
33
31
|
)
|
|
34
32
|
|
|
@@ -45,9 +43,8 @@ expr sub
|
|
|
45
43
|
(file
|
|
46
44
|
(transaction
|
|
47
45
|
(date)
|
|
48
|
-
(
|
|
49
|
-
(
|
|
50
|
-
(postings
|
|
46
|
+
(txn)
|
|
47
|
+
(narration)
|
|
51
48
|
(posting
|
|
52
49
|
(account)
|
|
53
50
|
(incomplete_amount
|
|
@@ -62,7 +59,6 @@ expr sub
|
|
|
62
59
|
(currency)
|
|
63
60
|
)
|
|
64
61
|
)
|
|
65
|
-
)
|
|
66
62
|
)
|
|
67
63
|
)
|
|
68
64
|
|
|
@@ -79,24 +75,22 @@ expr mult
|
|
|
79
75
|
(file
|
|
80
76
|
(transaction
|
|
81
77
|
(date)
|
|
82
|
-
(
|
|
83
|
-
(
|
|
84
|
-
(postings
|
|
78
|
+
(txn)
|
|
79
|
+
(narration)
|
|
85
80
|
(posting
|
|
86
81
|
(account)
|
|
87
82
|
(incomplete_amount
|
|
88
|
-
(binary_number_expr (number) (
|
|
83
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
89
84
|
(currency)
|
|
90
85
|
)
|
|
91
86
|
)
|
|
92
87
|
(posting
|
|
93
88
|
(account)
|
|
94
89
|
(incomplete_amount
|
|
95
|
-
(binary_number_expr (number) (
|
|
90
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
96
91
|
(currency)
|
|
97
92
|
)
|
|
98
93
|
)
|
|
99
|
-
)
|
|
100
94
|
)
|
|
101
95
|
)
|
|
102
96
|
|
|
@@ -113,9 +107,8 @@ expr div
|
|
|
113
107
|
(file
|
|
114
108
|
(transaction
|
|
115
109
|
(date)
|
|
116
|
-
(
|
|
117
|
-
(
|
|
118
|
-
(postings
|
|
110
|
+
(txn)
|
|
111
|
+
(narration)
|
|
119
112
|
(posting
|
|
120
113
|
(account)
|
|
121
114
|
(incomplete_amount
|
|
@@ -130,7 +123,6 @@ expr div
|
|
|
130
123
|
(currency)
|
|
131
124
|
)
|
|
132
125
|
)
|
|
133
|
-
)
|
|
134
126
|
)
|
|
135
127
|
)
|
|
136
128
|
|
|
@@ -148,9 +140,8 @@ expr neg
|
|
|
148
140
|
(file
|
|
149
141
|
(transaction
|
|
150
142
|
(date)
|
|
151
|
-
(
|
|
152
|
-
(
|
|
153
|
-
(postings
|
|
143
|
+
(txn)
|
|
144
|
+
(narration)
|
|
154
145
|
(posting
|
|
155
146
|
(account)
|
|
156
147
|
(incomplete_amount
|
|
@@ -172,7 +163,6 @@ expr neg
|
|
|
172
163
|
(currency)
|
|
173
164
|
)
|
|
174
165
|
)
|
|
175
|
-
)
|
|
176
166
|
)
|
|
177
167
|
)
|
|
178
168
|
|
|
@@ -189,9 +179,8 @@ expr pos
|
|
|
189
179
|
(file
|
|
190
180
|
(transaction
|
|
191
181
|
(date)
|
|
192
|
-
(
|
|
193
|
-
(
|
|
194
|
-
(postings
|
|
182
|
+
(txn)
|
|
183
|
+
(narration)
|
|
195
184
|
(posting
|
|
196
185
|
(account)
|
|
197
186
|
(incomplete_amount
|
|
@@ -206,7 +195,6 @@ expr pos
|
|
|
206
195
|
(currency)
|
|
207
196
|
)
|
|
208
197
|
)
|
|
209
|
-
)
|
|
210
198
|
)
|
|
211
199
|
)
|
|
212
200
|
|
|
@@ -225,14 +213,13 @@ expr predence
|
|
|
225
213
|
(file
|
|
226
214
|
(transaction
|
|
227
215
|
(date)
|
|
228
|
-
(
|
|
229
|
-
(
|
|
230
|
-
(postings
|
|
216
|
+
(txn)
|
|
217
|
+
(narration)
|
|
231
218
|
(posting
|
|
232
219
|
(account)
|
|
233
220
|
(incomplete_amount
|
|
234
221
|
(binary_number_expr
|
|
235
|
-
(binary_number_expr (number) (
|
|
222
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
236
223
|
(plus)
|
|
237
224
|
(number)
|
|
238
225
|
)
|
|
@@ -243,9 +230,9 @@ expr predence
|
|
|
243
230
|
(account)
|
|
244
231
|
(incomplete_amount
|
|
245
232
|
(binary_number_expr
|
|
246
|
-
(binary_number_expr (number) (plus) (number))
|
|
247
|
-
(asterick)
|
|
248
233
|
(number)
|
|
234
|
+
(plus)
|
|
235
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
249
236
|
)
|
|
250
237
|
(currency)
|
|
251
238
|
)
|
|
@@ -254,9 +241,9 @@ expr predence
|
|
|
254
241
|
(account)
|
|
255
242
|
(incomplete_amount
|
|
256
243
|
(binary_number_expr
|
|
257
|
-
(binary_number_expr (number) (plus) (minus) (number))
|
|
258
|
-
(asterick)
|
|
259
244
|
(number)
|
|
245
|
+
(plus)
|
|
246
|
+
(binary_number_expr (unary_number_expr (minus) (number)) (asterisk) (number))
|
|
260
247
|
)
|
|
261
248
|
(currency)
|
|
262
249
|
)
|
|
@@ -265,14 +252,13 @@ expr predence
|
|
|
265
252
|
(account)
|
|
266
253
|
(incomplete_amount
|
|
267
254
|
(binary_number_expr
|
|
268
|
-
(binary_number_expr (number) (plus) (minus) (number))
|
|
269
|
-
(
|
|
255
|
+
(binary_number_expr (number) (plus) (unary_number_expr (minus) (number)))
|
|
256
|
+
(asterisk)
|
|
270
257
|
(number)
|
|
271
258
|
)
|
|
272
259
|
(currency)
|
|
273
260
|
)
|
|
274
261
|
)
|
|
275
|
-
)
|
|
276
262
|
)
|
|
277
263
|
)
|
|
278
264
|
|
|
@@ -289,15 +275,14 @@ expr groups
|
|
|
289
275
|
(file
|
|
290
276
|
(transaction
|
|
291
277
|
(date)
|
|
292
|
-
(
|
|
293
|
-
(
|
|
294
|
-
(postings
|
|
278
|
+
(txn)
|
|
279
|
+
(narration)
|
|
295
280
|
(posting
|
|
296
281
|
(account)
|
|
297
282
|
(incomplete_amount
|
|
298
283
|
(binary_number_expr
|
|
299
|
-
(binary_number_expr (number) (plus) (minus) (number))
|
|
300
|
-
(
|
|
284
|
+
(binary_number_expr (number) (plus) (unary_number_expr (minus) (number)))
|
|
285
|
+
(asterisk)
|
|
301
286
|
(number)
|
|
302
287
|
)
|
|
303
288
|
(currency)
|
|
@@ -308,13 +293,12 @@ expr groups
|
|
|
308
293
|
(incomplete_amount
|
|
309
294
|
(binary_number_expr
|
|
310
295
|
(number)
|
|
311
|
-
(
|
|
312
|
-
(binary_number_expr (number) (plus) (minus) (number))
|
|
296
|
+
(asterisk)
|
|
297
|
+
(binary_number_expr (number) (plus) (unary_number_expr (minus) (number)))
|
|
313
298
|
)
|
|
314
299
|
(currency)
|
|
315
300
|
)
|
|
316
301
|
)
|
|
317
|
-
)
|
|
318
302
|
)
|
|
319
303
|
)
|
|
320
304
|
|
|
@@ -325,7 +309,8 @@ expr different places
|
|
|
325
309
|
2013-05-18 * "Test"
|
|
326
310
|
Assets:Something -(3 * 4) HOOL {120.01 * 2.1 USD} @ 134.02 * 2.1 USD
|
|
327
311
|
Assets:Something 1000000 USD ;; No balance checks.
|
|
328
|
-
|
|
312
|
+
|
|
313
|
+
2014-01-01 balance Assets:Something 3 * 4 * 120.01 * 2.1 USD
|
|
329
314
|
number: -(5662.23 + 22.3)
|
|
330
315
|
|
|
331
316
|
---
|
|
@@ -333,23 +318,56 @@ expr different places
|
|
|
333
318
|
(file
|
|
334
319
|
(transaction
|
|
335
320
|
(date)
|
|
336
|
-
(
|
|
337
|
-
(
|
|
338
|
-
(postings
|
|
321
|
+
(txn)
|
|
322
|
+
(narration)
|
|
339
323
|
(posting
|
|
340
324
|
(account)
|
|
341
325
|
(incomplete_amount
|
|
342
|
-
(binary_number_expr (number) (number))
|
|
326
|
+
(unary_number_expr (minus) (binary_number_expr (number) (asterisk) (number)))
|
|
343
327
|
(currency)
|
|
344
328
|
)
|
|
329
|
+
(cost_spec
|
|
330
|
+
(cost_comp
|
|
331
|
+
(compound_amount
|
|
332
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
333
|
+
(currency)
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
(at)
|
|
338
|
+
(price_annotation
|
|
339
|
+
(incomplete_amount
|
|
340
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
341
|
+
(currency)
|
|
342
|
+
)
|
|
343
|
+
)
|
|
345
344
|
)
|
|
346
345
|
(posting
|
|
347
346
|
(account)
|
|
348
|
-
(incomplete_amount
|
|
349
|
-
|
|
350
|
-
|
|
347
|
+
(incomplete_amount (number) (currency))
|
|
348
|
+
(comment)
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
(balance
|
|
352
|
+
(date)
|
|
353
|
+
(account)
|
|
354
|
+
(amount_tolerance
|
|
355
|
+
(binary_number_expr
|
|
356
|
+
(binary_number_expr
|
|
357
|
+
(binary_number_expr (number) (asterisk) (number))
|
|
358
|
+
(asterisk)
|
|
359
|
+
(number)
|
|
351
360
|
)
|
|
361
|
+
(asterisk)
|
|
362
|
+
(number)
|
|
352
363
|
)
|
|
364
|
+
(currency)
|
|
353
365
|
)
|
|
366
|
+
(key_value
|
|
367
|
+
(key)
|
|
368
|
+
(value
|
|
369
|
+
(unary_number_expr (minus) (binary_number_expr (number) (plus) (number)))
|
|
370
|
+
)
|
|
371
|
+
)
|
|
354
372
|
)
|
|
355
373
|
)
|