-
Notifications
You must be signed in to change notification settings - Fork 18
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
POC - Unicode chars in identifiers #317
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,6 +354,10 @@ describe('Wollok parser', () => { | |
'_foo123'.should.be.be.parsedBy(parser).into('_foo123') | ||
}) | ||
|
||
it('should parse names that contains unicode chars', () => { | ||
'_foö123_and_bár'.should.be.be.parsedBy(parser).into('_foö123_and_bár') | ||
}) | ||
|
||
it('should not parse names with spaces', () => { | ||
'foo bar'.should.not.be.parsedBy(parser) | ||
}) | ||
|
@@ -370,6 +374,9 @@ describe('Wollok parser', () => { | |
'"foo"'.should.not.be.parsedBy(parser) | ||
}) | ||
|
||
it('should not parse strings containing unicode as names', () => { | ||
'"foö"'.should.not.be.parsedBy(parser) | ||
fdodino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) | ||
}) | ||
|
||
|
||
|
@@ -1914,6 +1921,10 @@ class c {}` | |
'var v'.should.be.parsedBy(parser).into(new Variable({ name: 'v', isConstant: false })).and.be.tracedTo(0, 5) | ||
}) | ||
|
||
it('should parse var declaration with non-ascii caracter in identifier', () => { | ||
'var ñ'.should.be.parsedBy(parser).into(new Variable({ name: 'ñ', isConstant: false })).and.be.tracedTo(0, 5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 para poder escribir codigo 100% en castellano There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uh qué bueno!! quiero ver si pasa también por el tamiz del validador, el cli y el LSP-IDE, pero definitivamente lo quiero!! 👏🏼 👏🏼 👏🏼 |
||
}) | ||
|
||
it('should parse var asignation', () => { | ||
'var v = 5'.should.be.parsedBy(parser).into( | ||
new Variable({ | ||
|
@@ -2240,6 +2251,18 @@ class c {}` | |
) | ||
}) | ||
|
||
it('should parse references starting with unicode letter', () => { | ||
'ñ'.should.be.parsedBy(parser).into(new Reference({ name: 'ñ' })).and.be.tracedTo(0, 1) | ||
}) | ||
|
||
it('should parse references containing unicode letter', () => { | ||
'some_ñandu'.should.be.parsedBy(parser).into(new Reference({ name: 'some_ñandu' })).and.be.tracedTo(0, 10) | ||
}) | ||
|
||
it('should not parse references starting with numbers that contain unicode letters', () => { | ||
'4ñandu'.should.not.be.parsedBy(parser) | ||
}) | ||
|
||
it('should not parse references with spaces', () => { | ||
'foo bar'.should.not.be.parsedBy(parser) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh aqui la magic, ese
\p{L}
hace referencia a cualquier unicode letter, que contiene a todos los\w
(menos al _ creo)