Commit Graph

15 Commits

Author SHA1 Message Date
강동윤
3321ca590d implement Spanned for {Span, BytePos} 2018-03-04 14:41:59 +09:00
강동윤
d5ef2be32a reexport Fold properly 2018-03-04 14:12:17 +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
강동윤
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
강동윤
0a2473fe1c Improve error reporting of ecmascript parser
And drop nll because it's currently too slow.
2018-01-22 21:47:16 +09:00
강동윤
e75836882b Use box for Diagnostic 2018-01-21 19:33:27 +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
강동윤
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
강동윤
6582429013 remove unused parser codes. 2018-01-13 19:07:05 +09:00
강동윤
7291667a19 use F: Folder<T> instead of T: FoldWith<F> 2018-01-13 19:06:13 +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
강동윤
0f9532dd5d initial commit 2017-12-22 22:07:03 +09:00