diff --git a/autotests/folding/example.rmd.fold b/autotests/folding/example.rmd.fold index 780c800..65745f3 100644 --- a/autotests/folding/example.rmd.fold +++ b/autotests/folding/example.rmd.fold @@ -1,68 +1,68 @@ --- -title: "test" -author: "me" -date: "07.10.2014" +title: "test" +author: "me" +date: "07.10.2014" output: html_document --- This is a simple test document. It shows syntax highlighting switches between YAML (above), R blocks ```{r, echo=FALSE} -for (i in 1:10) { +for (i in 1:10) { if(i>=10) print(i) -} +} # two blank lines below sessionInfo() ``` LaTeX equations, $$ h_{i}(t \mid q,C) = h_{0}(t) e^{\beta_{1}quality_{i} + \beta_{2}C_{iq}} $$ and Markdown. A [link](http://example.com) in Markdown. Inline `r y <- 5 + x - sin(3)` R code. Inline `y <- 5 + x - sin(3)` code. Heading ======= Sub-heading ----------- A list of editors: * kate * vim * emacs *italic*, **bold**, `monospace` code block more code normal text normal text normal text 1. item * This is a list item with multiple lines. ```{r pressure, echo=FALSE} plot(pressure) ``` > This is a blockquote `r cos(33) ` This is a new paragraph, which is part of this $$ \text{item} $$. indented code block Other paragraph. * subitem * subitem $$ A = B + C $$ diff --git a/autotests/folding/highlight.js.fold b/autotests/folding/highlight.js.fold index 67d5a70..507c417 100644 --- a/autotests/folding/highlight.js.fold +++ b/autotests/folding/highlight.js.fold @@ -1,139 +1,161 @@ -/* 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!"); 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 =

Hello World

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! somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1"); // ^ fallthrough expected. ("new" whould be bold) 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); // ^ 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 + "
"); 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: break; } + +// Numerics +var a = 0xA; +var b = 0b1; +var c = 0o7; +var d = 1.1E+3; +var e = 1.E+3; +var f = .1E+3; +var g = 1E+3; +var h = 1.1; +var i = 1.; +var j = .1; +var k = 1; +// Bigint +const binBig = 0b101n; +const octBig = 0o567n; +const hexBig = 0xC0Bn; +const decBig = 123n; +// Invalid numbers +var l = 0xA1t; +var m = 0b0123; +var n = 0o29; diff --git a/autotests/folding/highlight.jsp.fold b/autotests/folding/highlight.jsp.fold index c1c7674..3b79ac1 100644 --- a/autotests/folding/highlight.jsp.fold +++ b/autotests/folding/highlight.jsp.fold @@ -1,173 +1,173 @@ <%-- This page won't actually work, as it is simply designed to display jsp syntax highlighting. --%> <%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%> <%@ include file="/include/myglobalvars.jsp"%> --%> <%@ page import="java.util.*, java.io.*, java.math.*" %> <%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%> <% // We can decipher our expected parameters here. String parm1 = noNull(request.getParameter(PARAMETER_1)).trim(); String parm2 = noNull(request.getParameter(PARAMETER_2)).trim(); String parm3 = noNull(request.getParameter(PARAMETER_3)).trim(); String parm4 = noNull(request.getParameter(PARAMETER_4)).trim(); String parm5 = noNull(request.getParameter(PARAMETER_5)).trim(); // A sample collection of Integers to display some code folding. List intList = getIntList(10); %> A Sample Jsp language="javascript">> type="text/css"> body{ color: yellow; } <%-- The top label table. --%>
The following parameters were detected:
<%-- Display the parameters which might have been passed in. --%> <%-- Label; Actual Parameter String; Value Detected --%> <%-- Label; Actual Parameter String; Value Detected --%> <%-- Label; Actual Parameter String; Value Detected --%> <%-- Label; Actual Parameter String; Value Detected --%> <%-- Label; Actual Parameter String; Value Detected --%>
PARAMETER_1 <%=PARAMETER_1%> "<%=parm1%>"
PARAMETER_2 <%=PARAMETER_2%> "<%=parm2%>"
PARAMETER_3 <%=PARAMETER_3%> "<%=parm3%>"
PARAMETER_4 <%=PARAMETER_4%> "<%=parm4%>"
PARAMETER_5 <%=PARAMETER_5%> "<%=parm5%>"


<%-- Display our list of random Integers (shows code folding). --%> <% - if (intList != null && intList.size() > 0) { + if (intList != null && intList.size() > 0) { %> <% Iterator intListIt = intList.iterator(); - while (intListIt.hasNext()) { + while (intListIt.hasNext()) { Integer i = (Integer) intListIt.next(); %> <% - } - } else { + } + } else { %> <% - } + } %>
Here are the elements of intList...
<%=i.toString()%>
Oooops, we forgot to initialize intList!


<%-- We can call javascript functions. --%>
Test our javascript...


<%-- If we actually had defined a tag library. --%>


<%-- Expression language. --%>
myParam's value: ""
<%! - /* A place for class variables and functions... */ + /* A place for class variables and functions... */ // Define some sample parameter names that this page might understand. private static final String PARAMETER_1 = "p1"; private static final String PARAMETER_2 = "p2"; private static final String PARAMETER_3 = "p3"; private static final String PARAMETER_4 = "p4"; private static final String PARAMETER_5 = "p5"; // Returns str trimmed, or an empty string if str is null. - private static String noNull(String str) { + private static String noNull(String str) { String retStr; if (str == null) retStr = ""; else retStr = str.trim(); return retStr; - } + } // Returns a list of Integers with listSize elements. - private static List getIntList(int listSize) { + private static List getIntList(int listSize) { ArrayList retList = new ArrayList(listSize); for (int i = 0; i < listSize; i++) retList.add(new Integer( (int) (Math.random() * 100) )); return retList; - } + } %> diff --git a/autotests/folding/highlight.php.fold b/autotests/folding/highlight.php.fold index 27891d7..ede0f87 100644 --- a/autotests/folding/highlight.php.fold +++ b/autotests/folding/highlight.php.fold @@ -1,69 +1,69 @@ /*
This is a pseudo PHP file to test Kate's PHP syntax highlighting. */ # TODO: this is incomplete, add more syntax examples! # this is also a comment. // Even this is a comment function test($varname) { return "bla"; # this is also a comment } ?> test"; ?> > - .inputText { + .inputText { width: px; text-indent: 10px; - } + } > > var some_js_var = ; > type="text/babel"> - > > /* aaa */ ?> >> - function a(i) { + > > /* aaa */ ?> >> + function a(i) { - return >{ i + j }>; - } + return >{ i + j }>; + } > type="text/typescript"> - class DateTime { + class DateTime { info: string; - constructor() { this.info = ; } - get() { return this.info; } - } + constructor() { this.info = ; } + get() { return this.info; } + } > type="x-tmpl-mustache"> - {{! }} - {{#movie}} - > + {{! }} + {{#movie}} + >

{{title}}

{{title}} - {{ratings.critics_rating}} -
> - {{/movie}} +
> + {{/movie}}
> << This is the $string inside the variable (which seems to be rendered as a string) It works well, I think. DOOH # bug 382527 throw new ParserException("Test {$this->some_var[$index]}\nin {$this->file} is missing.\nThis is bad."); ?> diff --git a/autotests/folding/test.coffee.fold b/autotests/folding/test.coffee.fold index de7ad09..f71cbb1 100644 --- a/autotests/folding/test.coffee.fold +++ b/autotests/folding/test.coffee.fold @@ -1,71 +1,75 @@ # CoffeeScript test # Source: https://coffeescript.org ### Multiline comment ### import 'local-file.coffee' # Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Splats: race = (winner, runners...) -> print winner, runners # Existence: alert "I knew it!" if elvis? # Array comprehensions: cubes = (math.cube num for num in list) # Classes: class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." # Switch/When/Else: switch day when "Mon" then go work when "Tue" then go relax when "Thu" then go iceFishing when "Fri", "Sat" if day is bingoDay go bingo go dancing when "Sun" then go church else go work # Member objects: Object.prop. Object .Object Object timelineEvent.class # Embedded JavaScript Code markdown = `function () { return \`In Markdown, write code like \\\`this\\\`\`; }` ``` // Comment var array = new Array(500); var name = "Willy"; alert(`Hello ${name}!`); ``` ` String.raw\`String ${x} \` ` + +` // Regular Expression after template + const a = \`6\` / 2; /*comment*/ + \`template\` /regex/ ` diff --git a/autotests/folding/test.htm.fold b/autotests/folding/test.htm.fold index c8747a9..de497eb 100644 --- a/autotests/folding/test.htm.fold +++ b/autotests/folding/test.htm.fold @@ -1,74 +1,74 @@ HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> This is a title > /* comment */ #xyz { color: red; } h1 { font: "Comic Sans"; } >

Hello, {{ name }}!

> document.body.appendChild(document.createTextNode('Hello World!')); // comment > type="text/typescript"> - class Student { + class Student { fullName: string; - constructor(public firstName: string, public middleInitial: string, public lastName: string) { + constructor(public firstName: string, public middleInitial: string, public lastName: string) { this.fullName = firstName + " " + middleInitial + " " + lastName; - } - } + } + } let a: null = null; let b: number = 12___3; > src="https://unpkg.com/babel-standalone@6/babel.min.js">> type="text/babel"> ReactDOM.render( - >Hello, world!>, + >Hello, world!>, document.getElementById('root') ); - function Story(props) { - const SpecificStory = components[props.storyType]; - return story={ props.story } attr2="&ref;" attr3="Hello\n" />; - } + function Story(props) { + const SpecificStory = components[props.storyType]; + return story={ props.story } attr2="&ref;" attr3="Hello\n" />; + } > type="x-tmpl-mustache"> - {{#movie}} - > + {{#movie}} + >

{{title}}

{{title}} -
> - > + > + > Rating - {{ratings.critics_rating}} - > - {{/movie}} - {{^movie}} - > + > + {{/movie}} + {{^movie}} + > Movie Does Not Exist :( - > - {{/movie}} - {{! comment }} +
> + {{/movie}} + {{! comment }}
> type="text/html">
  • Hello
  • > > ? > diff --git a/autotests/folding/test.js.fold b/autotests/folding/test.js.fold index 5e2a92e..397b095 100644 --- a/autotests/folding/test.js.fold +++ b/autotests/folding/test.js.fold @@ -1,26 +1,43 @@ #! 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 // Member objects: text after "." object.property instanceof Number; iden1.iden2 . iden3.class class; var escapes = "aa\b\n\0a\"a\x12a\32a\u{123}a\$\%\ \#\y\aaa\ aaa"; var octal = 0o124; var bin = 0b1010; -ლಠ益ಠლ.ñá = 42; -δ /No-RegExp/ +日本語().ლಠ益ಠლ.ñá = 42; +δ /No-Regex/ -/* Modelines: finish comment in incomplete Modeline: - * kate: replace-tabs */ normal text +// Only highlight valid regular expressions, of a single line, after strings +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786 +"text" /No-Regex +"text" /Regex[:)]*/; +const a = "6" / 2; /*comment*/ const b = 5; +console.log("4" / "2"); // 2 +// Single quote +const a = '6' / 2; /*comment*/ const b = 5; +console.log('4' / '2'); // 2 +// Template +const a = `6` / 2; /*comment*/ const b = 5; +console.log(`4` / `2`); // 2 + +// Built-in +const os = require('os'); +JSON.stringify("hello"); +console.error("hello"); +Math.LOG10E; +Number.MAX_SAFE_INTEGER; diff --git a/autotests/folding/test.jsx.fold b/autotests/folding/test.jsx.fold index ad75228..9d15c8e 100644 --- a/autotests/folding/test.jsx.fold +++ b/autotests/folding/test.jsx.fold @@ -1,96 +1,98 @@ // JavaScript React -/** @author Willy - * @url https://reactjs.org/ **/ +/** @author Willy + * @url https://reactjs.org/ **/ import React from 'react'; -import { PhotoStory, VideoStory } from './stories'; +import { PhotoStory, VideoStory } from './stories'; -function Story(props) { - const SpecificStory = components[props.storyType]; - return story={ props.story } attr2="&ref;" attr3="Hello\n" />; -} +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() } -> + 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 - */ /> - word . } -return /* comment - multiline */ /> /* comment */ /> -&& /*comment*/ /> -& /*comment*/ - - /> -{ >Hello> } -? />; -[ /> ( /> -,/> =/> -&&/> ||/> -return /> ; -default/> ; -> > /> > return > +/* comment */ >> +{ /* comment + */ /> + word . } +return /* comment + multiline */ /> /* comment */ /> +&& /*comment*/ /> +& /*comment*/ + + /> +{ >Hello> } +? />; +[ /> ( /> ] +,/> =/> +&&/> ||/> +return /> ; +default/> ; +> > /> > return > anyWord -anyWord/*comment*/ +anyWord/*comment*/ . & | -% /* comment*/ - -/> -> > - -/> +% /* comment*/ // Non-ASCII tag name & attribute -<日本語>>; - 本本:本-本 aa本:本 aa:aa /> +<日本語>>; + 本本:本-本 aa本:本 aa:aa /> - />; - { ... x } y -={2 } z />; + />; + { ... x } y +={2 } z />; -let k1 = > > Hello > > world >>; -let k2 = > > Hello > >; +let k1 = > > Hello > > world >>; +let k2 = > > Hello > >; // Empty tags -<>; // no whitespace -< >; // lots of whitespace -< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags -<>hi; // text inside -<>>hi>>bye>; // children -<>>1><>>2.1>>2.2>>3>; // nested fragments -<>#; // # would cause scanning error if not in jsxtext +<>; // no whitespace +< >; // lots of whitespace +< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags +<>hi; // text inside +<>>hi>>bye>; // children +<>>1><>>2.1>>2.2>>3>; // nested fragments +<>#; // # would cause scanning error if not in jsxtext // Tags after substitutions in templates -`aaa${>>//comment - /*comment*//>}` +`aaa${>>//comment + /*comment*//>}` // Don't highlight tags within variable declaration let myIdentity: (arg: T) => T = identity; var myIdentity: (arg: U) => U = identity; -const myIdentity: {<T>(arg: T): T} = identity; +const myIdentity: {<T>(arg: T): T} = identity; // Don't highlight tags within interfaces and classes -interface GenericIdentityFn { +interface GenericIdentityFn { (arg: T): T; -} -class Handler { +} +class Handler { info: (arg: T): T ; - > > -} + > > +} + +// Check character after tag name, do not highlight invalid tags +/* comment */ ? +/*comment*/# diff --git a/autotests/folding/test.markdown.fold b/autotests/folding/test.markdown.fold index b9a41a4..82c3baa 100644 --- a/autotests/folding/test.markdown.fold +++ b/autotests/folding/test.markdown.fold @@ -1,582 +1,582 @@ --- Title: A Sample Markdown Document Author: Fletcher T. Penney Date: February 9, 2011 Comment: This is a comment intended to demonstrate metadata that spans multiple lines. --- # H1 ## H2 ### H3 Multi-line paragraph bla bla bla bla bla bla. Intentional line break via two spaces at line. Formats: _italic_, **bold**, `monospace`, ~~strikeout~~ Bullet list: * item1 * item2 Numbered list: 1. item 1 2. item 2 Task list: - [x] Finish my changes - [ ] Push my commits - [ ] Open a pull request A link as normal text: http://example.com [link](http://kde.org) Auto-link: Mail: This is [an example](http://example.com/ "Title") inline link. See my [About](/about/) page for details. This is [an example] [id] reference-style link. [id]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [bar]: http://example.com/ (Optional Title Here) [id2]: "Optional Title Here" ![Alt text](/path/to/img.jpg) ![Alt text](/path/to/img.jpg "Optional title") [![Alt text](https://url/to/img.svg)](https://link.com/example/) code 1 code 2 normal text > block quote _italic_ > more block quote normal text Title: some text normal text # Lists 1. item * This is a list item with multiple lines. ``` code ``` > This is a blockquote This is a new paragraph, which is part of the item in the previous list. indented code block Other paragraph. * subitem * subitem with multiple lines. New paragraph of the previous subitem. code block ----------------------- Other paragraph of the subitem. 30. numlist item 31. numlist item New paragraph of the previous item. > Blockquote code block Other paragraph. # Inline HTML © bold code -> +> a b - > + >
  • c
  • d
  • -
    > +
    > e -
    > +
    > normal text *italic* # Code `simple code` ``simple ` code`` ```simple `` ` code ``` ````simple`code```` normal text normal text normal text normal text code blocks are only allowed after an empty line. * list list normal text 1. num-list num-list normal text > quote quote code block normal code normal code # Fenced code blocks (bug 356974) ## Bash ```bash #!/usr/bin/env bash for f in *; do echo "$f" done ``` ## C++ ```cpp #include class Q : public QObject { Q_OBJECT public: Q(); } Q::Q() :QObject(NULL) { } ``` ## C ```c #include #include "stdint.h" #define SOME_VAR 1 static uint64_t intWithSuffix = 42ull + ~1233L; static int octNum = 07232; ``` ## C# ## ```csharp var arr = new[] { 0, 1, 2, 3, 4 }; var anon = new { Country = "Germany", Inhabitants = 80000000 }; ``` ## CMake ```cmake cmake_minimum_required(VERSION 3.10 FATAL_ERROR) project (hello_world) set(QT_MIN_VERSION "5.6.0") ``` ## CSS ```css h1.main::hover { font-size: 100; color: green; } ``` ## Email ```email From: Konqi Dragon To: All Subject: highlights ``` ## Go ```go package main import "fmt" func main() { fmt.Println("Hola, mundo.") } ``` ## Haskell ```haskell module Main (main) where main :: IO () main = putStrLn "Hello, World!" ``` ## HTML ```html

    Hello world!

    ``` ## Java ```java package fibsandlies; import java.util.HashMap; -/** +/** * This is an example of a Javadoc comment; Javadoc can compile documentation * from this text. Javadoc comments must immediately precede the class, method, or field being documented. - */ -public class FibCalculator extends Fibonacci implements Calculator { + */ +public class FibCalculator extends Fibonacci implements Calculator { private static Map memoized = new HashMap(); - public static void main(String[] args) { + public static void main(String[] args) { memoized.put(1, 1); memoized.put(2, 1); System.out.println(fibonacci(12)); - } -} + } +} ``` ## JavaScript ```js function factorial(n) { if (n === 0) { return 1; // 0! = 1 } return n * factorial(n - 1); } ``` ## JavaScript React (JSX) ```jsx - /> -function Story(props) { - const SpecificStory = components[props.storyType]; - return story={ props.story } attr2="&ref;" attr3="Hello\n" />; -} + /> +function Story(props) { + const SpecificStory = components[props.storyType]; + return story={ props.story } attr2="&ref;" attr3="Hello\n" />; +} ``` ## JSON ```json -[{ +[{ "hello": "world", "count": 1, "bool": true -}] +}] ``` ## Matlab ```matlab % Numbers _____________________________________________ 5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i 5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i' ``` ## Markdown ```markdown **bold** `code` > quote ``` ## Mustache/Handlebars ```handlebars -{{#movie}} - > +{{#movie}} + >

    {{title}}

    {{title}} -
    > - > + > + > Rating - {{ratings.critics_rating}} - > -{{/movie}} +
    > +{{/movie}} ``` ## Perl ```perl my $var = shift; -$var =~ s/bla/foo/igs; -$var =~ s!bla!foo!igs; -$var =~ s#bla#foo#igs; +$var =~ s/bla/foo/igs; +$var =~ s!bla!foo!igs; +$var =~ s#bla#foo#igs; ``` ## PHP ```php namespace Application\Controller; use Zend\Mvc\Controller\AbstractActionController; class IndexController extends AbstractActionController -{ -} +{ +} ``` ## Python ```python -def addXToY(x, y): +def addXToY(x, y): total = x + y print total ``` ## QML ```qml -Text { +Text { id: hello width: 100 text: "Hello world!" -} +} ``` ## R ```r # Declare function “f” with parameters “x”, “y“ # that returns a linear combination of x and y. -f <- function(x, y) { +f <- function(x, y) { z <- 3 * x + 4 * y return(z) -} +} ``` ## Ruby ```ruby require 'Config' - def CGI::escape(string) - string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do + def CGI::escape(string) + string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do '%' + $1.unpack('H2' * $1.size).join('%').upcase - end.tr(' ', '+') - end + end.tr(' ', '+') + end ``` ## Rust ```rust -fn main() { +fn main() { println!("Hello world!"); -} +} ``` ## MySQL ```mysql -- comment CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar); SELECT * FROM stuff WHERE id = 'string'; select * from stuff where id < 0.42; Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL; ``` ## TypeScript ```ts -class Student { +class Student { fullName: string; - constructor(public firstName: string, public middleInitial: string, public lastName: string) { + constructor(public firstName: string, public middleInitial: string, public lastName: string) { this.fullName = firstName + " " + middleInitial + " " + lastName; - } -} + } +} ``` ## XML ```xml - attribute="3"> - /> -> + attribute="3"> + /> +> ``` ## reStructuredText ```rst Section Header ============== .. image:: /path/to/image.jpg - A bullet list item ``` ## Doxygen ```doxygen a normal member taking two arguments and returning an integer value. @param a an integer argument. @param s a constant character pointer. @see Javadoc_Test() @see publicVar() @return The test results ``` ## No language specified ``` No language is specified, but it should be still rendered as code block. ``` # Fenced code blocks with more than 3 backticks or tildes ~~~ Fenced code block with 3 tildes. ~~~ ````````` Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes. ``` The block ends with the same amount of backticks. ````````` ~~~~~~~~~~~~ Fenced code block with more tildes. ~~~~~~~~~~~~ ## With languages ```````html

    Hello world!

    -``` +``` ``````` ~~~bash for f in *; do echo "$f" done ~~~ ~~~~~~~~~python -def addXToY(x, y): +def addXToY(x, y): total = x + y print total ~~~ # <= doesn't end here ~~~~~~~~~ # Italic and bold text **b** *i* __b__ _i_ ***ib*** ___ib___ **_ib_** __*ib*__ * _italic_ **bold** ***ib*** ~~strikeout~~ > _italic_ **bold** ***ib*** ~~strikeout~~ ## Bold **bold*___text** normal __bold_***text__ normal ## Italic *italic _ text* normal _italic * text_ normal ## Italic-Bold ***italic-bold ** italic-bold*** normal ***bold-italic text **bold-italic text*** normal ***bold*italic*** normal **_bold-italic text_** normal _ normal text_ * normal text * *italic text*normal text* *italic text *italic text* **bold text**normal text** **bold text **bold text** aaa**bold text**aaaaa aaa__normal text__aaaaa пристаням_стремятся_ \*normal text* _normal text\_ **italic text\** ***only bold\*** **bold\** bold** diff --git a/autotests/folding/test.qml.fold b/autotests/folding/test.qml.fold index ad2f9f3..8d635b6 100644 --- a/autotests/folding/test.qml.fold +++ b/autotests/folding/test.qml.fold @@ -1,23 +1,24 @@ -/* +/* * multi line comment - */ + */ // single line comment import QtQuick 2.0 Rectangle { property real myNumProp: 0.1e12; property alias sub.color; signal mySignal(int arg1, string arg2) color: "lightsteelblue" width: 320 height: width/2 Rectangle { id: sub width: 0x10 height: 007 objectName: 'single quote' + objectName2: a ? b : c; } } diff --git a/autotests/folding/test.ts.fold b/autotests/folding/test.ts.fold index 418ec2f..ca8f32a 100644 --- a/autotests/folding/test.ts.fold +++ b/autotests/folding/test.ts.fold @@ -1,207 +1,224 @@ /// // 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); +// Built-in +document.body.innerHTML = greeter(user); to JSON.stringify() console.log("Hello world"); +const os = require('os'); +Math.LOG10E; +Number.MAX_SAFE_INTEGER; 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; }); } for (var i in pieces) { switch (true) { case /^\"?Accession\"?/.test(pieces[i]): numeration[0] = i; break; } } const enum ResponseCode { Success = 200, BadRequest = 400 } // Substitutions export function isInOpenInterval(start: number, end: number) { return tersible(a => a > start && a < end, () => `(${start}...${end})`) } const bar = `${x} ${y}`; // readonly function f1(mt: [number, number], rt: readonly [number, number]) { } function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) { } type ReadWrite = { -readonly [P in keyof T] : T[P] }; // const assertion let obj = { x: 10, y: [20, 30], z: { a: { b: 42 } } } as const; let r2 = { x: 20, y: 10 } as const; let r2 = {...p} as const; let p1 = { x: 10, y: 20 as const }; let p2 = { 10 as const, 'foo' as const }; // Definite assignment operator class Cl { one?: string; two!: string; } let x! = 1; // Function with multiple arguments const children = [].map>>(element => { if (!this.identityProvider) { return element; } return element; }); // Numerics var a = 0xA; var b = 0b1; var c = 0o7; var d = 1.1E+3; var e = 1.E+3; var f = .1E+3; var g = 1E+3; var h = 1.1; var i = 1.; var j = .1; var k = 1; var l = 1__.e+3_22 | .2____e2 | 0o1_23 | 11__. ; // Bigint const binBig = 0b101n; const octBig = 0o567n; const hexBig = 0xC0Bn; const decBig = 123n; // Types let a: null = null; let b: number = 123; let c: number = 123.456; let d: string = `Geeks`; let e: undefined = undefined; let f: boolean = true; let g: number = 0b111001; // Binary let h: number = 0o436; // Octal let i: number = 0xadf0d; // Hexa-Decimal const query = query<[number], number>(` SELECT * FROM statistics WHERE unit_id = $1`) function runQuery() { const query = createQuery<[number[]], Table>(` some SQL here `) return database.execute(query) } aa: string ? string string // Don't highlight aa: string assa | string string ; string aa: { string string } // Don't highlight aa: [ string string ] aa: ( string string ) // Don't highlight aa: string interface a { - aa: /* comment - */ string, - bb: /* comment */ + aa: /* comment + */ string, + bb: /* comment */ number, cc: // comment void, dd: any, } null, <{[key]: () => any}> null null, <{[key]: () =>{a: number}}> null // Correctly highlighting regular expressions dt = ((dt[0] * 1e9 + dt[1]) / 1e6).toFixed(3).replace(/\.?0+$/, '') + 'ms'; (a[0] / 2) / (2) // Type guards function isNumber(x: any): x is number { return typeof x === "number"; } // Conditional expressions (highlight keywords before ":") class C { w = () => this.a() ? true : this.b() ? false : true; z = () => this.b() ? hello : k; } function foo(arg: T): T extends B ? number : string { if (arg === "A") return 111; return "returning a string"; } // Types and logical `&&` and `||` operators after `as` expression Date as any || null; //Assertions const assert: (value: unknown) => asserts value = value => {} declare function assertIsString(value: unknown): asserts value is string; declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; declare function assertDefined(value: T): asserts value is NonNullable; namespace Debug { export declare function assert(value: unknown, message?: string): asserts value; export declare function assertDefined(value: T): asserts value is NonNullable; } + +// Only highlight valid regular expressions, of a single line, after strings +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786 +"text" /No-Regex +"text" /Regex[:)]*/; +const a = "6" / 2; /*comment*/ const b = 5; +console.log("4" / "2"); // 2 +// Single quote +const a = '6' / 2; /*comment*/ const b = 5; +console.log('4' / '2'); // 2 +// Template +const a = `6` / 2; /*comment*/ const b = 5; +console.log(`4` / `2`); // 2 diff --git a/autotests/folding/test.tsx.fold b/autotests/folding/test.tsx.fold index 0441ad1..c9a5d67 100644 --- a/autotests/folding/test.tsx.fold +++ b/autotests/folding/test.tsx.fold @@ -1,146 +1,153 @@ // TypeScript React -/** @author Willy - * @url https://reactjs.org/ **/ +/** @author Willy + * @url https://reactjs.org/ **/ import React from 'react'; -import { PhotoStory, VideoStory } from './stories'; +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 /> +/*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*/ +return /* comment + multiline */ /> /* comment */ /> +&& /*comment*/ /> +& /*comment*/ /> { >Hello> } ? />; -[ /> ( /> +[ /> ( /> ,/> =/> &&/> ||/> return /> ; default/> ; > > /> > return > anyWord -anyWord/*comment*/ +anyWord/*comment*/ . & | -% /* comment*/ +% /* comment*/ // TODO: Fix this (comment before the tag name): -var x = </**/div>; +var x = </**/div>; // Tag after ":" annotation: /> annotation: text [ /> ] console.log("hello") // Type assertion in tag /> > > /> // Non-ASCII tag name & attribute -<日本語>>; +<日本語>>; 本本:本-本 aa本:本 aa:aa /> -<aaaa:ñ /> + /> />; { ... x } y ={2 } z />; let k1 = a={10} b="hi" {...o} > hi hi hi! >; let k2 = a={10} b="hi"> > My Div > {(name: string) => > My name {name} >} >; let k3 = initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error // OK let k1 = a={10} b="hi"><> /> />>; let k2 = a={10} b="hi"><> /> />>; let k3 = a={10} b="hi"><> /> />>; let k4 = a={10} b="hi"><> /> />>; // OK let k1 = > > Hello > > world >>; let k2 = > > Hello > {(user: any) => >{user.name}>}>; let k3 = > {1} {"That is a number"} >; let k4 = > > Hello > >; // Empty tags hello<> hello <>; // no whitespace < >; // lots of whitespace -< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags +< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags <>hi; // text inside <>>hi>>bye>; // children <>>1><>>2.1>>2.2>>3>; // nested fragments <>#; // # would cause scanning error if not in jsxtext // Tags after substitutions in templates `aaa${>>//comment - /*comment*//>}` + /*comment*//>}` // Don't highlight tags within type declaration type T12 = ReturnType<(() => T)>; type T13 = ReturnType<([]>() => T)>; type T14 = ReturnType; type T15 = ReturnType<(s: string) => void>; // Don't highlight tags within variable declaration let myIdentity: (arg: T) => T = />; var myIdentity: (arg: U) => U = identity; const myIdentity: {(arg: T): T} = identity; // Don't highlight tags within interfaces and classes interface GenericIdentityFn { (arg: T): T; } class Handler { info: (arg: T): T ; > > } // Highlight "( arg: T ) => { const a = arg return a } > text extends I/> > // Here "" is a tag + +// Check character after tag name, do not highlight invalid tags +/* comment */ ? +/*comment*/# diff --git a/autotests/html/highlight.js.html b/autotests/html/highlight.js.html index 4b41bc7..e841684 100644 --- a/autotests/html/highlight.js.html +++ b/autotests/html/highlight.js.html @@ -1,146 +1,168 @@ highlight.js
     /* 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/
    +   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!");
    +somestring.replace( /dooh/ , "bah!");
     re=/foo/ig; // hehe
     
    -somestring.search(
    +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");
    +somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1");
     //                  ^ fallthrough expected. ("new" whould be bold)
     
     
    -something.method =
    +something.method =
         function ( a, b, c ) { /* ... */ }
     //  ^ fallthrough ?!
     
    -something.other =
    +something.other =
     function ( d, e, f ) { /* ... */ }
     // fallthrough expected at col 0 ("function" should be bold)
     
    -var ary = new Array(5);
    +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();
    +  dostuff();
     else
    -  dont();
    +  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 + "<br>");
    +  document.write("i is" + i + "<br>");
     
     while (something)
     {
    -  block();
    +  block();
       picky:
         if (!1)
           break;
         else
           continue;
     }
     
     with (a) {
       do {
    -    stuff( b ); // a.b if it exists
    +    stuff( b ); // a.b if it exists
       } while (itmakessense);
     }
     
     switch (i) {
       case 0:
    -  f();
    +  f();
       break;
       default:
       break;
     }
    +
    +// Numerics
    +var a = 0xA;
    +var b = 0b1;
    +var c = 0o7;
    +var d = 1.1E+3;
    +var e = 1.E+3;
    +var f = .1E+3;
    +var g = 1E+3;
    +var h = 1.1;
    +var i = 1.;
    +var j = .1;
    +var k =  1;
    +// Bigint
    +const binBig = 0b101n;
    +const octBig = 0o567n;
    +const hexBig = 0xC0Bn;
    +const decBig = 123n;
    +// Invalid numbers
    +var l = 0xA1t;
    +var m = 0b0123;
    +var n = 0o29;
     
    diff --git a/autotests/html/highlight.jsp.html b/autotests/html/highlight.jsp.html index a48d651..82ac1bf 100644 --- a/autotests/html/highlight.jsp.html +++ b/autotests/html/highlight.jsp.html @@ -1,180 +1,180 @@ highlight.jsp
     <%--
       This page won't actually work, as it is simply designed to display jsp syntax highlighting.
     --%>
     <%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
     <%@ include file="/include/myglobalvars.jsp"%> --%>
     <%@ page import="java.util.*,
                      java.io.*,
                      java.math.*" %>
     <%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
     <jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/>
     <jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
     <%
       // We can decipher our expected parameters here.
       String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
       String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
       String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
       String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
       String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();
     
       // A sample collection of Integers to display some code folding.
       List intList = getIntList(10);
     
     
     %>
     <html>
       <title>A Sample Jsp</title>
       <head>
       <script language="javascript"><!--
    -    function doAlert1() {
    -      alert("This is the first javascript example.");
    +    function doAlert1() {
    +      alert("This is the first javascript example.");
         }
     
    -    function doAlert2() {
    -      alert("This is the second javascript example.");
    +    function doAlert2() {
    +      alert("This is the second javascript example.");
         }
       //--></script>
       <style type="text/css">
         body{ color: yellow; }
       </style>
       </head>
       <body>
         <%-- The top label table. --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
           <tr>
             <td><font size="3"><b>The following parameters were detected:</b></font></td>
           </tr>
         </table>
     
         <%-- Display the parameters which might have been passed in. --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
           <%-- Label; Actual Parameter String; Value Detected --%>
           <tr>
             <td><b>PARAMETER_1</b></td>
             <td align="center"><%=PARAMETER_1%></td>
             <td align="right">&quot;<%=parm1%>&quot;</td>
           </tr>
     
           <%-- Label; Actual Parameter String; Value Detected --%>
           <tr>
             <td><b>PARAMETER_2</b></td>
             <td align="center"><%=PARAMETER_2%></td>
             <td align="right">&quot;<%=parm2%>&quot;</td>
           </tr>
     
           <%-- Label; Actual Parameter String; Value Detected --%>
           <tr>
             <td><b>PARAMETER_3</b></td>
             <td align="center"><%=PARAMETER_3%></td>
             <td align="right">&quot;<%=parm3%>&quot;</td>
           </tr>
     
           <%-- Label; Actual Parameter String; Value Detected --%>
           <tr>
             <td><b>PARAMETER_4</b></td>
             <td align="center"><%=PARAMETER_4%></td>
             <td align="right">&quot;<%=parm4%>&quot;</td>
           </tr>
     
           <%-- Label; Actual Parameter String; Value Detected --%>
           <tr>
             <td><b>PARAMETER_5</b></td>
             <td align="center"><%=PARAMETER_5%></td>
             <td align="right">&quot;<%=parm5%>&quot;</td>
           </tr>
         </table>
     
         <br><br>
     
         <%-- Display our list of random Integers (shows code folding). --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
     <%
       if (intList != null && intList.size() > 0) {
     %>
           <tr><td><b>Here are the elements of intList...</b></td></tr>
     <%
         Iterator intListIt = intList.iterator();
         while (intListIt.hasNext()) {
           Integer i = (Integer) intListIt.next();
     %>
           <tr><td><%=i.toString()%></td></tr>
     <%
         }
       } else {
     %>
           <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
     <%
       }
     %>
         </table>
     
         <br><br>
     
         <%-- We can call javascript functions. --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
           <tr><td colspan="2"><b>Test our javascript...</b></td></tr>
           <tr>
             <td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td>
             <td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td>
           </tr>
         </table>
     
         <br><br>
         <%-- If we actually had defined a tag library. --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
           <tr><td>
           <my:SampleTag prop1="first" prop2="third">
             <my:SampleTagChild nameProp="value1"/>
             <my:SampleTagChild nameProp="value2"/>
           </my:SampleTag>
           </td></tr>
         </table>
     
         <br><br>
         <%-- Expression language. --%>
         <table width="400" cellpadding="0" cellspacing="0" border="0">
           <c:if test="${!empty param.aParam}">
             <c:set var="myParam" scope="session" value="${param.aParam}"/>
           </c:if>
     
           <tr><td>myParam's value: &quot;<c:out value="${myParam}" default=="Default"/>&quot;</td></tr>
         </table>
       </body>
     </html>
     <%!
       /* A place for class variables and functions... */
     
       // Define some sample parameter names that this page might understand.
       private static final String PARAMETER_1            = "p1";
       private static final String PARAMETER_2            = "p2";
       private static final String PARAMETER_3            = "p3";
       private static final String PARAMETER_4            = "p4";
       private static final String PARAMETER_5            = "p5";
     
       // Returns str trimmed, or an empty string if str is null.
       private static String noNull(String str) {
         String retStr;
         if (str == null)
           retStr = "";
         else
           retStr = str.trim();
     
         return retStr;
       }
     
       // Returns a list of Integers with listSize elements.
       private static List getIntList(int listSize) {
         ArrayList retList = new ArrayList(listSize);
         for (int i = 0; i < listSize; i++)
           retList.add(new Integer( (int) (Math.random() * 100) ));
     
         return retList;
       }
     %>
     
    diff --git a/autotests/html/highlight.php.html b/autotests/html/highlight.php.html index 5502f68..bb39473 100644 --- a/autotests/html/highlight.php.html +++ b/autotests/html/highlight.php.html @@ -1,76 +1,76 @@ highlight.php
     <?
     /* This is a pseudo PHP file to test Kate's PHP syntax highlighting. */
     # TODO: this is incomplete, add more syntax examples!
     # this is also a comment.
     // Even this is a comment
     function test($varname) {
     	return "bla";	# this is also a comment
     }
     
     ?>
     
     <?php echo("hello test"); ?>
     
     <html>
     	<? print "<title>test</title>"; ?>
     
     	<!-- CSS -->
     	<style>
     		.inputText {
     			width: <?php echo $width; ?>px;
     			text-indent: 10px;
     		}
     	</style>
     
     	<!-- JavaScript -->
     	<script>
     		var some_js_var = <?php echo $somevar; ?> ;
     		<?php echo 'alert("Hello there.");'; ?>
     	</script>
     	<!-- JavaScript React -->
     	<script type="text/babel">
     		<Hello> <?php echo("Hello, hello!"); ?> </Hello> <?php /* aaa */ ?> <div></div>
    -		function a(i) {
    +		function a(i) {
     			<?php echo "var j = 1;"; ?>
     			return <p>{ i + j }</p>;
     		}
     	</script>
     	<!-- TypeScript -->
     	<script type="text/typescript">
     		<?php $timestamp = time(); ?>
     		class DateTime {
     			info: string;
     			constructor() { this.info = <?php echo(date("F d, Y h:i:s", $timestamp)); ?>; }
     			get() { return this.info; }
     		}
     	</script>
     	<!-- MustacheJS -->
     	<script type="x-tmpl-mustache">
     		{{! <?php print "comment"; ?> }}
     		{{#movie}}
     			<div>
     				<h1>{{title}}</h1>
     				<img src="{{poster}}" alt="{{title}}"/>
     				<?php echo $movierating; ?> - {{ratings.critics_rating}}
     			</div>
     		{{/movie}}
     	</script>
     
     </html>
     
     <?php
     $var = <<<DOOH
     This is the $string inside the variable (which seems to be rendered as a string)
     It works well, I think.
     DOOH
     
     # bug 382527
     throw new ParserException("Test {$this->some_var[$index]}\nin {$this->file} is missing.\nThis is bad.");
     ?>
     
    diff --git a/autotests/html/highlight.qml.html b/autotests/html/highlight.qml.html index e74d91c..898c7b3 100644 --- a/autotests/html/highlight.qml.html +++ b/autotests/html/highlight.qml.html @@ -1,66 +1,66 @@ highlight.qml
     import Qt 4.6
     
     // some random qml snippets stolen from the qt docs
     
     Rectangle {
         important: true
         propertyAsdf:
         id: container
         signalA: bla
         property string label
         signal clicked
    -    radius: 5; border.color: "black"
    -    color: mouse.pressed ? "steelblue" : "lightsteelblue"
    +    radius: 5; border.color: "black"
    +    color: mouse.pressed ? "steelblue" : "lightsteelblue"
         gradient: Gradient {
    -            GradientStop { position: mouse.pressed ? 1.0 : 0.0; color: "steelblue" }
    -            GradientStop { position: mouse.pressed ? 0.0 : 1.0; color: "lightsteelblue" }
    +            GradientStop { position: mouse.pressed ? 1.0 : 0.0; color: "steelblue" }
    +            GradientStop { position: mouse.pressed ? 0.0 : 1.0; color: "lightsteelblue" }
         }
    -    MouseRegion { id: mouse; anchors.fill: parent; onClicked: container.clicked() }
    -    Text { anchors.fill: parent; text: container.label; anchors.centerIn: parent }
    +    MouseRegion { id: mouse; anchors.fill: parent; onClicked: container.clicked() }
    +    Text { anchors.fill: parent; text: container.label; anchors.centerIn: parent }
     }
     
     Rectangle {
         Script {
    -        function calculateMyHeight() {
    -            return Math.max(otherItem.height, thirdItem.height);
    +        function calculateMyHeight() {
    +            return Math.max(otherItem.height, thirdItem.height);
             }
         }
     
    -    anchors.centerIn: parent
    -    width: Math.min(otherItem.width, 10)
    -    height: calculateMyHeight()
    +    anchors.centerIn: parent
    +    width: Math.min(otherItem.width, 10)
    +    height: calculateMyHeight()
         color: { if (width > 10) "blue"; else "red" }
     }
     
     Rectangle {
         default property color innerColor: "black"
         property color innerColor: "black"
    -    property alias text: textElement.text
    -    property alias aliasXYZ: testElement.text
    +    property alias text: textElement.text
    +    property alias aliasXYZ: testElement.text
         signal bar
         signal bar(var blah, string yxcv)
         width: 240; height: 320;
         width: 100; height: 30; source: "images/toolbutton.sci"
         ListView {
    -        anchors.fill: parent
    +        anchors.fill: parent
             model: contactModel
             delegate: Component {
                 Text {
    -                text: modelData.firstName + " " + modelData.lastName
    +                text: modelData.firstName + " " + modelData.lastName
                 }
             }
         }
     }
     
     Item {
    -    function say(text) {
    -        console.log("You said " + text);
    +    function say(text) {
    +        console.log("You said " + text);
         }
     }
     
    diff --git a/autotests/html/test.coffee.html b/autotests/html/test.coffee.html index 6fe3b4d..7670989 100644 --- a/autotests/html/test.coffee.html +++ b/autotests/html/test.coffee.html @@ -1,78 +1,82 @@ test.coffee
     # CoffeeScript test
     # Source: https://coffeescript.org
     
     ### Multiline
       comment ###
     import 'local-file.coffee'
     
     # Assignment:
     number   = 42
     opposite = true
     
     # Conditions:
     number = -42 if opposite
     
     # Functions:
     square = (x) -> x * x
     
     # Arrays:
     list = [1, 2, 3, 4, 5]
     
     # Objects:
     math =
       root:   Math.sqrt
       square: square
       cube:   (x) -> x * square x
     
     # Splats:
     race = (winner, runners...) ->
       print winner, runners
     
     # Existence:
     alert "I knew it!" if elvis?
     
     # Array comprehensions:
     cubes = (math.cube num for num in list)
     
     # Classes:
     class Animal
       constructor: (@name) ->
     
       move: (meters) ->
         alert @name + " moved #{meters}m."
     
     # Switch/When/Else:
     switch day
       when "Mon" then go work
       when "Tue" then go relax
       when "Thu" then go iceFishing
       when "Fri", "Sat"
         if day is bingoDay
           go bingo
           go dancing
       when "Sun" then go church
       else go work
     
     # Member objects:
     Object.prop.  Object .Object Object
     timelineEvent.class
     
     # Embedded JavaScript Code
     markdown = `function () {
       return \`In Markdown, write code like \\\`this\\\`\`;
     }`
     
     ```
     	// Comment
    -	var array = new Array(500);
    +	var array = new Array(500);
     	var name = "Willy";
    -	alert(`Hello ${name}!`);
    +	alert(`Hello ${name}!`);
     ```
     ` String.raw\`String ${x} \` `
    +
    +` // Regular Expression after template
    +  const a = \`6\` / 2; /*comment*/
    +  \`template\` /regex/ `
     
    diff --git a/autotests/html/test.htm.html b/autotests/html/test.htm.html index 5c67866..db578d7 100644 --- a/autotests/html/test.htm.html +++ b/autotests/html/test.htm.html @@ -1,81 +1,81 @@ test.htm
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     <html>
       <head>
         <title>This is a title</title>
         <style>
         /* comment */
         #xyz { color: red; }
         h1 { font: "Comic Sans"; }
         </style>
       </head>
       <body class="ui main">
         <p *ngFor="let name of names">Hello, {{ name }}!</p>
       </body>
     
       <!-- JavaScript code -->
       <script>
    -    document.body.appendChild(document.createTextNode('Hello World!')); // comment
    +    document.body.appendChild(document.createTextNode('Hello World!')); // comment
       </script>
     
       <!-- TypeScript code -->
       <script type="text/typescript">
         class Student {
             fullName: string;
             constructor(public firstName: string, public middleInitial: string, public lastName: string) {
                 this.fullName = firstName + " " + middleInitial + " " + lastName;
             }
         }
         let a: null = null;
         let b: number = 12___3;
       </script>
     
       <!-- JSX code -->
       <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
       <script type="text/babel">
    -    ReactDOM.render(
    +    ReactDOM.render(
           <h1>Hello, world!</h1>,
    -      document.getElementById('root')
    +      document.getElementById('root')
         );
    -    function Story(props) {
    -      const SpecificStory = components[props.storyType];
    -      return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    +    function Story(props) {
    +      const SpecificStory = components[props.storyType];
    +      return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
         }
       </script>
     
       <!-- Mustache/Handlebars -->
       <script type="x-tmpl-mustache">
         {{#movie}}
             <div>
                 <h1>{{title}}</h1>
                 <img src="{{poster}}" alt="{{title}}"/>
             </div>
             <div>
                 Rating - {{ratings.critics_rating}}
             </div>
         {{/movie}}
         {{^movie}}
             <div>
                 Movie Does Not Exist :(
             </div>
         {{/movie}}
         {{! comment }}
       </script>
     
       <!-- HTML template -->
       <script type="text/html">
         <li><a href="link">Hello</a></li>
       </script>
     
       <!-- Close the block correctly after "?" in the JavaScript highlighter -->
       <script>
         ?
       </script>
     
     </html>
     
    diff --git a/autotests/html/test.js.html b/autotests/html/test.js.html index b87434c..0b16c27 100644 --- a/autotests/html/test.js.html +++ b/autotests/html/test.js.html @@ -1,33 +1,50 @@ test.js
     #! shebang
     #! no-shebang
     
     /* comment */
     
    -function fun()
    +function fun()
     {
         var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] };
     }
     
     class MyClass; // reserved keywords
     
     // Member objects: text after "."
    -object.property instanceof Number;
    -iden1.iden2  . iden3.class class;
    +object.property instanceof Number;
    +iden1.iden2  . iden3.class class;
     
     var escapes = "aa\b\n\0a\"a\x12a\32a\u{123}a\$\%\ \#\y\aaa\
     aaa";
     var octal = 0o124;
     var bin = 0b1010;
     
    -ლಠ益ಠლ.ñá = 42;
    -δ /No-RegExp/
    +日本語().ლಠ益ಠლ.ñá = 42;
    +δ /No-Regex/
     
    -/* Modelines: finish comment in incomplete Modeline:
    - * kate: replace-tabs */ normal text
    +// Only highlight valid regular expressions, of a single line, after strings
    +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786
    +"text" /No-Regex
    +"text" /Regex[:)]*/;
    +const a = "6" / 2; /*comment*/ const b = 5;
    +console.log("4" / "2"); // 2
    +// Single quote
    +const a = '6' / 2; /*comment*/ const b = 5;
    +console.log('4' / '2'); // 2
    +// Template
    +const a = `6` / 2; /*comment*/ const b = 5;
    +console.log(`4` / `2`); // 2
    +
    +// Built-in
    +const os = require('os');
    +JSON.stringify("hello");
    +console.error("hello");
    +Math.LOG10E;
    +Number.MAX_SAFE_INTEGER;
     
    diff --git a/autotests/html/test.jsx.html b/autotests/html/test.jsx.html index 6feb59a..5f9f672 100644 --- a/autotests/html/test.jsx.html +++ b/autotests/html/test.jsx.html @@ -1,103 +1,105 @@ test.jsx
     // 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 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/>
     &&<tag/>   ||<tag/>
     return <tag/> ;
     default<tag/> ;
     <Tag> <tag> <tag$/> </tag> return </Tag>
     
     anyWord<noTag>
     anyWord/*comment*/ <noTag/>
     .<noTag>
     &<notag> | <noTag/>
     % /* comment*/ <noTag/>
     
    -<C<number>/>
    -<C<number>> </C>
    -<C
    -<error />
    -
     // Non-ASCII tag name & attribute
     <日本語></日本語>;
     <Component 本本:本-本 aa本:本 aa:aa />
     
     <Namespace.DeepNamespace.Component />;
     <Component { ... x } y
     ={2 } z />;
     
     let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
     let k2 = <Button> <h2> Hello </h2> </Button>;
     
     // Empty tags
     <></>; // no whitespace
     <    ></   >; // lots of whitespace
     < /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
     <>hi</>; // text inside
     <><span>hi</span><div>bye</div></>; // children
     <><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
     <>#</>; // # would cause scanning error if not in jsxtext
     
     // Tags after substitutions in templates
     `aaa${<tag></tag>//comment
         /*comment*/<A/>}`
     
     // Don't highlight tags within variable declaration
     let myIdentity: <T>(arg: T) => T = identity;
     var myIdentity: <U>(arg: U) => U = identity;
     const myIdentity: {<T>(arg: T): T} = identity;
     
     // Don't highlight tags within interfaces and classes
     interface GenericIdentityFn {
         <T>(arg: T): T;
         <noTag />
     }
     class Handler {
         info: <T>(arg: T): T <noTag />;
         <tag> </tag>
     }
    +
    +// Check character after tag name, do not highlight invalid tags
    +<noTag ?
    +<noTag  ,
    +<noTag /* comment */ ?
    +<noTag#
    +<noTag/*comment*/#
     
    diff --git a/autotests/html/test.markdown.html b/autotests/html/test.markdown.html index bc6551b..eccec2b 100644 --- a/autotests/html/test.markdown.html +++ b/autotests/html/test.markdown.html @@ -1,589 +1,589 @@ test.markdown
     ---
     Title:    A Sample Markdown Document
     Author:   Fletcher T. Penney
     Date:     February 9, 2011
     Comment:  This is a comment intended to demonstrate 
               metadata that spans multiple lines.
     ---
     
     # H1
     
     ## H2
     
     ### H3
     
     Multi-line paragraph bla bla bla
     bla bla bla.
     
     Intentional line break  
     via two spaces at line.
     
     Formats: _italic_, **bold**, `monospace`, ~~strikeout~~
     
     Bullet list:
     
     * item1
     * item2
     
     Numbered list:
     
     1. item 1
     2. item 2
     
     Task list:
     
     - [x] Finish my changes
     - [ ] Push my commits
     - [ ] Open a pull request
     
     A link as normal text: http://example.com
     
     [link](http://kde.org)
     
     Auto-link: <http://kate-editor.org>
     Mail: <mailto:mark@kde.org>
     
     This is [an example](http://example.com/ "Title") inline link.
     
     See my [About](/about/) page for details.
     
     This is [an example] [id] reference-style link.
     
     [id]: http://example.com/  "Optional Title Here"
     [foo]: http://example.com/ 'Optional Title Here'
     [bar]: http://example.com/ (Optional Title Here)
     [id2]: <http://example.com/>  "Optional Title Here"
     
     ![Alt text](/path/to/img.jpg)
     
     ![Alt text](/path/to/img.jpg "Optional title")
     
     [![Alt text](https://url/to/img.svg)](https://link.com/example/)
     
         code 1
         code 2
     
     normal text
     
     > block quote _italic_
     > more block quote
     
     normal text
     
     Title: some text
     
     normal text
     
     # Lists
     
     1. item
        * This is a list item
          with multiple lines.
          ```
          code
          ```
     
          > This is a
          blockquote
     
          This is a new paragraph, which
          is part of the item in the
          previous list.
     
              indented code block
     
            Other paragraph.
     
          * subitem
            * subitem
              with multiple
                 lines.
     
              New paragraph of
              the previous subitem.
     
                  code block
     
               -----------------------
     
                 Other paragraph of
                 the subitem.
     
               30. numlist item
               31. numlist item
     
                      New paragraph of
                      the previous item.
     
                      > Blockquote
     
                       code block
       
                   Other paragraph.
     
     # Inline HTML
     
     &copy;
     <strong>bold</strong>
     <code>code</code>
     
     <table>
         <tr>
             <th>a</th>
             <th>b</th>
         </tr>
         <tr>
             <th><ul>
                 <li>c</li>
                 <li>d</li>
             </ul></th>
             <th>e</th>
         </tr>
     </table>
     
     normal text *italic*
     
     # Code
     
     `simple code`
     
     ``simple ` code``
     
     ```simple `` ` code ```
     
     ````simple`code````
     
     normal text
         normal text
         normal text
             normal text
     
         code blocks are only allowed
         after an empty line.
     
     * list
         list
         
         normal text
         
     1. num-list
         num-list
     
         normal text
     
     > quote
         quote
         
         code block
     
     normal
     <!-- comment -->
         <!-- code, not comment -->
         code
     
     normal
     
       <!-- coment -->
         code
     
     # Fenced code blocks (bug 356974)
     
     ## Bash
     
     ```bash
     #!/usr/bin/env bash
     
     for f in *; do
         echo "$f"
     done
     ```
     
     ## C++
     
     ```cpp
     #include <QtCore/QObject>
     
     class Q : public QObject {
     Q_OBJECT
     public:
         Q();
     }
     
     Q::Q() :QObject(NULL) {
     }
     ```
     
     ## C
     
     ```c
     #include <stdio.h>
     #include "stdint.h"
     #define SOME_VAR 1
     
     static uint64_t intWithSuffix = 42ull + ~1233L;
     static int octNum = 07232;
     ```
     
     ## C#  ##
     
     ```csharp
     var arr = new[] { 0, 1, 2, 3, 4 };
     var anon = new { Country = "Germany", Inhabitants = 80000000 };
     ```
     
     ## CMake
     
     ```cmake
     cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
     
     project (hello_world)
     
     set(QT_MIN_VERSION "5.6.0")
     ```
     
     ## CSS
     
     ```css
     h1.main::hover {
         font-size: 100;
         color: green;
     }
     ```
     
     ## Email
     
     ```email
     From: Konqi Dragon <konqi@kde.org>
     To: All <all@kde.og>
     Subject: highlights
     ```
     
     ## Go
     
     ```go
     package main
     
     import "fmt"
     
     func main() {
       fmt.Println("Hola, mundo.")
     }
     ```
     
     ## Haskell
     
     ```haskell
     module Main (main) where
     
     main :: IO ()
     main = putStrLn "Hello, World!"
     ```
     
     ## HTML
     
     ```html
     <html>
       <body>
         <p class="main">Hello world!</p>
       </body>
     </html>
     ```
     
     ## Java
     
     ```java
     package fibsandlies;
     import java.util.HashMap;
     
     /**
      * This is an example of a Javadoc comment; Javadoc can compile documentation
      * from this text. Javadoc comments must immediately precede the class, method, or field being documented.
      */
     public class FibCalculator extends Fibonacci implements Calculator {
     
         private static Map<Integer, Integer> memoized = new HashMap<Integer, Integer>();
         public static void main(String[] args) {
             memoized.put(1, 1);
             memoized.put(2, 1);
             System.out.println(fibonacci(12));
         }
     }
     ```
     
     ## JavaScript
     
     ```js
    -function factorial(n) {
    +function factorial(n) {
         if (n === 0) {
             return 1;  // 0! = 1
         }
    -    return n * factorial(n - 1);
    +    return n * factorial(n - 1);
     }
     ```
     
     ## JavaScript React (JSX)
     
     ```jsx
     <hello />
    -function Story(props) {
    -  const SpecificStory = components[props.storyType];
    -  return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    +function Story(props) {
    +  const SpecificStory = components[props.storyType];
    +  return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
     }
     ```
     
     ## JSON
     
     ```json
     [{
         "hello": "world",
         "count": 1,
         "bool": true
     }]
     ```
     
     ## Matlab
     
     ```matlab
     % Numbers _____________________________________________
     5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i
     5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i'
     ```
     
     ## Markdown
     
     ```markdown
     **bold** `code`
     > quote
     
     ```
     
     ## Mustache/Handlebars
     
     ```handlebars
     {{#movie}}
         <div>
             <h1>{{title}}</h1>
             <img src="{{poster}}" alt="{{title}}"/>
         </div>
         <div>
             Rating - {{ratings.critics_rating}}
         </div>
     {{/movie}}
     ```
     
     ## Perl
     
     ```perl
     my $var = shift;
     
     $var =~ s/bla/foo/igs;
     $var =~ s!bla!foo!igs;
     $var =~ s#bla#foo#igs;
     ```
     
     ## PHP
     
     ```php
     namespace Application\Controller;
     
     use Zend\Mvc\Controller\AbstractActionController;
     
     class IndexController extends AbstractActionController
     {
     }
     ```
     
     ## Python
     
     ```python
     def addXToY(x, y):
         total = x + y
         print total
     ```
     
     ## QML
     
     ```qml
     Text {
         id: hello
         width: 100
         text: "Hello world!"
     }
     ```
     
     ## R
     
     ```r
     # Declare function “f” with parameters “x”, “y“
     # that returns a linear combination of x and y.
     f <- function(x, y) {
       z <- 3 * x + 4 * y
       return(z)
     }
     ```
     
     ## Ruby
     
     ```ruby
     require 'Config'
       def CGI::escape(string)
         string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
           '%' + $1.unpack('H2' * $1.size).join('%').upcase
         end.tr(' ', '+')
       end
     ```
     
     ## Rust
     
     ```rust
     fn main() {
         println!("Hello world!");
     }
     ```
     
     ## MySQL
     
     ```mysql
     -- comment
     CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar);
     SELECT * FROM stuff WHERE id = 'string';
     select * from stuff where id < 0.42;
     Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL;
     ```
     
     ## TypeScript
     
     ```ts
     class Student {
         fullName: string;
         constructor(public firstName: string, public middleInitial: string, public lastName: string) {
             this.fullName = firstName + " " + middleInitial + " " + lastName;
         }
     }
     ```
     
     ## XML
     
     ```xml
     <tag attribute="3">
       <nested/>
     </tag>
     ```
     
     ## reStructuredText
     
     ```rst
     Section Header
     ==============
     
     .. image:: /path/to/image.jpg
     
     - A bullet list item
     ```
     
     ## Doxygen
     
     ```doxygen
     a normal member taking two arguments and returning an integer value.
     @param a an integer argument.
     @param s a constant character pointer.
     @see Javadoc_Test()
     @see publicVar()
     @return The test results
     ```
     
     ## No language specified
     
     ```
     No language is specified, but it should be still rendered as code block.
     ```
     
     # Fenced code blocks with more than 3 backticks or tildes
     
     ~~~
     Fenced code block with 3 tildes.
     ~~~
     
     `````````
     Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes.
     ```
     The block ends with the same amount of backticks.
     `````````
     
     ~~~~~~~~~~~~
     Fenced code block with more tildes.
     ~~~~~~~~~~~~
     
     ## With languages
     
     ```````html
     <html>
       <body>
         <p class="main">Hello world!</p>
       </body>
     </html>
     ``` <!-- <= doesn't end here -->
     ```````
     
     ~~~bash
     for f in *; do
         echo "$f"
     done
     ~~~
     
     ~~~~~~~~~python
     def addXToY(x, y):
         total = x + y
         print total
     ~~~ # <= doesn't end here
     ~~~~~~~~~
     
     # Italic and bold text
     
     **b** *i* __b__ _i_
     ***ib*** ___ib___
     **_ib_** __*ib*__
     
     * _italic_ **bold** ***ib*** ~~strikeout~~
     
     > _italic_ **bold** ***ib*** ~~strikeout~~
     
     ## Bold
     **bold*___text** normal
     __bold_***text__ normal
     
     ## Italic
     *italic _ text* normal
     _italic * text_ normal
     
     ## Italic-Bold
     ***italic-bold ** italic-bold*** normal
     ***bold-italic text **bold-italic text*** normal
     ***bold*italic*** normal
     **_bold-italic text_** normal
     
     <!-- A non-space character is required after or before * or _ -->
     _ normal text_ * normal text *
     *italic text*normal text*
     *italic text *italic text*
     **bold text**normal text**
     **bold text **bold text**
     
     <!-- A delimiter is required after or before _ -->
     aaa**bold text**aaaaa
     aaa__normal text__aaaaa
     пристаням_стремятся_
     
     <!-- Escapes within bold or italic text -->
     \*normal text*
     _normal text\_
     **italic text\**
     ***only bold\***
     **bold\** bold**
     
    diff --git a/autotests/html/test.qml.html b/autotests/html/test.qml.html index 39cc95d..ff8a711 100644 --- a/autotests/html/test.qml.html +++ b/autotests/html/test.qml.html @@ -1,30 +1,31 @@ test.qml
     /*
      * multi line comment
      */
     
     // single line comment
     
     import QtQuick 2.0
     
     Rectangle {
         property real myNumProp: 0.1e12;
         property alias sub.color;
         signal mySignal(int arg1, string arg2)
         color: "lightsteelblue"
         width: 320
         height: width/2
     
         Rectangle {
             id: sub
             width: 0x10
             height: 007
             objectName: 'single quote'
    +        objectName2: a ? b : c;
         }
     }
     
    diff --git a/autotests/html/test.ts.html b/autotests/html/test.ts.html index 47e63d9..cef4363 100644 --- a/autotests/html/test.ts.html +++ b/autotests/html/test.ts.html @@ -1,214 +1,231 @@ test.ts
     /// <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;
    +    return "Hello, " + person.firstName + " " + person.lastName;
     }
     
     let user = new Student("Jane", "M.", "User");
     
    -document.body.innerHTML = greeter(user);
    +// Built-in
    +document.body.innerHTML = greeter(user); to
     JSON.stringify()
     console.log("Hello world");
    +const os = require('os');
    +Math.LOG10E;
    +Number.MAX_SAFE_INTEGER;
     
     import http = require("http");
     import path = require("path");
    -import URL = url.URL;
    +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 rootDir = path.dirname(__dirname);
     
    -const defaultBrowser = os.platform() === "win32" ? "edge" : "chrome";
    +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;
    +    return s.replace(/\w/g, (ch) => {
    +        const up = ch.toUpperCase();
    +        return ch === up ? ch.toLowerCase() : up;
         });
     }
     
     for (var i in pieces) {
         switch (true) {
             case /^\"?Accession\"?/.test(pieces[i]):
                 numeration[0] = i;
                 break;
         }
     }
     
     const enum ResponseCode {
         Success = 200,
         BadRequest = 400
     }
     
     // Substitutions
     export function isInOpenInterval(start: number, end: number) {
         return tersible(a => a > start && a < end, () => `(${start}...${end})`)
     }
     const bar = `${x} ${y}`;
     
     // readonly
     function f1(mt: [number, number], rt: readonly [number, number]) {
     }
     
     function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
     }
     
     type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
     
     // const assertion
     let obj = { x: 10, y: [20, 30], z: { a: { b: 42 } } } as const;
     let r2 = { x: 20, y: 10 } as const;
     let r2 = {...p} as const;
     let p1 = { x: 10, y: 20 as const };
     let p2 = { 10 as const, 'foo' as const };
     
     // Definite assignment operator
     class Cl {
         one?: string;
         two!: string;
     }
     let x! = 1;
     
     // Function with multiple arguments
     const children = [].map<Set<Map<number, string>>>(element => {
         if (!this.identityProvider) {
             return element;
         }
         return element;
     });
     
     // Numerics
     var a = 0xA;
     var b = 0b1;
     var c = 0o7;
     var d = 1.1E+3;
     var e = 1.E+3;
     var f = .1E+3;
     var g = 1E+3;
     var h = 1.1;
     var i = 1.;
     var j = .1;
     var k =  1;
     var l = 1__.e+3_22 | .2____e2 | 0o1_23 | 11__. ;
     
     // Bigint
     const binBig = 0b101n;
     const octBig = 0o567n;
     const hexBig = 0xC0Bn;
     const decBig = 123n;
     
     // Types
     let a: null = null;
     let b: number = 123;
     let c: number = 123.456;
     let d: string = `Geeks`;
     let e: undefined = undefined;
     let f: boolean = true;
     let g: number = 0b111001; // Binary
     let h: number = 0o436; // Octal
     let i: number = 0xadf0d; // Hexa-Decimal
     
     const query = query<[number], number>(`
             SELECT *
             FROM statistics
             WHERE unit_id = $1`)
     
     function runQuery() {
         const query = createQuery<[number[]], Table<Columns>>(`
             some SQL here
         `)
    -    return database.execute(query)
    +    return database.execute(query)
     }
     
     aa: <sdf/> string ?<ssd/> string
      string // Don't highlight
     aa: string assa |
        string
        string ;
        string
     
     aa: { string
         string } // Don't highlight
     
     aa: [ string
           string ]
     aa: ( string
           string ) // Don't highlight
     aa: string <string>
     interface a {
         aa: /* comment
             */ string,
         bb: /* comment */
             number,
         cc: // comment
             void,
         dd:
             any,
     }
     
     null, <{[key]: () => any}> null
     null, <{[key]: () =>{a: number}}> null
     
     // Correctly highlighting regular expressions
     dt = ((dt[0] * 1e9 + dt[1]) / 1e6).toFixed(3).replace(/\.?0+$/, '') + 'ms';
     (a[0] / 2) / (2)
     
     // Type guards
     function isNumber(x: any): x is number {
         return typeof x === "number";
     }
     
     // Conditional expressions (highlight keywords before ":")
     class C {
         w = () =>
             this.a() ? true : this.b() ? false : true;
         z = () =>
             this.b() ? hello : k;
     }
     
     function foo<T extends X>(arg: T): T extends B ? number : string {
       if (arg === "A") return <T extends B ? number : never>111;
       return <T extends B ? never : string>"returning a string";
     }
     
     // Types and logical `&&` and `||` operators after `as` expression
     Date as any || null;
     
     //Assertions
     const assert: (value: unknown) => asserts value = value => {}
     declare function assertIsString(value: unknown): asserts value is string;
     declare function assertIsArrayOfStrings(value: unknown): asserts value is string[];
     declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
     namespace Debug {
         export declare function assert(value: unknown, message?: string): asserts value;
         export declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
     }
    +
    +// Only highlight valid regular expressions, of a single line, after strings
    +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786
    +"text" /No-Regex
    +"text" /Regex[:)]*/;
    +const a = "6" / 2; /*comment*/ const b = 5;
    +console.log("4" / "2"); // 2
    +// Single quote
    +const a = '6' / 2; /*comment*/ const b = 5;
    +console.log('4' / '2'); // 2
    +// Template
    +const a = `6` / 2; /*comment*/ const b = 5;
    +console.log(`4` / `2`); // 2
     
    diff --git a/autotests/html/test.tsx.html b/autotests/html/test.tsx.html index d375ec2..e8557c8 100644 --- a/autotests/html/test.tsx.html +++ b/autotests/html/test.tsx.html @@ -1,153 +1,160 @@ test.tsx
     // TypeScript 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" />;
    +  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/>
     
     // TODO: Fix this (comment before the tag name):
     var x = </**/div></div>;
     
     // Tag after ":"
     annotation: <tag/>
     annotation: text [ <tag/> ]
     console.log("hello")
     
     // Type assertion in tag
     <C<number>/>
     <C<number>> </C>
     <C
     <error />
     
     // Non-ASCII tag name & attribute
     <日本語></日本語>;
     <Component 本本:本-本 aa本:本 aa:aa />
     <aaaa:ñ />
     
     <Namespace.DeepNamespace.Component />;
     <Component { ... x } y
     ={2 } z />;
     
     let k1 =
         <Comp a={10} b="hi" {...o} >
             hi hi hi!
         </Comp>;
     
     let k2 =
         <Comp a={10} b="hi">
             <div> My Div </div>
             {(name: string) => <div> My name {name} </div>}
         </Comp>;
     
    -let k3 = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error
    +let k3 = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error
     
     // OK
     let k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
     let k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
     let k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
     let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
     // OK
     let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
    -let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
    +let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
     let k3 = <div> {1} {"That is a number"} </div>;
     let k4 = <Button> <h2> Hello </h2> </Button>;
     
     // Empty tags
     hello<>
     hello<string>
     
     <></>; // no whitespace
     <    ></   >; // lots of whitespace
     < /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
     <>hi</>; // text inside
     <><span>hi</span><div>bye</div></>; // children
     <><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
     <>#</>; // # would cause scanning error if not in jsxtext
     
     // Tags after substitutions in templates
     `aaa${<tag></tag>//comment
         /*comment*/<A/>}`
     
     // Don't highlight tags within type declaration
     type T12 = ReturnType<(<T>() => T)>;
     type T13 = ReturnType<(<T extends U, U extends number[]>() => T)>;
     type T14 = ReturnType<typeof f1>;
     type T15 = ReturnType<(s: string) => void>;
     
     // Don't highlight tags within variable declaration
     let myIdentity: <T>(arg: T) => T <noTag/> = <Tag />;
     var myIdentity: <U>(arg: U) => U = identity;
     const myIdentity: {<T>(arg: T): T} = identity;
     
     // Don't highlight tags within interfaces and classes
     interface GenericIdentityFn {
         <T>(arg: T): T;
         <noTag />
     }
     class Handler {
         info: <T>(arg: T): T <noTag />;
         <tag> </tag>
     }
     
     // Highlight "<T extends" as a type assertion, not as a tag
     // (the "cast" expression works and isn't supported in the TSX file)
     const goodHighlighting = <T extends I>(
       arg: T
     ) => {
       const a = arg
       return a
     }
     <tag> text <T extends I/> </tag> // Here "<T extends I/>" is a tag
    +
    +// Check character after tag name, do not highlight invalid tags
    +<noTag  ?
    +<noTag  ,
    +<noTag /* comment */ ?
    +<noTag#
    +<noTag/*comment*/#
     
    diff --git a/autotests/input/highlight.js b/autotests/input/highlight.js index d0e7533..b2f77c7 100644 --- a/autotests/input/highlight.js +++ b/autotests/input/highlight.js @@ -1,139 +1,161 @@ /* 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 =

    Hello World

    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 + "
    "); 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: break; } + +// Numerics +var a = 0xA; +var b = 0b1; +var c = 0o7; +var d = 1.1E+3; +var e = 1.E+3; +var f = .1E+3; +var g = 1E+3; +var h = 1.1; +var i = 1.; +var j = .1; +var k = 1; +// Bigint +const binBig = 0b101n; +const octBig = 0o567n; +const hexBig = 0xC0Bn; +const decBig = 123n; +// Invalid numbers +var l = 0xA1t; +var m = 0b0123; +var n = 0o29; diff --git a/autotests/input/test.coffee b/autotests/input/test.coffee index 56f8a69..a856055 100644 --- a/autotests/input/test.coffee +++ b/autotests/input/test.coffee @@ -1,71 +1,75 @@ # CoffeeScript test # Source: https://coffeescript.org ### Multiline comment ### import 'local-file.coffee' # Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Splats: race = (winner, runners...) -> print winner, runners # Existence: alert "I knew it!" if elvis? # Array comprehensions: cubes = (math.cube num for num in list) # Classes: class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." # Switch/When/Else: switch day when "Mon" then go work when "Tue" then go relax when "Thu" then go iceFishing when "Fri", "Sat" if day is bingoDay go bingo go dancing when "Sun" then go church else go work # Member objects: Object.prop. Object .Object Object timelineEvent.class # Embedded JavaScript Code markdown = `function () { return \`In Markdown, write code like \\\`this\\\`\`; }` ``` // Comment var array = new Array(500); var name = "Willy"; alert(`Hello ${name}!`); ``` ` String.raw\`String ${x} \` ` + +` // Regular Expression after template + const a = \`6\` / 2; /*comment*/ + \`template\` /regex/ ` diff --git a/autotests/input/test.js b/autotests/input/test.js index f6ec2a9..6e7ba4c 100644 --- a/autotests/input/test.js +++ b/autotests/input/test.js @@ -1,26 +1,43 @@ #! shebang #! no-shebang /* comment */ function fun() { var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] }; } class MyClass; // reserved keywords // Member objects: text after "." object.property instanceof Number; iden1.iden2 . iden3.class class; var escapes = "aa\b\n\0a\"a\x12a\32a\u{123}a\$\%\ \#\y\aaa\ aaa"; var octal = 0o124; var bin = 0b1010; -ლಠ益ಠლ.ñá = 42; -δ /No-RegExp/ +日本語().ლಠ益ಠლ.ñá = 42; +δ /No-Regex/ -/* Modelines: finish comment in incomplete Modeline: - * kate: replace-tabs */ normal text +// Only highlight valid regular expressions, of a single line, after strings +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786 +"text" /No-Regex +"text" /Regex[:)]*/; +const a = "6" / 2; /*comment*/ const b = 5; +console.log("4" / "2"); // 2 +// Single quote +const a = '6' / 2; /*comment*/ const b = 5; +console.log('4' / '2'); // 2 +// Template +const a = `6` / 2; /*comment*/ const b = 5; +console.log(`4` / `2`); // 2 + +// Built-in +const os = require('os'); +JSON.stringify("hello"); +console.error("hello"); +Math.LOG10E; +Number.MAX_SAFE_INTEGER; diff --git a/autotests/input/test.jsx b/autotests/input/test.jsx index 5985dd1..1ac7460 100644 --- a/autotests/input/test.jsx +++ b/autotests/input/test.jsx @@ -1,96 +1,98 @@ // 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 ; } function 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() } // Detect Valid tags /* comment */ { /* comment */ word . } return /* comment multiline */ /* comment */ && /*comment*/ & /*comment*/ { Hello } ?; -[ ( +[ ( ] , = && || return ; default ; return anyWord anyWord/*comment*/ . & | % /* comment*/ -/> -> - - // Non-ASCII tag name & attribute <日本語>; ; ; let k1 =

    Hello

    world

    ; let k2 = ; // Empty tags <>; // no whitespace < >; // lots of whitespace < /*starting wrap*/ >; // comments in the tags <>hi; // text inside <>hi
    bye
    ; // children <>1<>2.12.23; // nested fragments <>#; // # would cause scanning error if not in jsxtext // Tags after substitutions in templates `aaa${//comment /*comment*/}` // Don't highlight tags within variable declaration let myIdentity: (arg: T) => T = identity; var myIdentity: (arg: U) => U = identity; const myIdentity: {(arg: T): T} = identity; // Don't highlight tags within interfaces and classes interface GenericIdentityFn { (arg: T): T; } class Handler { info: (arg: T): T ; } + +// Check character after tag name, do not highlight invalid tags + // 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); +// Built-in +document.body.innerHTML = greeter(user); to JSON.stringify() console.log("Hello world"); +const os = require('os'); +Math.LOG10E; +Number.MAX_SAFE_INTEGER; 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; }); } for (var i in pieces) { switch (true) { case /^\"?Accession\"?/.test(pieces[i]): numeration[0] = i; break; } } const enum ResponseCode { Success = 200, BadRequest = 400 } // Substitutions export function isInOpenInterval(start: number, end: number) { return tersible(a => a > start && a < end, () => `(${start}...${end})`) } const bar = `${x} ${y}`; // readonly function f1(mt: [number, number], rt: readonly [number, number]) { } function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) { } type ReadWrite = { -readonly [P in keyof T] : T[P] }; // const assertion let obj = { x: 10, y: [20, 30], z: { a: { b: 42 } } } as const; let r2 = { x: 20, y: 10 } as const; let r2 = {...p} as const; let p1 = { x: 10, y: 20 as const }; let p2 = { 10 as const, 'foo' as const }; // Definite assignment operator class Cl { one?: string; two!: string; } let x! = 1; // Function with multiple arguments const children = [].map>>(element => { if (!this.identityProvider) { return element; } return element; }); // Numerics var a = 0xA; var b = 0b1; var c = 0o7; var d = 1.1E+3; var e = 1.E+3; var f = .1E+3; var g = 1E+3; var h = 1.1; var i = 1.; var j = .1; var k = 1; var l = 1__.e+3_22 | .2____e2 | 0o1_23 | 11__. ; // Bigint const binBig = 0b101n; const octBig = 0o567n; const hexBig = 0xC0Bn; const decBig = 123n; // Types let a: null = null; let b: number = 123; let c: number = 123.456; let d: string = `Geeks`; let e: undefined = undefined; let f: boolean = true; let g: number = 0b111001; // Binary let h: number = 0o436; // Octal let i: number = 0xadf0d; // Hexa-Decimal const query = query<[number], number>(` SELECT * FROM statistics WHERE unit_id = $1`) function runQuery() { const query = createQuery<[number[]], Table>(` some SQL here `) return database.execute(query) } aa: string ? string string // Don't highlight aa: string assa | string string ; string aa: { string string } // Don't highlight aa: [ string string ] aa: ( string string ) // Don't highlight aa: string interface a { aa: /* comment */ string, bb: /* comment */ number, cc: // comment void, dd: any, } null, <{[key]: () => any}> null null, <{[key]: () =>{a: number}}> null // Correctly highlighting regular expressions dt = ((dt[0] * 1e9 + dt[1]) / 1e6).toFixed(3).replace(/\.?0+$/, '') + 'ms'; (a[0] / 2) / (2) // Type guards function isNumber(x: any): x is number { return typeof x === "number"; } // Conditional expressions (highlight keywords before ":") class C { w = () => this.a() ? true : this.b() ? false : true; z = () => this.b() ? hello : k; } function foo(arg: T): T extends B ? number : string { if (arg === "A") return 111; return "returning a string"; } // Types and logical `&&` and `||` operators after `as` expression Date as any || null; //Assertions const assert: (value: unknown) => asserts value = value => {} declare function assertIsString(value: unknown): asserts value is string; declare function assertIsArrayOfStrings(value: unknown): asserts value is string[]; declare function assertDefined(value: T): asserts value is NonNullable; namespace Debug { export declare function assert(value: unknown, message?: string): asserts value; export declare function assertDefined(value: T): asserts value is NonNullable; } + +// Only highlight valid regular expressions, of a single line, after strings +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786 +"text" /No-Regex +"text" /Regex[:)]*/; +const a = "6" / 2; /*comment*/ const b = 5; +console.log("4" / "2"); // 2 +// Single quote +const a = '6' / 2; /*comment*/ const b = 5; +console.log('4' / '2'); // 2 +// Template +const a = `6` / 2; /*comment*/ const b = 5; +console.log(`4` / `2`); // 2 diff --git a/autotests/input/test.tsx b/autotests/input/test.tsx index 3483900..7484dcb 100644 --- a/autotests/input/test.tsx +++ b/autotests/input/test.tsx @@ -1,146 +1,153 @@ // 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 ; } function 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() } // Detect Valid tags /* comment */ { /* comment */ word . } return /* comment multiline */ /* comment */ && /*comment*/ & /*comment*/ { Hello } ?; [ ( , = && || return ; default ; return anyWord anyWord/*comment*/ . & | % /* comment*/ // TODO: Fix this (comment before the tag name): var x = ; // Tag after ":" annotation: annotation: text [ ] console.log("hello") // Type assertion in tag /> >
    // Non-ASCII tag name & attribute <日本語>; ; ; let k1 = hi hi hi! ; let k2 =
    My Div
    {(name: string) =>
    My name {name}
    }
    ; let k3 = ({ x: a.x })} />; // No Error // OK let k1 = <>; // Empty tags hello<> hello <>; // no whitespace < >; // lots of whitespace < /*starting wrap*/ >; // comments in the tags <>hi; // text inside <>hi
    bye
    ; // children <>1<>2.12.23; // nested fragments <>#; // # would cause scanning error if not in jsxtext // Tags after substitutions in templates `aaa${//comment /*comment*/
    }` // Don't highlight tags within type declaration type T12 = ReturnType<(() => T)>; type T13 = ReturnType<(() => T)>; type T14 = ReturnType; type T15 = ReturnType<(s: string) => void>; // Don't highlight tags within variable declaration let myIdentity: (arg: T) => T = ; var myIdentity: (arg: U) => U = identity; const myIdentity: {(arg: T): T} = identity; // Don't highlight tags within interfaces and classes interface GenericIdentityFn { (arg: T): T; } class Handler { info: (arg: T): T ; } // Highlight "( arg: T ) => { const a = arg return a } text // Here "" is a tag + +// Check character after tag name, do not highlight invalid tags +/* 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/
    + 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!");
    +somestring.replace( /dooh/ , "bah!");
    re=/foo/ig; // hehe

    -somestring.search(
    +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>
    +var p = <p>Hello Worldp>
    var 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");
    +somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1");
    // ^ fallthrough expected. ("new" whould be bold)


    -something.method =
    - function ( a, b, c ) { /* ... */ }
    +something.method =
    + function ( a, b, c ) { /* ... */ }
    // ^ fallthrough ?!

    -something.other =
    -function ( d, e, f ) { /* ... */ }
    +something.other =
    +function ( d, e, f ) { /* ... */ }
    // fallthrough expected at col 0 ("function" should be bold)

    -var ary = new Array(5);
    +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();
    + dostuff();
    else
    - dont();
    + 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 + "
    "
    );
    + document.write("i is" + i + "
    "
    );

    while (something)
    -{
    - block();
    +{
    + block();
    picky:
    if (!1)
    break;
    else
    continue;
    -}
    +}

    -with (a) {
    - do {
    - stuff( b ); // a.b if it exists
    - } while (itmakessense);
    -}
    +with (a) {
    + do {
    + stuff( b ); // a.b if it exists
    + } while (itmakessense);
    +}

    -switch (i) {
    +switch (i) {
    case 0:
    - f();
    + f();
    break;
    default:
    break;
    -}
    +}
    +
    +// Numerics
    +var a = 0xA;
    +var b = 0b1;
    +var c = 0o7;
    +var d = 1.1E+3;
    +var e = 1.E+3;
    +var f = .1E+3;
    +var g = 1E+3;
    +var h = 1.1;
    +var i = 1.;
    +var j = .1;
    +var k = 1;
    +// Bigint
    +const binBig = 0b101n;
    +const octBig = 0o567n;
    +const hexBig = 0xC0Bn;
    +const decBig = 123n;
    +// Invalid numbers
    +var l = 0xA1t;
    +var m = 0b0123;
    +var n = 0o29;
    diff --git a/autotests/reference/highlight.jsp.ref b/autotests/reference/highlight.jsp.ref index a7a682b..7d0f2ac 100644 --- a/autotests/reference/highlight.jsp.ref +++ b/autotests/reference/highlight.jsp.ref @@ -1,173 +1,173 @@ <%--
    This page won't actually work, as it is simply designed to display jsp syntax highlighting.
    --%>
    <%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
    <%@ include file="/include/myglobalvars.jsp"%> --%>
    <%@ page import="java.util.*,
    java.io.*,
    java.math.*" %>
    <%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
    id="aPageBean" scope="page" class="my.package.MyPageBean"/>
    id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
    <%
    // We can decipher our expected parameters here.
    String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
    String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
    String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
    String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
    String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();

    // A sample collection of Integers to display some code folding.
    List intList = getIntList(10);


    %>

    A Sample Jsp





    <%-- The top label table. --%>
    width="400" cellpadding="0" cellspacing="0" border="0">

    size="3">The following parameters were detected:



    <%-- Display the parameters which might have been passed in. --%>
    width="400" cellpadding="0" cellspacing="0" border="0">
    <%-- Label; Actual Parameter String; Value Detected --%>

    PARAMETER_1
    align="center"><%=PARAMETER_1%>
    align="right">"<%=parm1%>"


    <%-- Label; Actual Parameter String; Value Detected --%>

    PARAMETER_2
    align="center"><%=PARAMETER_2%>
    align="right">"<%=parm2%>"


    <%-- Label; Actual Parameter String; Value Detected --%>

    PARAMETER_3
    align="center"><%=PARAMETER_3%>
    align="right">"<%=parm3%>"


    <%-- Label; Actual Parameter String; Value Detected --%>

    PARAMETER_4
    align="center"><%=PARAMETER_4%>
    align="right">"<%=parm4%>"


    <%-- Label; Actual Parameter String; Value Detected --%>

    PARAMETER_5
    align="center"><%=PARAMETER_5%>
    align="right">"<%=parm5%>"







    <%-- Display our list of random Integers (shows code folding). --%>
    width="400" cellpadding="0" cellspacing="0" border="0">
    <%
    if (intList != null && intList.size() > 0) {
    %>
    Here are the elements of intList...
    <%
    Iterator intListIt = intList.iterator();
    while (intListIt.hasNext()) {
    Integer i = (Integer) intListIt.next();
    %>
    <%=i.toString()%>
    <%
    }
    } else {
    %>
    color="blue">Oooops, we forgot to initialize intList!
    <%
    }
    %>






    <%-- We can call javascript functions. --%>
    width="400" cellpadding="0" cellspacing="0" border="0">
    colspan="2">Test our javascript...

    type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()">
    type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()">






    <%-- If we actually had defined a tag library. --%>
    width="400" cellpadding="0" cellspacing="0" border="0">

    prop1="first" prop2="third">
    nameProp="value1"/>
    nameProp="value2"/>







    <%-- Expression language. --%>
    width="400" cellpadding="0" cellspacing="0" border="0">
    test="${!empty param.aParam}">
    var="myParam" scope="session" value="${param.aParam}"/>


    myParam's value: " value="${myParam}" default=="Default"/>"



    <%!
    /* A place for class variables and functions... */

    // Define some sample parameter names that this page might understand.
    private static final String PARAMETER_1 = "p1";
    private static final String PARAMETER_2 = "p2";
    private static final String PARAMETER_3 = "p3";
    private static final String PARAMETER_4 = "p4";
    private static final String PARAMETER_5 = "p5";

    // Returns str trimmed, or an empty string if str is null.
    private static String noNull(String str) {
    String retStr;
    if (str == null)
    retStr = "";
    else
    retStr = str.trim();

    return retStr;
    }

    // Returns a list of Integers with listSize elements.
    private static List getIntList(int listSize) {
    ArrayList retList = new ArrayList(listSize);
    for (int i = 0; i < listSize; i++)
    retList.add(new Integer( (int) (Math.random() * 100) ));

    return retList;
    }
    %>
    diff --git a/autotests/reference/highlight.php.ref b/autotests/reference/highlight.php.ref index a6452ee..7d916c0 100644 --- a/autotests/reference/highlight.php.ref +++ b/autotests/reference/highlight.php.ref @@ -1,69 +1,69 @@
    /* This is a pseudo PHP file to test Kate's PHP syntax highlighting. */
    # TODO: this is incomplete, add more syntax examples!
    # this is also a comment.
    // Even this is a comment
    function test($varname) {
    return "bla"; # this is also a comment
    }

    ?>

    echo("hello test"); ?>


    print "test"; ?>







    type="text/babel">
    echo("Hello, hello!"); ?> /* aaa */ ?>

    - function a(i) {
    + function a(i) {
    echo "var j = 1;"; ?>
    return

    { i + j }

    ;
    - }
    + }


    type="text/typescript">
    $timestamp = time(); ?>
    - class DateTime {
    + class DateTime {
    info: string;
    - constructor() { this.info = echo(date("F d, Y h:i:s", $timestamp)); ?>; }
    - get() { return this.info; }
    - }
    + constructor() { this.info = echo(date("F d, Y h:i:s", $timestamp)); ?>; }
    + get() { return this.info; }
    + }


    type="x-tmpl-mustache">
    {{! print "comment"; ?> }}
    {{#movie}}

    {{title}}


    src="{{poster}}" alt="{{title}}"/>
    echo $movierating; ?> - {{ratings.critics_rating}}

    {{/movie}}





    $var = <<
    This is the $string inside the variable (which seems to be rendered as a string)
    It works well, I think.
    DOOH

    # bug 382527
    throw new ParserException("Test {$this->some_var[$index]}\nin {$this->file} is missing.\nThis is bad.");
    ?>
    diff --git a/autotests/reference/highlight.qml.ref b/autotests/reference/highlight.qml.ref index 20ee44a..768a67f 100644 --- a/autotests/reference/highlight.qml.ref +++ b/autotests/reference/highlight.qml.ref @@ -1,59 +1,59 @@ import Qt 4.6

    // some random qml snippets stolen from the qt docs

    Rectangle {
    important: true
    propertyAsdf:
    id: container
    signalA: bla
    property string label
    signal clicked
    - radius: 5; border.color: "black"
    - color: mouse.pressed ? "steelblue" : "lightsteelblue"
    + radius: 5; border.color: "black"
    + color: mouse.pressed ? "steelblue" : "lightsteelblue"
    gradient: Gradient {
    - GradientStop { position: mouse.pressed ? 1.0 : 0.0; color: "steelblue" }
    - GradientStop { position: mouse.pressed ? 0.0 : 1.0; color: "lightsteelblue" }
    + GradientStop { position: mouse.pressed ? 1.0 : 0.0; color: "steelblue" }
    + GradientStop { position: mouse.pressed ? 0.0 : 1.0; color: "lightsteelblue" }
    }
    - MouseRegion { id: mouse; anchors.fill: parent; onClicked: container.clicked() }
    - Text { anchors.fill: parent; text: container.label; anchors.centerIn: parent }
    + MouseRegion { id: mouse; anchors.fill: parent; onClicked: container.clicked() }
    + Text { anchors.fill: parent; text: container.label; anchors.centerIn: parent }
    }

    Rectangle {
    Script {
    - function calculateMyHeight() {
    - return Math.max(otherItem.height, thirdItem.height);
    + function calculateMyHeight() {
    + return Math.max(otherItem.height, thirdItem.height);
    }
    }

    - anchors.centerIn: parent
    - width: Math.min(otherItem.width, 10)
    - height: calculateMyHeight()
    - color: { if (width > 10) "blue"; else "red" }
    + anchors.centerIn: parent
    + width: Math.min(otherItem.width, 10)
    + height: calculateMyHeight()
    + color: { if (width > 10) "blue"; else "red" }
    }

    Rectangle {
    default property color innerColor: "black"
    property color innerColor: "black"
    - property alias text: textElement.text
    - property alias aliasXYZ: testElement.text
    + property alias text: textElement.text
    + property alias aliasXYZ: testElement.text
    signal bar
    signal bar(var blah, string yxcv)
    width: 240; height: 320;
    width: 100; height: 30; source: "images/toolbutton.sci"
    ListView {
    - anchors.fill: parent
    + anchors.fill: parent
    model: contactModel
    delegate: Component {
    Text {
    - text: modelData.firstName + " " + modelData.lastName
    + text: modelData.firstName + " " + modelData.lastName
    }
    }
    }
    }

    Item {
    - function say(text) {
    - console.log("You said " + text);
    + function say(text) {
    + console.log("You said " + text);
    }
    }
    diff --git a/autotests/reference/test.coffee.ref b/autotests/reference/test.coffee.ref index e499f72..f347f71 100644 --- a/autotests/reference/test.coffee.ref +++ b/autotests/reference/test.coffee.ref @@ -1,71 +1,75 @@ # CoffeeScript test
    # Source: https://coffeescript.org

    ### Multiline
    comment ###
    import 'local-file.coffee'

    # Assignment:
    number = 42
    opposite = true

    # Conditions:
    number = -42 if opposite

    # Functions:
    square = (x) -> x * x

    # Arrays:
    list = [1, 2, 3, 4, 5]

    # Objects:
    math =
    root: Math.sqrt
    square: square
    cube: (x) -> x * square x

    # Splats:
    race = (winner, runners...) ->
    print winner, runners

    # Existence:
    alert "I knew it!" if elvis?

    # Array comprehensions:
    cubes = (math.cube num for num in list)

    # Classes:
    class Animal
    constructor: (@name) ->

    move: (meters) ->
    alert @name + " moved #{meters}m."

    # Switch/When/Else:
    switch day
    when "Mon" then go work
    when "Tue" then go relax
    when "Thu" then go iceFishing
    when "Fri", "Sat"
    if day is bingoDay
    go bingo
    go dancing
    when "Sun" then go church
    else go work

    # Member objects:
    Object.prop. Object .Object Object
    timelineEvent.class

    # Embedded JavaScript Code
    -markdown = `function () {
    +markdown = `function () {
    return \`In Markdown, write code like \\\`this\\\`\`;
    -}`
    +}`

    ```
    // Comment
    - var array = new Array(500);
    + var array = new Array(500);
    var name = "Willy";
    - alert(${name});
    + alert(${name});
    ```
    ` String.raw\`String ${x} \` `
    +
    +` // Regular Expression after template
    + const a = \`6\` / 2; /*comment*/
    + \`template\` /regex/ `
    diff --git a/autotests/reference/test.htm.ref b/autotests/reference/test.htm.ref index 26388cb..641045f 100644 --- a/autotests/reference/test.htm.ref +++ b/autotests/reference/test.htm.ref @@ -1,74 +1,74 @@ HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


    </Element><Normal Text>This is a title</Normal Text><Element>


    class="ui main">
    *ngFor="let name of names">Hello, {{ name }}!








    type="text/typescript">
    - class Student {
    + class Student {
    fullName: string;
    - constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    - this.fullName = firstName + " " + middleInitial + " " + lastName;
    - }
    - }
    + constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    + this.fullName = firstName + " " + middleInitial + " " + lastName;
    + }
    + }
    let a: null = null;
    let b: number = 12___3;



    src="https://unpkg.com/babel-standalone@6/babel.min.js">
    type="text/babel">
    - ReactDOM.render(
    + ReactDOM.render(

    Hello, world!

    ,
    - document.getElementById('root')
    + document.getElementById('root')
    );
    - function Story(props) {
    - const SpecificStory = components[props.storyType];
    - return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    - }
    + function Story(props) {
    + const SpecificStory = components[props.storyType];
    + return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    + }



    type="x-tmpl-mustache">
    {{#movie}}

    {{title}}


    src="{{poster}}" alt="{{title}}"/>


    Rating - {{ratings.critics_rating}}

    {{/movie}}
    {{^movie}}

    Movie Does Not Exist :(

    {{/movie}}
    {{! comment }}



    type="text/html">







    diff --git a/autotests/reference/test.js.ref b/autotests/reference/test.js.ref index 9b6a2f1..8d778a4 100644 --- a/autotests/reference/test.js.ref +++ b/autotests/reference/test.js.ref @@ -1,26 +1,43 @@ #! shebang
    #! no-shebang

    /* comment */

    -function fun()
    -{
    - var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] };
    -}
    +function fun()
    +{
    + var boo = { 'key': [ 1, 2.0, 3.0e1, 004, 0x5 ] };
    +}

    class MyClass; // reserved keywords

    // Member objects: text after "."
    -object.property instanceof Number;
    -iden1.iden2 . iden3.class class;
    +object.property instanceof Number;
    +iden1.iden2 . iden3.class class;

    var escapes = "aa\b\n\0a\"a\x12a\32a\u{123}a\$\%\ \#\y\aaa\
    aaa";
    var octal = 0o124;
    var bin = 0b1010;

    -ლಠ益ಠლ.ñá = 42;
    -δ /No-RegExp/
    +日本語().ლಠ益ಠლ.ñá = 42;
    +δ /No-Regex/

    -/* Modelines: finish comment in incomplete Modeline:
    - * kate: replace-tabs */ normal text
    +// Only highlight valid regular expressions, of a single line, after strings
    +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786
    +"text" /No-Regex
    +"text" /Regex[:)]*/;
    +const a = "6" / 2; /*comment*/ const b = 5;
    +console.log("4" / "2"); // 2
    +// Single quote
    +const a = '6' / 2; /*comment*/ const b = 5;
    +console.log('4' / '2'); // 2
    +// Template
    +const a = / 2; /*comment*/ const b = 5;
    +console.log( / ); // 2
    +
    +// Built-in
    +const os = require('os');
    +JSON.stringify("hello");
    +console.error("hello");
    +Math.LOG10E;
    +Number.MAX_SAFE_INTEGER;
    diff --git a/autotests/reference/test.jsx.ref b/autotests/reference/test.jsx.ref index e36c9f4..e667563 100644 --- a/autotests/reference/test.jsx.ref +++ b/autotests/reference/test.jsx.ref @@ -1,96 +1,98 @@ // JavaScript React

    /** @author Willy
    * @url https://reactjs.org/ **/

    import React from 'react';
    -import { PhotoStory, VideoStory } from './stories';
    +import { PhotoStory, VideoStory } from './stories';

    -function Story(props) {
    - const SpecificStory = components[props.storyType];
    - return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    -}
    +function Story(props) {
    + const SpecificStory = components[props.storyType];
    + return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    +}

    function
    - attr1={ function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
    + attr1={ function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
    /* no comment*/ function return class var 0x123 &ref; hello() React.Component()
    . anyWord
    - { function <tag> return class var 0x123 hello() React.Component() }
    + { function <tag> return class var 0x123 hello() React.Component() }
  • href="link">Hello



  • Tag$>


    /*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />

    // Detect Valid tags

    /* comment */
    -{ /* comment
    +{ /* comment
    */ />
    - word <noTag/> . <noTag/> } <noTag/>
    + word <noTag/> . <noTag/> } <noTag/>
    return /* comment
    multiline */ /* comment */
    && /*comment*/
    & /*comment*/ <noTag/>


    -{ Hello }
    +{ Hello }
    ? />;
    -[ /> ( />
    +[ /> ( /> ]
    , =
    && ||
    return ;
    default ;
    return


    anyWord<noTag>
    anyWord/*comment*/ <noTag/>
    -.<noTag>
    +.<noTag>
    &<notag> | <noTag/>
    % /* comment*/ <noTag/>

    -<number>/>
    -<number>>
    -
    - />
    -
    // Non-ASCII tag name & attribute
    <日本語>;
    本本:本-本 aa本:本 aa:aa />

    />;
    - { ... x } y
    + { ... x } y
    ={2 } z />;

    let k1 =

    Hello

    world

    ;
    let k2 = ;

    // Empty tags
    <>; // no whitespace
    < >; // lots of whitespace
    -< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags
    +< /*starting wrap*/ > /*ending wrap*/>; // comments in the tags
    <>hi; // text inside
    <>hi
    bye
    ; // children
    <>1<>2.12.23; // nested fragments
    <>#; // # would cause scanning error if not in jsxtext

    // Tags after substitutions in templates
    ${//comment
    /*comment*/}

    // Don't highlight tags within variable declaration
    let myIdentity: <T>(arg: T) => T = identity;
    var myIdentity: <U>(arg: U) => U = identity;
    -const myIdentity: {<T>(arg: T): T} = identity;
    +const myIdentity: {<T>(arg: T): T} = identity;

    // Don't highlight tags within interfaces and classes
    -interface GenericIdentityFn {
    +interface GenericIdentityFn {
    <T>(arg: T): T;
    <noTag />
    -}
    -class Handler {
    +}
    +class Handler {
    info: <T>(arg: T): T <noTag />;

    -}
    +}
    +
    +// Check character after tag name, do not highlight invalid tags
    +<noTag ?
    +<noTag ,
    +<noTag /* comment */ ?
    +<noTag#
    +<noTag/*comment*/#
    diff --git a/autotests/reference/test.markdown.ref b/autotests/reference/test.markdown.ref index 3fef013..07ca4fd 100644 --- a/autotests/reference/test.markdown.ref +++ b/autotests/reference/test.markdown.ref @@ -1,582 +1,582 @@ ---
    Title: A Sample Markdown Document
    Author: Fletcher T. Penney
    Date: February 9, 2011
    Comment: This is a comment intended to demonstrate
    metadata that spans multiple lines.
    ---

    # H1


    ## H2


    ### H3


    Multi-line paragraph bla bla bla
    bla bla bla.

    Intentional line break
    via two spaces at line.

    Formats: _italic_, **bold**, `monospace`, ~~strikeout~~

    Bullet list:

    * item1
    * item2

    Numbered list:

    1. item 1
    2. item 2

    Task list:

    - [x] Finish my changes
    - [ ] Push my commits
    - [ ] Open a pull request

    A link as normal text: http://example.com

    [link](http://kde.org)

    Auto-link: <http://kate-editor.org>
    Mail: mark@kde.org>

    This is [an example](http://example.com/ "Title") inline link.

    See my [About](/about/) page for details.

    This is [an example] [id] reference-style link.

    [id]: http://example.com/ "Optional Title Here"
    [foo]: http://example.com/ 'Optional Title Here'
    [bar]: http://example.com/ (Optional Title Here)
    [id2]: <http://example.com/> "Optional Title Here"

    ![Alt text](/path/to/img.jpg)

    ![Alt text](/path/to/img.jpg "Optional title")

    [![Alt text](https://url/to/img.svg)](https://link.com/example/)

    code 1
    code 2

    normal text

    >
    block quote _italic_
    >
    more block quote

    normal text

    Title: some text

    normal text

    # Lists


    1. item
    * This is a list item
    with multiple lines.
    ```
    code
    ```

    >
    This is a
    blockquote

    This is a new paragraph, which
    is part of the item in the
    previous list.

    indented code block

    Other paragraph.

    * subitem
    * subitem
    with multiple
    lines.

    New paragraph of
    the previous subitem.

    code block

    -----------------------

    Other paragraph of
    the subitem.

    30. numlist item
    31. numlist item

    New paragraph of
    the previous item.

    >
    Blockquote

    code block

    Other paragraph.

    # Inline HTML


    ©
    bold
    code










    a b

    • c

    • d

    e


    normal text *italic*

    # Code


    `simple code`

    ``simple ` code``

    ```simple `` ` code ```

    ````simple`code````

    normal text
    normal text
    normal text
    normal text

    code blocks are only allowed
    after an empty line.

    * list
    list

    normal text

    1. num-list
    num-list

    normal text

    >
    quote
    quote

    code block

    normal


    code

    normal


    code

    # Fenced code blocks (bug 356974)


    ## Bash


    ```bash
    #!/usr/bin/env bash

    for f *; do
    echo "$f"
    done
    ```

    ## C++


    ```cpp
    #include

    class Q : public QObject {
    Q_OBJECT
    public:
    Q();
    }

    Q::Q() :QObject(NULL) {
    }
    ```

    ## C


    ```c
    #include
    #include "stdint.h"
    #define SOME_VAR 1

    static uint64_t intWithSuffix = 42ull + ~1233L;
    static int octNum = 07232;
    ```

    ## C# ##


    ```csharp
    var arr = new[] { 0, 1, 2, 3, 4 };
    var anon = new { Country = "Germany", Inhabitants = 80000000 };
    ```

    ## CMake


    ```cmake
    cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

    project (hello_world)

    set(QT_MIN_VERSION "5.6.0")
    ```

    ## CSS


    ```css
    h1.main::hover {
    font-size: 100;
    color: green;
    }
    ```

    ## Email


    ```email
    From: Konqi Dragon

    To: All

    Subject: highlights
    ```

    ## Go


    ```go
    package main

    import "fmt"

    func main() {
    fmt.Println("Hola, mundo.")
    }
    ```

    ## Haskell


    ```haskell
    module Main (main) where

    main :: IO ()
    main = putStrLn "Hello, World!"
    ```

    ## HTML


    ```html


    class="main">Hello world!




    ```

    ## Java


    ```java
    package fibsandlies;
    import java.util.HashMap;

    /**
    * This is an example of a Javadoc comment; Javadoc can compile documentation
    * from this text. Javadoc comments must immediately precede the class, method, or field being documented.
    */
    public class FibCalculator extends Fibonacci implements Calculator {

    private static Map<Integer, Integer> memoized = new HashMap<Integer, Integer>();
    public static void main(String[] args) {
    memoized.put(1, 1);
    memoized.put(2, 1);
    System.out.println(fibonacci(12));
    }
    }
    ```

    ## JavaScript


    ```js
    -function factorial(n) {
    - if (n === 0) {
    +function factorial(n) {
    + if (n === 0) {
    return 1; // 0! = 1
    - }
    - return n * factorial(n - 1);
    -}
    + }
    + return n * factorial(n - 1);
    +}
    ```

    ## JavaScript React (JSX)


    ```jsx
    />
    -function Story(props) {
    - const SpecificStory = components[props.storyType];
    - return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    -}
    +function Story(props) {
    + const SpecificStory = components[props.storyType];
    + return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    +}
    ```

    ## JSON


    ```json
    [{
    "hello": "world",
    "count": 1,
    "bool": true
    }]
    ```

    ## Matlab


    ```matlab
    % Numbers _____________________________________________
    5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i
    5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i'
    ```

    ## Markdown


    ```markdown
    **bold** `code`
    >
    quote

    ```

    ## Mustache/Handlebars


    ```handlebars
    {{#movie}}

    {{title}}


    src="{{poster}}" alt="{{title}}"/>


    Rating - {{ratings.critics_rating}}

    {{/movie}}
    ```

    ## Perl


    ```perl
    my $var = shift;

    $var =~ s/bla/foo/igs;
    $var =~ s!bla!foo!igs;
    $var =~ s#bla#foo#igs;
    ```

    ## PHP


    ```php
    namespace Application\Controller;

    use Zend\Mvc\Controller\AbstractActionController;

    class IndexController extends AbstractActionController
    {
    }
    ```

    ## Python


    ```python
    def addXToY(x, y):
    total = x + y
    print total
    ```

    ## QML


    ```qml
    Text {
    id: hello
    width: 100
    text: "Hello world!"
    }
    ```

    ## R


    ```r
    # Declare function “f” with parameters “x”, “y“
    # that returns a linear combination of x and y.
    f <- function(x, y) {
    z <- 3 * x + 4 * y
    return(z)
    }
    ```

    ## Ruby


    ```ruby
    require 'Config'
    def CGI::escape(string)
    string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
    '%' + $1.unpack('H2' * $1.size).join('%').upcase
    end.tr(' ', '+')
    end
    ```

    ## Rust


    ```rust
    fn main() {
    println!("Hello world!");
    }
    ```

    ## MySQL


    ```mysql
    -- comment
    CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar);
    SELECT * FROM stuff WHERE id = 'string';
    select * from stuff where id < 0.42;
    Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL;
    ```

    ## TypeScript


    ```ts
    -class Student {
    +class Student {
    fullName: string;
    - constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    - this.fullName = firstName + " " + middleInitial + " " + lastName;
    - }
    -}
    + constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    + this.fullName = firstName + " " + middleInitial + " " + lastName;
    + }
    +}
    ```

    ## XML


    ```xml
    attribute="3">


    ```

    ## reStructuredText


    ```rst
    Section Header
    ==============

    .. image:: /path/to/image.jpg

    - A bullet list item
    ```

    ## Doxygen


    ```doxygen
    a normal member taking two arguments and returning an integer value.
    @param a an integer argument.
    @param s a constant character pointer.
    @see Javadoc_Test()
    @see publicVar()
    @return The test results
    ```

    ## No language specified


    ```
    No language is specified, but it should be still rendered as code block.
    ```

    # Fenced code blocks with more than 3 backticks or tildes


    ~~~
    Fenced code block with 3 tildes.
    ~~~

    `````````
    Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes.
    ```
    The block ends with the same amount of backticks.
    `````````

    ~~~~~~~~~~~~
    Fenced code block with more tildes.
    ~~~~~~~~~~~~

    ## With languages


    ```````html


    class="main">Hello world!




    ```
    ```````

    ~~~bash
    for f *; do
    echo "$f"
    done
    ~~~

    ~~~~~~~~~python
    def addXToY(x, y):
    total = x + y
    print total
    ~~~ # <= doesn't end here
    ~~~~~~~~~

    # Italic and bold text


    **b** *i* __b__ _i_
    ***ib*** ___ib___
    **_ib_** __*ib*__

    * _italic_ **bold** ***ib*** ~~strikeout~~

    >
    _italic_ **bold** ***ib*** ~~strikeout~~

    ## Bold

    **bold*___text** normal
    __bold_***text__ normal

    ## Italic

    *italic _ text* normal
    _italic * text_ normal

    ## Italic-Bold

    ***italic-bold ** italic-bold*** normal
    ***bold-italic text **bold-italic text*** normal
    ***bold*italic*** normal
    **_bold-italic text_** normal


    _ normal text_ * normal text *
    *italic text*normal text*
    *italic text *italic text*
    **bold text**normal text**
    **bold text **bold text**


    aaa**bold text**aaaaa
    aaa__normal text__aaaaa
    пристаням_стремятся_


    \*normal text*
    _normal text\_
    **italic text\**
    ***only bold\***
    **bold\** bold**
    diff --git a/autotests/reference/test.qml.ref b/autotests/reference/test.qml.ref index 00c5e8c..51533f3 100644 --- a/autotests/reference/test.qml.ref +++ b/autotests/reference/test.qml.ref @@ -1,23 +1,24 @@ /*
    * multi line comment
    */

    // single line comment

    import QtQuick 2.0

    Rectangle {
    property real myNumProp: 0.1e12;
    property alias sub.color;
    signal mySignal(int arg1, string arg2)
    color: "lightsteelblue"
    width: 320
    height: width/2

    Rectangle {
    id: sub
    width: 0x10
    height: 007
    objectName: 'single quote'
    + objectName2: a ? b : c;
    }
    }
    diff --git a/autotests/reference/test.ts.ref b/autotests/reference/test.ts.ref index 8658084..e90e041 100644 --- a/autotests/reference/test.ts.ref +++ b/autotests/reference/test.ts.ref @@ -1,207 +1,224 @@ /// types="node" />

    // TypeScript Test

    -class Student {
    +class Student {
    fullName: string;
    - constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    - this.fullName = firstName + " " + middleInitial + " " + lastName;
    - }
    -}
    + constructor(public firstName: string, public middleInitial: string, public lastName: string) {
    + this.fullName = firstName + " " + middleInitial + " " + lastName;
    + }
    +}

    -interface Person {
    +interface Person {
    firstName: string;
    lastName: string;
    -}
    +}

    -function greeter(person : Person) {
    +function greeter(person : Person) {
    return "Hello, " + person.firstName + " " + person.lastName;
    -}
    +}

    let user = new Student("Jane", "M.", "User");

    -document.body.innerHTML = greeter(user);
    +// Built-in
    +document.body.innerHTML = greeter(user); to
    JSON.stringify()
    console.log("Hello world");
    +const os = require('os');
    +Math.LOG10E;
    +Number.MAX_SAFE_INTEGER;

    -import http = require("http");
    -import path = require("path");
    +import http = require("http");
    +import path = require("path");
    import URL = url.URL;
    -import { Readable, Writable } from "stream";
    -import { isBuffer, isString, isObject } from "util";
    +import { Readable, Writable } from "stream";
    +import { isBuffer, isString, isObject } from "util";

    const port = 8__88___8;
    const baseUrl = new URL(${port});
    -const rootDir = path.dirname(__dirname);
    +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;
    -}
    +interface FileBasedTestConfiguration {
    + [setting: string]: string;
    +}

    -function swapCase(s: string): string {
    - return s.replace(/\w/g, (ch) => {
    +function swapCase(s: string): string {
    + return s.replace(/\w/g, (ch) => {
    const up = ch.toUpperCase();
    return ch === up ? ch.toLowerCase() : up;
    - });
    -}
    + });
    +}

    -for (var i in pieces) {
    - switch (true) {
    - case /^\"?Accession\"?/.test(pieces[i]):
    - numeration[0] = i;
    +for (var i in pieces) {
    + switch (true) {
    + case /^\"?Accession\"?/.test(pieces[i]):
    + numeration[0] = i;
    break;
    - }
    -}
    + }
    +}

    -const enum ResponseCode {
    +const enum ResponseCode {
    Success = 200,
    BadRequest = 400
    -}
    +}

    // Substitutions
    -export function isInOpenInterval(start: number, end: number) {
    +export function isInOpenInterval(start: number, end: number) {
    return tersible(a => a > start && a < end, () => ${start}${end})
    -}
    +}
    const bar = ${x}${y};

    // readonly
    -function f1(mt: [number, number], rt: readonly [number, number]) {
    -}
    +function f1(mt: [number, number], rt: readonly [number, number]) {
    +}

    -function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
    -}
    +function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
    +}

    -type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };
    +type ReadWrite<T> = { -readonly [P in keyof T] : T[P] };

    // const assertion
    -let obj = { x: 10, y: [20, 30], z: { a: { b: 42 } } } as const;
    -let r2 = { x: 20, y: 10 } as const;
    -let r2 = {...p} as const;
    -let p1 = { x: 10, y: 20 as const };
    -let p2 = { 10 as const, 'foo' as const };
    +let obj = { x: 10, y: [20, 30], z: { a: { b: 42 } } } as const;
    +let r2 = { x: 20, y: 10 } as const;
    +let r2 = {...p} as const;
    +let p1 = { x: 10, y: 20 as const };
    +let p2 = { 10 as const, 'foo' as const };

    // Definite assignment operator
    -class Cl {
    - one?: string;
    +class Cl {
    + one?: string;
    two!: string;
    -}
    +}
    let x! = 1;

    // Function with multiple arguments
    -const children = [].map<Set<Map<number, string>>>(element => {
    - if (!this.identityProvider) {
    +const children = [].map<Set<Map<number, string>>>(element => {
    + if (!this.identityProvider) {
    return element;
    - }
    + }
    return element;
    -});
    +});

    // Numerics
    var a = 0xA;
    var b = 0b1;
    var c = 0o7;
    var d = 1.1E+3;
    var e = 1.E+3;
    var f = .1E+3;
    var g = 1E+3;
    var h = 1.1;
    var i = 1.;
    var j = .1;
    var k = 1;
    var l = 1__.e+3_22 | .2____e2 | 0o1_23 | 11__. ;

    // Bigint
    const binBig = 0b101n;
    const octBig = 0o567n;
    const hexBig = 0xC0Bn;
    const decBig = 123n;

    // Types
    let a: null = null;
    let b: number = 123;
    let c: number = 123.456;
    let d: string = ;
    let e: undefined = undefined;
    let f: boolean = true;
    let g: number = 0b111001; // Binary
    let h: number = 0o436; // Octal
    let i: number = 0xadf0d; // Hexa-Decimal

    -const query = query<[number], number>(
    +const query = query<[number], number>(


    )

    -function runQuery() {
    - const query = createQuery<[number[]], Table<Columns>>(
    +function runQuery() {
    + const query = createQuery<[number[]], Table<Columns>>(

    )
    return database.execute(query)
    -}
    +}

    aa: <sdf/> string ?<ssd/> string
    string // Don't highlight
    aa: string assa |
    string
    string ;
    string

    -aa: { string
    - string } // Don't highlight
    +aa: { string
    + string } // Don't highlight

    -aa: [ string
    - string ]
    +aa: [ string
    + string ]
    aa: ( string
    string ) // Don't highlight
    aa: string <string>
    -interface a {
    +interface a {
    aa: /* comment
    */ string,
    bb: /* comment */
    number,
    cc: // comment
    void,
    dd:
    any,
    -}
    +}

    -null, <{[key]: () => any}> null
    -null, <{[key]: () =>{a: number}}> null
    +null, <{[key]: () => any}> null
    +null, <{[key]: () =>{a: number}}> null

    // Correctly highlighting regular expressions
    -dt = ((dt[0] * 1e9 + dt[1]) / 1e6).toFixed(3).replace(/\.?0+$/, '') + 'ms';
    -(a[0] / 2) / (2)
    +dt = ((dt[0] * 1e9 + dt[1]) / 1e6).toFixed(3).replace(/\.?0+$/, '') + 'ms';
    +(a[0] / 2) / (2)

    // Type guards
    -function isNumber(x: any): x is number {
    +function isNumber(x: any): x is number {
    return typeof x === "number";
    -}
    +}

    // Conditional expressions (highlight keywords before ":")
    -class C {
    +class C {
    w = () =>
    - this.a() ? true : this.b() ? false : true;
    + this.a() ? true : this.b() ? false : true;
    z = () =>
    - this.b() ? hello : k;
    -}
    + this.b() ? hello : k;
    +}

    -function foo<T extends X>(arg: T): T extends B ? number : string {
    +function foo<T extends X>(arg: T): T extends B ? number : string {
    if (arg === "A") return <T extends B ? number : never>111;
    return <T extends B ? never : string>"returning a string";
    -}
    +}

    // Types and logical `&&` and `||` operators after `as` expression
    Date as any || null;

    //Assertions
    -const assert: (value: unknown) => asserts value = value => {}
    -declare function assertIsString(value: unknown): asserts value is string;
    -declare function assertIsArrayOfStrings(value: unknown): asserts value is string[];
    -declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
    -namespace Debug {
    - export declare function assert(value: unknown, message?: string): asserts value;
    +const assert: (value: unknown) => asserts value = value => {}
    +declare function assertIsString(value: unknown): asserts value is string;
    +declare function assertIsArrayOfStrings(value: unknown): asserts value is string[];
    +declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
    +namespace Debug {
    + export declare function assert(value: unknown, message?: string): asserts value;
    export declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
    -}
    +}
    +
    +// Only highlight valid regular expressions, of a single line, after strings
    +// See: https://github.com/microsoft/TypeScript-TmLanguage/issues/786
    +"text" /No-Regex
    +"text" /Regex[:)]*/;
    +const a = "6" / 2; /*comment*/ const b = 5;
    +console.log("4" / "2"); // 2
    +// Single quote
    +const a = '6' / 2; /*comment*/ const b = 5;
    +console.log('4' / '2'); // 2
    +// Template
    +const a = / 2; /*comment*/ const b = 5;
    +console.log( / ); // 2
    diff --git a/autotests/reference/test.tsx.ref b/autotests/reference/test.tsx.ref index b22590e..e927345 100644 --- a/autotests/reference/test.tsx.ref +++ b/autotests/reference/test.tsx.ref @@ -1,146 +1,153 @@ // TypeScript React

    /** @author Willy
    * @url https://reactjs.org/ **/

    import React from 'react';
    -import { PhotoStory, VideoStory } from './stories';
    +import { PhotoStory, VideoStory } from './stories';

    -function Story(props) {
    - const SpecificStory = components[props.storyType];
    +function Story(props) {
    + const SpecificStory = components[props.storyType];
    return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
    -}
    +}

    function
    - attr1={ function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
    + attr1={ function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
    /* no comment*/ function return class var 0x123 &ref; hello() React.Component()
    . anyWord
    { function <tag> return class var 0x123 hello() React.Component() }



    Tag$>


    /*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />

    // Detect Valid tags

    /* comment */
    -{ /* comment
    +{ /* comment
    */ />
    - word <noTag/> . <noTag/> } <noTag/>
    + word <noTag/> . <noTag/> } <noTag/>
    return /* comment
    multiline */ /* comment */
    && /*comment*/
    & /*comment*/ <noTag/>


    -{ Hello }
    +{ Hello }
    ? />;
    -[ /> ( />
    +[ /> ( />
    , =
    && ||
    return ;
    default ;
    return


    anyWord<noTag>
    anyWord/*comment*/ <noTag/>
    -.<noTag>
    +.<noTag>
    &<notag> | <noTag/>
    % /* comment*/ <noTag/>

    // TODO: Fix this (comment before the tag name):
    -var x = </**/div>
    >;
    +var x = </**/div>div>;

    // Tag after ":"
    annotation:
    -annotation: text [ ]
    +annotation: text [ ]
    console.log("hello")

    // Type assertion in tag
    <number>/>
    <number>>

    />

    // Non-ASCII tag name & attribute
    <日本語>;
    本本:本-本 aa本:本 aa:aa />
    />

    />;
    { ... x } y
    ={2 } z />;

    let k1 =
    a={10} b="hi" {...o} >
    hi hi hi!
    ;

    let k2 =
    a={10} b="hi">
    My Div

    {(name: string) =>
    My name {name}
    }
    ;

    -let k3 = initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error
    +let k3 = initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error

    // OK
    let k1 = a={10} b="hi"><> /> />;
    let k2 = a={10} b="hi"><> /> />;
    let k3 = a={10} b="hi"><> /> />;
    let k4 = a={10} b="hi"><> /> />;
    // OK
    let k1 =

    Hello

    world

    ;
    let k2 =

    Hello

    {(user: any) =>

    {user.name}

    }
    ;
    let k3 =
    {1} {"That is a number"}
    ;
    let k4 = ;

    // Empty tags
    hello<>
    hello<string>

    <>; // no whitespace
    < >; // lots of whitespace
    -< /*starting wrap*/ >/*ending wrap*/>; // comments in the tags
    +< /*starting wrap*/ > /*ending wrap*/>; // comments in the tags
    <>hi; // text inside
    <>hi
    bye
    ; // children
    <>1<>2.12.23; // nested fragments
    <>#; // # would cause scanning error if not in jsxtext

    // Tags after substitutions in templates
    ${//comment
    /*comment*/
    }

    // Don't highlight tags within type declaration
    type T12 = ReturnType<(<T>() => T)>;
    -type T13 = ReturnType<(<T extends U, U extends number[]>() => T)>;
    +type T13 = ReturnType<(<T extends U, U extends number[]>() => T)>;
    type T14 = ReturnType<typeof f1>;
    type T15 = ReturnType<(s: string) => void>;

    // Don't highlight tags within variable declaration
    let myIdentity: <T>(arg: T) => T <noTag/> = />;
    var myIdentity: <U>(arg: U) => U = identity;
    -const myIdentity: {<T>(arg: T): T} = identity;
    +const myIdentity: {<T>(arg: T): T} = identity;

    // Don't highlight tags within interfaces and classes
    -interface GenericIdentityFn {
    +interface GenericIdentityFn {
    <T>(arg: T): T;
    <noTag />
    -}
    -class Handler {
    +}
    +class Handler {
    info: <T>(arg: T): T <noTag />;

    -}
    +}

    // Highlight "
    // (the "cast" expression works and isn't supported in the TSX file)
    const goodHighlighting = <T extends I>(
    arg: T
    -) => {
    +) => {
    const a = arg
    return a
    -}
    +}
    text extends I/>
    // Here "" is a tag
    +
    +// Check character after tag name, do not highlight invalid tags
    +<noTag ?
    +<noTag ,
    +<noTag /* comment */ ?
    +<noTag#
    +<noTag/*comment*/#
    diff --git a/data/syntax/coffee.xml b/data/syntax/coffee.xml index 46d3a28..428d55d 100644 --- a/data/syntax/coffee.xml +++ b/data/syntax/coffee.xml @@ -1,340 +1,340 @@ false true yes no on off undefined null NaN Infinity return break continue throw for while until loop if else unless switch when then and or in do of by is isnt not typeof delete where super try catch finally try catch finally constructor class extends new instanceof case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf Object Number Boolean Array String RegExp Function Date Math eval setInterval clearInterval setTimeout clearTimeout isFinite isNaN parseFloat parseInt escape unescape console encodeURI encodeURIComponent decodeURI decodeURIComponent window document navigator location history screen alert prompt process GLOBAL require exports - + - + - + - + - + - + + - + - - + + - diff --git a/data/syntax/javascript-react.xml b/data/syntax/javascript-react.xml index a0f110d..21090b3 100644 --- a/data/syntax/javascript-react.xml +++ b/data/syntax/javascript-react.xml @@ -1,383 +1,421 @@ - + - + + + - + ]> - - + + - + + + + + + + - + - - - + + + + - + - - - + - + - - + - + + - + - + + + + + + + + + + + + + + - + - - - - + + + + + + + + - + diff --git a/data/syntax/javascript.xml b/data/syntax/javascript.xml index cac6d94..944cbad 100644 --- a/data/syntax/javascript.xml +++ b/data/syntax/javascript.xml @@ -1,289 +1,2029 @@ + ]> - - - - + Minor changes: Joseph Wenninger + Full JavaScript 1.0 support by Whitehawk Stormchaser + + Last Update: Nov. 20, 2019 (Version 14) + + IMPORTANT: This syntax highlighting definition depends on + JavaScript React (JSX), TypeScript and QML. +--> + + + await break case catch continue debugger do else finally for if return switch throw try while with const delete function in instanceof new of this typeof var void async class enum extends super arguments implements interface let private protected public static yield import from as default export package Infinity NaN false null true undefined + + + + + Array + ArrayBuffer + Atomics + Boolean + BigInt + BigInt64Array + BigUint64Array + DataView + Date + Float32Array + Float64Array + Function + Generator + GeneratorFunction + Int8Array + Int16Array + Int32Array + Intl + Map + Object + Proxy + Reflect + RegExp + Set + SharedArrayBuffer + SIMD + String + Symbol + TypedArray + Uint8Array + Uint16Array + Uint32Array + Uint8ClampedArray + WeakMap + WeakSet + + Error + EvalError + InternalError + RangeError + ReferenceError + SyntaxError + TypeError + URIError + + Number + + Math + + Promise + + JSON + console + process + + + + AnalyserNode + ArrayBufferView + Attr + AudioBuffer + AudioBufferSourceNode + AudioContext + AudioDestinationNode + AudioListener + AudioNode + AudioParam + BatteryManager + BeforeUnloadEvent + BiquadFilterNode + Blob + BufferSource + ByteString + CSS + CSSConditionRule + CSSCounterStyleRule + CSSGroupingRule + CSSMatrix + CSSMediaRule + CSSPageRule + CSSPrimitiveValue + CSSRule + CSSRuleList + CSSStyleDeclaration + CSSStyleRule + CSSStyleSheet + CSSSupportsRule + CSSValue + CSSValueList + CanvasGradient + CanvasImageSource + CanvasPattern + CanvasRenderingContext2D + ChannelMergerNode + ChannelSplitterNode + CharacterData + ChromeWorker + CloseEvent + Comment + CompositionEvent + Console + ConvolverNode + Coordinates + Credential + CredentialsContainer + Crypto + CryptoKey + CustomEvent + DOMError + DOMException + DOMHighResTimeStamp + DOMImplementation + DOMString + DOMStringList + DOMStringMap + DOMTimeStamp + DOMTokenList + DataTransfer + DataTransferItem + DataTransferItemList + DedicatedWorkerGlobalScope + DelayNode + DeviceProximityEvent + DirectoryEntry + DirectoryEntrySync + DirectoryReader + DirectoryReaderSync + Document + DocumentFragment + DocumentTouch + DocumentType + DragEvent + DynamicsCompressorNode + Element + Entry + EntrySync + ErrorEvent + Event + EventListener + EventSource + EventTarget + FederatedCredential + FetchEvent + File + FileEntry + FileEntrySync + FileException + FileList + FileReader + FileReaderSync + FileSystem + FileSystemSync + FontFace + FormData + GainNode + Gamepad + GamepadButton + GamepadEvent + Geolocation + GlobalEventHandlers + HTMLAnchorElement + HTMLAreaElement + HTMLAudioElement + HTMLBRElement + HTMLBaseElement + HTMLBodyElement + HTMLButtonElement + HTMLCanvasElement + HTMLCollection + HTMLContentElement + HTMLDListElement + HTMLDataElement + HTMLDataListElement + HTMLDialogElement + HTMLDivElement + HTMLDocument + HTMLElement + HTMLEmbedElement + HTMLFieldSetElement + HTMLFontElement + HTMLFormControlsCollection + HTMLFormElement + HTMLHRElement + HTMLHeadElement + HTMLHeadingElement + HTMLHtmlElement + HTMLIFrameElement + HTMLImageElement + HTMLInputElement + HTMLKeygenElement + HTMLLIElement + HTMLLabelElement + HTMLLegendElement + HTMLLinkElement + HTMLMapElement + HTMLMediaElement + HTMLMetaElement + HTMLMeterElement + HTMLModElement + HTMLOListElement + HTMLObjectElement + HTMLOptGroupElement + HTMLOptionElement + HTMLOptionsCollection + HTMLOutputElement + HTMLParagraphElement + HTMLParamElement + HTMLPreElement + HTMLProgressElement + HTMLQuoteElement + HTMLScriptElement + HTMLSelectElement + HTMLShadowElement + HTMLSourceElement + HTMLSpanElement + HTMLStyleElement + HTMLTableCaptionElement + HTMLTableCellElement + HTMLTableColElement + HTMLTableDataCellElement + HTMLTableElement + HTMLTableHeaderCellElement + HTMLTableRowElement + HTMLTableSectionElement + HTMLTextAreaElement + HTMLTimeElement + HTMLTitleElement + HTMLTrackElement + HTMLUListElement + HTMLUnknownElement + HTMLVideoElement + HashChangeEvent + History + IDBCursor + IDBCursorWithValue + IDBDatabase + IDBEnvironment + IDBFactory + IDBIndex + IDBKeyRange + IDBMutableFile + IDBObjectStore + IDBOpenDBRequest + IDBRequest + IDBTransaction + IDBVersionChangeEvent + IIRFilterNode + IdentityManager + ImageBitmap + ImageBitmapFactories + ImageData + Index + InputDeviceCapabilities + InputEvent + InstallEvent + InstallTrigger + KeyboardEvent + LinkStyle + LocalFileSystem + LocalFileSystemSync + Location + MIDIAccess + MIDIConnectionEvent + MIDIInput + MIDIInputMap + MIDIOutputMap + MediaElementAudioSourceNode + MediaError + MediaKeyMessageEvent + MediaKeySession + MediaKeyStatusMap + MediaKeySystemAccess + MediaKeySystemConfiguration + MediaKeys + MediaRecorder + MediaStream + MediaStreamAudioDestinationNode + MediaStreamAudioSourceNode + MessageChannel + MessageEvent + MessagePort + MouseEvent + MutationObserver + MutationRecord + NamedNodeMap + Navigator + NavigatorConcurrentHardware + NavigatorGeolocation + NavigatorID + NavigatorLanguage + NavigatorOnLine + Node + NodeFilter + NodeIterator + NodeList + NonDocumentTypeChildNode + Notification + OfflineAudioCompletionEvent + OfflineAudioContext + OscillatorNode + PageTransitionEvent + PannerNode + ParentNode + PasswordCredential + Path2D + PaymentAddress + PaymentRequest + PaymentResponse + Performance + PerformanceEntry + PerformanceFrameTiming + PerformanceMark + PerformanceMeasure + PerformanceNavigation + PerformanceNavigationTiming + PerformanceObserver + PerformanceObserverEntryList + PerformanceResourceTiming + PerformanceTiming + PeriodicSyncEvent + PeriodicWave + Plugin + Point + PointerEvent + PopStateEvent + PortCollection + Position + PositionError + PositionOptions + PresentationConnectionClosedEvent + PresentationConnectionList + PresentationReceiver + ProcessingInstruction + ProgressEvent + PromiseRejectionEvent + PushEvent + PushRegistrationManager + RTCCertificate + RTCConfiguration + RTCPeerConnection + RTCSessionDescriptionCallback + RTCStatsReport + RadioNodeList + RandomSource + Range + ReadableByteStream + RenderingContext + SVGAElement + SVGAngle + SVGAnimateColorElement + SVGAnimateElement + SVGAnimateMotionElement + SVGAnimateTransformElement + SVGAnimatedAngle + SVGAnimatedBoolean + SVGAnimatedEnumeration + SVGAnimatedInteger + SVGAnimatedLength + SVGAnimatedLengthList + SVGAnimatedNumber + SVGAnimatedNumberList + SVGAnimatedPoints + SVGAnimatedPreserveAspectRatio + SVGAnimatedRect + SVGAnimatedString + SVGAnimatedTransformList + SVGAnimationElement + SVGCircleElement + SVGClipPathElement + SVGCursorElement + SVGDefsElement + SVGDescElement + SVGElement + SVGEllipseElement + SVGEvent + SVGFilterElement + SVGFontElement + SVGFontFaceElement + SVGFontFaceFormatElement + SVGFontFaceNameElement + SVGFontFaceSrcElement + SVGFontFaceUriElement + SVGForeignObjectElement + SVGGElement + SVGGlyphElement + SVGGradientElement + SVGHKernElement + SVGImageElement + SVGLength + SVGLengthList + SVGLineElement + SVGLinearGradientElement + SVGMPathElement + SVGMaskElement + SVGMatrix + SVGMissingGlyphElement + SVGNumber + SVGNumberList + SVGPathElement + SVGPatternElement + SVGPoint + SVGPolygonElement + SVGPolylineElement + SVGPreserveAspectRatio + SVGRadialGradientElement + SVGRect + SVGRectElement + SVGSVGElement + SVGScriptElement + SVGSetElement + SVGStopElement + SVGStringList + SVGStylable + SVGStyleElement + SVGSwitchElement + SVGSymbolElement + SVGTRefElement + SVGTSpanElement + SVGTests + SVGTextElement + SVGTextPositioningElement + SVGTitleElement + SVGTransform + SVGTransformList + SVGTransformable + SVGUseElement + SVGVKernElement + SVGViewElement + ServiceWorker + ServiceWorkerContainer + ServiceWorkerGlobalScope + ServiceWorkerRegistration + ServiceWorkerState + ShadowRoot + SharedWorker + SharedWorkerGlobalScope + SourceBufferList + StereoPannerNode + Storage + StorageEvent + StyleSheet + StyleSheetList + SubtleCrypto + SyncEvent + Text + TextMetrics + TimeEvent + TimeRanges + Touch + TouchEvent + TouchList + Transferable + TreeWalker + UIEvent + USVString + VRDisplayCapabilities + ValidityState + WaveShaperNode + WebGL + WebGLActiveInfo + WebGLBuffer + WebGLContextEvent + WebGLFramebuffer + WebGLProgram + WebGLRenderbuffer + WebGLRenderingContext + WebGLShader + WebGLShaderPrecisionFormat + WebGLTexture + WebGLTimerQueryEXT + WebGLTransformFeedback + WebGLUniformLocation + WebGLVertexArrayObject + WebGLVertexArrayObjectOES + WebSocket + WebSockets + WebVTT + WheelEvent + Window + WindowBase64 + WindowEventHandlers + WindowTimers + Worker + WorkerGlobalScope + WorkerLocation + WorkerNavigator + XMLHttpRequest + XMLHttpRequestEventTarget + XMLSerializer + XPathExpression + XPathResult + XSLTProcessor + + + + Buffer + EventEmitter + Server + Pipe + Socket + REPLServer + ReadStream + WriteStream + Stream + Inflate + Deflate + InflateRaw + DeflateRaw + GZip + GUnzip + Unzip + Zip + + + + + constructor + length + prototype + __proto__ + + + + clearInterval + clearTimeout + decodeURI + decodeURIComponent + encodeURI + encodeURIComponent + escape + eval + isFinite + isNaN + parseFloat + parseInt + require + setTimeout + setInterval + super + unescape + uneval + + + + + assert + clear + count + debug + dir + error + group + groupCollapsed + groupEnd + info + log + profile + profileEnd + table + time + timeEnd + timeStamp + trace + warn + + + + arch + argv + config + connected + env + execArgv + execPath + exitCode + mainModule + pid + platform + release + stderr + stdin + stdout + title + version + versions + + + + abort + chdir + cwd + disconnect + exit + setegid + seteuid + getegid + geteuid + setgid + setuid + getgid + getuid + send + setgroups + getgroups + initgroups + kill + memoryUsage + nextTick + umask + uptime + hrtime + + + + + EPSILON + MAX_SAFE_INTEGER + MAX_VALUE + MIN_SAFE_INTEGER + MIN_VALUE + NEGATIVE_INFINITY + POSITIVE_INFINITY + + + + E + LN10 + LN2 + LOG10E + LOG2E + PI + SQRT1_2 + SQRT2 + + + + abs + acos + acosh + asin + asinh + atan + atan2 + atanh + cbrt + ceil + clz32 + cos + cosh + exp + expm1 + floor + fround + hypot + imul + log + log10 + log1p + log2 + max + min + pow + random + round + sign + sin + sinh + sqrt + tan + tanh + trunc + + + + parse + stringify + + + + all + catch + finally + race + reject + resolve + then + + + + + global + GLOBAL + root + __dirname + __filename + + + + document + event + navigator + performance + screen + window + + + + ATTRIBUTE_NODE + CDATA_SECTION_NODE + COMMENT_NODE + DOCUMENT_FRAGMENT_NODE + DOCUMENT_NODE + DOCUMENT_TYPE_NODE + DOMSTRING_SIZE_ERR + ELEMENT_NODE + ENTITY_NODE + ENTITY_REFERENCE_NODE + HIERARCHY_REQUEST_ERR + INDEX_SIZE_ERR + INUSE_ATTRIBUTE_ERR + INVALID_CHARACTER_ERR + NO_DATA_ALLOWED_ERR + NO_MODIFICATION_ALLOWED_ERR + NOT_FOUND_ERR + NOT_SUPPORTED_ERR + NOTATION_NODE + PROCESSING_INSTRUCTION_NODE + TEXT_NODE + WRONG_DOCUMENT_ERR + + + + + + _content + x + y + z + abbr + above + accept + acceptCharset + accessKey + action + align + aLink + vLink + aLinkcolor + vLinkcolor + all + alt + anchors + appCodeName + appCore + applets + appMinorVersion + appName + appVersion + archive + areas + arguments + attributes + availHeight + availLeft + availTop + availWidth + axis + background + backgroundColor + backgroundImage + below + bgColor + body + border + borderBottomWidth + borderColor + borderLeftWidth + borderRightWidth + borderStyle + borderTopWidth + borderWidth + bottom + bufferDepth + callee + caller + caption + cellPadding + cells + cellSpacing + ch + characterSet + charset + checked + childNodes + chOff + cite + classes + className + clear + clientInformation + clip + clipBoardData + closed + code + codeBase + codeType + color + colorDepth + cols + colSpan + compact + complete + components + content + controllers + cookie + cookieEnabled + cords + cpuClass + crypto + current + data + dateTime + declare + defaultCharset + defaultChecked + defaultSelected + defaultStatus + defaultValue + defaultView + defer + description + dialogArguments + dialogHeight + dialogLeft + dialogTop + dialogWidth + dir + directories + disabled + display + docmain + doctype + documentElement + elements + embeds + enabledPlugin + encoding + enctype + entities + event + expando + external + face + fgColor + filename + firstChild + fontFamily + fontSize + fontWeight + form + formName + forms + frame + frameBorder + frameElement + frames + hasFocus + hash + headers + height + history + host + hostname + href + hreflang + hspace + htmlFor + httpEquiv + id + ids + ignoreCase + images + implementation + index + innerHeight + innerWidth + input + isMap + label + lang + language + lastChild + lastIndex + lastMatch + lastModified + lastParen + layers + layerX + layerY + left + leftContext + lineHeight + link + linkColor + links + listStyleType + localName + location + locationbar + longDesc + lowsrc + lowSrc + marginBottom + marginHeight + marginLeft + marginRight + marginTop + marginWidth + maxLength + media + menubar + method + mimeTypes + multiline + multiple + name + nameProp + namespaces + namespaceURI + next + nextSibling + nodeName + nodeType + nodeValue + noHref + noResize + noShade + notationName + notations + noWrap + object + offscreenBuffering + onLine + onreadystatechange + opener + opsProfile + options + oscpu + outerHeight + outerWidth + ownerDocument + paddingBottom + paddingLeft + paddingRight + paddingTop + pageX + pageY + pageXOffset + pageYOffset + parent + parentLayer + parentNode + parentWindow + pathname + personalbar + pixelDepth + pkcs11 + platform + plugins + port + prefix + previous + previousDibling + product + productSub + profile + profileend + prompt + prompter + protocol + publicId + readOnly + readyState + referrer + rel + responseText + responseXML + rev + right + rightContext + rowIndex + rows + rowSpan + rules + scheme + scope + screenX + screenY + screenLeft + screenTop + scripts + scrollbars + scrolling + sectionRowIndex + security + securityPolicy + selected + selectedIndex + selection + self + shape + siblingAbove + siblingBelow + size + source + specified + standby + start + status + statusbar + statusText + style + styleSheets + suffixes + summary + systemId + systemLanguage + tagName + tags + target + tBodies + text + textAlign + textDecoration + textIndent + textTransform + tFoot + tHead + title + toolbar + top + type + undefined + uniqueID + updateInterval + URL + URLUnencoded + useMap + userAgent + userLanguage + userProfile + vAlign + value + valueType + vendor + vendorSub + version + visibility + vspace + whiteSpace + width + XMLDocument + XSLDocument + zIndex + + + + acceptNode + add + addEventListener + addTextTrack + adoptNode + after + animate + append + appendChild + appendData + before + blur + canPlayType + captureStream + caretPositionFromPoint + caretRangeFromPoint + checkValidity + clear + click + cloneContents + cloneNode + cloneRange + close + closest + collapse + compareBoundaryPoints + compareDocumentPosition + comparePoint + contains + convertPointFromNode + convertQuadFromNode + convertRectFromNode + createAttribute + createAttributeNS + createCaption + createCDATASection + createComment + createContextualFragment + createDocument + createDocumentFragment + createDocumentType + createElement + createElementNS + createEntityReference + createEvent + createExpression + createHTMLDocument + createNodeIterator + createNSResolver + createProcessingInstruction + createRange + createShadowRoot + createTBody + createTextNode + createTFoot + createTHead + createTreeWalker + delete + deleteCaption + deleteCell + deleteContents + deleteData + deleteRow + deleteTFoot + deleteTHead + detach + disconnect + dispatchEvent + elementFromPoint + elementsFromPoint + enableStyleSheetsForSet + entries + evaluate + execCommand + exitFullscreen + exitPointerLock + expand + extractContents + fastSeek + firstChild + focus + forEach + get + getAll + getAnimations + getAttribute + getAttributeNames + getAttributeNode + getAttributeNodeNS + getAttributeNS + getBoundingClientRect + getBoxQuads + getClientRects + getContext + getDestinationInsertionPoints + getElementById + getElementsByClassName + getElementsByName + getElementsByTagName + getElementsByTagNameNS + getItem + getNamedItem + getSelection + getStartDate + getVideoPlaybackQuality + has + hasAttribute + hasAttributeNS + hasAttributes + hasChildNodes + hasFeature + hasFocus + importNode + initEvent + insertAdjacentElement + insertAdjacentHTML + insertAdjacentText + insertBefore + insertCell + insertData + insertNode + insertRow + intersectsNode + isDefaultNamespace + isEqualNode + isPointInRange + isSameNode + item + key + keys + lastChild + load + lookupNamespaceURI + lookupPrefix + matches + move + moveAttribute + moveAttributeNode + moveChild + moveNamedItem + namedItem + nextNode + nextSibling + normalize + observe + open + parentNode + pause + play + postMessage + prepend + preventDefault + previousNode + previousSibling + probablySupportsContext + queryCommandEnabled + queryCommandIndeterm + queryCommandState + queryCommandSupported + queryCommandValue + querySelector + querySelectorAll + registerContentHandler + registerElement + registerProtocolHandler + releaseCapture + releaseEvents + remove + removeAttribute + removeAttributeNode + removeAttributeNS + removeChild + removeEventListener + removeItem + replace + replaceChild + replaceData + replaceWith + reportValidity + requestFullscreen + requestPointerLock + reset + scroll + scrollBy + scrollIntoView + scrollTo + seekToNextFrame + select + selectNode + selectNodeContents + set + setAttribute + setAttributeNode + setAttributeNodeNS + setAttributeNS + setCapture + setCustomValidity + setEnd + setEndAfter + setEndBefore + setItem + setNamedItem + setRangeText + setSelectionRange + setSinkId + setStart + setStartAfter + setStartBefore + slice + splitText + stepDown + stepUp + stopImmediatePropagation + stopPropagation + submit + substringData + supports + surroundContents + takeRecords + terminate + toBlob + toDataURL + toggle + + values + write + writeln + + + + onRowsinserted + onRowsdelete + onRowenter + onRowexit + onResize + onResizestart + onResizeend + onReset + onReadystatechange + onMouseout + onMouseover + onMousedown + onMouseup + onMousemove + onBeforecut + onBeforedeactivate + onBeforeunload + onBeforeupdate + onBeforepaste + onBeforeprint + onBeforeeditfocus + onBeforeactivate + onBlur + onScrolltop + onSubmit + onSelect + onSelectstart + onSelectionchange + onHover + onHelp + onChange + onContextmenu + onControlselect + onCut + onCellchange + onClock + onClose + onDeactivate + onDatasetchanged + onDatasetcomplete + onDataavailable + onDrop + onDrag + onDragstart + onDragover + onDragdrop + onDragenter + onDragend + onDragleave + onDblclick + onUnload + onPaste + onPropertychange + onError + onErrorupdate + onKeydown + onKeyup + onKeypress + onFocus + onLoad + onActivate + onAfterupdate + onAfterprint + onAbort + + + + shift + showModelessDialog + showModalDialog + showHelp + scroll + scrollX + scrollByPages + scrollByLines + scrollY + scrollTo + stop + strike + sizeToContent + sidebar + signText + sort + sup + sub + substr + substring + splice + split + send + setMilliseconds + setSeconds + setMinutes + setHours + setMonth + setYear + setFullYear + setDate + setUTCMilliseconds + setUTCSeconds + setUTCMinutes + setUTCHours + setUTCMonth + setUTCFullYear + setUTCDate + setTime + setHotkeys + setCursor + setZOptions + setActive + setResizable + setRequestHeader + search + slice + savePreferences + small + home + handleEvent + navigate + char + charCodeAt + charAt + concat + contextual + confirm + compile + clear + captureEvents + call + createStyleSheet + createPopup + createEventObject + toGMTString + toUTCString + toString + toSource + toUpperCase + toLowerCase + toLocaleString + test + taint + taintEnabled + indexOf + italics + disableExternalCapture + dump + detachEvent + unshift + untaint + unwatch + updateCommands + join + javaEnabled + pop + push + plugins.refresh + paddings + parse + print + prompt + preference + enableExternalCapture + exec + execScript + valueOf + UTC + find + file + fileModifiedDate + fileSize + fileCreatedDate + fileUpdatedDate + fixed + fontsize + fontcolor + forward + fromCharCode + watch + link + load + lastIndexOf + anchor + attachEvent + atob + apply + alert + abort + routeEvents + resize + resizeBy + resizeTo + recalc + returnValue + replace + reverse + reload + releaseCapture + releaseEvents + go + getMilliseconds + getSeconds + getMinutes + getHours + getMonth + getDay + getYear + getFullYear + getTime + getDate + getTimezoneOffset + getUTCMilliseconds + getUTCSeconds + getUTCMinutes + getUTCHours + getUTCDay + getUTCMonth + getUTCFullYear + getUTCDate + getAttention + getSelection + getResponseHeader + getAllResponseHeaders + moveBy + moveBelow + moveTo + moveToAbsolute + moveAbove + mergeAttributes + match + margins + btoa + big + bold + borderWidths + blink + back + + - + This uses "lineEmptyContext" & "lineEndContext" to force the highlight only on the first line. --> + - - + + + - - - - - - - - - - - - - - - - + + + + + + + - - - - - + + + - - - - + + - + - + + - - - - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - + - + - - + + + + + + - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + - + + + - + + diff --git a/data/syntax/qml.xml b/data/syntax/qml.xml index a40baa2..1ed88c6 100644 --- a/data/syntax/qml.xml +++ b/data/syntax/qml.xml @@ -1,173 +1,190 @@ - + +]> State PropertyChanges StateGroup ParentChange StateChangeScript AnchorChanges PropertyAnimation NumberAnimation ColorAnimation SequentialAnimation ParallelAnimation PauseAnimation PropertyAction ParentAction ScriptAction Transition SpringFollow EaseFollow Behavior Binding ListModel ListElement VisualItemModel XmlListModel XmlRole DateTimeFormatter NumberFormatter Script Connections Component Timer QtObject Item Rectangle Image BorderImage Text TextInput TextEdit MouseArea FocusScope Flickable Flipable WebView Loader Repeater SystemPalette GraphicsObjectContainer LayoutItem ListView GridView PathView Path PathLine PathQuad PathCubic PathAttribute PathPercent Column Row Grid Scale Rotation Blur Colorize DropShadow Opacity Particles ParticleMotionLinear ParticleMotionGravity ParticleMotionWander Gradient GradientStop MouseRegion readonly string int bool date color url real double var variant - + + + + + + + + - - - + + - + + + + + + + + - + + diff --git a/data/syntax/typescript-react.xml b/data/syntax/typescript-react.xml index 845e333..c10da67 100644 --- a/data/syntax/typescript-react.xml +++ b/data/syntax/typescript-react.xml @@ -1,497 +1,528 @@ - + - + + + - + ]> - - + + + - - - - + + - + - - - + + + - + - + - + - + - + - + - + - + + - + + + + + + - - + + + + + + + + + - - + - + - - - - + + + + + + + + - + - + - + diff --git a/data/syntax/typescript.xml b/data/syntax/typescript.xml index 57db171..fc504fa 100644 --- a/data/syntax/typescript.xml +++ b/data/syntax/typescript.xml @@ -1,2109 +1,705 @@ + + + ]> controlflow##JavaScript goto keywords##JavaScript declare reserved##JavaScript type arguments readonly abstract constructor get set module##JavaScript primitives##JavaScript object namespace module keyof infer string number boolean symbol any void never unknown undefined null object - + - Array - ArrayBuffer - Atomics - Boolean - DataView - Date - Float32Array - Float64Array - Function - Generator - GeneratorFunction - Int8Array - Int16Array - Int32Array - Intl - Map - Number - Object - Proxy - Reflect - RegExp - Set - SharedArrayBuffer - SIMD - String - Symbol - TypedArray - Uint8Array - Uint16Array - Uint32Array - Uint8ClampedArray - WeakMap - WeakSet - - Error - EvalError - InternalError - RangeError - ReferenceError - SyntaxError - TypeError - URIError - - Math - - Promise - - JSON - console - process + class_builtin##JavaScript - AnalyserNode - ArrayBufferView - Attr - AudioBuffer - AudioBufferSourceNode - AudioContext - AudioDestinationNode - AudioListener - AudioNode - AudioParam - BatteryManager - BeforeUnloadEvent - BiquadFilterNode - Blob - BufferSource - ByteString - CSS - CSSConditionRule - CSSCounterStyleRule - CSSGroupingRule - CSSMatrix - CSSMediaRule - CSSPageRule - CSSPrimitiveValue - CSSRule - CSSRuleList - CSSStyleDeclaration - CSSStyleRule - CSSStyleSheet - CSSSupportsRule - CSSValue - CSSValueList - CanvasGradient - CanvasImageSource - CanvasPattern - CanvasRenderingContext2D - ChannelMergerNode - ChannelSplitterNode - CharacterData - ChromeWorker - CloseEvent - Comment - CompositionEvent - Console - ConvolverNode - Coordinates - Credential - CredentialsContainer - Crypto - CryptoKey - CustomEvent - DOMError - DOMException - DOMHighResTimeStamp - DOMImplementation - DOMString - DOMStringList - DOMStringMap - DOMTimeStamp - DOMTokenList - DataTransfer - DataTransferItem - DataTransferItemList - DedicatedWorkerGlobalScope - DelayNode - DeviceProximityEvent - DirectoryEntry - DirectoryEntrySync - DirectoryReader - DirectoryReaderSync - Document - DocumentFragment - DocumentTouch - DocumentType - DragEvent - DynamicsCompressorNode - Element - Entry - EntrySync - ErrorEvent - Event - EventListener - EventSource - EventTarget - FederatedCredential - FetchEvent - File - FileEntry - FileEntrySync - FileException - FileList - FileReader - FileReaderSync - FileSystem - FileSystemSync - FontFace - FormData - GainNode - Gamepad - GamepadButton - GamepadEvent - Geolocation - GlobalEventHandlers - HTMLAnchorElement - HTMLAreaElement - HTMLAudioElement - HTMLBRElement - HTMLBaseElement - HTMLBodyElement - HTMLButtonElement - HTMLCanvasElement - HTMLCollection - HTMLContentElement - HTMLDListElement - HTMLDataElement - HTMLDataListElement - HTMLDialogElement - HTMLDivElement - HTMLDocument - HTMLElement - HTMLEmbedElement - HTMLFieldSetElement - HTMLFontElement - HTMLFormControlsCollection - HTMLFormElement - HTMLHRElement - HTMLHeadElement - HTMLHeadingElement - HTMLHtmlElement - HTMLIFrameElement - HTMLImageElement - HTMLInputElement - HTMLKeygenElement - HTMLLIElement - HTMLLabelElement - HTMLLegendElement - HTMLLinkElement - HTMLMapElement - HTMLMediaElement - HTMLMetaElement - HTMLMeterElement - HTMLModElement - HTMLOListElement - HTMLObjectElement - HTMLOptGroupElement - HTMLOptionElement - HTMLOptionsCollection - HTMLOutputElement - HTMLParagraphElement - HTMLParamElement - HTMLPreElement - HTMLProgressElement - HTMLQuoteElement - HTMLScriptElement - HTMLSelectElement - HTMLShadowElement - HTMLSourceElement - HTMLSpanElement - HTMLStyleElement - HTMLTableCaptionElement - HTMLTableCellElement - HTMLTableColElement - HTMLTableDataCellElement - HTMLTableElement - HTMLTableHeaderCellElement - HTMLTableRowElement - HTMLTableSectionElement - HTMLTextAreaElement - HTMLTimeElement - HTMLTitleElement - HTMLTrackElement - HTMLUListElement - HTMLUnknownElement - HTMLVideoElement - HashChangeEvent - History - IDBCursor - IDBCursorWithValue - IDBDatabase - IDBEnvironment - IDBFactory - IDBIndex - IDBKeyRange - IDBMutableFile - IDBObjectStore - IDBOpenDBRequest - IDBRequest - IDBTransaction - IDBVersionChangeEvent - IIRFilterNode - IdentityManager - ImageBitmap - ImageBitmapFactories - ImageData - Index - InputDeviceCapabilities - InputEvent - InstallEvent - InstallTrigger - KeyboardEvent - LinkStyle - LocalFileSystem - LocalFileSystemSync - Location - MIDIAccess - MIDIConnectionEvent - MIDIInput - MIDIInputMap - MIDIOutputMap - MediaElementAudioSourceNode - MediaError - MediaKeyMessageEvent - MediaKeySession - MediaKeyStatusMap - MediaKeySystemAccess - MediaKeySystemConfiguration - MediaKeys - MediaRecorder - MediaStream - MediaStreamAudioDestinationNode - MediaStreamAudioSourceNode - MessageChannel - MessageEvent - MessagePort - MouseEvent - MutationObserver - MutationRecord - NamedNodeMap - Navigator - NavigatorConcurrentHardware - NavigatorGeolocation - NavigatorID - NavigatorLanguage - NavigatorOnLine - Node - NodeFilter - NodeIterator - NodeList - NonDocumentTypeChildNode - Notification - OfflineAudioCompletionEvent - OfflineAudioContext - OscillatorNode - PageTransitionEvent - PannerNode - ParentNode - PasswordCredential - Path2D - PaymentAddress - PaymentRequest - PaymentResponse - Performance - PerformanceEntry - PerformanceFrameTiming - PerformanceMark - PerformanceMeasure - PerformanceNavigation - PerformanceNavigationTiming - PerformanceObserver - PerformanceObserverEntryList - PerformanceResourceTiming - PerformanceTiming - PeriodicSyncEvent - PeriodicWave - Plugin - Point - PointerEvent - PopStateEvent - PortCollection - Position - PositionError - PositionOptions - PresentationConnectionClosedEvent - PresentationConnectionList - PresentationReceiver - ProcessingInstruction - ProgressEvent - PromiseRejectionEvent - PushEvent - PushRegistrationManager - RTCCertificate - RTCConfiguration - RTCPeerConnection - RTCSessionDescriptionCallback - RTCStatsReport - RadioNodeList - RandomSource - Range - ReadableByteStream - RenderingContext - SVGAElement - SVGAngle - SVGAnimateColorElement - SVGAnimateElement - SVGAnimateMotionElement - SVGAnimateTransformElement - SVGAnimatedAngle - SVGAnimatedBoolean - SVGAnimatedEnumeration - SVGAnimatedInteger - SVGAnimatedLength - SVGAnimatedLengthList - SVGAnimatedNumber - SVGAnimatedNumberList - SVGAnimatedPoints - SVGAnimatedPreserveAspectRatio - SVGAnimatedRect - SVGAnimatedString - SVGAnimatedTransformList - SVGAnimationElement - SVGCircleElement - SVGClipPathElement - SVGCursorElement - SVGDefsElement - SVGDescElement - SVGElement - SVGEllipseElement - SVGEvent - SVGFilterElement - SVGFontElement - SVGFontFaceElement - SVGFontFaceFormatElement - SVGFontFaceNameElement - SVGFontFaceSrcElement - SVGFontFaceUriElement - SVGForeignObjectElement - SVGGElement - SVGGlyphElement - SVGGradientElement - SVGHKernElement - SVGImageElement - SVGLength - SVGLengthList - SVGLineElement - SVGLinearGradientElement - SVGMPathElement - SVGMaskElement - SVGMatrix - SVGMissingGlyphElement - SVGNumber - SVGNumberList - SVGPathElement - SVGPatternElement - SVGPoint - SVGPolygonElement - SVGPolylineElement - SVGPreserveAspectRatio - SVGRadialGradientElement - SVGRect - SVGRectElement - SVGSVGElement - SVGScriptElement - SVGSetElement - SVGStopElement - SVGStringList - SVGStylable - SVGStyleElement - SVGSwitchElement - SVGSymbolElement - SVGTRefElement - SVGTSpanElement - SVGTests - SVGTextElement - SVGTextPositioningElement - SVGTitleElement - SVGTransform - SVGTransformList - SVGTransformable - SVGUseElement - SVGVKernElement - SVGViewElement - ServiceWorker - ServiceWorkerContainer - ServiceWorkerGlobalScope - ServiceWorkerRegistration - ServiceWorkerState - ShadowRoot - SharedWorker - SharedWorkerGlobalScope - SourceBufferList - StereoPannerNode - Storage - StorageEvent - StyleSheet - StyleSheetList - SubtleCrypto - SyncEvent - Text - TextMetrics - TimeEvent - TimeRanges - Touch - TouchEvent - TouchList - Transferable - TreeWalker - UIEvent - USVString - VRDisplayCapabilities - ValidityState - WaveShaperNode - WebGL - WebGLActiveInfo - WebGLBuffer - WebGLContextEvent - WebGLFramebuffer - WebGLProgram - WebGLRenderbuffer - WebGLRenderingContext - WebGLShader - WebGLShaderPrecisionFormat - WebGLTexture - WebGLTimerQueryEXT - WebGLTransformFeedback - WebGLUniformLocation - WebGLVertexArrayObject - WebGLVertexArrayObjectOES - WebSocket - WebSockets - WebVTT - WheelEvent - Window - WindowBase64 - WindowEventHandlers - WindowTimers - Worker - WorkerGlobalScope - WorkerLocation - WorkerNavigator - XMLHttpRequest - XMLHttpRequestEventTarget - XMLSerializer - XPathExpression - XPathResult - XSLTProcessor + class_dom##JavaScript - Buffer - EventEmitter - Server - Pipe - Socket - REPLServer - ReadStream - WriteStream - Stream - Inflate - Deflate - InflateRaw - DeflateRaw - GZip - GUnzip - Unzip - Zip + class_node##JavaScript + - constructor - length - prototype - __proto__ - EPSILON - MAX_SAFE_INTEGER - MAX_VALUE - MIN_SAFE_INTEGER - MIN_VALUE - NEGATIVE_INFINITY - POSITIVE_INFINITY + variable_property##JavaScript - clearInterval - clearTimeout - decodeURI - decodeURIComponent - encodeURI - encodeURIComponent - escape - eval - isFinite - isNaN - parseFloat - parseInt - require - setTimeout - setInterval - super - unescape - uneval - - - - abs - acos - acosh - asin - asinh - atan - atan2 - atanh - cbrt - ceil - clz32 - cos - cosh - exp - expm1 - floor - fround - hypot - imul - log - log10 - log1p - log2 - max - min - pow - random - round - sign - sin - sinh - sqrt - tan - tanh - trunc - - - - E - LN10 - LN2 - LOG10E - LOG2E - PI - SQRT1_2 - SQRT2 + functions##JavaScript + - assert - clear - count - debug - dir - error - group - groupCollapsed - groupEnd - info - log - profile - profileEnd - table - time - timeEnd - timeStamp - trace - warn - - - - parse - stringify - - - - global - GLOBAL - root - __dirname - __filename + console_functions##JavaScript - arch - argv - config - connected - env - execArgv - execPath - exitCode - mainModule - pid - platform - release - stderr - stdin - stdout - title - version - versions + process_property##JavaScript - abort - chdir - cwd - disconnect - exit - setegid - seteuid - getegid - geteuid - setgid - setuid - getgid - getuid - send - setgroups - getgroups - initgroups - kill - memoryUsage - nextTick - umask - uptime - hrtime + process_functions##JavaScript + + + + + number_constant##JavaScript + + + + math_constant##JavaScript + + + + math_functions##JavaScript + + + + json_functions##JavaScript - all - catch - finally - race - reject - resolve - then + promise_functions##JavaScript + + + + + node_variable##JavaScript - document - event - navigator - performance - screen - window + dom_variable##JavaScript - + - ATTRIBUTE_NODE - CDATA_SECTION_NODE - COMMENT_NODE - DOCUMENT_FRAGMENT_NODE - DOCUMENT_NODE - DOCUMENT_TYPE_NODE - DOMSTRING_SIZE_ERR - ELEMENT_NODE - ENTITY_NODE - ENTITY_REFERENCE_NODE - HIERARCHY_REQUEST_ERR - INDEX_SIZE_ERR - INUSE_ATTRIBUTE_ERR - INVALID_CHARACTER_ERR - NO_DATA_ALLOWED_ERR - NO_MODIFICATION_ALLOWED_ERR - NOT_FOUND_ERR - NOT_SUPPORTED_ERR - NOTATION_NODE - PROCESSING_INSTRUCTION_NODE - TEXT_NODE - WRONG_DOCUMENT_ERR + dom_constant##JavaScript + + - _content - x - y - z - abbr - above - accept - acceptCharset - accessKey - action - align - aLink - vLink - aLinkcolor - vLinkcolor - all - alt - anchors - appCodeName - appCore - applets - appMinorVersion - appName - appVersion - archive - areas - arguments - attributes - availHeight - availLeft - availTop - availWidth - axis - background - backgroundColor - backgroundImage - below - bgColor - body - border - borderBottomWidth - borderColor - borderLeftWidth - borderRightWidth - borderStyle - borderTopWidth - borderWidth - bottom - bufferDepth - callee - caller - caption - cellPadding - cells - cellSpacing - ch - characterSet - charset - checked - childNodes - chOff - cite - classes - className - clear - clientInformation - clip - clipBoardData - closed - code - codeBase - codeType - color - colorDepth - cols - colSpan - compact - complete - components - content - controllers - cookie - cookieEnabled - cords - cpuClass - crypto - current - data - dateTime - declare - defaultCharset - defaultChecked - defaultSelected - defaultStatus - defaultValue - defaultView - defer - description - dialogArguments - dialogHeight - dialogLeft - dialogTop - dialogWidth - dir - directories - disabled - display - docmain - doctype - documentElement - elements - embeds - enabledPlugin - encoding - enctype - entities - event - expando - external - face - fgColor - filename - firstChild - fontFamily - fontSize - fontWeight - form - formName - forms - frame - frameBorder - frameElement - frames - hasFocus - hash - headers - height - history - host - hostname - href - hreflang - hspace - htmlFor - httpEquiv - id - ids - ignoreCase - images - implementation - index - innerHeight - innerWidth - input - isMap - label - lang - language - lastChild - lastIndex - lastMatch - lastModified - lastParen - layers - layerX - layerY - left - leftContext - lineHeight - link - linkColor - links - listStyleType - localName - location - locationbar - longDesc - lowsrc - lowSrc - marginBottom - marginHeight - marginLeft - marginRight - marginTop - marginWidth - maxLength - media - menubar - method - mimeTypes - multiline - multiple - name - nameProp - namespaces - namespaceURI - next - nextSibling - nodeName - nodeType - nodeValue - noHref - noResize - noShade - notationName - notations - noWrap - object - offscreenBuffering - onLine - onreadystatechange - opener - opsProfile - options - oscpu - outerHeight - outerWidth - ownerDocument - paddingBottom - paddingLeft - paddingRight - paddingTop - pageX - pageY - pageXOffset - pageYOffset - parent - parentLayer - parentNode - parentWindow - pathname - personalbar - pixelDepth - pkcs11 - platform - plugins - port - prefix - previous - previousDibling - product - productSub - profile - profileend - prompt - prompter - protocol - publicId - readOnly - readyState - referrer - rel - responseText - responseXML - rev - right - rightContext - rowIndex - rows - rowSpan - rules - scheme - scope - screenX - screenY - screenLeft - screenTop - scripts - scrollbars - scrolling - sectionRowIndex - security - securityPolicy - selected - selectedIndex - selection - self - shape - siblingAbove - siblingBelow - size - source - specified - standby - start - status - statusbar - statusText - style - styleSheets - suffixes - summary - systemId - systemLanguage - tagName - tags - target - tBodies - text - textAlign - textDecoration - textIndent - textTransform - tFoot - tHead - title - toolbar - top - type - undefined - uniqueID - updateInterval - URL - URLUnencoded - useMap - userAgent - userLanguage - userProfile - vAlign - value - valueType - vendor - vendorSub - version - visibility - vspace - whiteSpace - width - XMLDocument - XSLDocument - zIndex + dom_property##JavaScript - acceptNode - add - addEventListener - addTextTrack - adoptNode - after - animate - append - appendChild - appendData - before - blur - canPlayType - captureStream - caretPositionFromPoint - caretRangeFromPoint - checkValidity - clear - click - cloneContents - cloneNode - cloneRange - close - closest - collapse - compareBoundaryPoints - compareDocumentPosition - comparePoint - contains - convertPointFromNode - convertQuadFromNode - convertRectFromNode - createAttribute - createAttributeNS - createCaption - createCDATASection - createComment - createContextualFragment - createDocument - createDocumentFragment - createDocumentType - createElement - createElementNS - createEntityReference - createEvent - createExpression - createHTMLDocument - createNodeIterator - createNSResolver - createProcessingInstruction - createRange - createShadowRoot - createTBody - createTextNode - createTFoot - createTHead - createTreeWalker - delete - deleteCaption - deleteCell - deleteContents - deleteData - deleteRow - deleteTFoot - deleteTHead - detach - disconnect - dispatchEvent - elementFromPoint - elementsFromPoint - enableStyleSheetsForSet - entries - evaluate - execCommand - exitFullscreen - exitPointerLock - expand - extractContents - fastSeek - firstChild - focus - forEach - get - getAll - getAnimations - getAttribute - getAttributeNames - getAttributeNode - getAttributeNodeNS - getAttributeNS - getBoundingClientRect - getBoxQuads - getClientRects - getContext - getDestinationInsertionPoints - getElementById - getElementsByClassName - getElementsByName - getElementsByTagName - getElementsByTagNameNS - getItem - getNamedItem - getSelection - getStartDate - getVideoPlaybackQuality - has - hasAttribute - hasAttributeNS - hasAttributes - hasChildNodes - hasFeature - hasFocus - importNode - initEvent - insertAdjacentElement - insertAdjacentHTML - insertAdjacentText - insertBefore - insertCell - insertData - insertNode - insertRow - intersectsNode - isDefaultNamespace - isEqualNode - isPointInRange - isSameNode - item - key - keys - lastChild - load - lookupNamespaceURI - lookupPrefix - matches - move - moveAttribute - moveAttributeNode - moveChild - moveNamedItem - namedItem - nextNode - nextSibling - normalize - observe - open - parentNode - pause - play - postMessage - prepend - preventDefault - previousNode - previousSibling - probablySupportsContext - queryCommandEnabled - queryCommandIndeterm - queryCommandState - queryCommandSupported - queryCommandValue - querySelector - querySelectorAll - registerContentHandler - registerElement - registerProtocolHandler - releaseCapture - releaseEvents - remove - removeAttribute - removeAttributeNode - removeAttributeNS - removeChild - removeEventListener - removeItem - replace - replaceChild - replaceData - replaceWith - reportValidity - requestFullscreen - requestPointerLock - reset - scroll - scrollBy - scrollIntoView - scrollTo - seekToNextFrame - select - selectNode - selectNodeContents - set - setAttribute - setAttributeNode - setAttributeNodeNS - setAttributeNS - setCapture - setCustomValidity - setEnd - setEndAfter - setEndBefore - setItem - setNamedItem - setRangeText - setSelectionRange - setSinkId - setStart - setStartAfter - setStartBefore - slice - splitText - stepDown - stepUp - stopImmediatePropagation - stopPropagation - submit - substringData - supports - surroundContents - takeRecords - terminate - toBlob - toDataURL - toggle - toString - values - write - writeln + dom_functions##JavaScript - - - - onRowsinserted - onRowsdelete - onRowenter - onRowexit - onResize - onResizestart - onResizeend - onReset - onReadystatechange - onMouseout - onMouseover - onMousedown - onMouseup - onMousemove - onBeforecut - onBeforedeactivate - onBeforeunload - onBeforeupdate - onBeforepaste - onBeforeprint - onBeforeeditfocus - onBeforeactivate - onBlur - onScrolltop - onSubmit - onSelect - onSelectstart - onSelectionchange - onHover - onHelp - onChange - onContextmenu - onControlselect - onCut - onCellchange - onClock - onClose - onDeactivate - onDatasetchanged - onDatasetcomplete - onDataavailable - onDrop - onDrag - onDragstart - onDragover - onDragdrop - onDragenter - onDragend - onDragleave - onDblclick - onUnload - onPaste - onPropertychange - onError - onErrorupdate - onKeydown - onKeyup - onKeypress - onFocus - onLoad - onActivate - onAfterupdate - onAfterprint - onAbort + + + eventhandler_property##JavaScript - shift - showModelessDialog - showModalDialog - showHelp - scroll - scrollX - scrollByPages - scrollByLines - scrollY - scrollTo - stop - strike - sizeToContent - sidebar - signText - sort - sup - sub - substr - substring - splice - split - send - setMilliseconds - setSeconds - setMinutes - setHours - setMonth - setYear - setFullYear - setDate - setUTCMilliseconds - setUTCSeconds - setUTCMinutes - setUTCHours - setUTCMonth - setUTCFullYear - setUTCDate - setTime - setHotkeys - setCursor - setZOptions - setActive - setResizable - setRequestHeader - search - slice - savePreferences - small - home - handleEvent - navigate - char - charCodeAt - charAt - concat - contextual - confirm - compile - clear - captureEvents - call - createStyleSheet - createPopup - createEventObject - toGMTString - toUTCString - toString - toSource - toUpperCase - toLowerCase - toLocaleString - test - taint - taintEnabled - indexOf - italics - disableExternalCapture - dump - detachEvent - unshift - untaint - unwatch - updateCommands - join - javaEnabled - pop - push - plugins.refresh - paddings - parse - print - prompt - preference - enableExternalCapture - exec - execScript - valueOf - UTC - find - file - fileModifiedDate - fileSize - fileCreatedDate - fileUpdatedDate - fixed - fontsize - fontcolor - forward - fromCharCode - watch - link - load - lastIndexOf - anchor - attachEvent - atob - apply - alert - abort - routeEvents - resize - resizeBy - resizeTo - recalc - returnValue - replace - reverse - reload - releaseCapture - releaseEvents - go - getMilliseconds - getSeconds - getMinutes - getHours - getMonth - getDay - getYear - getFullYear - getTime - getDate - getTimezoneOffset - getUTCMilliseconds - getUTCSeconds - getUTCMinutes - getUTCHours - getUTCDay - getUTCMonth - getUTCFullYear - getUTCDate - getAttention - getSelection - getResponseHeader - getAllResponseHeaders - moveBy - moveBelow - moveTo - moveToAbsolute - moveAbove - mergeAttributes - match - margins - btoa - big - bold - borderWidths - blink - back + function_common##JavaScript + + - + - - - + + - - - + + + + - - - - - - - - - - - - - - + + + + - + + + + - - - - - + + + + + + + + + + + - + - - - + + + - + - + - + + + + - + - + - - + + + + - - + + + + + + + + - - + + + + + + + + + + + - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + - + + + - + + + + + + + + + + + + + - + + +