Commit graph

74 commits

Author SHA1 Message Date
Max Brunsfeld
95828f42a8 Fix leak of StringInput wrapper struct 2016-01-29 16:40:38 -08:00
Max Brunsfeld
3dde0a6f39 Handle allocation failures during parsing 2016-01-19 18:08:01 -08:00
Max Brunsfeld
1543a6c7b0 Handle allocation failures when instantiating documents 2016-01-18 11:32:10 -08:00
Max Brunsfeld
87316f22f3 Wrap all calls to malloc and friends 2016-01-15 15:27:50 -08:00
Max Brunsfeld
da1bc038e5 Remove nested options structs in Tree 2015-12-22 14:20:58 -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
joshvera
2dc63f2c30 Revert "start the root node from 1"
This reverts commit 7fab9e2c42.
2015-11-30 12:16:49 -05:00
joshvera
7fab9e2c42 start the root node from 1 2015-11-25 14:28:52 -05:00
joshvera
3d9a44d880 Calculate the column and offset separately in TSNode 2015-11-25 13:36:19 -05:00
joshvera
b0f6bac3ab replace start and end with padding and size 2015-11-18 16:34:50 -08:00
Max Brunsfeld
0955f660d0 Add ts_document_invalidate, for forcing a full re-parse 2015-10-18 13:05:40 -07:00
Max Brunsfeld
216ce8c80b Rename receiver parameter to 'self' 2015-10-14 22:14:08 -07:00
Max Brunsfeld
aba8af9e5b Cleanup debug logging in parser 2015-09-22 19:35:13 -07:00
Max Brunsfeld
7be067a2e9 Guard for null tree in ts_document_edit 2015-09-20 13:39:18 -07:00
Max Brunsfeld
f37f73f92f Add ability to edit multiple times between parses 2015-09-18 23:20: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
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
252fa7b631 Add Document getter methods for input, language 2015-09-08 23:33:43 -07:00
Max Brunsfeld
ebd60213d9 Drop release functions from callback structs
The caller can just as easily take care of the cleanup explicitly
2015-09-08 23:24:33 -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
53926c467e Don't automatically hide singleton nodes 2015-09-02 16:36:29 -07:00
Max Brunsfeld
21258e6a9e Remove 'document' wrapper node 2015-08-22 10:48:34 -07:00
Max Brunsfeld
6933d7b425 🎨 naming conventions 2015-08-16 20:05:47 -07:00
Max Brunsfeld
3e17172f6e Remove unnecessary conditional 2015-08-16 10:54:02 -07:00
Max Brunsfeld
8a9626bfc5 Simplify storage of position on nodes 2015-08-14 14:48:29 -07:00
Max Brunsfeld
54e40b8146 Rework AST access API: reduce heap allocation 2015-07-31 15:47:48 -07:00
Max Brunsfeld
f9b057f3a9 clang-format everything 2015-07-27 18:29:48 -07:00
Max Brunsfeld
8cf800ef5d Unify debugging API for parsing and lexing 2014-10-17 17:52:54 -07:00
Max Brunsfeld
c594208ab8 Allow callbacks to be specified for debug output 2014-10-13 01:02:18 -07:00
Max Brunsfeld
e23f11b7c4 Allow lexical debug mode to be enabled on documents
- `ts_document_set_debug(doc, 1)` implies parse debug mode
- `ts_document_set_debug(doc, > 1)` implies parse and lex debug mode
2014-09-11 13:12:06 -07:00
Max Brunsfeld
2e7ffb4d14 Tweak auto-format settings
Prefer lines that exceed 80 characters by a small margin to
line breaks in argument lists
2014-09-09 13:15:40 -07:00
Max Brunsfeld
43ecac2a1d Expose debug flag on document 2014-09-06 17:56:00 -07:00
Max Brunsfeld
0193be166b Fix overridden initializer warning in tree constructor 2014-08-27 22:06:27 -07:00
Max Brunsfeld
9db291fe88 Fix missing initializer warning in document constructor 2014-08-27 21:45:46 -07:00
Max Brunsfeld
4327f3ed26 Refactor parser and stack 2014-08-09 01:03:55 -07:00
Max Brunsfeld
8da9219c3a Remove redundant functions for Documents
There's no need for a `string` function since one already
exists for Nodes.

Now the root node is always stored on the document. This
means callers of `ts_document_root_node` don't need to release
its return value.
2014-08-08 12:58:51 -07:00
Max Brunsfeld
03a5a97992 Move StringInput into its own file 2014-08-01 12:43:14 -07:00
Max Brunsfeld
41d26aaceb Fix segfault when document's input is set before its language 2014-08-01 12:34:49 -07:00
Max Brunsfeld
412cc93812 clang format 2014-07-31 13:11:39 -07:00
Max Brunsfeld
eecbcccee0 Remove generated parsers' dependency on the runtime library
Generated parsers no longer export a parser constructor function.
They now export an opaque Language object which can be set on
Documents directly. This way, the logic for constructing parsers
lives entirely in the runtime. The Languages are just structs which
have no load-time dependency on the runtime
2014-07-30 23:40:02 -07:00
Max Brunsfeld
048a479b5f Fix missing initializer warning in gcc 2014-07-29 13:04:19 -07:00
Max Brunsfeld
98cc2f2264 Auto-format all source code with clang-format 2014-07-21 13:20:00 -07:00
Max Brunsfeld
df359bc01f Use 2-space indent in c files 2014-07-20 20:27:33 -07:00
Max Brunsfeld
466daeaf99 Add function for retrieving a leaf node by position 2014-07-18 18:52:08 -07:00
Max Brunsfeld
0e11bf7271 Precompute trees' visible children 2014-07-18 13:08:14 -07:00
Max Brunsfeld
b3385f20c8 Hide TSTree, expose TSNode 2014-07-17 23:29:11 -07:00
Max Brunsfeld
25f927e321 Remove unnecessary accessor functions for tree 2014-07-14 21:11:15 -07:00
Max Brunsfeld
9da7663e99 Combine TSParser and TSStateMachine objects
My original thought was to decouple the runtime from
the LR parser generator by making TSParser a generic
interface that LR parsers implement.

I think this was more trouble than it was worth.
2014-07-10 13:23:20 -07:00