language-javascript icon indicating copy to clipboard operation
language-javascript copied to clipboard

Parser for JavaScript, in Haskell

Results 24 language-javascript issues
Sort by recently updated
recently updated
newest added

The AST contains a lot of uninteresting information such as commas, making it really bloat. It would be ness to have a way to prune out that information.

Fixes #116 The issue with the current parsing rules and representation is that arrow function bodies are not statements, they're either function blocks or expressions. Looking at the [specification](https://www.ecma-international.org/ecma-262/#prod-ExpressionBody) we...

See #124 ``` λ> parseModule "export * from 'lib.mjs';" "src" Right (JSAstModule [JSModuleExportDeclaration (JSAnnot (TokenPn 0 1 1) []) (JSExportAllFrom (JSBinOpTimes (JSAnnot (TokenPn 7 1 8) [WhiteSpace (TokenPn 6 1...

``` λ> parseModule "export {x} from 'lib.mjs';" "src" Right (JSAstModule [JSModuleExportDeclaration (JSAnnot (TokenPn 0 1 1) []) (JSExportFrom (JSExportClause (JSAnnot (TokenPn 7 1 8) [WhiteSpace (TokenPn 6 1 7) "...

``` λ> parseModule "f(x)" "src" Right (JSAstModule [JSModuleStatementListItem (JSMethodCall (JSIdentifier (JSAnnot (TokenPn 0 1 1) []) "f") (JSAnnot (TokenPn 1 1 2) []) (JSLOne (JSIdentifier (JSAnnot (TokenPn 2 1 3)...

``` diff --git a/test/Test/Language/Javascript/StatementParser.hs b/test/Test/Language/Javascript/StatementParser.hs index 5e0c98c..0c102d5 100644 --- a/test/Test/Language/Javascript/StatementParser.hs +++ b/test/Test/Language/Javascript/StatementParser.hs @@ -86,8 +86,13 @@ testStatementParser = describe "Parse statements:" $ do it "with" $ testStmt "with (x) {};"...

I'm able to work around this [like so](https://github.com/reach-sh/reach-lang/compare/63cfe3482bd9...0f9a66aa7875#diff-f985de41a397939bbab675172143b267) but it would be nice if these data structures came with these instances. If you're interested in this, let me know; I'd...

Related to #71. Support for spread expressions was added for all contexts other than object literals. This PR adds support for them in object literals, too.

I noticed a parse error when parsing an object literal containing an arrow function if any properties are defined _after_ the arrow function. ```js ({ f: x => x })...