-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
吾有一計,可實現“\n,\t……” #128
Comments
錶 means watch, which is different from 表 |
This could be integrated with the unicode notation for escape character mentioned in #84 Something like
could be compiled to: var a = "問" + "「" + "天地" + "」" + "\n" + "\t" + "好在。";
console.log(a); which outputs:
|
然則冗長,頓失文言之利也。況若人欲言“表之符”三字,何以書之? |
In the case
In the case
instead is a possible solution. |
则以「「表之符之字」之字」表「表之符之字」 |
通假可解之。例一:
could be compiled to: console.log('問「天地」\n\t好在。') directly, let a = '問上天地下行表好在。'
.replace(/上/g, '「')
.replace(/下/g, '」')
.replace(/行/g, '\n')
.replace(/表/g, '\t')
console.log(a) with detail. 例二:
console.log('辭云:\n「路曼曼其脩遠兮,\n 吾將上下而求索。」') or let a = '辭云:行前路曼曼其脩遠兮,行空吾將上下而求索。後'
.replace(/前/g, '「')
.replace(/後/g, '」')
.replace(/行/g, '\n')
.replace(/空/g, ' ')
console.log(a) |
然則言中另存“上”“下”“表”之語又當何如? |
just replace “上”“下”“表” with any char not shown in the sentence, as |
My point was that the proposal doesn't offer a general, elegant solution - one has to inspect the string before deciding on the escape characters. The escape characters may need adjustment if the string is changed. The solution is also far from elegant, generating a long trail of verbose sentences just to deal with escaping, let alone the inefficient speed with multiple replace() functions when translated into javascript. The escaping process should be dealt with at the compiler stage. I feel that instead of reinventing the wheel, a better solution is just to follow what other language designers have done. Stick with one rarely used character as a prefix. In c-like languages this would be "\". Perhaps one can pick another rarely used Chinese character for the purpose of escaping. |
You are right, and you can use the char which is 避諱 or 河蟹. 秦漢以降,再無雅言。皆為「帶著鐐銬跳舞」。 |
Good idea, perhaps 諱 would be a good enough option since it is rarely used enough. So something like 「「甲諱表乙諱表丙諱表諱行」」= "甲\t乙\t丙\t\n" |
yes, it's so ironic |
但是如此會讓語意難以理解。 |
只是選字而已,通假說明還是需要的,因為每一個時代的避諱字不一樣,we won't rebuild complier for every dynasty. 「香菱度名諱表曰石頭記」 |
如果兼用兩個字符 語與諱呢 |
At present, there is no escape character in wenyan-lang.
I have an idea that we can use "符" as escape character.
\b → 退之符
\f → 頁之符
\n → 行之符
\t → 表之符
The text was updated successfully, but these errors were encountered: