samples/es6.js
///<reference types="node"/>
var i = 10000 / 111.77; /[*]/.test(i); // */
{ i = "aaa\"" } /aaa/.test(i);
/* comments */var i = 10000 / 111.77; /\][*]/.test(i); // */
console.log(
[
/\s*\(\?#.*\)\/[/*[)(?\]]\s*$|#\s.*$|\s+/
]
);
let gg = 10;
var re = 10000 / 111.77 * gg /gg;;;; ////// comments...
// ^---------------^ <- this case is match. but, not regexp literal
// skip to -->^
// line comment start -->^ <- parse by class SlashVisitor
// in this case, correctly detects.
const re4 = /\s*\(\?#.*\)\/[/*[)(?\]]\s*$|#\s.*$|\s+/ /* comments...*/
const nnn = 123 /+"2" * gg /* comments...*/
let ok2 = 12.2 / 33 * .9 // "comments"...*/
// ^ <- parse by class SlashVisitor
// ^---------------^ <- will recognize as regexp literal ...
// ^ however, since its actually a line comment, deleted from this position to the end of the line.
let ok3 = 12.2 / 33 * .9/* comments...*/
// ^ <- parse by class SlashVisitor, in this case it can be correctly judged that it is not regexp literal.
// ^ <- parse by class SlashVisitor, Its recognized and deleted as multiline comment.
// ↓ parse by class SlashVisitor
/**
* triple nested es6 template string.
*/
const test_text = `:Key Binding:${ 234 }}
// ^ <- parse by class BackQuoteScanner
}
about [alt+A]
${
"nest-1:" + `:Key Binding:${ 234 }}
}
${
// comment line...
"nest-2:" + `:Key Binding:${ `let abc = ${
Boolean("")
}` }}
}
// comment line in backquote
${
/**
* triple nested es6 template string.
*/
"nest-3:" + `:Key Binding:${ 234 }}
}
// comment line in backquote
:On comment:\`\ \"\`\"\\
------------------------------[ X ]`
}
:On comment:\`\ \"\`\"\\
------------------------------[ X ]`
}
:On comment:\`\ \"\`\"\\
------------------------------[ X ]`
// comment line...
}
:On comment:\`\ \"\`\"\\
------------------------------[ X ]`;
;
/**
* block comment.
*/// test
const $3 = { keyCode: $1, key: "$5\"this is\
^ <- parse by class QuoteScanner\
test" };
const gm = 234;
; ;; ;
var i = 100 / 10 * 123.555/gm; // comment line
// ^ <- parse by class SlashVisitor
var HTMLIZE_TEXT = {
title: `/anything/g`,
// ^ <- parse by class BackQuoteScanner
description: '--- nothing ---',
// ^ <- parse by class QuoteScanner
qre: "/(<button)\\s+([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*([\\w\\-]+(?:=\"[^\"]+\")?)?\\s*(>.*<\\/button>)/g.toString()",
// ^ <- parse by class QuoteScanner
re: /(<button)\s+([\w\-]+(?:="[^"]+")?)?\s*([\w\-]+(?:="[^"]+")?)?\s*([\w\-]+(?:=`[^`]+`)?)?\s*([\w\-]+(?:="[^"]+")?)?\s*([\w\-]+(?:="[^"]+")?)?\s*([\w\-]+(?:="[^"]+")?)?\s*([\w\-]+(?:="[^"]+")?)?\s*(>.*<\/button>)/g.toString(),
// ^ <- parse by class SlashVisitor. this regexp literal although contains quote character, since it is correctly recognized as regexp literal, can avoid parse by quotevisitor.
ere: `(^:[\\w ]+:\$)| (?#heading text)
(^[\\w ]+)(\\[[\\w\\+]+\\])| (?#text item)
(?:([\\-]+)(\\[ X \\])) (?#emulate close button)`,
flags: "",
test_text: `:Key Binding:{}
}
:On comment:\`\ \"\`\"\\
------------------------------[ X ]`,
test_textQ: ":Key Binding:\
\
:On comment:\`\ \"\`\"\
------------------------------[ X ]",
test_textS: ':Key Binding:\
\
:On comment:\`\ \' \"\`\"\
------------------------------[ X ]',
timestamp: 1499535241972
};
let name = "apple";
// comment line.
const templete = `function ${name}($) {
// comment line.
var some = ${
// comment line #2...
`12.5 / 50 * 100,
// might be a very important comment line.
things = "${ name + `anything` }",
obj={ "\\\\": null }`
}, unused = \`length is ${name.length}\` || undefined;
/**
* multi line comment...
*/
return true;
}
`;
; /* ... */