Make some implicit constructors explicit

This commit is contained in:
Max Brunsfeld 2014-03-09 22:53:49 -07:00
parent a4120f36d4
commit 504c361cb8
8 changed files with 9 additions and 8 deletions

View file

@ -37,7 +37,7 @@ namespace tree_sitter {
using CanBeBlank::visit;
public:
CanBeBlankRecursive(const PreparedGrammar &grammar) : grammar(grammar) {}
explicit CanBeBlankRecursive(const PreparedGrammar &grammar) : grammar(grammar) {}
void visit(const rules::Symbol *rule) {
value = grammar.has_definition(*rule) && apply(grammar.rule(*rule));

View file

@ -9,6 +9,7 @@ namespace tree_sitter {
struct CharacterRange {
char min;
char max;
// IMPLICIT_CONSTRUCTORS
CharacterRange(char value);
CharacterRange(char min, char max);
bool operator==(const CharacterRange &other) const;

View file

@ -13,8 +13,8 @@ namespace tree_sitter {
class CharacterSet : public Rule {
public:
CharacterSet();
CharacterSet(const std::set<CharacterRange> &ranges);
CharacterSet(const std::initializer_list<CharacterRange> &ranges);
explicit CharacterSet(const std::set<CharacterRange> &ranges);
explicit CharacterSet(const std::initializer_list<CharacterRange> &ranges);
bool operator==(const Rule& other) const;
bool operator<(const CharacterSet &) const;

View file

@ -16,7 +16,7 @@ namespace tree_sitter {
class PatternParser {
public:
PatternParser(const string &input) :
explicit PatternParser(const string &input) :
input(input),
length(input.length()),
position(0) {}

View file

@ -9,7 +9,7 @@ namespace tree_sitter {
class Pattern : public Rule {
const std::string value;
public:
Pattern(const std::string &string);
explicit Pattern(const std::string &string);
bool operator==(const Rule& other) const;
size_t hash_code() const;

View file

@ -8,7 +8,7 @@ namespace tree_sitter {
namespace rules {
class Repeat : public Rule {
public:
Repeat(rule_ptr content);
explicit Repeat(rule_ptr content);
bool operator==(const Rule& other) const;
size_t hash_code() const;

View file

@ -8,7 +8,7 @@ namespace tree_sitter {
namespace rules {
class String : public Rule {
public:
String(std::string value);
explicit String(std::string value);
bool operator==(const Rule& other) const;
size_t hash_code() const;

View file

@ -16,7 +16,7 @@ namespace tree_sitter {
class Symbol : public Rule {
public:
Symbol(const std::string &name);
explicit Symbol(const std::string &name);
Symbol(const std::string &name, SymbolType type);
bool operator==(const Rule& other) const;