Fix linter errors
This commit is contained in:
parent
82726ad53b
commit
4b817dc07c
15 changed files with 26 additions and 26 deletions
|
|
@ -38,7 +38,7 @@ describe("item_set_closure", []() {
|
|||
ParseItemSet item_set = item_set_closure(ParseItemSet({
|
||||
{
|
||||
ParseItem(Symbol(0), 0, 0, 100),
|
||||
set<Symbol>({ Symbol(10, true) }),
|
||||
LookaheadSet({ Symbol(10, true) }),
|
||||
}
|
||||
}), grammar);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include "compiler/build_tables/lex_item.h"
|
||||
#include <unordered_set>
|
||||
#include "compiler/build_tables/get_metadata.h"
|
||||
#include "compiler/build_tables/lex_item_transitions.h"
|
||||
#include "compiler/rules/symbol.h"
|
||||
#include <unordered_set>
|
||||
|
||||
namespace tree_sitter {
|
||||
namespace build_tables {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class LexItem {
|
|||
class LexItemSet {
|
||||
public:
|
||||
LexItemSet();
|
||||
LexItemSet(const std::unordered_set<LexItem, LexItem::Hash> &);
|
||||
explicit LexItemSet(const std::unordered_set<LexItem, LexItem::Hash> &);
|
||||
|
||||
bool operator==(const LexItemSet &) const;
|
||||
std::map<rules::CharacterSet, LexItemSet> transitions() const;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include "compiler/build_tables/rule_can_be_blank.h"
|
||||
#include "compiler/rules/blank.h"
|
||||
#include "compiler/rules/choice.h"
|
||||
|
|
@ -28,10 +29,10 @@ class LexItemTransitions : public rules::RuleFn<void> {
|
|||
const rules::Symbol &item_lhs;
|
||||
|
||||
LexItemSet transform_item_set(const LexItemSet &item_set,
|
||||
function<rule_ptr(rule_ptr)> transform) {
|
||||
function<rule_ptr(rule_ptr)> callback) {
|
||||
LexItemSet new_set;
|
||||
for (const LexItem &item : item_set.entries)
|
||||
new_set.entries.insert(LexItem(item.lhs, transform(item.rule)));
|
||||
new_set.entries.insert(LexItem(item.lhs, callback(item.rule)));
|
||||
return new_set;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COMPILER_BUILD_TABLES_RULE_TRANSITIONS_H_
|
||||
#define COMPILER_BUILD_TABLES_RULE_TRANSITIONS_H_
|
||||
#ifndef COMPILER_BUILD_TABLES_LEX_ITEM_TRANSITIONS_H_
|
||||
#define COMPILER_BUILD_TABLES_LEX_ITEM_TRANSITIONS_H_
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
|
@ -16,4 +16,4 @@ void lex_item_transitions(std::map<rules::CharacterSet, LexItemSet> *transitions
|
|||
} // namespace build_tables
|
||||
} // namespace tree_sitter
|
||||
|
||||
#endif // COMPILER_BUILD_TABLES_RULE_TRANSITIONS_H_
|
||||
#endif // COMPILER_BUILD_TABLES_LEX_ITEM_TRANSITIONS_H_
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace build_tables {
|
|||
class LookaheadSet {
|
||||
public:
|
||||
LookaheadSet();
|
||||
LookaheadSet(const std::set<rules::Symbol> &);
|
||||
explicit LookaheadSet(const std::set<rules::Symbol> &);
|
||||
|
||||
bool empty() const;
|
||||
bool operator==(const LookaheadSet &) const;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class ParseItem {
|
|||
class ParseItemSet {
|
||||
public:
|
||||
ParseItemSet();
|
||||
ParseItemSet(const std::map<ParseItem, LookaheadSet> &);
|
||||
explicit ParseItemSet(const std::map<ParseItem, LookaheadSet> &);
|
||||
|
||||
std::map<rules::Symbol, ParseItemSet> transitions(const SyntaxGrammar &) const;
|
||||
bool operator==(const ParseItemSet &) const;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "compiler/parse_table.h"
|
||||
#include "compiler/precedence_range.h"
|
||||
#include <string>
|
||||
#include "compiler/precedence_range.h"
|
||||
|
||||
namespace tree_sitter {
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ struct PrecedenceRange {
|
|||
PrecedenceRange();
|
||||
PrecedenceRange(int min, int max);
|
||||
|
||||
void add(int);
|
||||
void add(int value);
|
||||
bool operator==(const PrecedenceRange &other) const;
|
||||
bool operator<(const PrecedenceRange &other) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#include "compiler/prepare_grammar/flatten_grammar.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "compiler/prepare_grammar/extract_choices.h"
|
||||
#include "compiler/prepare_grammar/initial_syntax_grammar.h"
|
||||
#include "compiler/rules/visitor.h"
|
||||
|
|
@ -6,8 +9,6 @@
|
|||
#include "compiler/rules/symbol.h"
|
||||
#include "compiler/rules/metadata.h"
|
||||
#include "compiler/rules/built_in_symbols.h"
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
namespace tree_sitter {
|
||||
namespace prepare_grammar {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COMPILER_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
#define COMPILER_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
#ifndef COMPILER_PREPARE_GRAMMAR_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
#define COMPILER_PREPARE_GRAMMAR_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
@ -21,4 +21,4 @@ struct InitialSyntaxGrammar {
|
|||
} // namespace prepare_grammar
|
||||
} // namespace tree_sitter
|
||||
|
||||
#endif // COMPILER_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
#endif // COMPILER_PREPARE_GRAMMAR_INITIAL_SYNTAX_GRAMMAR_H_
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ class Rule {
|
|||
virtual void accept(rules::Visitor *visitor) const = 0;
|
||||
virtual ~Rule();
|
||||
|
||||
template<typename T>
|
||||
const T * as() const {
|
||||
template <typename T>
|
||||
const T *as() const {
|
||||
return dynamic_cast<const T *>(this);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
#include "compiler/rules/character_range.h"
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include "compiler/util/string_helpers.h"
|
||||
|
||||
namespace tree_sitter {
|
||||
namespace rules {
|
||||
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
using std::to_string;
|
||||
|
||||
CharacterRange::CharacterRange(uint32_t value) : min(value), max(value) {}
|
||||
CharacterRange::CharacterRange(uint32_t min, uint32_t max)
|
||||
|
|
@ -32,7 +29,7 @@ string CharacterRange::to_string() const {
|
|||
if (min == max)
|
||||
return util::escape_char(min);
|
||||
else
|
||||
return string() + util::escape_char(min) + "-" + util::escape_char(max);
|
||||
return util::escape_char(min) + "-" + util::escape_char(max);
|
||||
}
|
||||
|
||||
} // namespace rules
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COMPILER_PREPARED_GRAMMAR_H_
|
||||
#define COMPILER_PREPARED_GRAMMAR_H_
|
||||
#ifndef COMPILER_SYNTAX_GRAMMAR_H_
|
||||
#define COMPILER_SYNTAX_GRAMMAR_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
@ -44,4 +44,4 @@ struct SyntaxGrammar {
|
|||
|
||||
} // namespace tree_sitter
|
||||
|
||||
#endif // COMPILER_PREPARED_GRAMMAR_H_
|
||||
#endif // COMPILER_SYNTAX_GRAMMAR_H_
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef COMPILER_VARIABLE_H_
|
||||
#define COMPILER_VARIABLE_H_
|
||||
|
||||
#include <string>
|
||||
#include "tree_sitter/compiler.h"
|
||||
#include "compiler/rules/symbol.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue