Add token helper for building token rules

Now you can specify the structure of tokens using
all of the rule functions, not just `str` and `pattern`
This commit is contained in:
Max Brunsfeld 2014-05-01 12:43:29 -07:00
parent d685edf015
commit 6d40dcf881
8 changed files with 59 additions and 12 deletions

View file

@ -9,7 +9,8 @@ namespace tree_sitter {
namespace rules {
typedef enum {
START_TOKEN,
PRECEDENCE
PRECEDENCE,
IS_TOKEN,
} MetadataKey;
class Metadata : public Rule {
@ -21,6 +22,7 @@ namespace tree_sitter {
rule_ptr copy() const;
std::string to_string() const;
void accept(Visitor *visitor) const;
int value_for(MetadataKey key) const;
const rule_ptr rule;
const std::map<MetadataKey, int> value;