Add golang example grammar
Also, support '\a' character class shorthand in regexes, for alphabetical characters
This commit is contained in:
parent
13c4e6e648
commit
7adb0bf34f
10 changed files with 4044 additions and 1015 deletions
|
|
@ -4,6 +4,7 @@
|
|||
extern "C" ts_parser ts_parser_javascript();
|
||||
extern "C" ts_parser ts_parser_json();
|
||||
extern "C" ts_parser ts_parser_arithmetic();
|
||||
extern "C" ts_parser ts_parser_golang();
|
||||
|
||||
START_TEST
|
||||
|
||||
|
|
@ -18,38 +19,25 @@ describe("Languages", [&]() {
|
|||
ts_document_free(doc);
|
||||
});
|
||||
|
||||
auto run_tests_for_language = [&](string language) {
|
||||
for (auto &entry : test_entries_for_language(language)) {
|
||||
it(entry.description.c_str(), [&]() {
|
||||
ts_document_set_input_string(doc, entry.input.c_str());
|
||||
AssertThat(ts_document_string(doc), Equals(entry.tree_string.c_str()));
|
||||
auto run_tests_for_language = [&](string language, ts_parser parser) {
|
||||
describe(language.c_str(), [&]() {
|
||||
before_each([&]() {
|
||||
ts_document_set_parser(doc, parser);
|
||||
});
|
||||
}
|
||||
|
||||
for (auto &entry : test_entries_for_language(language)) {
|
||||
it(entry.description.c_str(), [&]() {
|
||||
ts_document_set_input_string(doc, entry.input.c_str());
|
||||
AssertThat(ts_document_string(doc), Equals(entry.tree_string.c_str()));
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
describe("json", [&]() {
|
||||
before_each([&]() {
|
||||
ts_document_set_parser(doc, ts_parser_json());
|
||||
});
|
||||
|
||||
run_tests_for_language("json");
|
||||
});
|
||||
|
||||
describe("arithmetic", [&]() {
|
||||
before_each([&]() {
|
||||
ts_document_set_parser(doc, ts_parser_arithmetic());
|
||||
});
|
||||
|
||||
run_tests_for_language("arithmetic");
|
||||
});
|
||||
|
||||
describe("javascript", [&]() {
|
||||
before_each([&]() {
|
||||
ts_document_set_parser(doc, ts_parser_javascript());
|
||||
});
|
||||
|
||||
run_tests_for_language("javascript");
|
||||
});
|
||||
run_tests_for_language("json", ts_parser_json());
|
||||
run_tests_for_language("arithmetic", ts_parser_arithmetic());
|
||||
run_tests_for_language("javascript", ts_parser_javascript());
|
||||
run_tests_for_language("golang", ts_parser_golang());
|
||||
});
|
||||
|
||||
END_TEST
|
||||
Loading…
Add table
Add a link
Reference in a new issue