Commit Graph

11306 Commits (5d75d81b1ec70ff72b03c89bfae0fdcbc3db1380)
 

Author SHA1 Message Date
pad 3e83446ec2 Support predefined types in type predicates
In `function (): object {...}` object is a predefined type, but
in `function (object: any): object is foo{}` object is now
a regular identifier. The previous grammar was not able
to parse the second example, probably because when the parsers
sees the second ':' for the return type, the contextual lexual
does not know yet if it's a type predicate or predefined type, so
it accepts 'object' as a predefined type and only fail later when
it sees 'is'.

test plan:

I tried in astexplorer.net and the second example is valid typescript
code (sadly).
2022-06-23 14:26:27 +07:00
Tim Luo c8b9c3f36a Refactor group_by clause 2022-06-23 02:56:31 +07:00
Tim Luo 1db9ca58f8 Refactor order_by clause 2022-06-23 00:24:31 +07:00
Yoann Padioleau 6ff54a9b15
Merge pull request #121 from cfroystad/heredoc
Adds support for interpolated strings to HEREDOC
2022-06-22 14:39:16 +07:00
Nat Mote 0a90858cc7
Fix type_query precedence
The precedence for `type_query` needs to be higher than that of
`_type_query_subscript_expression`. Otherwise, the parser will generate
incorrect parses, and even fail to parse valid code in some cases.

The code `type X1 = typeof Y[keyof typeof Z];` should actually have
`typeof Y` grouped together. I verified this in astexplorer.net, and I
verified that TypeScript itself does parse this line. Currently, it
fails to parse using this tree-sitter grammar. Because of the incorrect
precedence, it expects an expression between the brackets instead of a
type.

I also used AST Explorer to check how TypeScript parses the other tests
that changed. In both cases, the updated parse is correct.
2022-06-21 19:03:39 +07:00
Calvin Lee b7bd692853 Parse Enum Class Labels
This commit adds parsing code for enum class labels, which use the `#`
character to separate a class from a label.

