tree-sitter/spec/fixtures/grammars/json.cc
Max Brunsfeld 1c6ad5f7e4 Rename ubiquitous_tokens -> extra_tokens in compiler API
They were already called this in the runtime code.
'Extra' is just easier to say.
2015-12-17 15:50:50 -08:00

29 lines
699 B
C++

#include "tree_sitter/compiler.h"
#include "helpers.h"
namespace tree_sitter_examples {
extern const Grammar json = Grammar({
{ "_value", choice({
sym("object"),
sym("array"),
sym("string"),
sym("number"),
sym("true"),
sym("false"),
sym("null"), }) },
{ "object", in_braces(comma_sep(err(seq({
sym("string"),
str(":"),
sym("_value") })))) },
{ "array", in_brackets(comma_sep(err(sym("_value")))) },
{ "string", pattern("\"([^\"]|\\\\\")*\"") },
{ "number", pattern("\\d+(\\.\\d+)?") },
{ "null", str("null") },
{ "true", str("true") },
{ "false", str("false") },
}).extra_tokens({
pattern("\\s"),
});
} // namespace tree_sitter_examples