diff --git a/include/compiler.h b/include/tree_sitter/compiler.h similarity index 100% rename from include/compiler.h rename to include/tree_sitter/compiler.h diff --git a/include/parser.h b/include/tree_sitter/parser.h similarity index 99% rename from include/parser.h rename to include/tree_sitter/parser.h index ca5cc7ca..2369123e 100644 --- a/include/parser.h +++ b/include/tree_sitter/parser.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include "runtime.h" +#include "./runtime.h" #include #include diff --git a/include/runtime.h b/include/tree_sitter/runtime.h similarity index 100% rename from include/runtime.h rename to include/tree_sitter/runtime.h diff --git a/spec/fixtures/grammars/arithmetic.cpp b/spec/fixtures/grammars/arithmetic.cpp index a0d1a3b8..f64e3692 100644 --- a/spec/fixtures/grammars/arithmetic.cpp +++ b/spec/fixtures/grammars/arithmetic.cpp @@ -1,5 +1,5 @@ #include "test_grammars.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" using namespace tree_sitter; using namespace rules; diff --git a/spec/fixtures/grammars/json.cpp b/spec/fixtures/grammars/json.cpp index 57bafba4..82e7be2b 100644 --- a/spec/fixtures/grammars/json.cpp +++ b/spec/fixtures/grammars/json.cpp @@ -1,5 +1,5 @@ #include "test_grammars.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" using namespace tree_sitter; using namespace rules; diff --git a/spec/fixtures/grammars/test_grammars.h b/spec/fixtures/grammars/test_grammars.h index d4ac381c..b8024d06 100644 --- a/spec/fixtures/grammars/test_grammars.h +++ b/spec/fixtures/grammars/test_grammars.h @@ -1,7 +1,7 @@ #ifndef TreeSitter_test_grammars_h #define TreeSitter_test_grammars_h -#include "compiler.h" +#include "tree_sitter/compiler.h" namespace test_grammars { tree_sitter::Grammar arithmetic(); diff --git a/spec/fixtures/parsers/arithmetic.c b/spec/fixtures/parsers/arithmetic.c index 3dead0a5..29113e45 100644 --- a/spec/fixtures/parsers/arithmetic.c +++ b/spec/fixtures/parsers/arithmetic.c @@ -1,4 +1,4 @@ -#include "parser.h" +#include "tree_sitter/parser.h" enum ts_symbol { ts_symbol_expression, diff --git a/spec/fixtures/parsers/json.c b/spec/fixtures/parsers/json.c index 363be6ee..7b0671eb 100644 --- a/spec/fixtures/parsers/json.c +++ b/spec/fixtures/parsers/json.c @@ -1,4 +1,4 @@ -#include "parser.h" +#include "tree_sitter/parser.h" enum ts_symbol { ts_symbol_array, diff --git a/spec/spec_helper.h b/spec/spec_helper.h index 6f1b3a43..2b9698f1 100644 --- a/spec/spec_helper.h +++ b/spec/spec_helper.h @@ -4,7 +4,7 @@ #include "bandit/bandit.h" #include "helpers/stream_methods.h" #include "helpers/equals_pointer.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" using namespace tree_sitter; using namespace std; diff --git a/src/compiler/build_tables/first_set.cpp b/src/compiler/build_tables/first_set.cpp index cd4a3b79..ed548d19 100644 --- a/src/compiler/build_tables/first_set.cpp +++ b/src/compiler/build_tables/first_set.cpp @@ -1,5 +1,5 @@ #include "first_set.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rule_can_be_blank.h" #include "rules/visitor.h" #include "rules/seq.h" diff --git a/src/compiler/build_tables/follow_sets.cpp b/src/compiler/build_tables/follow_sets.cpp index 9d9feb93..5deb8581 100644 --- a/src/compiler/build_tables/follow_sets.cpp +++ b/src/compiler/build_tables/follow_sets.cpp @@ -2,7 +2,7 @@ #include "first_set.h" #include "rule_transitions.h" #include "rule_can_be_blank.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" namespace tree_sitter { using std::set; diff --git a/src/compiler/build_tables/item.cpp b/src/compiler/build_tables/item.cpp index 016113c8..7242d3e1 100644 --- a/src/compiler/build_tables/item.cpp +++ b/src/compiler/build_tables/item.cpp @@ -1,5 +1,5 @@ #include "item.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rule_can_be_blank.h" namespace tree_sitter { diff --git a/src/compiler/build_tables/item_set_closure.cpp b/src/compiler/build_tables/item_set_closure.cpp index d3a55378..7cdc7c06 100644 --- a/src/compiler/build_tables/item_set_closure.cpp +++ b/src/compiler/build_tables/item_set_closure.cpp @@ -1,5 +1,5 @@ #include "item_set_closure.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "./follow_sets.h" #include "item.h" diff --git a/src/compiler/build_tables/perform.cpp b/src/compiler/build_tables/perform.cpp index 5e1281c5..9e1531dd 100644 --- a/src/compiler/build_tables/perform.cpp +++ b/src/compiler/build_tables/perform.cpp @@ -2,7 +2,7 @@ #include "item.h" #include "item_set_closure.h" #include "item_set_transitions.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "stream_methods.h" diff --git a/src/compiler/build_tables/rule_can_be_blank.cpp b/src/compiler/build_tables/rule_can_be_blank.cpp index f6359165..c935d564 100644 --- a/src/compiler/build_tables/rule_can_be_blank.cpp +++ b/src/compiler/build_tables/rule_can_be_blank.cpp @@ -1,5 +1,5 @@ #include "rule_can_be_blank.h" -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rules/symbol.h" #include "rules/visitor.h" #include "rules/seq.h" diff --git a/src/compiler/build_tables/rule_can_be_blank.h b/src/compiler/build_tables/rule_can_be_blank.h index faa2d044..94175b33 100644 --- a/src/compiler/build_tables/rule_can_be_blank.h +++ b/src/compiler/build_tables/rule_can_be_blank.h @@ -1,7 +1,7 @@ #ifndef __tree_sitter__rule_can_be_blank__ #define __tree_sitter__rule_can_be_blank__ -#include "compiler.h" +#include "tree_sitter/compiler.h" namespace tree_sitter { namespace build_tables { diff --git a/src/compiler/compile.cpp b/src/compiler/compile.cpp index 6169200f..1873f369 100644 --- a/src/compiler/compile.cpp +++ b/src/compiler/compile.cpp @@ -1,4 +1,4 @@ -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "prepare_grammar/perform.h" #include "build_tables/perform.h" #include "generate_code/c_code.h" diff --git a/src/compiler/generate_code/c_code.cpp b/src/compiler/generate_code/c_code.cpp index 3e64f96a..09c118c3 100644 --- a/src/compiler/generate_code/c_code.cpp +++ b/src/compiler/generate_code/c_code.cpp @@ -246,7 +246,7 @@ namespace tree_sitter { } string includes() { - return "#include \"parser.h\""; + return "#include \"tree_sitter/parser.h\""; } string lex_function() { diff --git a/src/compiler/grammar.cpp b/src/compiler/grammar.cpp index 7dc36385..7f454694 100644 --- a/src/compiler/grammar.cpp +++ b/src/compiler/grammar.cpp @@ -1,4 +1,4 @@ -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "symbol.h" namespace tree_sitter { diff --git a/src/compiler/prepare_grammar/expand_repeats.h b/src/compiler/prepare_grammar/expand_repeats.h index 7d075d5e..b9529d6a 100644 --- a/src/compiler/prepare_grammar/expand_repeats.h +++ b/src/compiler/prepare_grammar/expand_repeats.h @@ -1,7 +1,7 @@ #ifndef __tree_sitter__expand_repeats__ #define __tree_sitter__expand_repeats__ -#include "compiler.h" +#include "tree_sitter/compiler.h" namespace tree_sitter { namespace prepare_grammar { diff --git a/src/compiler/prepare_grammar/extract_tokens.cpp b/src/compiler/prepare_grammar/extract_tokens.cpp index 654519a7..951f90f2 100644 --- a/src/compiler/prepare_grammar/extract_tokens.cpp +++ b/src/compiler/prepare_grammar/extract_tokens.cpp @@ -1,7 +1,7 @@ #include "extract_tokens.h" #include "search_for_symbols.h" #include -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rules/visitor.h" #include "rules/seq.h" #include "rules/choice.h" diff --git a/src/compiler/rules/character_range.cpp b/src/compiler/rules/character_range.cpp index d5466746..635583d6 100644 --- a/src/compiler/rules/character_range.cpp +++ b/src/compiler/rules/character_range.cpp @@ -1,4 +1,4 @@ -#include "compiler.h" +#include "tree_sitter/compiler.h" namespace tree_sitter { using std::string; diff --git a/src/compiler/rules/character_set.h b/src/compiler/rules/character_set.h index 6252ec37..98734df8 100644 --- a/src/compiler/rules/character_set.h +++ b/src/compiler/rules/character_set.h @@ -1,7 +1,7 @@ #ifndef __tree_sitter__character_set__ #define __tree_sitter__character_set__ -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rule.h" #include #include diff --git a/src/compiler/rules/rules.cpp b/src/compiler/rules/rules.cpp index 74a6e798..a7390efe 100644 --- a/src/compiler/rules/rules.cpp +++ b/src/compiler/rules/rules.cpp @@ -1,4 +1,4 @@ -#include "compiler.h" +#include "tree_sitter/compiler.h" #include "rule.h" #include "blank.h" #include "symbol.h" diff --git a/tree_sitter.xcodeproj/project.pbxproj b/tree_sitter.xcodeproj/project.pbxproj index 99818dc8..578ab4b7 100644 --- a/tree_sitter.xcodeproj/project.pbxproj +++ b/tree_sitter.xcodeproj/project.pbxproj @@ -122,7 +122,7 @@ 12D136A2183678A2005F3369 /* repeat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = repeat.cpp; sourceTree = ""; }; 12D136A3183678A2005F3369 /* repeat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = repeat.h; sourceTree = ""; }; 12E71794181D02A80051A649 /* compiler_specs */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = compiler_specs; sourceTree = BUILT_PRODUCTS_DIR; }; - 12E71852181D081C0051A649 /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compiler.h; path = include/compiler.h; sourceTree = SOURCE_ROOT; }; + 12E71852181D081C0051A649 /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compiler.h; path = include/tree_sitter/compiler.h; sourceTree = SOURCE_ROOT; }; 12E75A961891BD32001B8F10 /* json.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = json.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 12E75A981891BF3B001B8F10 /* json.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = json.c; sourceTree = ""; }; 12E75A9B1891C17D001B8F10 /* json_spec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = json_spec.cpp; sourceTree = ""; }; @@ -246,21 +246,31 @@ 1213061C182C854F00FCF928 /* build_tables */ = { isa = PBXGroup; children = ( - 12EDCFB6188205BA005A7A07 /* rule_transitions_spec.cpp */, - 12EDCFB7188205BA005A7A07 /* perform_spec.cpp */, 12BC470618830BC5005AC502 /* first_set_spec.cpp */, 12AB4660188CB3A300DE79DF /* item_set_closure_spec.cpp */, + 12EDCFB7188205BA005A7A07 /* perform_spec.cpp */, 127528B418AACB70006B682B /* rule_can_be_blank_spec.cpp */, + 12EDCFB6188205BA005A7A07 /* rule_transitions_spec.cpp */, ); path = build_tables; sourceTree = ""; }; + 1236A7CB18B2ACA700593ABB /* tree_sitter */ = { + isa = PBXGroup; + children = ( + 12E71852181D081C0051A649 /* compiler.h */, + 121D8B3018795CC0003CF44B /* parser.h */, + 127528B918B041B6006B682B /* runtime.h */, + ); + path = tree_sitter; + sourceTree = ""; + }; 125120A118307FCA00C9B56A /* grammars */ = { isa = PBXGroup; children = ( - 125120A218307FFD00C9B56A /* test_grammars.h */, 125120A3183083BD00C9B56A /* arithmetic.cpp */, 12E75A961891BD32001B8F10 /* json.cpp */, + 125120A218307FFD00C9B56A /* test_grammars.h */, ); path = grammars; sourceTree = ""; @@ -268,8 +278,8 @@ 12AB4662188DCB7B00DE79DF /* helpers */ = { isa = PBXGroup; children = ( - 12AB4663188DCB9800DE79DF /* stream_methods.h */, 1236A7CA18B2ABB900593ABB /* equals_pointer.h */, + 12AB4663188DCB9800DE79DF /* stream_methods.h */, ); path = helpers; sourceTree = ""; @@ -277,9 +287,9 @@ 12D1369F18357066005F3369 /* rules */ = { isa = PBXGroup; children = ( - 121492EA181E200B008E9BDA /* rules_spec.cpp */, - 12D136A0183570F5005F3369 /* pattern_spec.cpp */, 12661BF318A1505A00A259FB /* character_set_spec.cpp */, + 12D136A0183570F5005F3369 /* pattern_spec.cpp */, + 121492EA181E200B008E9BDA /* rules_spec.cpp */, ); name = rules; path = compiler/rules; @@ -347,8 +357,8 @@ 12FD4062185E74DF0041A84E /* parsers */ = { isa = PBXGroup; children = ( - 12E75A981891BF3B001B8F10 /* json.c */, 12FD4065185E7C2F0041A84E /* arithmetic.c */, + 12E75A981891BF3B001B8F10 /* json.c */, ); path = parsers; sourceTree = ""; @@ -382,9 +392,9 @@ 12FD40AD185EE5440041A84E /* runtime */ = { isa = PBXGroup; children = ( - 12FD40DE1860064C0041A84E /* tree.c */, 12EDCF8C187C6282005A7A07 /* document.c */, 12BC470318822A17005AC502 /* error.cpp */, + 12FD40DE1860064C0041A84E /* tree.c */, ); path = runtime; sourceTree = ""; @@ -413,8 +423,8 @@ isa = PBXGroup; children = ( 12FD40DA185FEF0D0041A84E /* arithmetic_spec.cpp */, - 12EDCF89187B498C005A7A07 /* tree_spec.cpp */, 12E75A9B1891C17D001B8F10 /* json_spec.cpp */, + 12EDCF89187B498C005A7A07 /* tree_spec.cpp */, ); path = runtime; sourceTree = ""; @@ -422,9 +432,7 @@ 12FD40D3185FED630041A84E /* include */ = { isa = PBXGroup; children = ( - 12E71852181D081C0051A649 /* compiler.h */, - 121D8B3018795CC0003CF44B /* parser.h */, - 127528B918B041B6006B682B /* runtime.h */, + 1236A7CB18B2ACA700593ABB /* tree_sitter */, ); path = include; sourceTree = ""; @@ -632,6 +640,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, externals/igloo, externals/bandit, + include, ); MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; @@ -672,6 +681,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, externals/igloo, externals/bandit, + include, ); MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = "$(TARGET_NAME)";