Refactor parser header

Make separate lexer, stack and parser structs.
This commit is contained in:
Max Brunsfeld 2014-03-13 00:43:23 -07:00
parent 05a5f9c124
commit 0dc3a95d0c
11 changed files with 361 additions and 276 deletions

View file

@ -1,8 +1,8 @@
#include "runtime_spec_helper.h"
#include "helpers/spy_reader.h"
extern ts_parse_config ts_parse_config_json;
extern "C" ts_parser ts_parse_config_json();
START_TEST
describe("parsing", [&]() {
@ -11,7 +11,7 @@ describe("parsing", [&]() {
before_each([&]() {
doc = ts_document_make();
ts_document_set_parser(doc, ts_parse_config_json);
ts_document_set_parser(doc, ts_parse_config_json());
reader = new SpyReader("{ \"key\": [1, 2] }", 5);
ts_document_set_input(doc, reader->input);
@ -31,7 +31,7 @@ describe("parsing", [&]() {
"(value (number)) "
"(value (number))))))"));
});
it("reads the entire input", [&]() {
AssertThat(reader->chunks_read, Equals(vector<string>({
"{ \"ke",
@ -63,7 +63,7 @@ describe("parsing", [&]() {
"(value (number))))"
));
});
it_skip("re-reads only the changed portion of the input", [&]() {
AssertThat(reader->chunks_read, Equals(vector<string>({
""