Max Brunsfeld
b91f48ced2
Call handle_error even when error occurs exactly where expected
...
Previously, if an error happened right at the beginning of an error
production, the error node would be immediately shifted onto the stack
without calling the error handling function.
2014-08-27 18:44:27 -07:00
Max Brunsfeld
e0a53b9f14
Make parse and lex debug output more readable
2014-08-27 18:27:53 -07:00
Max Brunsfeld
7b0a52ec26
Pretty-print single hidden tree nodes correctly
2014-08-27 12:56:36 -07:00
Max Brunsfeld
bd145d2c6a
Preserve the initial error node in handle_error function
2014-08-26 23:22:18 -07:00
Max Brunsfeld
b71d0f7f9d
Remove untested, unused error handling for reduce_extra action
2014-08-26 22:22:09 -07:00
Max Brunsfeld
37d5db6fee
Move newline in lexer debugging output
2014-08-26 22:21:21 -07:00
Max Brunsfeld
346cf4fe5d
Remove LEX_PANIC macro
2014-08-26 13:12:12 -07:00
Max Brunsfeld
0470b34f2f
Clean up build_error_node function
2014-08-26 08:40:21 -07:00
Max Brunsfeld
77941c85ff
Avoid building incomplete error nodes during lexing
...
The lexer doesn't know the expected symbols, so it doesn't have enough
information to construct error nodes. Now, when it encounters an invalid
character, it returns NULL and the parser builds a correct error node.
2014-08-25 23:35:00 -07:00
Max Brunsfeld
c04474acf6
Format comments consistently in parser.c
2014-08-25 23:02:43 -07:00
Max Brunsfeld
826d4dfa23
Clean up handle_error function
2014-08-25 23:00:24 -07:00
Max Brunsfeld
2318691e28
Move newline in debugging output
2014-08-25 21:23:29 -07:00
Max Brunsfeld
117869e49a
Fix position calculation in node_find_for_range
2014-08-25 15:52:17 -07:00
Max Brunsfeld
1535ebd21c
Handle null parent in {next,prev}_sibling
2014-08-25 11:28:09 -07:00
Max Brunsfeld
cef6827182
Add find_for_range function for Nodes
2014-08-25 09:31:27 -07:00
Max Brunsfeld
b1a7886225
Rename node_leaf_at_pos -> node_find_pos
...
It doesn't always return a leaf node, just the smallest node
that spans the given position.
2014-08-25 09:06:51 -07:00
Max Brunsfeld
8f4939a3d3
unsigned char -> uint32_t in CharacterRange
2014-08-24 01:05:59 -07:00
Max Brunsfeld
9338249075
Remove implicit CharacterRange constructors
...
Also fix misc smaller lint errors
2014-08-23 14:52:44 -07:00
Max Brunsfeld
0bb5663f0f
Refactor - represent char sets in terms of inclusions and exclusions
2014-08-23 14:25:45 -07:00
Max Brunsfeld
6f374fddff
Tweak format for pretty printing some classes
2014-08-23 13:52:00 -07:00
Max Brunsfeld
2963b08f79
Eliminate duplicates when constructing choice rules
2014-08-21 20:04:42 -07:00
Max Brunsfeld
fcdcdca303
Whitespace
2014-08-09 01:07:14 -07:00
Max Brunsfeld
4327f3ed26
Refactor parser and stack
2014-08-09 01:03:55 -07:00
Max Brunsfeld
1e79ed794b
Allow multiple top-level nodes
...
Now, the root node of a document is always a document node.
It will often have only one child node which corresponds to the grammar's
start symbol, but not always. Currently, it may have more than one child
if there are ubiquitous tokens such as comments at the beginning of the
document. In the future, it will also be possible be possible to have multiple
for the document to have multiple children if the document is partially parsed.
2014-08-09 00:00:20 -07:00
Max Brunsfeld
9302080aa6
Remove unit test on parser
...
It wasn't adding any value
2014-08-09 00:00:20 -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
7ba3953f7e
Simplify handling of ubiquitous tokens during reduce
2014-08-08 08:46:01 -07:00
Max Brunsfeld
41c4e7cd8f
Fix more namespace formatting
2014-08-08 08:35:26 -07:00
Max Brunsfeld
9366f11dcb
In generated C, only format printable characters as char literals
2014-08-07 08:12:15 -07:00
Max Brunsfeld
b155994491
Fix indentation in specs
2014-08-07 08:11:21 -07:00
Max Brunsfeld
01571da30d
Handle more escaped characters in regexps
2014-08-03 21:57:21 -07:00
Max Brunsfeld
4720672cfb
In lexer, stop reading input as soon as empty string is returned
2014-08-01 13:27:50 -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
0d6d09cbd9
In generated parsers, export language as a function
2014-07-31 13:04:46 -07:00
Max Brunsfeld
909261d742
Remove unnecessary type name in parser.h
2014-07-31 12:31:38 -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
f1eb9a92a3
Separate .gyp files for libs and tests
2014-07-25 12:55:00 -07:00
Max Brunsfeld
6a8addb84f
Fix segfault when grammar consists of a single token
2014-07-23 18:26:10 -07:00
Max Brunsfeld
df3613d511
Make compiler and runtime libraries two separate targets
2014-07-22 13:11:07 -07:00
Max Brunsfeld
18e918b704
Fix lint errors in public compiler header
2014-07-22 09:03:33 -07:00
Max Brunsfeld
cfd4d423a9
Update lint script to check whitespace
2014-07-21 13:22:00 -07:00
Max Brunsfeld
fbdd6ee591
Update todo
2014-07-21 13:20:00 -07:00
Max Brunsfeld
98cc2f2264
Auto-format all source code with clang-format
2014-07-21 13:20:00 -07:00
Max Brunsfeld
b8d8386e63
Add format script
2014-07-20 22:12:09 -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