Commit graph

57 commits

Author SHA1 Message Date
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
Max Brunsfeld
da7b50a2d1 Rename type ts_string_input_data -> TSStringInput 2014-06-28 19:29:44 -07:00
Max Brunsfeld
9d4fcf75de Rename type ts_lexer, ts_parser -> TSLexer, TSParser 2014-06-28 19:01:46 -07:00
Max Brunsfeld
c8797bfa27 Rename type ts_input_edit -> TSInputEdit 2014-06-28 18:56:47 -07:00
Max Brunsfeld
ff13122419 Rename type ts_input -> TSInput 2014-06-28 18:56:04 -07:00
Max Brunsfeld
5f59de72a8 Rename type ts_tree -> TSTree 2014-06-28 18:48:07 -07:00
Max Brunsfeld
2795078633 Rename type ts_document -> TSDocument 2014-06-28 18:37:29 -07:00
Max Brunsfeld
12331d66f5 Fix memory leaks 2014-06-09 13:12:44 -07:00
Max Brunsfeld
963768eb8a Remove unnecessary parser helper functions 2014-05-09 15:03:29 -07:00
Max Brunsfeld
95188d84b6 Make tree struct private 2014-03-24 00:34:13 -07:00
Max Brunsfeld
fbe8b0a905 Fix incremental parsing
Stop collapsing hidden symbols upon reducing them.
Sadly, this messes up the ability to re-use parse
trees. Instead, for now, hide these nodes when
stringifying parse trees
2014-03-19 19:27:31 -07:00
Max Brunsfeld
0d6435e24a Pass edit information into parser function 2014-03-15 16:55:35 -07:00
Max Brunsfeld
0dc3a95d0c Refactor parser header
Make separate lexer, stack and parser structs.
2014-03-15 14:43:50 -07:00
Max Brunsfeld
05a5f9c124 Add function for notifying documents of edits 2014-03-12 13:39:12 -07:00
Max Brunsfeld
42e9a264f3 In parser, read chunked input correctly 2014-03-10 13:25:31 -07:00
Max Brunsfeld
9c6c47e02f Make parser input reads indicate the # of bytes read 2014-03-08 16:51:08 -08:00
Max Brunsfeld
1fd381ae7a Don't use c++ for runtime
Don't really need it, and it makes compilation slightly more
complicated
2014-03-08 16:30:44 -08:00
Max Brunsfeld
1b56832cb7 Use c++ in runtime src file
It makes string manipulation easier
2014-02-19 18:58:28 -08:00