Fixes #50
2022-06-21 17:38:28 +07:00
Calvin Lee e6ced83a5b Remove # comments from corpus
It has not been valid to start a comment with a `#` character for a [quite a
while](https://docs.hhvm.com/hack/source-code-fundamentals/comments). Remove
this usage from the test corpus.
2022-06-21 17:38:28 +07:00
Nat Mote bd6912a801
Add test for type_query precedence 2022-06-21 16:16:43 +07:00
Max Brunsfeld 2b9e9e0d23 0.20.0 2022-06-21 12:02:51 +07:00
Tim Luo 1196535079 Improve VALUES clause 2022-06-21 23:40:55 +07:00
Christian Frøystad 3b2af709a9 Fixes bugs in nowdoc implementation 2022-06-21 12:13:51 +07:00
Tim Luo eb962a95c8 Improve the drop statement 2022-06-21 02:10:30 +07:00
Jonathan Arnett ed604993ba
Forbid anonymous function parameter labels (#34)
Corresponds to gleam-lang/gleam#1629
2022-06-20 13:13:52 +07:00
Tim Luo 26f3ff5f2e Improve CREATE TYPE statement 2022-06-20 22:56:46 +07:00
Pieter Goetschalckx cc26b1ef11
Cache examples in Github workflow 2022-06-19 21:41:43 +07:00
Pieter Goetschalckx dcc477e3c2
Bump rust version and add test (#58)
* Update .gitignore

* Update README

* Update rust docs

* Bump rust version

* Add rust test
2022-06-19 21:36:54 +07:00
Max Novikov 370a66ecb1
Merge pull request #33 from m-novikov/float-support
Add float number support
2022-06-19 17:06:51 +07:00
Maksim Novikov 3e2433f5a6
Add float number support 2022-06-19 17:00:29 +07:00
Maksim Novikov 5a22eb8602
Merge branch 'function-calls' 2022-06-19 16:40:13 +07:00
Wilfred Hughes 79ad6b7ed2 Move split_on_newlines tests to the defining file 2022-06-19 15:30:34 +07:00
Maksim Novikov 4bb2bbe6ed
Merge branch 'create-function-trigger' 2022-06-19 16:26:04 +07:00
Maksim Novikov f0d0f27f22
Fix codestyle 2022-06-19 15:46:08 +07:00
Maksim Novikov 148b442971
Merge branch 'merico' 2022-06-19 15:41:45 +07:00
Max Novikov 162db936a4
Merge pull request #32 from m-novikov/add-pre-commit
Add pre-commit config
2022-06-19 15:38:35 +07:00
Maksim Novikov 71c75697f4
Remove update playground 2022-06-19 15:36:08 +07:00
Maksim Novikov e123cc2dde
Add pre-commit config 2022-06-19 15:35:04 +07:00
Maksim Novikov bc5651c5d9
Merge branch 'mhoffm-add-real-world-corpus' 2022-06-19 15:25:32 +07:00
Pieter Goetschalckx bcad5b2630
Bump tree-sitter to 0.20 2022-06-18 23:00:30 +07:00
Pieter Goetschalckx b1af6f443b
Update, add and fix tests 2022-06-18 22:59:36 +07:00
Max Novikov acc5784b7e
Merge pull request #30 from m-novikov/update-github-pipeline
Update github workflow to validate build
2022-06-18 08:01:30 +07:00
Maksim Novikov e699698ed0
Update github workflow to validate build 2022-06-18 07:57:49 +07:00
Max Novikov cc77682dc3
Merge pull request #26 from m-novikov/pain
External parser for dollar quoted strings
2022-06-18 07:55:51 +07:00
Yuya Nishihara 49eba629f8 regenerate 2022-06-18 14:53:36 +07:00
Yuya Nishihara 47b8f7fdc6 merge with dev 2022-06-18 14:52:18 +07:00
Yuya Nishihara 48111fa1c0 regenerate 2022-06-18 14:50:38 +07:00
Yuya Nishihara a305b73e3e readme: add comment about ambiguous grouped notation 2022-06-18 14:48:21 +07:00
Yuya Nishihara 274c7586bc bump tree-sitter-typescript to 1b3ba31c75 2022-06-18 14:23:52 +07:00
Yuya Nishihara 569d2f193b bump ref grammar to ba94a296c3ea97c755538ef99efe5d1dd034725c (no change) 2022-06-18 14:18:45 +07:00
Torsten Schmits 14bf3061a3
bump tree-sitter in Cargo.toml (#85)
* bump tree-sitter is Cargo.toml

* Update Cargo.toml

Co-authored-by: Logan Wemyss <62594135+VixieTSQ@users.noreply.github.com>

* regenerate bindings

Co-authored-by: Logan Wemyss <62594135+VixieTSQ@users.noreply.github.com>
2022-06-17 15:14:50 +07:00
Logan Wemyss e91d3a3762 highlights.scm and locals.scm exist, so uncomment them 2022-06-16 11:42:31 +07:00
Wilfred Hughes bef61be1ab cargo fmt 2022-06-15 16:39:55 +07:00
Wilfred Hughes 6c45e74220 Move split_on_newlines to the lines module 2022-06-15 16:38:26 +07:00
Wilfred Hughes 4e6eb1de42 Document the trailing newline behaviour for split_on_newlines 2022-06-15 16:31:17 +07:00
Wilfred Hughes 3147eb8e6a Prefer splitting source by newline once
This is a small performance reduction (0.2% increase in instruction
count for the file in #293) but simplifies the code and ensures we're
splitting with the same logic everywhere.
2022-06-15 16:24:23 +07:00
Wilfred Hughes 6ade73138c Skip printed lines when computing hunk matched lines
This function is hot for textual diffs, such as the sample files in
issue #293. For those files, this produces a 21% reduction in
instruction count.
2022-06-15 01:07:25 +07:00
Tim Luo f1a4b8c896 Improve create function statement & support create trigger statement 2022-06-15 03:35:15 +07:00
Wilfred Hughes 95ba06ab23 Remove pointless vec copy 2022-06-13 22:34:40 +07:00
Wilfred Hughes 1c9e05ed0c Ignore generated flamegraphs 2022-06-13 21:52:12 +07:00
Wilfred Hughes ed168635c9 Use 32-bit integers for line numbers
This saves 16% time, 18% memory and 1% instruction counts from the
sample files in #293. These are large files, treated as textual diffs,
so reducing the storage per-line is significant. Files with structural
diffing, such as sample_files/slow_before.rs, are unchanged.

Fixes #293
Closes #297
2022-06-13 21:47:19 +07:00
Wilfred Hughes 5d5eaea84e Store column numbers as a u32
It's reasonable to assume that a single column won't exceed four
billion, and this is a small speedup (1% instruction count reduction
on the sample file in #293).
2022-06-13 21:26:02 +07:00