Skip to content

Conversation

@antfu
Copy link
Member

@antfu antfu commented Mar 16, 2020

This PR adds eval function to wenyan, which can run native code from strings.

吾嘗觀「「天地經」」之書。方悟「鑒」之義。

施「鑒」於「「1 + 1」」書之。

A fix for literal parsing is also included, line breaking will now be presented as \n in compiled code.

With this fix, we can also get rid of the \ in 混沌經 example.

吾有一言。曰「「\
	物\
		之「名」言「李白」\
		之「字」言「太白」\
		之「號」言「青蓮」\
」」
吾有一言。曰「「
	物
		之「名」言「李白」
		之「字」言「太白」
		之「號」言「青蓮」
」」

@ghost
Copy link

ghost commented Mar 16, 2020

That’ll simplify most of my work :D

@LingDong- LingDong- merged commit ba6ff59 into wenyan-lang:master Mar 16, 2020
@LingDong-
Copy link
Member

Nice! Thanks :)

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is eval() function only work on JavaScript code or Wenyan code?

@antfu
Copy link
Member Author

antfu commented Mar 17, 2020

Is eval() function only work on JavaScript code or Wenyan code?

It works on the native target language. If you compile to js then it's Javascript code, if you compile it to python then it's python code and so on.

@ghost
Copy link

ghost commented Mar 17, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants