tree-sitter/src/compiler/rules/metadata.h
Max Brunsfeld 1da9f1fdfd Store rule metadata as a map, not a single number
Need to store more than just boolean values
2014-04-07 08:50:00 -07:00

31 lines
770 B
C++

#ifndef COMPILER_RULES_METADATA_H_
#define COMPILER_RULES_METADATA_H_
#include <string>
#include <map>
#include "compiler/rules/rule.h"
namespace tree_sitter {
namespace rules {
typedef enum {
START_TOKEN,
PRECEDENCE
} MetadataKey;
class Metadata : public Rule {
public:
Metadata(rule_ptr rule, std::map<MetadataKey, int> value);
bool operator==(const Rule& other) const;
size_t hash_code() const;
rule_ptr copy() const;
std::string to_string() const;
void accept(Visitor *visitor) const;
const rule_ptr rule;
const std::map<MetadataKey, int> value;
};
}
}
#endif // COMPILER_RULES_METADATA_H_