Max Brunsfeld
abbc282950
Add a public function for printing debugging graphs
2016-02-23 11:16:50 -08:00
Max Brunsfeld
2b35890bbb
Add ts_node_symbols() function
2016-02-19 15:41:30 -08:00
Max Brunsfeld
b80a330a74
Fix assorted memory leaks in test code
2016-02-05 12:23:54 -08:00
Max Brunsfeld
3dde0a6f39
Handle allocation failures during parsing
2016-01-19 18:08:01 -08:00
Max Brunsfeld
9d0835edbf
Return non-const string from ts_node_string
...
The caller should free the string.
2016-01-18 10:27:23 -08:00
Max Brunsfeld
d4632ab9a9
Make the compile function plain C and take a JSON grammar
2016-01-11 12:33:48 -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
4b04afac5e
Control lexer's error-mode via explicit boolean argument
...
Previously, the lexer would operate in error-mode (ignoring any garbage input
until it found a valid token) if it was invoked in the 'error' state. Now that
the error state is deduped with other lexical states, the lexer might be invoked
in that state even when error-mode is not intended. This adds a third argument
to `ts_lex` that explicitly sets the error-mode.
This bug was unlikely to occur in any real grammars, but it caused the
node-tree-sitter-compiler test suite to fail for some grammars with only one
rule.
2015-12-30 09:43:12 -08:00
Max Brunsfeld
4ad1a666be
clang-format
2015-12-29 21:17:31 -08:00
Max Brunsfeld
97a281502e
Store parse table more compactly
2015-12-29 11:27:41 -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
2bcd2e4d00
Reuse fragile tokens that came from the current lex state
2015-12-21 16:04:11 -08:00
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
Max Brunsfeld
c495076adb
Record in parse table which actions can hide splits
...
Suppose a parse state S has multiple actions for a terminal lookahead symbol A.
Then during incremental parsing, while in state S, the parser should not
reuse a non-terminal lookahead B where FIRST(B) contains A, because reusing B
might prematurely discard one of the possible actions that a batch parser
would have attempted in state S, upon seeing A as a lookahead.
2015-12-17 13:11:56 -08:00
Max Brunsfeld
66144dc28e
Treat tokens that are sometimes extra as fragile
2015-12-16 20:04:45 -08:00
Max Brunsfeld
d713054d61
Record which tokens are fragile when lexing
2015-12-10 21:05:54 -08:00
Max Brunsfeld
d2bf88d5fe
Include rows and columns in TSLength
...
This way, we don't have to have separate 1D and 2D versions for so many values
2015-12-04 20:20:29 -08:00
Max Brunsfeld
22c76fc71b
Remove TSLength from runtime header
...
Refactor node functions now that character offset and byte offset are stored separately
2015-12-04 10:45:30 -08:00
Max Brunsfeld
8e217f758c
Use individual args instead of TSLength in input seek function
2015-12-03 23:06:01 -08:00
Max Brunsfeld
b3a6de6dad
Replace node pos/size functions with start/end char/byte functions
2015-12-03 22:59:27 -08:00
Max Brunsfeld
ad619d95f6
Add 'extra' field to symbol metadata
...
This stores whether a symbol is only ever used as a ubiquitous token. This will
allow ubiquitous nodes to be reused more effectively: if they are always
ubiquitous, then they can be reused immediately, and otherwise, they must be
broken down in case they need to be used structurally.
2015-12-02 15:10:24 -08:00
Max Brunsfeld
f08554e958
Replace NodeType enum with SymbolMetadata bitfield
...
This will allow storing other metadata about symbols, like if they
only appear as ubiquitous tokens
2015-12-02 15:10:24 -08:00
joshvera
7633cbb836
indentation
2015-11-30 12:59:23 -05:00
joshvera
3d9a44d880
Calculate the column and offset separately in TSNode
2015-11-25 13:36:19 -05:00
joshvera
1687d66776
expose ts_node start and end point functions
2015-11-25 11:57:39 -05:00
joshvera
8446b657f0
Rename position to offset and point to offset_point
2015-11-18 17:53:38 -08:00
joshvera
cf72f2f0ae
ts_node_size_point
2015-11-18 16:47:27 -08:00
joshvera
6485e27d70
add ts_node_end_point
2015-11-18 16:45:10 -08:00
joshvera
b0f6bac3ab
replace start and end with padding and size
2015-11-18 16:34:50 -08:00
joshvera
e720922662
Add source info to TSLexer
2015-11-12 12:24:05 -05:00
Rob Rix
3da510d53b
Add a prototype for the symbol count.
2015-10-29 12:44:28 -04:00
Rob Rix
a176baa26f
Pass a language, rather than a document.
2015-10-29 12:41:21 -04:00
Rob Rix
09162d1981
Export the symbol over ts_language_….
2015-10-29 12:40:01 -04:00
Rob Rix
63f1a618b4
Add a prototype for getting the name for a symbol from a document.
2015-10-28 17:12:43 -04:00
Max Brunsfeld
0955f660d0
Add ts_document_invalidate, for forcing a full re-parse
2015-10-18 13:05:40 -07:00
Max Brunsfeld
9959fe35b0
Allow associativity to be specified in rules w/o precedence
2015-10-13 11:25:28 -07:00
Max Brunsfeld
82726ad53b
Define repeat rule in terms of repeat1 rule
2015-10-12 19:22:05 -07:00
Max Brunsfeld
f37f73f92f
Add ability to edit multiple times between parses
2015-09-18 23:20:06 -07:00
Max Brunsfeld
296d8cc1e8
clang-format
2015-09-13 19:41:11 -07:00
Max Brunsfeld
66ad271c82
Add Document parse_count() method, for tracking if trees are still valid
2015-09-10 14:23:42 -07:00
Max Brunsfeld
e6f3239bef
Move stream operator definitions to spec helpers
...
This is one less thing for users to worry about when compiling and linking
the library itself
2015-09-10 10:12:11 -07:00
Max Brunsfeld
67241e3052
Don't use std::set in public compiler header
...
Just use vectors
2015-09-08 23:43:45 -07:00
Max Brunsfeld
252fa7b631
Add Document getter methods for input, language
2015-09-08 23:33:43 -07:00
Max Brunsfeld
7ee5eaa16a
Rename node accessor methods
...
Instead of child() vs concrete_child(), next_sibling() vs next_concrete_sibling(), etc,
the default is switched: child() refers to the concrete syntax tree, and named_child()
refers to the AST. Because the AST is abstract through exclusion of some nodes, the
names are clearer if the qualifier goes on the AST operations
2015-09-08 23:16:24 -07:00
Max Brunsfeld
245daffbc4
Add {next,prev}_concrete_sibling Node methods
2015-09-08 21:43:37 -07:00
Max Brunsfeld
c3f3f19ea8
Add concrete_child and concrete_child_count Node methods
2015-09-08 09:53:26 -07:00
Max Brunsfeld
9591c88f39
In runtime, distinguish between anonymous and hidden nodes
2015-09-06 00:12:37 -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
e386c634aa
Remove unused Grammar methods
2015-09-03 17:19:43 -07:00