-
Notifications
You must be signed in to change notification settings - Fork 46
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
Allow both simplified and traditional keyword characters simultaneously #56
Comments
是为了支持不同代码文件中分别使用简繁关键词么? |
@nobodxbodon It is to support the use of both traditional and simplified characters in the same piece of code. I see that @StepfenShawn changed This would allow either traditional or simplified. For example, >>> import re
>>> re.fullmatch(r'[点點][样樣]先', '點样先')
<re.Match object; span=(0, 3), match='點样先'> |
如果支持同一代码中不需一致的简繁混合关键词,是否会让用户误认为标识符也可以呢? @StepfenShawn 祝虎年快乐,捞乜都掂! |
Hmm, I guess allowing the mixing of traditional and simplified characters can lead to confusion. But I'm not sure if that would cause users to mistake them for identifiers since variables, expressions, and function calls are surrounded by vertical bars, It's probably not an important feature since most people won't be mixing traditional and simplified in the same file. It might happen in a project with multiple teammates, but then you could just enforce one character set or have a converter to get them to be consistent. Allowing both character sets would also make searching through code a pain. Happy New Year! |
Hi @nobodxbodon @dosentmatter 虎年快乐! |
好像有点误会。之前的意思是,如果允许关键词的简繁混用,是否也应允许标识符的简繁混用呢?比如:
|
@nobodxbodon, oh I did misunderstand.
I'm not sure if allowing leniency in traditional/simplified keywords would lead to users to mistakenly believe identifiers can also be a mix of traditional/simplified characters.
The keywords are decided by the cantonese programming language, while the identifiers are chosen by the user, so it might be better to stick with the exact same characters they declared the identifier with. If we did allow mixing traditional/simplified characters for identifiers, it might complicate code generation to other languages, since we would have to identify and unify all of the identifiers before they can run in the other language. My feature request for allowing leniency in the keywords wasn't proposed because I expected users to mix-and-match traditional/simplified all the time. It was just to allow leniency and to have one less option, |
Instead of using the
-use_tr
flag to switch modes, is it possible to allow both simplified and traditional keywords at the same time?The text was updated successfully, but these errors were encountered: