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

Add Elm language support #744

Merged
merged 3 commits into from
Sep 22, 2017
Merged

Add Elm language support #744

merged 3 commits into from
Sep 22, 2017

Conversation

dmitryrogozhny
Copy link
Contributor

Hi!

This is an implementation of a lexer for the Elm language (http://elm-lang.org/).

I've seen that there is a long-running PR for Elm support #552. While its author did a great job in covering basic scenarios, the lexer lacks a support for a lot of Elm features. So after trying to update it, I ended up implementing this new separate lexer version. I've listed main differences of the current implementation below.

For extended example of parsing (i.e. /spec/visual/samples/elm) I've used several sources: (1) description of a basic Elm package, that covers basic operators and syntax; (2) elm-compiler test cases that include some edge-case scenarios; (3) examples from the Elm syntax guide.

The sample is quite long, but it provides a good coverage of Elm syntax and features.

I've added a lot of comments to the lexer code to make it easier to read by others and to extend it in future.

Here are the main differences of the current version over the #552:

  • support for standard Elm operators (including >, /, //, >>, <<, !, %)
  • support for hex numbers, numbers in exponent notation
  • support for custom inflix operators
  • proper parsing of nested comments
  • proper parsing of a multiline string (case when there is a text with double quotes in it)
  • proper parsing of chars with escaped symbols
  • additional support for keywords (alias, port)
  • up to date check for variables and functions names (single quote is not supported for names starting from the last Elm version, i.e. v0.18)

@gfx
Copy link
Member

gfx commented Sep 13, 2017

I love to support Elem, but I have no knowledge to choose one from PRs.

@benjamin-thomas what do think of it?

@gfx
Copy link
Member

gfx commented Sep 22, 2017

Thanks for the contribution. I'm happy to support Elem 👏

close #552

@gfx gfx merged commit ee05d76 into rouge-ruby:master Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants