Skip to content

Fails to parse non-ascii letters in identifiers #226

@lydell

Description

@lydell

This is a regression compared to Elm, introduced in #27. (We noticed the same regression in Elm as we tried to port those changes.)

module Main exposing (main)

import Html

åäö = "hello"

main = Html.text åäö
-- WEIRD DECLARATION --------------------------------------------- src/Main.gren

I am trying to parse a declaration, but I am getting stuck here:

5| åäö = "hello"
   ^
When a line has no spaces at the beginning, I expect it to be a declaration like
one of these:

    greet : String -> String
    greet name =
      "Hello " ++ name ++ "!"

    type User = Anonymous | LoggedIn String

Try to make your declaration look like one of those? Or if this is not supposed
to be a declaration, try adding some spaces before it?

It is occasionally useful to use letters from the language of the country your program is used in, even if the code is in English, for proper names in the language of the country that don’t translate easily to English. For example, in Sweden you might have special cases for “Försäkringskassan” and “Skåne“ and want to use those in variable names, or you work with “öre” (the equivalent to cents). Just removing the dots and the circle makes them read weird, and causes them to be marked as spelling errors in the IDE. Another example is making a union type of all the Swedish municipalities: Then we have both “Habo” and “Håbo”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions