Commit graph

336 commits

Author SHA1 Message Date
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
6a8addb84f Fix segfault when grammar consists of a single token 2014-07-23 18:26:10 -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
af5a118000 Add ts_node_child_count function 2014-07-20 17:57:20 -07:00
Max Brunsfeld
466daeaf99 Add function for retrieving a leaf node by position 2014-07-18 18:52:08 -07:00
Max Brunsfeld
1ecafb874e Add functions to retrieve nodes' siblings and parents 2014-07-18 13:24:03 -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
779bf0d745 Don't store tree's hidden children in a separate array
Just mark hidden trees as such, and skip them when
pretty-printing a tree
2014-07-17 13:36:53 -07:00
Max Brunsfeld
25f927e321 Remove unnecessary accessor functions for tree 2014-07-14 21:11:15 -07:00
Max Brunsfeld
6e551d6d9f Simplify handling of multiple top-level nodes after parsing 2014-07-14 20:46:20 -07:00
Max Brunsfeld
6951acb13b Fix error when grammar contains to error productions 2014-07-13 21:26:21 -07:00
Max Brunsfeld
4d14a65e22 In build_parse_table, switch recursion to explicit iteration 2014-07-13 18:06:37 -07:00
Max Brunsfeld
b217cd38fb Handle built-in symbols correctly in conflict manager 2014-07-13 17:59:57 -07:00
Max Brunsfeld
44c4bf5f5e Refactor add_ubiquitous_token_actions method 2014-07-11 13:21:44 -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
f4287c07d0 Fix ParseStateId / size_t confusion in parse table 2014-07-07 13:21:30 -07:00
Max Brunsfeld
77df7fe511 In lexer, always prefer the longest match
Only use rules' precedence to decide between two tokens
that match the same string
2014-07-03 08:57:35 -07:00
Max Brunsfeld
67590eddc7 Fix stream operator for new parse action types 2014-07-03 08:15:36 -07:00
Max Brunsfeld
18ae326459 Fix lint errors 2014-07-02 09:01:38 -07:00
Max Brunsfeld
6424eea62a Refactor handling of ubiquitous tokens when building parse table 2014-07-01 21:43:26 -07:00
Max Brunsfeld
83a1b9439e Fix handling of ubiquitous tokens used in grammar rules 2014-07-01 20:47:35 -07:00
Max Brunsfeld
59cc65c2e3 Rename parse action types 2014-06-29 00:20:16 -07:00
Max Brunsfeld
da7b50a2d1 Rename type ts_string_input_data -> TSStringInput 2014-06-28 19:29:44 -07:00
Max Brunsfeld
0ec3faba3e Rename type ts_lr_parser -> TSStateMachine 2014-06-28 19:22:16 -07:00
Max Brunsfeld
27f6eb725d Rename type ts_parse_action -> TSParseAction 2014-06-28 19:06:37 -07:00
Max Brunsfeld
26f612a20d Rename type ts_stack -> TSStack 2014-06-28 19:04:14 -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
d7449bf5ea Rename type ts_symbol -> TSSymbol 2014-06-28 18:53:32 -07:00
Max Brunsfeld
7e0d46002c Rename type ts_state_id -> TSStateId 2014-06-28 18:51:06 -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
7a6d3365c5 Remove helper function in rule_transitions.cc 2014-06-28 18:09:32 -07:00
Max Brunsfeld
3be648593e merge_{sym,char}_transitions -> merge_{sym,char}_transition 2014-06-28 17:02:48 -07:00
Max Brunsfeld
9bad5dff3e Avoid unnecessary std::map construction when merging transition sets 2014-06-26 13:42:42 -07:00
Max Brunsfeld
9686c57e90 Allow ubiquitous tokens to also be used in grammar rules 2014-06-26 08:52:42 -07:00
Max Brunsfeld
a9dff20658 Make grammars' separator characters configurable 2014-06-26 07:31:08 -07:00
Max Brunsfeld
7df35f9b8d Make separate types for syntax and lexical grammars
This way, the separator characters can be added as a field to
lexical grammars only
2014-06-25 13:27:16 -07:00
Max Brunsfeld
240de1ca61 Reorder methods in c code generator 2014-06-18 08:21:43 -07:00
Max Brunsfeld
2c382b7363 Trim trailing whitespace 2014-06-16 21:33:35 -07:00
Max Brunsfeld
c312f985c8 Refactor c code generator
It's been rewritten in a less functional style. String copies were actually
taking significant time for large parsers.
2014-06-16 21:29:04 -07:00
Max Brunsfeld
1daaf4485f Refactor item set transition functions 2014-06-16 13:37:34 -07:00
Max Brunsfeld
17040e32ec Remove unused version of first_set function 2014-06-16 13:25:30 -07:00
Max Brunsfeld
39c1ab2d50 Refactor item_set_closure
Inline unnecessary  function
2014-06-16 13:20:39 -07:00
Max Brunsfeld
7a2c2c1c90 Store ParseItemSets as maps, w/ core items as keys
ParseItem no longer has a lookahead_sym field; it now represents
the 'core' of a parse item. The lookahead context is stored separately,
as a set per core item. This makes iterating, copying and merging item
sets more efficient, because before, the core items were repeated for each
different lookahead symbol.

Also, the memoization in sym_transitions(ParseItemSet) has been removed.
Maybe I'll add it back later.
2014-06-16 08:35:20 -07:00
Max Brunsfeld
d203c15911 Remove unneeded blank rule in lex table builder 2014-06-11 17:43:07 -07:00