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

Introducing Compiler Option for Retain the Wyrd Comment and Compile Into JavaScript Comment #42

Open
Alexius-Huang opened this issue Feb 3, 2020 · 0 comments

Comments

@Alexius-Huang
Copy link
Owner

What?
Support for compiler option which the compiled result contains the comment in the original Wyrd code.

Why?
Convenient for inspecting compiled code with comment description contained.

How?
Add a new compiler option which supports compiling the comment, for instance, the compileComment option which default value is false (or skipComment option which default value is true)

The compiled comment in different cases are listed below:

Case 1. Singleline comment
Wyrd Code:

foo = 123 # Singleline comment

Compiled Wyrd Code:

const foo = 123; // Singleline comment

Case 2. Multiline comment
Wyrd Code:

foo = 123 ##
  Multiline comment
##
bar = ## Assignment ## 456

Compiled Wyrd Code:

const foo = 123; /*
  Multiline comment
*/
const bar = /* Assignment */ 456;

Case 3. Since JavaScript's multiline comment is /* ... */, we need to escape these character combination
Wyrd Code:

foo = 123 ##
  /* Multiline comment */
##

Compiled Wyrd Code:

const foo = 123; /*
   Multiline comment 
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant