diff --git a/autotests/folding/highlight.js.fold b/autotests/folding/highlight.js.fold
--- a/autotests/folding/highlight.js.fold
+++ b/autotests/folding/highlight.js.fold
@@ -1,18 +1,18 @@
-/* test.js - test for javascript.xml syntax file */
+/* test.js - test for javascript.xml syntax file */
// Note: this script will not, and is not supposed to, compile in any js engine.
-/*
+/*
NOTE: The words "todo", "fixme" and "note" should be rendered in a different style
within comments, match should be caseless (to test for regexp insensitive attribute).
- The regex used for this rule is */
+ The regex used for this rule is */
String = /\b(?:fixme|todo|note)\b/
- /* Thus, for example "Notebook" is not caught by
+ /* Thus, for example "Notebook" is not caught by
this rule. (the "?:" in the subpattern is there to avoid the regex engine wasting time
saving a backref, which is not used for anything. I do not know if the overhead of parsing
that is greater than the time saved by not capturing the text...)
The rule for catching these words is placed in a context "Comment common", which is used
by both comment contexts (single line, multiline) using the new "IncludeRules" item.
-*/
+*/
// test if regex support works - nice with new fallthrough prop in context:)
somestring.replace( /dooh/ , "bah!");
@@ -33,15 +33,15 @@
re = //;
re = /a|b/;
-/*
+/*
Tests for the regex parser.
It will parse classes, quanitfiers, special characters and regex operaters,
as specified in the netscape documentation for javascript.
Regexps are only parsed in their clean form, as the RegExp(string) constructor
is using a quoted string.
TODO: Find out if more regex feats should be supported.
Consider using more itemDatas - assertion, quantifier are options.
-*/
+*/
re = /^text\s+\d+\s*$/;
re = /a pattern with caret \(^\) in it/;
@@ -58,15 +58,15 @@
var p = />/
// a test if #pop back from a comment will work
-re = /*/foo/*/ /bar/;
+re = /*/foo/*/ /bar/;
// ^ POP
// ^ we got back after pop in comment, if there is regexp attribs here :-)
-/*
+/*
Some tests if the fallthrough works.
The fallthrough happens if a regexp is not found in a possible (!) position,
which is after "search(" or "replace(" or "=" or "?" or ":" in version 0.1 of the xml file
-*/
+*/
var foo = 'bar';
// ^ fallthrough!
@@ -77,11 +77,11 @@
something.method =
- function ( a, b, c ) { /* ... */ }
+ function ( a, b, c ) { /* ... */ }
// ^ fallthrough ?!
something.other =
-function ( d, e, f ) { /* ... */ }
+function ( d, e, f ) { /* ... */ }
// fallthrough expected at col 0 ("function" should be bold)
var ary = new Array(5);
@@ -98,42 +98,42 @@
// guess...
-/*
+/*
Normal program flow...
-*/
+*/
if (something)
dostuff();
else
dont();
return;
-try { bla() } catch (e) { alert("ERROR! : " + e) }
+try { bla() } catch (e) { alert("ERROR! : " + e) }
for (int i=0; i < j; i++)
document.write("i is" + i + "
");
while (something)
-{
+{
block();
picky:
if (!1)
break;
else
continue;
-}
+}
-with (a) {
- do {
+with (a) {
+ do {
stuff( b ); // a.b if it exists
- } while (itmakessense);
-}
+ } while (itmakessense);
+}
-switch (i) {
+switch (i) {
case 0:
f();
break;
default:
break;
-}
+}
diff --git a/autotests/folding/test.js.fold b/autotests/folding/test.js.fold
--- a/autotests/folding/test.js.fold
+++ b/autotests/folding/test.js.fold
@@ -1,12 +1,12 @@
#! shebang
#! no-shebang
-/* comment */
+/* comment */
function fun()
-{
- var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] };
-}
+{
+ var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] };
+}
class MyClass; // reserved keywords
diff --git a/autotests/folding/test.jsx.fold b/autotests/folding/test.jsx.fold
--- a/autotests/folding/test.jsx.fold
+++ b/autotests/folding/test.jsx.fold
@@ -1,50 +1,52 @@
-/* email:
- * URL: https://reactjs.org/*/
+// JavaScript React
+
+/** @author Willy
+ * @url https://reactjs.org/ **/
import React from 'react';
import { PhotoStory, VideoStory } from './stories';
function Story(props) {
const SpecificStory = components[props.storyType];
- return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
+ return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
}
function
- attr1={ /> function return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
- /* no comment*/ function /> return class var 0x123 &ref; hello() React.Component()
- ./> anyWord />
- { function return class var 0x123 hello() React.Component() }
->
+ attr1={ /> function return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
+ /* no comment*/ function /> return class var 0x123 &ref; hello() React.Component()
+ ./> anyWord />
+ { function return class var 0x123 hello() React.Component() }
+>
-> >
-> >
-> >
+> >
+> >
+> >
-/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />
+/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />
// Detect Valid tags
-/* comment */ >>
-{ /* comment
- */ />
+/* comment */ >>
+{ /* comment
+ */ />
word . }
-return /* comment
- multiline */ /> /* comment */ />
-&& /*comment*/ />
-& /*comment*/
-
- />
-{ >Hello> }
-? />;
-[ /> ( />
-,/> =/>
-&&/> ||/>
-return /> ;
-default/> ;
-> > /> > return >
+return /* comment
+ multiline */ /> /* comment */ />
+&& /*comment*/ />
+& /*comment*/
+
+ />
+{ >Hello> }
+? />;
+[ /> ( />
+,/> =/>
+&&/> ||/>
+return /> ;
+default/> ;
+> > /> > return >
anyWord
-anyWord/*comment*/
+anyWord/*comment*/
.
& |
-% /* comment*/
+% /* comment*/
diff --git a/autotests/folding/test.qml.fold b/autotests/folding/test.qml.fold
--- a/autotests/folding/test.qml.fold
+++ b/autotests/folding/test.qml.fold
@@ -1,6 +1,6 @@
-/*
+/*
* multi line comment
- */
+ */
// single line comment
diff --git a/autotests/folding/test.ts.fold b/autotests/folding/test.ts.fold
new file mode 100644
--- /dev/null
+++ b/autotests/folding/test.ts.fold
@@ -0,0 +1,50 @@
+///
+
+// TypeScript Test
+
+class Student {
+ fullName: string;
+ constructor(public firstName: string, public middleInitial: string, public lastName: string) {
+ this.fullName = firstName + " " + middleInitial + " " + lastName;
+ }
+}
+
+interface Person {
+ firstName: string;
+ lastName: string;
+}
+
+function greeter(person : Person) {
+ return "Hello, " + person.firstName + " " + person.lastName;
+}
+
+let user = new Student("Jane", "M.", "User");
+
+document.body.innerHTML = greeter(user);
+JSON.stringify()
+console.log("Hello world");
+
+import http = require("http");
+import path = require("path");
+import URL = url.URL;
+import { Readable, Writable } from "stream";
+import { isBuffer, isString, isObject } from "util";
+
+const port = 8__88___8;
+const baseUrl = new URL(`http://localhost:${port}/`);
+const rootDir = path.dirname(__dirname);
+
+const defaultBrowser = os.platform() === "win32" ? "edge" : "chrome";
+let browser: "edge" | "chrome" | "none" = defaultBrowser;
+let grep: string | undefined;
+
+interface FileBasedTestConfiguration {
+ [setting: string]: string;
+}
+
+function swapCase(s: string): string {
+ return s.replace(/\w/g, (ch) => {
+ const up = ch.toUpperCase();
+ return ch === up ? ch.toLowerCase() : up;
+ });
+}
diff --git a/autotests/folding/test.tsx.fold b/autotests/folding/test.tsx.fold
new file mode 100644
--- /dev/null
+++ b/autotests/folding/test.tsx.fold
@@ -0,0 +1,56 @@
+// TypeScript React
+
+/** @author Willy
+ * @url https://reactjs.org/ **/
+
+import React from 'react';
+import { PhotoStory, VideoStory } from './stories';
+
+function Story(props) {
+ const SpecificStory = components[props.storyType];
+ return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
+}
+
+function
+ attr1={ /> function return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
+ /* no comment*/ function /> return class var 0x123 &ref; hello() React.Component()
+ ./> anyWord />
+ { function return class var 0x123 hello() React.Component() }
+>
+
+> >
+> >
+> >
+
+/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />
+
+// Detect Valid tags
+
+/* comment */ >>
+{ /* comment
+ */ />
+ word . }
+return /* comment
+ multiline */ /> /* comment */ />
+&& /*comment*/ />
+& /*comment*/
+
+ />
+{ >Hello> }
+? />;
+[ /> ( />
+,/> =/>
+&&/> ||/>
+return /> ;
+default/> ;
+> > /> > return >
+
+anyWord
+anyWord/*comment*/
+.
+& |
+% /* comment*/
+
+annotation: />
+annotation: text [ /> ]
+console.log("hello")
diff --git a/autotests/html/highlight.js.html b/autotests/html/highlight.js.html
--- a/autotests/html/highlight.js.html
+++ b/autotests/html/highlight.js.html
@@ -140,7 +140,7 @@
case 0:
f();
break;
- default:
+ default:
break;
}