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/src/scanner.cc CHANGED
@@ -8,7 +8,7 @@ using std::iswspace;
8
8
  using std::vector;
9
9
 
10
10
  enum TokenType {
11
- HL_STARS,
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[HL_STARS] && iswspace(lexer->lookahead)) {
127
+ } else if (valid_symbols[SECTION] && iswspace(lexer->lookahead)) {
120
128
  org_section_stack.push_back(stars);
121
- lexer->result_symbol = HL_STARS;
129
+ lexer->result_symbol = SECTION;
122
130
  return true;
123
131
  }
124
132
  return false;
package/shell.nix DELETED
@@ -1,13 +0,0 @@
1
- let
2
- pkgs = import <nixpkgs> {};
3
- in
4
- pkgs.mkShell rec {
5
- name = "tree-sitter";
6
-
7
- buildInputs = with pkgs; [
8
- nodejs-14_x
9
- python38Full
10
- tree-sitter
11
- ];
12
-
13
- }