tree-sitter-beancount 2.1.2 → 2.1.3
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/.github/dependabot.yml +11 -0
- package/.github/workflows/cicd.yml +3 -3
- package/.github/workflows/release.yml +4 -4
- package/CHANGELOG.md +7 -0
- package/Cargo.toml +1 -1
- package/LICENSE +21 -0
- package/flake.lock +84 -10
- package/flake.nix +80 -83
- package/package.json +2 -2
- package/src/parser.c +1040 -420
- package/src/scanner.cc +11 -3
- package/shell.nix +0 -13
package/src/scanner.cc
CHANGED
|
@@ -8,7 +8,7 @@ using std::iswspace;
|
|
|
8
8
|
using std::vector;
|
|
9
9
|
|
|
10
10
|
enum TokenType {
|
|
11
|
-
|
|
11
|
+
SECTION,
|
|
12
12
|
SECTIONEND,
|
|
13
13
|
END_OF_FILE,
|
|
14
14
|
};
|
|
@@ -75,8 +75,16 @@ struct Scanner {
|
|
|
75
75
|
lexer->advance(lexer, true);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
static bool in_error_recovery(const bool *valid_symbols) {
|
|
79
|
+
return (valid_symbols[SECTION] && valid_symbols[SECTIONEND]
|
|
80
|
+
&& valid_symbols[END_OF_FILE]);
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
bool scan(TSLexer *lexer, const bool *valid_symbols) {
|
|
79
84
|
|
|
85
|
+
if (in_error_recovery(valid_symbols))
|
|
86
|
+
return false;
|
|
87
|
+
|
|
80
88
|
// - Section ends
|
|
81
89
|
int16_t indent_length = 0;
|
|
82
90
|
lexer->mark_end(lexer);
|
|
@@ -116,9 +124,9 @@ struct Scanner {
|
|
|
116
124
|
org_section_stack.pop_back();
|
|
117
125
|
lexer->result_symbol = SECTIONEND;
|
|
118
126
|
return true;
|
|
119
|
-
} else if (valid_symbols[
|
|
127
|
+
} else if (valid_symbols[SECTION] && iswspace(lexer->lookahead)) {
|
|
120
128
|
org_section_stack.push_back(stars);
|
|
121
|
-
lexer->result_symbol =
|
|
129
|
+
lexer->result_symbol = SECTION;
|
|
122
130
|
return true;
|
|
123
131
|
}
|
|
124
132
|
return false;
|