Skip to content
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

Escape quote (「」) in string #84

Open
splitline opened this issue Dec 18, 2019 · 6 comments
Open

Escape quote (「」) in string #84

splitline opened this issue Dec 18, 2019 · 6 comments
Labels
syntax Suggestions to improve the syntax

Comments

@splitline
Copy link
Contributor

In a lot of programming language, we can use backslash to prevent interpreter from interpreting a quote (", ') as the end of string.
I think that wenyan-lang also need feature like this

For example, if I want to print 問「天地」好在。, maybe we can use syntax like this 吾有一言。曰「「問\「天地\」好在。」」。書之。
But put backslash straightly seems doesn't fit with the wenyan philosophy :/

@splitline splitline changed the title Escape quote (「」) Escape quote (「」) in string Dec 18, 2019
@shyoshyo
Copy link

shyoshyo commented Dec 18, 2019

If quote notations 「」 inside the string necessarily match up, then they can be directly determined by AST.
The problem comes when quote notations inside the string do not required to be matched up, e.g. print 問「「, then print 天地, then print 」」好在。

@shyoshyo
Copy link

how about using something like 萬國碼之一萬兩千三百零一 to represent \u300d, i.e.

@satouriko
Copy link

how about using something like 萬國碼之一萬兩千三百零一 to represent \u300d, i.e.

@LingDong-
Copy link
Member

@shyoshyo I like your solution! Or perhaps we can wrap String.fromCharCode to do the trick.

@nikacan
Copy link

nikacan commented Dec 18, 2019

how about using something like 萬國碼之一萬兩千三百零一 to represent \u300d, i.e.

Is 「二」not better than「兩」?

@cuixiping
Copy link
Contributor

Before there is a escape syntax, you can do like this:

夫「「「」」」之一。名之曰「左括弧」。
夫「「「」」」之二。名之曰「右括弧」。

夫「左括弧」書之。
夫「右括弧」書之。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax Suggestions to improve the syntax
Projects
None yet
Development

No branches or pull requests

6 participants