Umlaute in variable names #9

Closed
opened 2024-10-05 19:15:35 +02:00 by Entkenntnis · 2 comments
Entkenntnis commented 2024-10-05 19:15:35 +02:00 (Migrated from github.com)

Java allows all unicode-letters in variable names, not only latin letters. Is there a chance to include these characters in the identifier regex?

Otherwise, this is how valid java code would look like:

grafik

My current approach is to copy-paste the grammar and change it from

github.com/lezer-parser/java@14901c5f4a/src/java.grammar (L712-L714)

to

  identifier { $[a-z_$äöü] $[a-zA-Z0-9_$äöüÄÖÜß]* }

  capitalIdentifier { $[A-ZÄÖÜ] $[a-zA-Z0-9_$äöüÄÖÜß]* }
Java allows all unicode-letters in variable names, not only latin letters. Is there a chance to include these characters in the identifier regex? Otherwise, this is how valid java code would look like: ![grafik](https://github.com/user-attachments/assets/f8c9588a-8b6a-4397-96e8-df6923066174) My current approach is to copy-paste the grammar and change it from https://github.com/lezer-parser/java/blob/14901c5f4aead1cdd28d2d05007f130b055f5ab6/src/java.grammar#L712-L714 to ``` identifier { $[a-z_$äöü] $[a-zA-Z0-9_$äöüÄÖÜß]* } capitalIdentifier { $[A-ZÄÖÜ] $[a-zA-Z0-9_$äöüÄÖÜß]* } ```
marijnh commented 2024-10-05 23:07:51 +02:00 (Migrated from github.com)

Attached patch should help with this.

Attached patch should help with this.
Entkenntnis commented 2024-10-06 14:42:44 +02:00 (Migrated from github.com)

Thank you, it's working now!

Thank you, it's working now!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/java#9
No description provided.