-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57aeae2
commit d587f50
Showing
4 changed files
with
22 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(executable | ||
(public_name js_bundler) | ||
(name main) | ||
(libraries js_bundler flow_parser)) | ||
(libraries JSBundler flow_parser)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
|
||
|
||
let parse_source = source => { | ||
let parse = source => { | ||
let parse_options = | ||
Some( | ||
Flow_parser.Parser_env.{ | ||
esproposal_nullish_coalescing: false, | ||
esproposal_optional_chaining: false, | ||
esproposal_class_instance_fields: true, | ||
esproposal_class_static_fields: true, | ||
esproposal_decorators: true, | ||
esproposal_export_star_as: true, | ||
types: true, | ||
types_in_comments: false, | ||
Parser_env.{ | ||
components: false, | ||
enums: false, | ||
esproposal_decorators: false, | ||
types: false, | ||
use_strict: false, | ||
module_ref_prefix: None, | ||
module_ref_prefix_LEGACY_INTEROP: None, | ||
}, | ||
); | ||
Parser_flow.program(source, ~parse_options); | ||
}; | ||
|
||
Flow_parser.Parser_flow.program(source, ~parse_options); | ||
let source = {| | ||
console.log("Hello, World."); | ||
|}; | ||
|
||
let print = ast => { | ||
Flow_ast.(Program.show(Loc.pp, Loc.pp, ast)); | ||
}; | ||
|
||
let (ast, _errors) = parse(source); | ||
ast |> print |> print_endline; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let hello = "hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
(library | ||
(name js_bundler)) | ||
(name JSBundler)) |