Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

[WIP] Update to pick up new grammars#16

Draft
CrossR wants to merge 35 commits intoonivim:masterfrom
CrossR:CrossR/Update
Draft

[WIP] Update to pick up new grammars#16
CrossR wants to merge 35 commits intoonivim:masterfrom
CrossR:CrossR/Update

Conversation

@CrossR
Copy link
Copy Markdown
Member

@CrossR CrossR commented Dec 31, 2019

The partnered PR for the esy-tree-sitter bits.

Just need to fix the building of the C++ bits.

@CrossR
Copy link
Copy Markdown
Member Author

CrossR commented Dec 31, 2019

Starting to add benchmarks and tests now.

I noticed that the current benchmarks seem to always be running with the JSON parser, so I've fixed that. I think I'll split the benchs up by parser as well, since it will grow quite a lot.

Just need to fix the Linux build as well.

@CrossR
Copy link
Copy Markdown
Member Author

CrossR commented Jan 8, 2020

@bryphe, am I missing something with the Linux build? I assume its just some obvious flag that I'm missing, just odd that the Mac build is happy.

Comment thread src/Languages.re
Comment on lines +5 to +24
type t =
| Json
| C
| Cpp
| Python
| Javascript
| Typescript
| Tsx;

let getLanguageFromScope = scope =>
switch (scope) {
| "source.json" => Some(Json)
| "source.c" => Some(C)
| "source.cpp" => Some(Cpp)
| "source.python" => Some(Python)
| "source.js" => Some(Javascript)
| "source.ts" => Some(Typescript)
| "source.tsx" => Some(Tsx)
| _ => None
};
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best way to do this?

I.e. right now you give a scope and get back an option then action on that, and assuming there is a language, you can use that to request the parser/scope converter. Wasn't sure if there was a cleaner way, that also keeps one source of truth for the supported languages, so changing this list enforces a parser and scope converter are added.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is reasonable - although we could also consider an API that gives a parser/scope converter combo for a given scope. But for now I think this OK - as we use it, we could see if it could be streamlined

Comment thread bench/FullParseBench.re
doBench("String: Small C++", parse(simpleC, cppParser));
doBench("String: Small JS", parse(simpleJs, jsParser));
doBench("String: Small TS", parse(simpleTs, tsParser));
doBench("String: Small Python", parse(simplePy, pyParser));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for adding these benchmarks, @CrossR

@bryphe
Copy link
Copy Markdown
Member

bryphe commented May 7, 2020

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants