Commit Graph

729 Commits

Author SHA1 Message Date
강동윤
f11434ee3c [WIP] Update parser 2018-03-06 22:34:42 +09:00
강동윤
160f5dc367 Add RestPat 2018-03-06 15:44:28 +09:00
강동윤
00bcd8f9af Don't use #[ast_node] for temporary for-head 2018-03-06 15:07:52 +09:00
강동윤
077e0c551f implement #[span] 2018-03-04 15:17:52 +09:00
강동윤
e1764f907b [WIP] Make ast nodes contain span
* `struct Expr` + `enum ExprKind` -> `enum Expr`

`Expr` / `ExprKind` approach does not work well with recursive
 processing based on the type system because we can't access common
 fields like span while processing child node like `MemberExpr`.

As ast processing is inherently recursive, we should use a
 recursive-friendly approach.

 * `#[derive(FromVariants)]`
It creates lots of `From<T>` to help using ast enums as a real sum type.

 * `#[derive(Spanned)]`

Inspired by https://docs.rs/syn/0.12.13/syn/spanned/trait.Spanned.html

It does not handle attributes yet.

 * Parser is not updated yet.
2018-03-03 19:37:01 +09:00
강동윤
171abda3c0 Implement #[derive(StringEnum)] 2018-03-02 14:50:50 +09:00
강동윤
10f83f3f02
Fix rls (again) (#33)
* Don't use `#[parser]` in lexer

* Don't use `#[parser]` in parser/util.rs

* Pin rust toolchain to nightly-2018-02-28
2018-02-28 14:35:52 +09:00
강동윤
67daa4c4e4
Fix a test about float parser (#32)
See https://github.com/rust-lang/rust/pull/48235
2018-02-27 15:31:50 +09:00
강동윤
4a30fb3436
Testing framework (#31)
- Make rls happy.
  - Some minor parser error improvements.
  - Add reference files for ecmascript parser errors.
  - Improve error message of import/export used outside of a module
2018-02-27 13:21:57 +09:00
강동윤
fa40c8ddf3 Make rls work
rust-analysis chokes with `Option<Box<Expr>>` style fields.
Rls only shows a warning on the crate with that fields, but ICEs on
dependent crates.
This can be workarounded by using `Option<(Box<Expr>)>`.

Also, using multiple glob imports is bad for rls.
So this commit deglobs them.
2018-02-03 20:00:03 +09:00
강동윤
056a11dd06 chores: cleanup for docs; no email from travis 2018-01-27 15:14:53 +09:00
강동윤
59f11a83d1 fixup! fix tests 2018-01-27 13:42:04 +09:00
강동윤
92c7defc2e fix tests 2018-01-27 11:31:45 +09:00
강동윤
5602c376e5 Implement error reporting for ecmascript parser
Passes all test262-identity tests and all fail tests.
2018-01-26 21:53:30 +09:00
강동윤
9b2a5880bb Use FileMap as an input. 2018-01-23 21:38:48 +09:00
강동윤
0a2473fe1c Improve error reporting of ecmascript parser
And drop nll because it's currently too slow.
2018-01-22 21:47:16 +09:00
강동윤
4d52cb49d4 Implement error reporting.
* Use syntax_pos and rustc_error.
 * Use syntax_pos::Span
2018-01-21 17:47:37 +09:00
강동윤
9c646596c5 Fix ecmascript parser.
* Make span inclusive-exclusive.
 * Fix array parsing.
2018-01-17 14:06:05 +09:00
강동윤
d6e61f9638 Make expression and statement consistent. Fixes #19 2018-01-16 11:35:05 +09:00
강동윤
06731dfcb5 Cleanup and documentations for swc_common.
* Remove CanIUse trait, which will be reimpplemented in future
 using Visitor.

 * Remove some other unused stuffs.

 * Change public path of swc_common::fold::* to swc_common::*.
2018-01-15 10:33:18 +09:00
강동윤
fd5b4d0dc0 Revert "Merge remote-tracking branch 'refs/remotes/origin/simplifier'"
This reverts commit 43fcbcbef2, reversing
changes made to 15fde7b5ff.
2018-01-14 14:00:01 +09:00
강동윤
b778f0c398 Rebase 2018-01-14 13:37:32 +09:00
강동윤
5a1c844549 [WIP] simplifier 2018-01-14 13:33:09 +09:00
강동윤
015ccb07f4 [WIP] Working for simplfier 2018-01-14 13:30:50 +09:00
강동윤
15fde7b5ff add op! macro 2018-01-14 13:29:57 +09:00
강동윤
3b02b27d62
groundwork for docs
Ignore two tests. See #8.

Add code coverage and travis to readme.
2018-01-13 20:42:52 +09:00
강동윤
58bc3b4ade [WIP] Working for simplfier 2018-01-13 19:13:32 +09:00
강동윤
4a9d66a0f3 update test262.rs 2018-01-13 19:06:50 +09:00
강동윤
e949c40517
ECMAScript parser (#1)
- Parser and lexer for lastest ecma spec https://tc39.github.io/ecma262

  - Lexer is currently very inefficient

 - Use https://github.com/tc39/test262-parser-tests/ for testing.

 - Implement proc-macro based ast folder and assert_eq_ignore_span! based on it.

 - Some utilities for proc macro at /macros/common
2018-01-12 16:53:06 +09:00