diff --git a/autotests/folding/highlight.js.fold b/autotests/folding/highlight.js.fold
index 122c0ac..5bc815a 100644
--- a/autotests/folding/highlight.js.fold
+++ b/autotests/folding/highlight.js.fold
@@ -1,139 +1,139 @@
-
Hello World
var p = / var p = />/ // a test if #pop back from a comment will work -re =/* 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 */ String = /\b(?:fixme|todo|note)\b/ /* 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!"); re=/foo/ig; // hehe somestring.search( /^foo\w+\s\d{0,15}$/ ); re = /dooh/; // This is supposedly legal: re = somebool ? /foo/ : /bar/; // NOTE - Special case: an empty regex, not a comment. // The rule uses a positive lookahead assertion to catch it: "//(?=;)". 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/; re = /(\d{0,4})\D/; re = /[a-zA-Z_]+/; re = /[^\d^]+/; re = /\s+?\w+\.$/; re = /\/\//; re = /a|b/; // the following are not regexps in E4X (=xml embedded into JavaScript) var p = <p>Hello World</p> var p = /</ var p = />/ // a test if #pop back from a comment will work 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! somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1"); // ^ fallthrough expected. ("new" whould be bold) something.method = function ( a, b, c ) { /* ... */ } // ^ fallthrough ?! something.other = function ( d, e, f ) { /* ... */ } // fallthrough expected at col 0 ("function" should be bold) var ary = new Array(5); // ^ fallthrough ? (if keyword is correctly rendered) var b = a ? 1 : 0; // ^ ^ fallthroughs. numbers must be rendered correctly. var c = d ? true : false; var conditinalstring = b ? "something" : "something else"; // guess... /* Normal program flow... */ if (something) dostuff(); else dont(); return; try { bla() } catch (e) { alert("ERROR! : " + e) } for (int i=0; i < j; i++) document.write("i is" + i + "<br>"); while (something) { block(); picky: if (!1) break; else continue; } with (a) { do { stuff( b ); // a.b if it exists } while (itmakessense); } switch (i) { case 0: f(); break; - default: + default: break; }diff --git a/autotests/html/test.jsx.html b/autotests/html/test.jsx.html index 4af3ffa..b19eabe 100644 --- a/autotests/html/test.jsx.html +++ b/autotests/html/test.jsx.html @@ -1,57 +1,59 @@
-/* email: <willy@wmail.com> - * URL: https://reactjs.org/*/ +// JavaScript React + +/** @author Willy <willy@wmail.com> + * @url https://reactjs.org/ **/ import React from 'react'; import { PhotoStory, VideoStory } from './stories'; function Story(props) { const SpecificStory = components[props.storyType]; return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />; } function <Tag attr1={ <tag/> function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;"> /* no comment*/ function <tag/> return class var 0x123 &ref; hello() React.Component() .<tag/> anyWord <tag/> { function <tag> return class var 0x123 hello() React.Component() } </Tag> <tag1> </tag1> <tag1> </Tag$> <Tag$> </tag> <tag/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 /> // Detect Valid tags /* comment */ <tag></tag> { /* comment */ <Tag /> word <noTag/> . <noTag/> } <noTag/> return /* comment multiline */ <tag/> /* comment */ <Tag/> && /*comment*/ <Tag/> & /*comment*/ <noTag/> <tag/> { <hello>Hello</hello> } ?<Tag />; [ <tag /> ( <tag /> ,<Tag/> =<Tag/> &&<tag/> ||<tag/> return <tag/> ; default<tag/> ; <Tag> <tag> <tag$/> </tag> return </Tag> anyWord<noTag> anyWord/*comment*/ <noTag/> .<noTag> &<notag> | <noTag/> % /* comment*/ <noTag/>diff --git a/autotests/html/test.ts.html b/autotests/html/test.ts.html new file mode 100644 index 0000000..fb89fe3 --- /dev/null +++ b/autotests/html/test.ts.html @@ -0,0 +1,57 @@ + + + +
+/// <reference types="node" /> + +// 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/html/test.jsx.html b/autotests/html/test.tsx.html similarity index 84% copy from autotests/html/test.jsx.html copy to autotests/html/test.tsx.html index 4af3ffa..847b6d0 100644 --- a/autotests/html/test.jsx.html +++ b/autotests/html/test.tsx.html @@ -1,57 +1,63 @@ -
-/* email: <willy@wmail.com> - * URL: https://reactjs.org/*/ +// TypeScript React + +/** @author Willy <willy@wmail.com> + * @url https://reactjs.org/ **/ import React from 'react'; import { PhotoStory, VideoStory } from './stories'; -function Story(props) { +function Story(props) { const SpecificStory = components[props.storyType]; return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />; } function -<Tag attr1={ <tag/> function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;"> +<Tag attr1={ <tag/> function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;"> /* no comment*/ function <tag/> return class var 0x123 &ref; hello() React.Component() .<tag/> anyWord <tag/> - { function <tag> return class var 0x123 hello() React.Component() } + { function <tag> return class var 0x123 hello() React.Component() } </Tag> <tag1> </tag1> <tag1> </Tag$> <Tag$> </tag> <tag/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 /> // Detect Valid tags /* comment */ <tag></tag> { /* comment */ <Tag /> word <noTag/> . <noTag/> } <noTag/> return /* comment multiline */ <tag/> /* comment */ <Tag/> && /*comment*/ <Tag/> & /*comment*/ <noTag/> <tag/> { <hello>Hello</hello> } ?<Tag />; [ <tag /> ( <tag /> ,<Tag/> =<Tag/> &&<tag/> ||<tag/> return <tag/> ; default<tag/> ; <Tag> <tag> <tag$/> </tag> return </Tag> anyWord<noTag> anyWord/*comment*/ <noTag/> .<noTag> &<notag> | <noTag/> % /* comment*/ <noTag/> + +annotation: <tag/> +annotation: text [ <tag/> ] +console.log("hello")diff --git a/autotests/input/test.jsx b/autotests/input/test.jsx index 52b35c5..483e116 100644 --- a/autotests/input/test.jsx +++ b/autotests/input/test.jsx @@ -1,50 +1,52 @@ -/* email:
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}