-
Notifications
You must be signed in to change notification settings - Fork 166
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
[Parser] Fix bug with non-ASCII characters in the new parser #948
Closed
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0719d02
Update the definition of a character.
akshanshbhatt a7935f4
Add tests and update refs.
akshanshbhatt 9e18b2c
Use import instead of manually specifying.
akshanshbhatt a160786
Add support for unicode numerals in identifier names along with tests.
akshanshbhatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def test_frompyfunc_name(self): | ||
# name conversion was failing for python 3 strings | ||
# resulting in the default '?' name. Also test utf-8 | ||
# encoding using non-ascii name. | ||
def cassé(x): | ||
return x | ||
|
||
ℙƴtℌøἤ = 1 | ||
print(ℙƴtℌøἤ) | ||
|
||
if 诶 != 2: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"basename": "ast_new-unicode-d3199dc", | ||
"cmd": "lpython --show-ast --new-parser --no-color {infile} -o {outfile}", | ||
"infile": "tests/parser/unicode.py", | ||
"infile_hash": "3e528c289a84fea33fc77e001303be40462884f95f5bfbab960125b6", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": "ast_new-unicode-d3199dc.stdout", | ||
"stdout_hash": "f823fd385e5a7c49558532b879dce3005229321e995631fabb19f6b1", | ||
"stderr": null, | ||
"stderr_hash": null, | ||
"returncode": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(Module [(FunctionDef test_frompyfunc_name ([] [(self () ())] [] [] [] [] []) [(FunctionDef cassé ([] [(x () ())] [] [] [] [] []) [(Return (Name x Load))] [] () ())] [] () ()) (Assign [(Name ℙƴtℌøἤ Store)] (ConstantInt 1 ()) ()) (Expr (Call (Name print Load) [(Name ℙƴtℌøἤ Load)] [])) (If (Compare (Name 诶 Load) NotEq [(ConstantInt 2 ())]) [(Pass)] [])] []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Would this accept a Hindi numeral? It seems it would only accept digits 0-9, but not Hindi numerals.
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.
I just added the support for Unicode numerals in the latest commit.