Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document public api and more #60

Open
aladdin-add opened this issue Apr 30, 2021 · 7 comments
Open

document public api and more #60

aladdin-add opened this issue Apr 30, 2021 · 7 comments
Labels
documentation Improvements or additions to documentation

Comments

@aladdin-add
Copy link
Collaborator

  • project arch
  • public API
  • config file (to do)
  • cli (to do)
  • how to contribute
  • FAQ
  • ...
@aladdin-add aladdin-add added the documentation Improvements or additions to documentation label Apr 30, 2021
@KFlash
Copy link
Contributor

KFlash commented May 1, 2021

@aladdin-add Not sure if there is a point in mention this in the documentation, but Kataw threats keywords differently.
For example this case let for. In this case the for keyword isn't allowed to be part of the lexical declaration. Instead the loop breaks, and for will be parsed out as forStatement.

It's done like this because Kataw re-construct the AST in all scenarios when it does error recovery.

Note You also need to document whitespace and line terminators. I described it here:

https://github.com/kataw/kataw/blob/main/src/parser/README.md#whitespace-and-linebreak

@KFlash
Copy link
Contributor

KFlash commented May 23, 2021

@aladdin-add friendly ping. You should mention in the documentation that Kataw can parse type annotations, but differently than TS and Flow. Need to do a 'in-depth' documentation for Kataw types.

@KFlash
Copy link
Contributor

KFlash commented May 25, 2021

@aladdin-add
Need to mention in the documentation how to gain perf with Kataw CST nodes.

For example escaped keywords can be found in Acorn and Babel parser I guess if you are using the raw property

if (x !== x.raw) // escaped

In Kataw you can do:

if (kataw.hasUnicodeEscape(x) // escaped

You can narrow this down further because you know this kind of tokens doesn't have any children - escaped keyword

if (kataw.isChildLess(x) {
// check for escaped keywords
if (kataw.hasUnicodeEscape(x) // escaped
}

If you need all Statement nodes in Acorn and Babel parser:

switch (node.type) {
case 'IfStatement': ...

// and 100 more cases
}

In Kataw you can do:

if (kataw.isStatementNode(x) // true if statement node

There are many more examples

@KFlash
Copy link
Contributor

KFlash commented Jul 27, 2021

@aladdin-add Close this? No progress last 4 months

@aladdin-add
Copy link
Collaborator Author

we'll have to document some of these before release v0.1.0

@KFlash
Copy link
Contributor

KFlash commented Jul 29, 2021

Some of the .md files in various folder may give you some clues

@KFlash
Copy link
Contributor

KFlash commented Aug 1, 2021

@aladdin-add Wait with the documentation. Kataw is undergoing a huge refactoring and I'm changing it to something I had zero plans to do :(

Soon as I'm done we need to document the folder structure first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants