Commit graph

114 commits

Author SHA1 Message Date
Max Brunsfeld
64fc944202 Fix missing criteria for leaf node reuse 2019-06-20 15:02:20 -07:00
Sebastián Gurin
bd97ad5c4c Wasm file generation note in readme (#368)
* readme .wasm file generate and usage in node.js

* generate wasm language files readme note
2019-06-20 14:06:09 -07:00
Max Brunsfeld
e4873191d6 Refactor generated lex function to use fewer instructions per state 2019-06-20 09:57:38 -07:00
Max Brunsfeld
28011b1e60 Add ts_node_is_extra API 2019-06-19 15:58:29 -07:00
Andrey Zaytsev
7f2233ddaf Ts tree cursor copy (#363)
* add ts_tree_cursor_copy fn

* indentation
2019-06-16 10:52:37 -07:00
Max Brunsfeld
0e046fc6c0 Fix bug when the assert macro is disabled
Fixes #364
2019-06-14 14:23:38 -07:00
Max Brunsfeld
80b785daee Improve behavior of node descendant queries with single positions 2019-06-13 10:53:59 -07:00
Antonio Scandurra
25b0fbd679 Don't use clock_gettime on macOS
This commit stops using the monotonic clock API on macOS because it is 
supported only on macOS >= 10.12. Instead, it uses the fallback clock 
APIs for platforms without monotonic clock support.

The use of `clock_gettime` was causing issues on Atom because, even 
though we build it on a new macOS version supporting such API, some 
users may run Atom on older versions of macOS. On those platforms, Atom 
would crash whenever opening a file parsed with a tree-sitter grammar.
2019-06-12 19:03:46 +02:00
Max Brunsfeld
3a51b23f1a web: 0.15.6 2019-06-03 16:19:16 -07:00
Max Brunsfeld
1cef6d4550 web: Don't require Parser.init to be called immediately 2019-06-03 16:18:49 -07:00
Max Brunsfeld
790b5558be web: 0.15.5 2019-05-31 11:14:45 -07:00
Max Brunsfeld
e58b69e3b8 Include type declarations in npm tarball 2019-05-31 11:14:29 -07:00
Max Brunsfeld
2084745152 0.15.4 2019-05-31 10:43:42 -07:00
Max Brunsfeld
31537a68c6 Bump library versions 2019-05-31 10:24:29 -07:00
Max Brunsfeld
b7bc2d30ae
Merge pull request #345 from tree-sitter/delete_nulls_safely
Make ts_tree_delete and ts_parser_delete NULL-safe.
2019-05-30 13:01:56 -07:00
Max Brunsfeld
f5163126c8 generate-fixtures-wasm: handle language repos w/ multiple grammars
Refs tree-sitter/tree-sitter-typescript#68
2019-05-30 12:34:03 -07:00
Patrick Thomson
6e2a60629c Make ts_tree_delete and ts_parser_delete NULL-safe.
Historically, `free(3)`-style functions have been NULL-safe, to make
resource handling functions more robust. This doesn't seem to be the
case with tree-sitter's `ts_tree_delete` and `ts_parser_delete` C
functions, which immediately dereference the passed pointer. This
leads to complexity in client libraries that have to ensure that trees
and parsers are cleaned up correctly.

This patch adds NULL checks to `parse_delete` and `tree_delete`. They
should have negligable performance impacts, since null checks are fast.

I didn't change the internal _delete functions, as arguably those
being NULL-unsafe is a feature, not a bug.
2019-05-30 11:47:56 -04:00
Max Brunsfeld
659f2825ba
Merge pull request #342 from georgewfraser/patch-1
Add type definitions
2019-05-28 15:31:23 -07:00
George Fraser
0fe67dc8b4 Dedent 2019-05-28 23:01:41 +01:00
Max Brunsfeld
6055108936 Wasm: 0.15.3 2019-05-28 13:00:17 -07:00
Max Brunsfeld
068f7b1a0c Wasm: Throw an exception if Parser is constructed before init() resolves 2019-05-28 12:59:00 -07:00
George Fraser
d4597e14f4
Reference tree-sitter-web.d.ts in package.json 2019-05-27 15:10:43 +01:00
George Fraser
a0d0ba9709
Add type definitions
This is based on https://github.com/tree-sitter/node-tree-sitter/blob/master/tree-sitter.d.ts with slight modifications because web-tree-sitter has a slightly different interface than node-tree-sitter
2019-05-27 15:08:29 +01:00
Federico
51345f3ea2 Ensure Point has column typeof number field 2019-05-24 14:34:04 +02:00
Max Brunsfeld
3ec91a8d8a Wasm: When in node, use fs APIs to load language wasm files
Fixes #338
2019-05-23 16:12:32 -07:00
Max Brunsfeld
7a511f82ac
Merge pull request #331 from tree-sitter/track-locals-for-highlighting
In syntax-highlighting library, add support for tracking local variables
2019-05-10 12:28:43 -07:00
Max Brunsfeld
0d70b485c0 Implement Wasm binding for Tree.getChangedRanges() 2019-05-09 23:52:57 -07:00
Max Brunsfeld
a7d02e7276 Add support for highlight properties that track local variables 2019-05-09 20:34:34 -07:00
Max Brunsfeld
31c2086273 🎨 Refactor TreePropertyCursor 2019-05-09 09:40:15 -07:00
Max Brunsfeld
9fc058656c In binding_web, use prepublishOnly, not prepublish 2019-05-07 13:24:29 -07:00
Max Brunsfeld
9a82bd9d83 Set up code to publish web bindings to npm 2019-05-07 13:11:04 -07:00
Max Brunsfeld
572f290ec0 Fix highlighting in the presence of node fields 2019-05-07 11:17:34 -07:00
Max Brunsfeld
3fc459a84b Reorganize language bindings
* Move rust binding: lib/binding -> lib/binding_rust
* Move wasm bindinig: lib/web -> lib/binding_web
* Add wasm readme
2019-05-07 10:41:49 -07:00
Max Brunsfeld
a6a50a6320 Avoid some bloat in wasm build 2019-05-01 12:44:58 -07:00
Max Brunsfeld
73e4db41b0 Render syntax tree efficiently in docs playground 2019-04-30 11:55:30 -07:00
Max Brunsfeld
3425b6e1c2 Add wasm binding for TreeCursor 2019-04-29 13:20:09 -07:00
Max Brunsfeld
f3ecafe13b Fix inclusion of libc++ in wasm build 2019-04-27 18:06:34 -07:00
Max Brunsfeld
b4c4dc48ff Minify JS build with terser 2019-04-26 19:52:01 -07:00
Max Brunsfeld
48743dda44 Get remaining wasm tests passing 2019-04-26 17:28:15 -07:00
Max Brunsfeld
66e006105c Build and test wasm on CI 2019-04-26 14:38:13 -07:00
Max Brunsfeld
58e1a0fee7 In node range queries, treat the end coordinate as exclusive 2019-04-26 13:36:28 -07:00
Max Brunsfeld
1fc0525940 Start work on a WASM binding 2019-04-25 17:27:39 -07:00
Max Brunsfeld
bc5e71bcc2 Fix handling of zero-width external tokens at beginning of document
Fixes #316
2019-04-08 15:01:52 -07:00
Max Brunsfeld
f30485f9f4 Fix accidentally-removed functions in api.h 2019-03-29 23:05:02 -07:00
Max Brunsfeld
00968db983 Add documentation to api.h
Fixes #166
2019-03-29 16:50:05 -07:00
Max Brunsfeld
5035e194ff Merge branch 'master' into node-fields 2019-03-26 11:58:21 -07:00
Marijn Haverbeke
fe5aa46d8d Swap two incorrectly placed comments 2019-03-26 16:53:35 +01:00
Max Brunsfeld
82358d3f2f
Merge pull request #307 from tree-sitter/pointer-sized-cancellation-flag
Make the cancellation flag a size_t, not a uint32_t
2019-03-22 12:30:39 -07:00
Max Brunsfeld
5a59f19b69 Use explicit syntax for functions with no parameters 2019-03-21 16:06:06 -07:00
Max Brunsfeld
74d154c706 Use CLOCK_MONOTONIC on platforms that support it
This way, timeouts will apply even if the current process
is starved for CPU.
2019-03-21 14:13:42 -07:00