Max Brunsfeld
46ec0804f8
Move tree comparison function to a separate translation unit
2017-08-04 11:03:14 -07:00
Phil Turnbull
2155505dcd
Enabled Fortify for libruntime.a
...
There is currently no code in libruntime.a that Fortify can protect so this
doesn't actually change the generated assembly. However, we may add code in the
future that Fortify can protect.
clang defines `_FORTIFY_SOURCE` by default so we need to undefine then redefine
it to avoid build errors.
2017-07-17 14:15:08 -07:00
Max Brunsfeld
34279257f9
Merge pull request #91 from tree-sitter/libFuzzer
...
Add support for fuzzing with libFuzzer
2017-07-17 11:43:01 -07:00
Phil Turnbull
798ef5e4dc
Add libFuzzer support
...
This adds support for fuzzing tree-sitter grammars with libFuzzer. This
currently only works on Linux because of linking issues on macOS. Breifly, the
AddressSanitizer library is dynamically linked into the fuzzer binary and
cannot be found at runtime if built with a compiler that wasn't provided by
Xcode(?). The runtime library is statically linked on Linux so this isn't a
problem.
2017-07-14 13:50:41 -07:00
Max Brunsfeld
b3a72954ff
Introduce RENAME rule type
2017-07-13 17:17:22 -07:00
Max Brunsfeld
76e35fd037
Enable address sanitizer when running tests on mac
...
Signed-off-by: Philip Turnbull <philipturnbull@github.com>
2017-06-27 14:54:20 -07:00
Max Brunsfeld
79ffc20be1
Remove RTTI flag in gyp file
2017-03-17 13:31:35 -07:00
Max Brunsfeld
db4b9ebc7c
Implement Rule as a union rather than an abstract base class
2017-03-17 13:29:31 -07:00
Max Brunsfeld
64e9230071
Use LexTableBuilder to detect conflicts between tokens more correctly
2017-03-08 12:47:38 -08:00
Max Brunsfeld
abf8a4f2c2
🎨
2017-03-01 22:15:26 -08:00
Max Brunsfeld
686dc0997c
Avoid introducing certain lexical conflicts during parse state merging
...
The current pretty conservative approach is to avoid merging parse states which
would cause a pair tokens to co-exist for the first time in any parse state,
where the two tokens can start with the same character and at least one of the
tokens can contain a character which is part of the grammar's separators.
2017-02-27 22:54:38 -08:00
Max Brunsfeld
3c8e6f9987
Restructure parse state merging logic
...
* Remove remnants of templatized remove_duplicate_states function
* Rename recovery_tokens function to get_compatible_tokens and augment it
also compute pairs of tokens which could potentially be incompatible
2017-02-26 12:23:48 -08:00
Max Brunsfeld
cefc57fe86
Move error cost comparisons into their own source file
2017-02-19 21:54:06 -08:00
Max Brunsfeld
32387400c6
Rework LR conflict resolution
...
* Unify precedence/associativity-based resolution with the
search for a whitelisted conflict
* Improve conflict error messages
2016-11-18 13:50:55 -08:00
Max Brunsfeld
8d9c261e3a
Don't include reduce actions for nonterminal lookaheads
2016-11-10 11:33:37 -08:00
Max Brunsfeld
22c550c9d6
Discard tokens after error detection to find the best repair
...
* Use GLR stack-splitting to try all numbers of tokens to
discard until a repair is found.
* Check the validity of repairs by looking at the child trees,
rather than the statically-computed 'in-progress symbols' list
2016-05-11 13:49:43 -07:00
Max Brunsfeld
5b74813a5c
Refine logic for which tokens to use in error recovery
2016-04-27 14:09:19 -07:00
Max Brunsfeld
dee1f697c1
Compute the set of variables that can begin with each terminal symbol
2016-02-25 21:51:52 -08:00
Max Brunsfeld
1543a6c7b0
Handle allocation failures when instantiating documents
2016-01-18 11:32:10 -08:00
Max Brunsfeld
b69e19c525
Add plain C API for compiling a JSON grammar
2016-01-10 13:44:22 -08:00
Max Brunsfeld
36870bfced
Make Grammar a simple struct
2016-01-08 15:51:30 -08:00
Max Brunsfeld
f2e7058ad9
Support UTF16 directly
...
This makes the API easier to use from javascript
2015-12-28 13:53:22 -08:00
Max Brunsfeld
4ab4fd7346
Merge pull request #4 from maxbrunsfeld/mb-precedence-handling-within-tokens
...
Make precedence more useful within tokens
2015-11-01 21:50:53 -08:00
Max Brunsfeld
998ae533da
Make completion_status() a method on LexItem
2015-10-30 16:48:37 -07:00
Max Brunsfeld
c8be143f65
🔥 get_metadata function
2015-10-30 16:22:25 -07:00
Max Brunsfeld
a26d7849ce
Merge pull request #2 from robrix/get-symbol-names-from-documents
...
Get symbol names from documents
2015-10-29 10:51:13 -07:00
Rob Rix
d5f6581531
Add the runtime file to the project.
2015-10-29 12:46:51 -04:00
Max Brunsfeld
a8ead10d6f
In lex error state, don't look for tokens that would match *any* line
2015-10-28 17:45:17 -07:00
Max Brunsfeld
db9966b57c
Simplify lex item set transitions code
2015-10-11 22:51:37 -07:00
Max Brunsfeld
25791085c3
Normalize lexical grammar rules before constructing lex table
2015-10-11 16:56:00 -07:00
Max Brunsfeld
6d748a6714
Store parse actions' precedences as ranges, not sets
2015-10-05 16:05:19 -07:00
Max Brunsfeld
f01972c64e
Reorganize ParseItemSet and LexItemSet
2015-10-05 15:09:06 -07:00
Max Brunsfeld
c4ef228397
Share common lookahead sets between parse item sets
2015-10-04 21:33:54 -07:00
Max Brunsfeld
ebc52f109d
Merge branch 'flatten-rules-into-productions'
...
This branch had diverged considerably, so merging it required changing a lot
of code.
Conflicts:
project.gyp
spec/compiler/build_tables/action_takes_precedence_spec.cc
spec/compiler/build_tables/build_conflict_spec.cc
spec/compiler/build_tables/build_parse_table_spec.cc
spec/compiler/build_tables/first_symbols_spec.cc
spec/compiler/build_tables/item_set_closure_spec.cc
spec/compiler/build_tables/item_set_transitions_spec.cc
spec/compiler/build_tables/rule_can_be_blank_spec.cc
spec/compiler/helpers/containers.h
spec/compiler/prepare_grammar/expand_repeats_spec.cc
spec/compiler/prepare_grammar/extract_tokens_spec.cc
src/compiler/build_tables/action_takes_precedence.h
src/compiler/build_tables/build_parse_table.cc
src/compiler/build_tables/first_symbols.cc
src/compiler/build_tables/first_symbols.h
src/compiler/build_tables/item_set_closure.cc
src/compiler/build_tables/item_set_transitions.cc
src/compiler/build_tables/parse_item.cc
src/compiler/build_tables/parse_item.h
src/compiler/build_tables/rule_can_be_blank.cc
src/compiler/build_tables/rule_can_be_blank.h
src/compiler/prepare_grammar/expand_repeats.cc
src/compiler/prepare_grammar/extract_tokens.cc
src/compiler/prepare_grammar/extract_tokens.h
src/compiler/prepare_grammar/prepare_grammar.cc
src/compiler/rules/built_in_symbols.cc
src/compiler/rules/built_in_symbols.h
src/compiler/syntax_grammar.cc
src/compiler/syntax_grammar.h
2015-10-02 23:46:39 -07:00
Max Brunsfeld
6254f45c1b
Rename ParseStack -> Stack
2015-09-18 22:02:06 -07:00
Max Brunsfeld
b3d883e128
Store edits in trees, not by splitting stack
...
This allows for multiple edits per parse, though it is not exposed through
the API yet
2015-09-18 22:02:06 -07:00
Max Brunsfeld
5982b77c97
In compiler, distinguish between anonymous tokens and hidden rules
2015-09-05 22:28:55 -07:00
Max Brunsfeld
bd77ab1ac9
Move public rule functions out of rule namespace
...
This way, there's only one public namespace: tree_sitter
2015-09-03 17:49:20 -07:00
Max Brunsfeld
97bb7a26cf
Fix precedence calculations when building parse table
...
* Recurse into choice rules
* Compute reduction precedence differently than shift precedence
2015-09-02 13:05:54 -07:00
Max Brunsfeld
9e57f2b881
Start work on graph-structured stack
2015-06-18 17:03:16 -07:00
Max Brunsfeld
0c4620f3ab
Build with -g, -O0 for specs
2015-06-15 15:26:06 -07:00
Max Brunsfeld
7872ddd21b
Improve reduce/reduce conflict error message
2015-03-16 11:59:45 -07:00
Max Brunsfeld
9a198562e0
Treat parse conflicts as errors in grammar compilation
...
For now, only reduce/reduce conflicts w/ no tie-breaking precedence
are treated as errors. The rest are dropped, because shift/reduce
conflicts are currently very common because we don't have a way
of specifying associativity along w/ precedence.
2015-03-15 20:31:41 -07:00
Max Brunsfeld
52daffb3f3
Separate syntax rules into flat lists of symbols
...
This way, every ParseItem can be associated with a particular production
for its non-terminal. That lets us keep track of which productions are
involved in shift/reduce conflicts.
2015-02-16 22:11:03 -08:00
Max Brunsfeld
22a4c5213d
Remove -O0 compile flag in tests
2015-02-15 21:23:17 -08:00
Max Brunsfeld
34d96909d1
Move {Syntax,Lexical}Grammar into separate files
2015-01-14 21:10:41 -08:00
Max Brunsfeld
0d267e41aa
Replace LexConflictManager class with action_takes_precedence function
2015-01-11 19:50:58 -08:00
Max Brunsfeld
5dc08ccce9
Include names of in-progress rules in shift/reduce conflicts
2014-11-05 18:39:50 -08:00
Max Brunsfeld
3bcb221379
Include non-terminal lookahead symbols for reduction actions
...
This is necessary for re-using the right subtree after an edit
2014-10-10 12:06:16 -07:00
Max Brunsfeld
cb5ecbd491
Handle string and regex rules w/ non-ascii chars
2014-09-28 18:21:22 -07:00