handle(lambda: (IN) /* parenthesized type */ -> OUT) {}
17 |
--------------------------------------------------------------------------------
/test/markup/sql/numeric-types.expect.txt:
--------------------------------------------------------------------------------
1 | SELECT CAST(32768 AS TINYINT) FROM VALUES('dummy');
2 |
--------------------------------------------------------------------------------
/test/detect/clojure/default.txt:
--------------------------------------------------------------------------------
1 | (def ^:dynamic chunk-size 17)
2 |
3 | (defn next-chunk [rdr]
4 | (let [buf (char-array chunk-size)
5 | s (.read rdr buf)]
6 | (when (pos? s)
7 | (java.nio.CharBuffer/wrap buf 0 s))))
8 |
9 | (defn chunk-seq [rdr]
10 | (when-let [chunk (next-chunk rdr)]
11 | (cons chunk (lazy-seq (chunk-seq rdr)))))
12 |
--------------------------------------------------------------------------------
/test/markup/php/comments.txt:
--------------------------------------------------------------------------------
1 | null
2 | returnTrue = () -> true
3 | square = (x) -> x * x
4 |
5 | npmWishlist.sha256 = (str) ->
6 | throw new Error()
7 |
8 | str.split(" ").map((m) -> m.charCodeAt(0))
9 |
10 | fs.readFile("package.json", "utf-8", (err, content) ->
11 | data = JSON.parse(content)
12 |
13 | data.version
14 | )
15 |
--------------------------------------------------------------------------------
/test/markup/cs/functions.txt:
--------------------------------------------------------------------------------
1 | public void ExampleFunction1() {
2 | }
3 |
4 | public void ExampleFunction2()
5 | {
6 | }
7 |
8 | void ExampleFunctionDeclaration1();
9 |
10 | void ExampleFunctionDeclaration2()
11 | ;
12 |
13 | public string ExampleExpressionBodiedFunction1() => "dummy";
14 |
15 | public string ExampleExpressionBodiedFunction2()
16 | => "dummy";
--------------------------------------------------------------------------------
/test/markup/powershell/apos-herestring.txt:
--------------------------------------------------------------------------------
1 | @' The wild cat jumped over the $height-tall fence.
2 | He did so with grace.
3 | '@
4 |
5 | This SHOULDNT be a part of the above strings span.
6 |
7 | @' The wild cat jumped over the $height-tall fence.
8 | He did so with grace.
9 | break-end-of-string'@
10 |
11 | This SHOULD be a part of the above strings span.
--------------------------------------------------------------------------------
/test/markup/powershell/quote-herestring.txt:
--------------------------------------------------------------------------------
1 | @" The wild cat jumped over the $height-tall fence.
2 | He did so with grace.
3 | "@
4 |
5 | This SHOULDNT be a part of the above strings span.
6 |
7 | @" The wild cat jumped over the $height-tall fence.
8 | He did so with grace.
9 | break-end-of-string"@
10 |
11 | This SHOULD be a part of the above strings span.
--------------------------------------------------------------------------------
/test/detect/htmlbars/default.txt:
--------------------------------------------------------------------------------
1 |
2 | {{!-- only output this author names if an author exists --}}
3 | {{#if author}}
4 | {{#playwright-wrapper playwright=author action=(mut author) as |playwright|}}
5 |
{{playwright.firstName}} {{playwright.lastName}}
6 | {{/playwright-wrapper}}
7 | {{/if}}
8 | {{yield}}
9 |
10 |
--------------------------------------------------------------------------------
/test/detect/scilab/default.txt:
--------------------------------------------------------------------------------
1 | // A comment
2 | function I = foo(dims, varargin)
3 | d=[1; matrix(dims(1:$-1),-1,1)]
4 | for i=1:size(varargin)
5 | if varargin(i)==[] then
6 | I=[],
7 | return;
8 | end
9 | end
10 | endfunction
11 |
12 | b = cos(a) + cosh(a);
13 | bar_matrix = [ "Hello", "world" ];
14 | foo_matrix = [1, 2, 3; 4, 5, 6];
15 |
--------------------------------------------------------------------------------
/test/markup/css/url.txt:
--------------------------------------------------------------------------------
1 | div { background: url("foo/bar/baz.jpg") }
2 | div { background: url('foo/bar/baz.jpg') }
3 | div { background: url(foo/bar/baz.jpg) }
4 | div { background-image: url(data:image/png;base64,TWFuIGlzIGRpc3=) }
5 | div { background-image: url("data:image/png;base64,TWFuIGlzIGRpc3=") }
6 | div { background-image: url('data:image/png;base64,TWFuIGlzIGRpc3=') }
--------------------------------------------------------------------------------
/test/markup/diff/comments.txt:
--------------------------------------------------------------------------------
1 | Index: languages/demo.js
2 | ===================================================================
3 | --- languages/demo.js (revision 199)
4 | +++ languages/demo.js (revision 200)
5 | @@ -1,8 +1,7 @@
6 | + Here we highlight correctly
7 | ====
8 | + Here too
9 | =====
10 | + Here we don't anymore after five '=' next to each other
11 |
--------------------------------------------------------------------------------
/test/markup/javascript/object-attr.expect.txt:
--------------------------------------------------------------------------------
1 | {
2 | key: value,
3 | key2: value,
4 | 'key-3': value,
5 | key4: false ? undefined : true
6 | }
7 |
--------------------------------------------------------------------------------
/test/markup/cs/floats.expect.txt:
--------------------------------------------------------------------------------
1 | float test = 1.0f;
2 | float test2 = 1.f;
3 | float test3 = 1.0;
4 | float test4 = 1;
--------------------------------------------------------------------------------
/test/detect/coffeescript/default.txt:
--------------------------------------------------------------------------------
1 | grade = (student, period=(if b? then 7 else 6)) ->
2 | if student.excellentWork
3 | "A+"
4 | else if student.okayStuff
5 | if student.triedHard then "B" else "B-"
6 | else
7 | "C"
8 |
9 | class Animal extends Being
10 | constructor: (@name) ->
11 |
12 | move: (meters) ->
13 | alert @name + " moved #{meters}m."
14 |
--------------------------------------------------------------------------------
/test/markup/java/numbers.txt:
--------------------------------------------------------------------------------
1 | long creditCardNumber = 1234_5678_9012_3456L;
2 | long socialSecurityNumber = 999_99_9999L;
3 | float pi = 3.14_15F;
4 | long hexBytes = 0xFF_EC_DE_5E;
5 | long hexWords = 0xCAFE_BABE;
6 | long maxLong = 0x7fff_ffff_ffff_ffffL;
7 | byte nybbles = 0b0010_0101;
8 | long bytes = 0b11010010_01101001_10010100_10010010;
9 | int n = 1234 + Contacts._ID;
10 |
--------------------------------------------------------------------------------
/test/detect/cpp/default.txt:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(int argc, char *argv[]) {
4 |
5 | /* An annoying "Hello World" example */
6 | for (auto i = 0; i < 0xFFFF; i++)
7 | cout << "Hello, World!" << endl;
8 |
9 | char c = '\n';
10 | unordered_map > m;
11 | m["key"] = "\\\\"; // this is an error
12 |
13 | return -2e3 + 12l;
14 | }
15 |
--------------------------------------------------------------------------------
/test/detect/profile/default.txt:
--------------------------------------------------------------------------------
1 | 261917242 function calls in 686.251 CPU seconds
2 |
3 | ncalls tottime filename:lineno(function)
4 | 152824 513.894 {method 'sort' of 'list' objects}
5 | 129590630 83.894 rrule.py:842(__cmp__)
6 | 129590630 82.439 {cmp}
7 | 153900 1.296 rrule.py:399(_iter)
8 | 304393/151570 0.963 rrule.py:102(_iter_cached)
9 |
--------------------------------------------------------------------------------
/test/detect/rust/default.txt:
--------------------------------------------------------------------------------
1 | #[derive(Debug)]
2 | pub enum State {
3 | Start,
4 | Transient,
5 | Closed,
6 | }
7 |
8 | impl From<&'a str> for State {
9 | fn from(s: &'a str) -> Self {
10 | match s {
11 | "start" => State::Start,
12 | "closed" => State::Closed,
13 | _ => unreachable!(),
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/markup/typescript/nested-templates.expect.txt:
--------------------------------------------------------------------------------
1 | let foo = true;
2 | `hello ${foo ? `Mr ${name}` : 'there'}`;
3 | foo = false;
4 |
--------------------------------------------------------------------------------
/test/api/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('hljs', function() {
4 | require('./ident');
5 | require('./underscoreIdent');
6 | require('./number');
7 | require('./cNumber');
8 | require('./binaryNumber');
9 | require('./starters');
10 | require('./getLanguage');
11 | require('./autoDetection');
12 | require('./highlight');
13 | require('./fixmarkup');
14 | });
15 |
--------------------------------------------------------------------------------
/test/detect/django/default.txt:
--------------------------------------------------------------------------------
1 | {% if articles|length %}
2 | {% for article in articles %}
3 |
4 | {% custom %}
5 |
6 | {# Striped table #}
7 |
8 | | {{ article|default:"Hi... " }} |
9 |
10 | Published on {{ article.date }}
11 | |
12 |
13 |
14 | {% endfor %}
15 | {% endif %}
16 |
--------------------------------------------------------------------------------
/test/detect/sql/default.txt:
--------------------------------------------------------------------------------
1 | CREATE TABLE "topic" (
2 | "id" serial NOT NULL PRIMARY KEY,
3 | "forum_id" integer NOT NULL,
4 | "subject" varchar(255) NOT NULL
5 | );
6 | ALTER TABLE "topic"
7 | ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")
8 | REFERENCES "forum" ("id");
9 |
10 | -- Initials
11 | insert into "topic" ("forum_id", "subject")
12 | values (2, 'D''artagnian');
13 |
--------------------------------------------------------------------------------
/test/detect/swift/default.txt:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | @objc class Person: Entity {
4 | var name: String!
5 | var age: Int!
6 |
7 | init(name: String, age: Int) {
8 | /* /* ... */ */
9 | }
10 |
11 | // Return a descriptive string for this person
12 | func description(offset: Int = 0) -> String {
13 | return "\(name) is \(age + offset) years old"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/test/markup/ini/types.txt:
--------------------------------------------------------------------------------
1 | i = 1_234
2 | f = 1.23
3 | f = 7e+12
4 | f = 2e3
5 | f = -1.234e-12
6 | basic = "string"
7 | multi_basic = """multiple
8 | lines"""
9 | literal = 'string'
10 | multi_literal = '''multiple
11 | lines'''
12 | b = true
13 | b = false
14 | b = on
15 | b = off
16 | b = yes
17 | b = no
18 | dotted.key = 1
19 | array = [1, 2, 3]
20 | inline = {name = "foo", id = 123}
21 |
--------------------------------------------------------------------------------
/test/detect/css/default.txt:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: Chunkfive; src: url('Chunkfive.otf');
3 | }
4 |
5 | body, .usertext {
6 | color: #F0F0F0; background: #600;
7 | font-family: Chunkfive, sans;
8 | --heading-1: 30px/32px Helvetica, sans-serif;
9 | }
10 |
11 | @import url(print.css);
12 | @media print {
13 | a[href^=http]::after {
14 | content: attr(href)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/detect/typescript/default.txt:
--------------------------------------------------------------------------------
1 | class MyClass {
2 | public static myValue: string;
3 | constructor(init: string) {
4 | this.myValue = init;
5 | }
6 | }
7 | import fs = require("fs");
8 | module MyModule {
9 | export interface MyInterface extends Other {
10 | myProperty: any;
11 | }
12 | }
13 | declare magicNumber number;
14 | myArray.forEach(() => { }); // fat arrow syntax
15 |
--------------------------------------------------------------------------------
/test/markup/cpp/number-literals.txt:
--------------------------------------------------------------------------------
1 | /* digit separators */
2 | int number = 2'555'555'555; // digit separators
3 | float exponentFloat = .123'456e3'000; // digit separators in floats
4 | float suffixed = 3.000'001'234f // digit separators in suffixed numbers
5 | char word[] = { '3', '\0' }; // make sure digit separators don't mess up chars
6 | float negative = -123.0f; // negative floating point numbers
7 |
--------------------------------------------------------------------------------
/test/detect/haml/default.txt:
--------------------------------------------------------------------------------
1 | !!! XML
2 | %html
3 | %body
4 | %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js
5 | /html comment
6 | -# ignore this line
7 | %ul(style='margin: 0')
8 | -items.each do |i|
9 | %i= i
10 | = variable
11 | =variable2
12 | ~ variable3
13 | ~variable4
14 | The current year is #{DataTime.now.year}.
15 |
--------------------------------------------------------------------------------
/test/detect/pgsql/default.txt:
--------------------------------------------------------------------------------
1 | BEGIN;
2 | SELECT sum(salary) OVER w, avg(salary) OVER w
3 | FROM empsalary
4 | WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);
5 | END;
6 |
7 | CREATE FUNCTION days_of_week() RETURNS SETOF text AS $$
8 | BEGIN
9 | FOR i IN 7 .. 13 LOOP
10 | RETURN NEXT to_char(to_date(i::text,'J'),'TMDy');
11 | END LOOP;
12 | END;
13 | $$ STABLE LANGUAGE plpgsql;
14 |
--------------------------------------------------------------------------------
/test/fixtures/nested.js:
--------------------------------------------------------------------------------
1 | module.exports = function(hljs) {
2 | var BODY = {
3 | className: 'body', endsWithParent: true
4 | };
5 | var LIST = {
6 | className: 'list',
7 | variants: [
8 | {begin: /\(/, end: /\)/},
9 | {begin: /\[/, end: /\]/}
10 | ],
11 | contains: [BODY]
12 | };
13 | BODY.contains = [LIST];
14 | return {
15 | contains: [LIST]
16 | }
17 | };
18 |
--------------------------------------------------------------------------------
/test/markup/dart/string-interpolation.expect.txt:
--------------------------------------------------------------------------------
1 | '1234$identifier $true';
2 |
3 | '1234${1234 + true + 'foo'}';
4 |
--------------------------------------------------------------------------------
/test/markup/ocaml/types.txt:
--------------------------------------------------------------------------------
1 | (* type variables *)
2 | type 'a t = 'a list
3 | let f (a : 'a list) : 'a = List.hd a
4 |
5 | (* polymorphic variants *)
6 | type t = [ `A | `B ]
7 |
8 | (* variants *)
9 | type result = Sat | Unsat | Unknown
10 |
11 | (* module and module types *)
12 | module type S = sig
13 | val compute : unit -> unit
14 | end
15 | module Impl : S = struct
16 | let compute () = ()
17 | end
18 |
--------------------------------------------------------------------------------
/test/detect/java/default.txt:
--------------------------------------------------------------------------------
1 | /**
2 | * @author John Smith
3 | */
4 | package l2f.gameserver.model;
5 |
6 | public abstract class L2Char extends L2Object {
7 | public static final Short ERROR = 0x0001;
8 |
9 | public void moveTo(int x, int y, int z) {
10 | _ai = null;
11 | log("Should not be called");
12 | if (1 > 5) { // wtf!?
13 | return;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/detect/processing/default.txt:
--------------------------------------------------------------------------------
1 | import java.util.LinkedList;
2 | import java.awt.Point;
3 |
4 | PGraphics pg;
5 | String load;
6 |
7 | void setup() {
8 | size(displayWidth, displayHeight, P3D);
9 | pg = createGraphics(displayWidth*2,displayHeight,P2D);
10 | pg.beginDraw();
11 | pg.background(255,255,255);
12 | //pg.smooth(8);
13 | pg.endDraw();
14 | }
15 | void draw(){
16 | background(255);
17 | }
18 |
--------------------------------------------------------------------------------
/test/markup/cpp/expression-keywords.expect.txt:
--------------------------------------------------------------------------------
1 | double x = exp(log(2));
2 | return 0;
3 |
--------------------------------------------------------------------------------
/test/markup/kotlin/nested_comment.expect.txt:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/test/markup/verilog/numbers.expect.txt:
--------------------------------------------------------------------------------
1 | a = 'hff;
2 | A = 'HFF;
3 | b = 8'h33;
4 | B = 8'H33;
5 | c = 12;
6 | d = 'o755;
7 | e = 8'b1001_0001;
8 | f = 8'b1111zzzx;
9 |
--------------------------------------------------------------------------------
/test/detect/leaf/default.txt:
--------------------------------------------------------------------------------
1 | #empty(friends) {
2 | Try adding some friends!
3 | } ##loop(friends, "friend") {
4 | #(friend.name)
5 | }
6 |
7 | #someTag(parameter.list, goes, "here") {
8 | This is an optional body here
9 | }
10 |
11 | #index(friends, "0") {
12 | Hello, #(self)!
13 | } ##else() {
14 | Nobody's there!
15 | }
16 |
17 | #()
18 |
19 | #raw() {
20 | Hello
21 | }
22 |
--------------------------------------------------------------------------------
/test/markup/ldif/ldapmodify.expect.txt:
--------------------------------------------------------------------------------
1 | dn: uid=user.0,ou=People,dc=example,dc=com
2 | changeType: modify
3 | add: cn
4 | cn: Morris Day
5 | -
6 | add: mobile
7 | mobile: (408) 555-7844
8 |
--------------------------------------------------------------------------------
/test/detect/cs/default.txt:
--------------------------------------------------------------------------------
1 | using System.IO.Compression;
2 |
3 | #pragma warning disable 414, 3021
4 |
5 | namespace MyApplication
6 | {
7 | [Obsolete("...")]
8 | class Program : IInterface
9 | {
10 | public static List JustDoIt(int count)
11 | {
12 | Console.WriteLine($"Hello {Name}!");
13 | return new List(new int[] { 1, 2, 3 })
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/detect/hsp/default.txt:
--------------------------------------------------------------------------------
1 | #include "foo.hsp"
2 |
3 | // line comment
4 | message = "Hello, World!"
5 | message2 = {"Multi
6 | line
7 | string"}
8 | num = 0
9 | mes message
10 |
11 | input num : button "sqrt", *label
12 | stop
13 |
14 | *label
15 | /*
16 | block comment
17 | */
18 | if(num >= 0) {
19 | dialog "sqrt(" + num + ") = " + sqrt(num)
20 | } else {
21 | dialog "error", 1
22 | }
23 | stop
24 |
--------------------------------------------------------------------------------
/test/detect/vim/default.txt:
--------------------------------------------------------------------------------
1 | if foo > 2 || has("gui_running")
2 | syntax on
3 | set hlsearch
4 | endif
5 |
6 | set autoindent
7 |
8 | " switch on highlighting
9 | function UnComment(fl, ll)
10 | while idx >= a:ll
11 | let srclines=getline(idx)
12 | let dstlines=substitute(srclines, b:comment, "", "")
13 | call setline(idx, dstlines)
14 | endwhile
15 | endfunction
16 |
17 | let conf = {'command': 'git'}
18 |
--------------------------------------------------------------------------------
/test/markup/javascript/keywords.txt:
--------------------------------------------------------------------------------
1 | function $initHighlight(block, cls) {
2 | try {
3 | if (cls.search(/\bno\-highlight\b/) != -1)
4 | return process(block, true, 0x0F) +
5 | ' class=""';
6 | } catch (e) {
7 | /* handle exception */
8 | }
9 | for (var i = 0 / 2; i < classes.length; i++) {
10 | if (checkCondition(classes[i]) === undefined)
11 | return /\d+[\s/]/g;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/detect/autoit/default.txt:
--------------------------------------------------------------------------------
1 | #NoTrayIcon
2 | #AutoIt3Wrapper_Run_Tidy=Y
3 | #include
4 |
5 | _Singleton(@ScriptName) ; Allow only one instance
6 | example(0, 10)
7 |
8 | Func example($min, $max)
9 | For $i = $min To $max
10 | If Mod($i, 2) == 0 Then
11 | MsgBox(64, "Message", $i & ' is even number!')
12 | Else
13 | MsgBox(64, "Message", $i & ' is odd number!')
14 | EndIf
15 | Next
16 | EndFunc ;==>example
--------------------------------------------------------------------------------
/test/markup/powershell/apos-herestring.expect.txt:
--------------------------------------------------------------------------------
1 | @' The wild cat jumped over the $height-tall fence.
2 | He did so with grace.
3 | '@
4 |
5 | This SHOULDNT be a part of the above strings span.
6 |
7 | @' The wild cat jumped over the $height-tall fence.
8 | He did so with grace.
9 | break-end-of-string'@
10 |
11 | This SHOULD be a part of the above strings span.
--------------------------------------------------------------------------------
/test/markup/arcade/profile.txt:
--------------------------------------------------------------------------------
1 | /*
2 | Isolated test for the most recent version
3 | */
4 | function offsetPopulation(offset){
5 | var popDensity = Round( $feature.POPULATION / AreaGeodetic(Geometry($feature), "square-kilometers") );
6 | var geom = Geometry({ 'x': offset.x, 'y': offset.y, 'spatialReference':{'wkid':102100} });
7 | var myLayer = FeatureSet($map, ["POPULATION", "ELECTION-DATA"]);
8 | return popDensity;
9 | }
10 |
--------------------------------------------------------------------------------
/test/markup/coffeescript/division.expect.txt:
--------------------------------------------------------------------------------
1 |
2 | x = 6/foo/i
3 | x = 6 /foo
4 | x = 6 / foo
5 | x = 6 /foo * 2/gm
6 | x = f /foo
7 | x = f / foo / gm
8 | x = f /foo * 2/6
9 |
--------------------------------------------------------------------------------
/test/markup/xquery/direct_method.txt:
--------------------------------------------------------------------------------
1 | xquery version "3.1";
2 | let $var := "rooting" out 1 or 2 root causes
3 | return
4 |
5 | disable highlight for a name such as root {
6 | for $name in $var
7 | return
8 | $name as xs:string
9 | }
10 | return to unhighlighted order of things.
11 | "rooting" out root causes
12 |
13 |
--------------------------------------------------------------------------------
/test/markup/x86asm/labels-directives.expect.txt:
--------------------------------------------------------------------------------
1 | .cfi_startproc
2 | _ZN3lib13is_whitespace17h28afa23272bf056bE:
3 | .align 16, 0x90
4 | ja .Lfunc_end0
5 | .Lfunc_end0:
6 | ret
7 |
--------------------------------------------------------------------------------
/test/markup/yaml/tag.expect.txt:
--------------------------------------------------------------------------------
1 | key: !!builtintagname test
2 | key: !localtagname test
3 | key: "!notatag"
4 | key: '!!notatageither'
5 |
--------------------------------------------------------------------------------
/test/detect/erlang-repl/default.txt:
--------------------------------------------------------------------------------
1 | 1> Str = "abcd".
2 | "abcd"
3 | 2> L = test:length(Str).
4 | 4
5 | 3> Descriptor = {L, list_to_atom(Str)}.
6 | {4,abcd}
7 | 4> L.
8 | 4
9 | 5> b().
10 | Descriptor = {4,abcd}
11 | L = 4
12 | Str = "abcd"
13 | ok
14 | 6> f(L).
15 | ok
16 | 7> b().
17 | Descriptor = {4,abcd}
18 | Str = "abcd"
19 | ok
20 | 8> {L, _} = Descriptor.
21 | {4,abcd}
22 | 9> L.
23 | 4
24 | 10> 2#101.
25 | 5
26 | 11> 1.85e+3.
27 | 1850
28 |
--------------------------------------------------------------------------------
/test/markup/cs/titles.txt:
--------------------------------------------------------------------------------
1 | namespace Foo // namespace
2 | {
3 | public class Greet : Base, Other // class
4 | {
5 | public Greet(string who) // function
6 | {
7 | Who = who;
8 | }
9 |
10 | int[] f(int val = 0)
11 | {
12 | new Type();
13 | return getType();
14 | throw getError();
15 | await Stuff();
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/tools/keywordsformat.js:
--------------------------------------------------------------------------------
1 | /** Example */
2 |
3 | var all = 'keywords here';
4 |
5 | var output = '', line = '';
6 | all.forEach(function (item) {
7 | if (12 + 1 + line.length + 1 + item.length + 4 > 120) {
8 | output += "\n" + " '" + line + " ' +";
9 | line = '';
10 | return;
11 | }
12 | if (line) {
13 | line = line + ' ' + item;
14 | } else {
15 | line = item;
16 | }
17 | });
18 | console.log(output);
19 |
--------------------------------------------------------------------------------
/test/fixtures/expect/customtabreplace.txt:
--------------------------------------------------------------------------------
1 | for x in [1, 2, 3]:
2 | count(x)
3 | if x == 3:
4 | count(x + 1)
--------------------------------------------------------------------------------
/test/detect/pony/default.txt:
--------------------------------------------------------------------------------
1 | use "collections"
2 |
3 | class StopWatch
4 | """
5 | A simple stopwatch class for performance micro-benchmarking
6 | """
7 | var _s: U64 = 0
8 |
9 | fun delta(): U64 =>
10 | Time.nanos() - _s
11 |
12 | actor LonelyPony
13 | """
14 | A simple manifestation of the lonely pony problem
15 | """
16 | var env: Env
17 | let sw: StopWatch = StopWatch
18 |
19 | new create(env': Env) =>
20 | env = env
21 |
--------------------------------------------------------------------------------
/test/detect/powershell/default.txt:
--------------------------------------------------------------------------------
1 | $initialDate = [datetime]'2013/1/8'
2 |
3 | $rollingDate = $initialDate
4 |
5 | do {
6 | $client = New-Object System.Net.WebClient
7 | $results = $client.DownloadString("http://not.a.real.url")
8 | Write-Host "$rollingDate.ToShortDateString() - $results"
9 | $rollingDate = $rollingDate.AddDays(21)
10 | $username = [System.Environment]::UserName
11 | } until ($rollingDate -ge [datetime]'2013/12/31')
12 |
--------------------------------------------------------------------------------
/test/markup/crystal/operators.expect.txt:
--------------------------------------------------------------------------------
1 | +
2 | -
3 | *
4 | %
5 | &
6 | |
7 | ^
8 | **
9 | <<
10 | >>
11 | ==
12 | !=
13 | <
14 | <=
15 | >
16 | >=
17 | <=>
18 | ===
19 | //
20 | //=
21 | &+
22 | &-
23 | &*
24 | &**
25 | &+=
26 | &-=
27 | &*=
28 | !
29 | ~
30 | []
31 | []?
32 | []=
33 | /
34 |
35 |
--------------------------------------------------------------------------------
/test/markup/pony/method.expect.txt:
--------------------------------------------------------------------------------
1 | fun foo(bar: String): String =>
2 | bar + "baz"
3 |
4 | new create(hunger: I32) =>
5 | _hunger = hunger
6 |
7 | be feed(food: I32) =>
8 | _hunger = _hunger - food
--------------------------------------------------------------------------------
/test/markup/yaml/string.expect.txt:
--------------------------------------------------------------------------------
1 | key: value
2 | key: 'some value'
3 | key: "some value"
4 | key: |
5 | multi-string
6 | value
7 | key: true
8 |
--------------------------------------------------------------------------------
/test/detect/ada/default.txt:
--------------------------------------------------------------------------------
1 | package body Sqlite.Simple is
2 |
3 | Foo : int := int'Size;
4 | Bar : int := long'Size;
5 |
6 | Error_Message_C : chars_ptr := Sqlite_Errstr (Error);
7 | Error_Message : String := Null_Ignore_Value (Error_Message_C);
8 | begin
9 |
10 | Named : for Index in Foo..Bar loop
11 | Put ("Hi[]{}");
12 | end loop Named;
13 |
14 | Foo := Bar;
15 | end Message;
16 |
17 | end Sqlite.Simple;
18 |
--------------------------------------------------------------------------------
/test/markup/crystal/toplevel-keywords.expect.txt:
--------------------------------------------------------------------------------
1 | class Foo; end
2 | struct Bar; end
3 |
4 | annotation JSON::Field; end
5 |
--------------------------------------------------------------------------------
/src/languages/shell.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Shell Session
3 | Requires: bash.js
4 | Author: TSUYUSATO Kitsune
5 | Category: common
6 | */
7 |
8 | function(hljs) {
9 | return {
10 | aliases: ['console'],
11 | contains: [
12 | {
13 | className: 'meta',
14 | begin: '^\\s{0,3}[\\w\\d\\[\\]()@-]*[>%$#]',
15 | starts: {
16 | end: '$', subLanguage: 'bash'
17 | }
18 | }
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/test/markup/maxima/symbols.txt:
--------------------------------------------------------------------------------
1 | /* symbolic constants */
2 |
3 | [true, false, unknown, inf, minf, ind,
4 | und, %e, %i, %pi, %phi, %gamma];
5 |
6 | /* built-in variables */
7 |
8 | [_, __, %, %%, linel, simp, dispflag,
9 | stringdisp, lispdisp, %edispflag];
10 |
11 | /* built-in functions */
12 |
13 | [sin, cosh, exp, atan2, sqrt, log, struve_h,
14 | sublist_indices, read_array];
15 |
16 | /* user-defined symbols */
17 |
18 | [foo, ?bar, baz%, quux_mumble_blurf];
19 |
--------------------------------------------------------------------------------
/test/markup/reasonml/modules.txt:
--------------------------------------------------------------------------------
1 | let decode = json =>
2 | Json.Decode.{
3 | query: json |> field("query", string),
4 | cacheKey: json |> field("cacheKey", string),
5 | desc: json |> field("desc", string),
6 | lambda: json |> field("lambda", string),
7 | };
8 |
9 | Some.Bucket.Of.(
10 | let value = stuff();
11 | );
12 |
13 | let value = Some.Bucket.Of.stuff();
14 |
15 | module type RewiredModule = {
16 | type t = {
17 | name: string
18 | };
19 | };
--------------------------------------------------------------------------------
/test/browser/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('browser build', function() {
4 | before(function() {
5 | this.text = 'var say = "Hello";';
6 | this.html = `${this.text}
`;
7 | this.expect = '' +
8 | 'var say = ' +
9 | '"Hello";';
10 | });
11 |
12 | require('./plain');
13 | require('./worker');
14 | });
15 |
--------------------------------------------------------------------------------
/test/fixtures/expect/useBr.txt:
--------------------------------------------------------------------------------
1 | <head>
<meta charset="utf-8">
<title></title>
</head>
2 |
--------------------------------------------------------------------------------
/test/markup/sql/set-operator.expect.txt:
--------------------------------------------------------------------------------
1 | SELECT * FROM VALUES 1, 2 ,3 UNION ALL VALUES 1, 2, 3;
2 |
--------------------------------------------------------------------------------
/src/languages/vbscript-html.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: VBScript in HTML
3 | Requires: xml.js, vbscript.js
4 | Author: Ivan Sagalaev
5 | Description: "Bridge" language defining fragments of VBScript in HTML within <% .. %>
6 | Category: scripting
7 | */
8 |
9 | function(hljs) {
10 | return {
11 | subLanguage: 'xml',
12 | contains: [
13 | {
14 | begin: '<%', end: '%>',
15 | subLanguage: 'vbscript'
16 | }
17 | ]
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/src/languages/clojure-repl.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Clojure REPL
3 | Description: Clojure REPL sessions
4 | Author: Ivan Sagalaev
5 | Requires: clojure.js
6 | Category: lisp
7 | */
8 |
9 | function(hljs) {
10 | return {
11 | contains: [
12 | {
13 | className: 'meta',
14 | begin: /^([\w.-]+|\s*#_)?=>/,
15 | starts: {
16 | end: /$/,
17 | subLanguage: 'clojure'
18 | }
19 | }
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/markup/dockerfile/default.txt:
--------------------------------------------------------------------------------
1 | FROM ubuntu
2 |
3 | MAINTAINER laurent@docker.com
4 |
5 | ARG debug=0
6 |
7 | COPY www.conf /etc/php5/fpm/pool.d/
8 |
9 | RUN apt-get update \
10 | && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql
11 | RUN mkdir /tmp/sessions
12 |
13 | ENV APPLICATION_ENV dev
14 |
15 | USER www-data
16 |
17 | EXPOSE 80
18 |
19 | VOLUME ["/var/www/html"]
20 |
21 | WORKDIR "/var/www/html"
22 |
23 | CMD [ "/usr/sbin/php5-fpm", "-F" ]
24 |
--------------------------------------------------------------------------------
/test/markup/ini/comments.expect.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | x = "abc"
4 | y = 123
5 | [table]
6 |
--------------------------------------------------------------------------------
/test/detect/sqf/default.txt:
--------------------------------------------------------------------------------
1 | /***
2 | Arma Scripting File
3 | Edition: 1.66
4 | ***/
5 |
6 | // Enable eating to improve health.
7 | _unit addAction ["Eat Energy Bar", {
8 | if (_this getVariable ["EB_NumActivation", 0] > 0) then {
9 | _this setDamage (0 max (damage _this - 0.25));
10 | } else {
11 | hint "You have eaten it all";
12 | };
13 | // 4 - means something...
14 | Z_obj_vip = nil;
15 | [_boat, ["Black", 1], true] call BIS_fnc_initVehicle;
16 | }];
17 |
--------------------------------------------------------------------------------
/test/markup/powershell/quote-herestring.expect.txt:
--------------------------------------------------------------------------------
1 | @" The wild cat jumped over the $height-tall fence.
2 | He did so with grace.
3 | "@
4 |
5 | This SHOULDNT be a part of the above strings span.
6 |
7 | @" The wild cat jumped over the $height-tall fence.
8 | He did so with grace.
9 | break-end-of-string"@
10 |
11 | This SHOULD be a part of the above strings span.
--------------------------------------------------------------------------------
/test/detect/markdown/default.txt:
--------------------------------------------------------------------------------
1 | # hello world
2 |
3 | you can write text [with links](http://example.com) inline or [link references][1].
4 |
5 | * one _thing_ has *em*phasis
6 | * two __things__ are **bold**
7 |
8 | [1]: http://example.com
9 |
10 | ---
11 |
12 | hello world
13 | ===========
14 |
15 |
16 |
17 | > markdown is so cool
18 |
19 | so are code segments
20 |
21 | 1. one thing (yeah!)
22 | 2. two thing `i can write code`, and `more` wipee!
23 |
24 |
--------------------------------------------------------------------------------
/test/markup/rust/types.expect.txt:
--------------------------------------------------------------------------------
1 | type A: Trait;
2 | type A;
3 | type A = B;
4 | type R<T> = m::R<T, ConcreteError>
5 |
--------------------------------------------------------------------------------
/test/detect/n1ql/default.txt:
--------------------------------------------------------------------------------
1 | SELECT *
2 | FROM `beer-sample`
3 | WHERE brewery_id IS NOT MISSING AND type="beer"
4 | LIMIT 1;
5 |
6 | UPSERT INTO product (KEY, VALUE) VALUES (
7 | "odwalla-juice1", {
8 | "productId": "odwalla-juice1",
9 | "unitPrice": 5.40,
10 | "type": "product",
11 | "color":"red"
12 | }
13 | ) RETURNING *;
14 |
15 | INFER `beer-sample` WITH {
16 | "sample_size": 10000,
17 | "num_sample_values": 1,
18 | "similarity_metric": 0.0
19 | };
20 |
--------------------------------------------------------------------------------
/test/markup/accesslog/default.expect.txt:
--------------------------------------------------------------------------------
1 | 20.164.151.111 - - [20/Aug/2015:22:20:18 -0400] "GET /mywebpage/index.php HTTP/1.1" 403 772 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1"
2 |
--------------------------------------------------------------------------------
/test/detect/go/swift-like.txt:
--------------------------------------------------------------------------------
1 | func makeRequest(method string, url string, cb func(error, io.ReadCloser)) {
2 | req, _ := http.NewRequest(method, url, nil)
3 | resp, err := http.DefaultClient.Do(req)
4 | if err != nil {
5 | cb(err, nil)
6 | } else {
7 | cb(err, resp.Body)
8 | }
9 | }
10 | func main() {
11 | makeRequest("GET", "http://ipinfo.io/json", func(err error, body io.ReadCloser) {
12 | defer body.Close()
13 | io.Copy(os.Stdout, body)
14 | })
15 | }
16 |
--------------------------------------------------------------------------------
/test/detect/q/default.txt:
--------------------------------------------------------------------------------
1 | select time, price by date,stock from quote where price=(max;price)fby stock
2 | data:raze value flip trade
3 | select vwap:size wavg price by 5 xbar time.minute from aapl where date within (.z.d-10;.z.d)
4 | f1:{[x;y;z] show (x;y+z);sum 1 2 3}
5 | .z.pc:{[handle] show -3!(`long$.z.p;"Closed";handle)}
6 | // random normal distribution, e.g. nor 10
7 | nor:{$[x=2*n:x div 2;raze sqrt[-2*log n?1f]*/:(sin;cos)@\:(2*pi)*n?1f;-1_.z.s 1+x]}
8 |
9 | mode:{where g=max g:count each group x} // mode function
--------------------------------------------------------------------------------
/test/detect/rsl/default.txt:
--------------------------------------------------------------------------------
1 | #define TEST_DEFINE 3.14
2 | /* plastic surface shader
3 | *
4 | * Pixie is:
5 | * (c) Copyright 1999-2003 Okan Arikan. All rights reserved.
6 | */
7 |
8 | surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;
9 | color specularcolor = 1;) {
10 | normal Nf = faceforward (normalize(N),I);
11 | Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks *
12 | specular(Nf,-normalize(I),roughness);
13 | Oi = Os;
14 | Ci *= Oi;
15 | }
16 |
--------------------------------------------------------------------------------
/test/markup/php/heredoc.expect.txt:
--------------------------------------------------------------------------------
1 | echo <<<EOT
2 | String with $var and {$foo->bar[1]}.
3 | EOT;
4 |
5 | echo <<<EOT
6 | string
7 | EOT
8 | still string
9 | EOT;
10 |
11 | array(<<<EOD
12 | foobar!
13 | EOD
14 | );
15 |
--------------------------------------------------------------------------------
/test/markup/pony/control-flow.txt:
--------------------------------------------------------------------------------
1 | if a == b and b == a then
2 | env.out.print("they are the same")
3 | elseif a > b or b < a then
4 | env.out.print("a is bigger")
5 | else
6 | env.out.print("b bigger")
7 | end
8 |
9 | while count <= 10 do
10 | env.out.print(count.string())
11 | count = count + 1
12 | end
13 |
14 | for name in ["Bob"; "Fred"; "Sarah"].values() do
15 | env.out.print(name)
16 | end
17 |
18 | repeat
19 | env.out.print("hello!")
20 | counter = counter + 1
21 | until counter > 7 end
--------------------------------------------------------------------------------
/test/markup/xml/space-attributes.expect.txt:
--------------------------------------------------------------------------------
1 | <img src ="/pics/foo.jpg">
2 | <img src= "/pics/foo.jpg">
3 | <img src = "/pics/foo.jpg">
4 |
--------------------------------------------------------------------------------
/test/fixtures/expect/custommarkup.txt:
--------------------------------------------------------------------------------
1 | <div id="contents">
2 | <p>Hello, World!Goodbye, cruel world!
3 | </div>
4 |
--------------------------------------------------------------------------------
/test/markup/http/default.expect.txt:
--------------------------------------------------------------------------------
1 | POST /task?id=1 HTTP/1.1
2 | Host: example.org
3 | Content-Type: application/json; charset=utf-8
4 | Content-Length: 19
5 |
6 | {"status": "ok", "extended": true}
7 |
8 |
--------------------------------------------------------------------------------
/test/detect/brainfuck/default.txt:
--------------------------------------------------------------------------------
1 | ++++++++++
2 | [ 3*10 and 10*10
3 | ->+++>++++++++++<<
4 | ]>>
5 | [ filling cells
6 | ->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[]<[<]<[<]>>
7 | ]<
8 | +++++++++<<
9 | [ rough codes correction loop
10 | ->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]<
11 | ]
12 | more accurate сodes correction
13 | >>>++>
14 | -->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++>
15 | ++>+++++++++++>++++++++++++>------>+++
16 | rewind and output
17 | [<]>[.>]
18 |
--------------------------------------------------------------------------------
/test/markup/tap/basic.expect.txt:
--------------------------------------------------------------------------------
1 | 1..4
2 | ok 1 - Input file opened
3 | not ok 2 - First line of the input valid
4 | ok 3 - Read the rest of the file
5 | not ok 4 - Summarized correctly
6 |
--------------------------------------------------------------------------------
/test/detect/tex/default.txt:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \usepackage[koi8-r]{inputenc}
3 | \hoffset=0pt
4 | \voffset=.3em
5 | \tolerance=400
6 | \newcommand{\eTiX}{\TeX}
7 | \begin{document}
8 | \section*{Highlight.js}
9 | \begin{table}[c|c]
10 | $\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
11 | \end{table}
12 | Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b
13 | G\"otterd\"ammerung~45\%=34.
14 | $$
15 | \int\limits_{0}^{\pi}\frac{4}{x-7}=3
16 | $$
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/test/detect/twig/default.txt:
--------------------------------------------------------------------------------
1 | {% if posts|length %}
2 | {% for article in articles %}
3 | <div>
4 | {{ article.title|upper() }}
5 |
6 | {# outputs 'WELCOME' #}
7 | </div>
8 | {% endfor %}
9 | {% endif %}
10 |
11 | {% set user = json_encode(user) %}
12 |
13 | {{ random(['apple', 'orange', 'citrus']) }}
14 |
15 | {{ include(template_from_string("Hello {{ name }}")) }}
16 |
17 |
18 | {#
19 | Comments may be long and multiline.
20 | Markup is <em>not</em> highlighted within comments.
21 | #}
22 |
--------------------------------------------------------------------------------
/test/markup/subunit/subunit-progressline.expect.txt:
--------------------------------------------------------------------------------
1 | progress: +5
2 | progress: +12
3 | progress: 29
4 | progress: -3
5 | progress: -91
6 | progress: push
7 | progress: pop
8 |
--------------------------------------------------------------------------------
/test/detect/dos/default.txt:
--------------------------------------------------------------------------------
1 | cd \
2 | copy a b
3 | ping 192.168.0.1
4 | @rem ping 192.168.0.1
5 | net stop sharedaccess
6 | del %tmp% /f /s /q
7 | del %temp% /f /s /q
8 | ipconfig /flushdns
9 | taskkill /F /IM JAVA.EXE /T
10 |
11 | cd Photoshop/Adobe Photoshop CS3/AMT/
12 | if exist application.sif (
13 | ren application.sif _application.sif
14 | ) else (
15 | ren _application.sif application.sif
16 | )
17 |
18 | taskkill /F /IM proquota.exe /T
19 |
20 | sfc /SCANNOW
21 |
22 | set path = test
23 |
24 | xcopy %1\*.* %2
25 |
--------------------------------------------------------------------------------
/test/markup/python/matrix-multiplication.expect.txt:
--------------------------------------------------------------------------------
1 | @meta
2 | class C:
3 |
4 | @decorator
5 | def f(self, H, V, beta, r):
6 | S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)
7 | return S
8 |
--------------------------------------------------------------------------------
/test/detect/arcade/default.txt:
--------------------------------------------------------------------------------
1 | function testGeometry(element, point) {
2 | if (point.y != -1)
3 | return point;
4 | for (var i = 0 / 2; i < element.length; i++) {
5 | if (checkCondition($map.element[i]) === Infinity) {
6 | return element[i];
7 | }
8 | }
9 | return element;
10 | }
11 |
12 | var filePath = "literal " + TextFormatting.BackSlash + TextFormatting.SingleQuote + ".ext"
13 | var d = Dictionary("field1", 1, "field2",2);
14 | return testGeometry(Geometry(d["field1"], filePath);
15 |
--------------------------------------------------------------------------------
/test/detect/basic/default.txt:
--------------------------------------------------------------------------------
1 | 10 CLS
2 | 20 FOR I = 0 TO 15
3 | 22 FOR J = 0 TO 7
4 | 30 COLOR I,J
5 | 40 PRINT " ** ";
6 | 45 NEXT J
7 | 46 COLOR I,0
8 | 47 GOSUB 100
9 | 48 PRINT
10 | 50 NEXT I
11 | 60 COLOR 15,0
12 | 99 END
13 | 100 FOR T = 65 TO 90
14 | 101 PRINT CHR$(T);
15 | 102 NEXT T
16 | 103 RETURN
17 | 200 REM Data types test
18 | 201 TOTAL# = 3.30# 'Double precision variable
19 | 202 BALANCE! = 3! 'Single precision variable
20 | 203 B2! = 12e5 '120000
21 | 204 ITEMS% = 10 'Integer variable
22 | 205 HEXTEST = &H12DB 'Hex value
23 |
--------------------------------------------------------------------------------
/test/markup/delphi/compiler-directive.expect.txt:
--------------------------------------------------------------------------------
1 |
2 | {$I} (*$I*)
3 | procedure A(x: {$IFDEF Debug}Integer{$ELSE}Word{$ENDIF});
4 | begin end;
5 |
--------------------------------------------------------------------------------
/test/markup/ocaml/literals.txt:
--------------------------------------------------------------------------------
1 | let i = 14
2 | let i = -14
3 | let i = 1_000
4 | let i = 0b100
5 | let i = 0x1FF
6 | let i = 0o777
7 | let i64 = 128L
8 | let i64 = 0b10L
9 | let i32 = 32l
10 | let i32 = 0x12l
11 | let nat = 10n
12 | let nat = 0o644n
13 | let f = 5.
14 | let f = 5.1
15 | let f = 1e+1
16 | let f = 1e1
17 | let f = 1e-1
18 | let f = 1_024e12
19 | let f = 1L
20 |
21 | let b = true || false
22 | let l = []
23 | let a = [||]
24 | let () = ignore (b)
25 |
26 | let c = 'a'
27 | let c = '\xFF'
28 | let c = '\128'
29 | let c = '\n'
30 |
--------------------------------------------------------------------------------
/test/detect/gml/default.txt:
--------------------------------------------------------------------------------
1 | /// @description Collision code
2 | // standard collision handling
3 |
4 | // Horizontal collisions
5 | if(place_meeting(x+hspd, y, obj_wall)) {
6 | while(!place_meeting(x+sign(hspd), y, obj_wall)) {
7 | x += sign(hspd);
8 | }
9 | hspd = 0;
10 | }
11 | x += hspd;
12 |
13 | // Vertical collisions
14 | if(place_meeting(x, y+vspd, collide_obj)) {
15 | while(!place_meeting(x, y+sign(vspd), collide_obj)) {
16 | y += sign(vspd);
17 | }
18 | vspd = 0;
19 | }
20 | y += vspd;
21 |
22 | show_debug_message("This is a test");
--------------------------------------------------------------------------------
/test/detect/elm/default.txt:
--------------------------------------------------------------------------------
1 | import Browser
2 | import Html exposing (div, button, text)
3 | import Html.Events exposing (onClick)
4 |
5 | type Msg
6 | = Increment
7 |
8 | main =
9 | Browser.sandbox
10 | { init = 0
11 | , update = \msg model -> model + 1
12 | , view = view
13 | }
14 |
15 | view model =
16 | div []
17 | [ div [] [ text (String.fromInt model) ]
18 | , button [ onClick Increment ] [ text "+" ]
19 | ]
20 |
21 | chars =
22 | String.cons 'C' <| String.cons 'h' <| "ars"
23 |
--------------------------------------------------------------------------------
/test/detect/javascript/sample1.txt:
--------------------------------------------------------------------------------
1 | // This was mis-detected as HSP and Perl because parsing of
2 | // keywords in those languages allowed adjacent dots
3 |
4 | window.requestAnimationFrame(function render() {
5 | var pos = state.pos;
6 |
7 | canvasEl.width = 500;
8 | canvasEl.height = 300;
9 |
10 | if (dpad.right) {
11 | pos.x += 3;
12 | } else if (dpad.left) {
13 | pos.x -= 3;
14 | }
15 |
16 | ctx.fillStyle = '#AF8452';
17 | ctx.fillRect(pos.x + 5, pos.y - 10, 10, 10);
18 |
19 | window.requestAnimationFrame(render);
20 | });
21 |
--------------------------------------------------------------------------------
/test/detect/nimrod/default.txt:
--------------------------------------------------------------------------------
1 | import module1, module2, module3
2 | from module4 import nil
3 |
4 | type
5 | TFoo = object ## Doc comment
6 | a: int32
7 | PFoo = ref TFoo
8 |
9 | proc do_stuff314(param_1: TFoo, par2am: var PFoo): PFoo {.exportc: "dostuff" .} =
10 | # Regular comment
11 | discard """
12 | dfag
13 | sdfg""
14 | """
15 | result = nil
16 |
17 | method abc(a: TFoo) = discard 1u32 + 0xabcdefABCDEFi32 + 0o01234567i8 + 0b010
18 |
19 | discard rawstring"asdf""adfa"
20 | var normalstring = "asdf"
21 | let a: uint32 = 0xFFaF'u32
22 |
--------------------------------------------------------------------------------
/test/markup/cpp/pointers-returns.expect.txt:
--------------------------------------------------------------------------------
1 |
2 | char** foo_bar();
3 | char ** foo_bar();
4 | char **foo_bar();
5 |
--------------------------------------------------------------------------------
/test/markup/javascript/inline-languages.txt:
--------------------------------------------------------------------------------
1 | let foo = true;
2 | `hello ${foo ? `Mr ${name}` : 'there'}`;
3 | foo = false;
4 |
5 | html`Hello world
`;
6 |
7 | html`Hello times ${10} world
`;
8 |
9 | html`
10 |
11 | ${repeat(['a', 'b', 'c'], (v) => {
12 | return html`- ${v}
`;
13 | }}
14 |
15 | `;
16 |
17 | css`
18 | body {
19 | color: red;
20 | }
21 | `;
22 |
23 | // Ensure that we're back in JavaScript mode.
24 | var foo = 10;
25 |
--------------------------------------------------------------------------------
/test/markup/subunit/subunit-successline.expect.txt:
--------------------------------------------------------------------------------
1 | success test simplename1
2 | success: test simplename2
3 | successful test simplename3
4 | successful: test simplename4
5 | success test simple name1
6 | success: test simple name2
7 | successful test simple name3
8 | successful: test simple name4
9 |
--------------------------------------------------------------------------------
/test/markup/typescript/inline-languages.txt:
--------------------------------------------------------------------------------
1 | let foo = true;
2 | `hello ${foo ? `Mr ${name}` : 'there'}`;
3 | foo = false;
4 |
5 | html`Hello world
`;
6 |
7 | html`Hello times ${10} world
`;
8 |
9 | html`
10 |
11 | ${repeat(['a', 'b', 'c'], (v) => {
12 | return html`- ${v}
`;
13 | }}
14 |
15 | `;
16 |
17 | css`
18 | body {
19 | color: red;
20 | }
21 | `;
22 |
23 | // Ensure that we're back in TypeScript mode.
24 | var foo = 10;
25 |
--------------------------------------------------------------------------------
/test/detect/nix/default.txt:
--------------------------------------------------------------------------------
1 | { stdenv, foo, bar ? false, ... }:
2 |
3 | /*
4 | * foo
5 | */
6 |
7 | let
8 | a = 1; # just a comment
9 | b = null;
10 | c = toString 10;
11 | in stdenv.mkDerivation rec {
12 | name = "foo-${version}";
13 | version = "1.3";
14 |
15 | configureFlags = [ "--with-foo2" ] ++ stdenv.lib.optional bar "--with-foo=${ with stdenv.lib; foo }"
16 |
17 | postInstall = ''
18 | ${ if true then "--${test}" else false }
19 | '';
20 |
21 | meta = with stdenv.lib; {
22 | homepage = https://nixos.org;
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/test/markup/rust/strings.expect.txt:
--------------------------------------------------------------------------------
1 | 'a';
2 | '\n';
3 | '\x1A';
4 | '\u12AS';
5 | '\U1234ASDF';
6 | b'a';
7 |
8 | "hello";
9 | b"hello";
10 |
11 | r"hello";
12 | r###"world"###;
13 | r##" "###
14 | "# "##;
15 |
--------------------------------------------------------------------------------
/test/special/subLanguages.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | let utility = require('../utility');
4 |
5 | describe('sub-languages', function() {
6 | before(function() {
7 | this.block = document.querySelector('#sublanguages');
8 | });
9 |
10 | it('should highlight XML with PHP and JavaScript', function() {
11 | const filename = utility.buildPath('fixtures', 'expect',
12 | 'sublanguages.txt'),
13 | actual = this.block.innerHTML;
14 |
15 | return utility.expectedFile(filename, 'utf-8', actual);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/test/detect/awk/default.txt:
--------------------------------------------------------------------------------
1 | BEGIN {
2 | POPService = "/inet/tcp/0/emailhost/pop3"
3 | RS = ORS = "\r\n"
4 | print "user name" |& POPService
5 | POPService |& getline
6 | print "pass password" |& POPService
7 | POPService |& getline
8 | print "retr 1" |& POPService
9 | POPService |& getline
10 | if ($1 != "+OK") exit
11 | print "quit" |& POPService
12 | RS = "\r\n\\.\r\n"
13 | POPService |& getline
14 | print $0
15 | close(POPService)
16 | }
17 |
--------------------------------------------------------------------------------
/test/detect/bnf/default.txt:
--------------------------------------------------------------------------------
1 | ::= |
2 | ::= "<" ">" "::="
3 | ::= " " | ""
4 | ::= | "|"
5 | ::= |
6 | ::= |
7 | ::= | "<" ">"
8 | ::= '"' '"' | "'" "'"
9 |
--------------------------------------------------------------------------------
/test/detect/javascript/default.txt:
--------------------------------------------------------------------------------
1 | function $initHighlight(block, cls) {
2 | try {
3 | if (cls.search(/\bno\-highlight\b/) != -1)
4 | return process(block, true, 0x0F) +
5 | ` class="${cls}"`;
6 | } catch (e) {
7 | /* handle exception */
8 | }
9 | for (var i = 0 / 2; i < classes.length; i++) {
10 | if (checkCondition(classes[i]) === undefined)
11 | console.log('undefined');
12 | }
13 |
14 | return (
15 |
16 | {block}
17 |
18 | )
19 | }
20 |
21 | export $initHighlight;
22 |
--------------------------------------------------------------------------------
/test/detect/stylus/default.txt:
--------------------------------------------------------------------------------
1 | @import "nib"
2 |
3 | // variables
4 | $green = #008000
5 | $green_dark = darken($green, 10)
6 |
7 | // mixin/function
8 | container()
9 | max-width 980px
10 |
11 | // mixin/function with parameters
12 | buttonBG($color = green)
13 | if $color == green
14 | background-color #008000
15 | else if $color == red
16 | background-color #B22222
17 |
18 | button
19 | buttonBG(red)
20 |
21 | #content, .content
22 | font Tahoma, Chunkfive, sans-serif
23 | background url('hatch.png')
24 | color #F0F0F0 !important
25 | width 100%
26 |
--------------------------------------------------------------------------------
/test/markup/kotlin/string.expect.txt:
--------------------------------------------------------------------------------
1 | "astring"
2 | expression
3 | "a ${ "string" } ${'c'} b"
4 | "a ${ "string $var ${subs}" } b"
5 | """ ${
6 | ${subst}
7 | } """
--------------------------------------------------------------------------------
/test/markup/sql/interval.txt:
--------------------------------------------------------------------------------
1 | SELECT
2 | CURRENT_TIMESTAMP
3 | - INTERVAL 2 YEARS
4 | + INTERVAL 1 MONTH
5 | - INTERVAL 3 DAYS
6 | + INTERVAL 10 HOURS
7 | + interval 30 MINUTES
8 | - INTERVAL 20 SECOND AS past_timestamp
9 | FROM VALUES ("dummy");
10 |
11 | WITH ts AS (
12 | SELECT CURRENT_TIMESTAMP AS now FROM VALUES ('dummy')
13 | )
14 | SELECT
15 | now - INTERVAL 1 DAY - INTERVAL 2 HOURS - INTERVAL 3 MINUTES - INTERVAL 4 SECONDS AS LONG_VERSION,
16 | now - INTERVAL '1 2:3:4.100' DAY TO SECOND AS SHORT_VERSION
17 | FROM ts;
18 |
--------------------------------------------------------------------------------
/test/detect/ebnf/default.txt:
--------------------------------------------------------------------------------
1 | (* line comment *)
2 |
3 | rule = [optional] , symbol , { letters } , ( digit | symbol ) ;
4 |
5 | optional = ? something unnecessary ? ; (* trailing comment *)
6 |
7 | symbol = '!' | '@' | '#' | '$' | '%' | '&' | '*' ;
8 | digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
9 | letter = "A" | "B" | "C" | "D" | "E" | "F" | "G"
10 | | "H" | "I" | "J" | "K" | "L" | "M" | "N"
11 | | "O" | "P" | "Q" | "R" | "S" | "T" | "U"
12 | | "V" | "W" | "X" | "Y" | "Z" ;
13 |
--------------------------------------------------------------------------------
/test/detect/fortran/default.txt:
--------------------------------------------------------------------------------
1 | subroutine test_sub(k)
2 | implicit none
3 |
4 | !===============================
5 | ! This is a test subroutine
6 | !===============================
7 |
8 | integer, intent(in) :: k
9 | double precision, allocatable :: a(:)
10 | integer, parameter :: nmax=10
11 | integer :: i
12 |
13 | allocate (a(nmax))
14 |
15 | do i=1,nmax
16 | a(i) = dble(i)*5.d0
17 | enddo
18 |
19 | print *, 'Hello world'
20 | write (*,*) a(:)
21 |
22 | end subroutine test_sub
23 |
--------------------------------------------------------------------------------
/test/markup/less/selectors.expect.txt:
--------------------------------------------------------------------------------
1 | #foo {
2 | tag #bar {}
3 | > #bar {}
4 | #bar {}
5 | &#bar {}
6 | &:hover {}
7 | height: ~"@{height}px";
8 | }
9 |
--------------------------------------------------------------------------------
/test/detect/crystal/default.txt:
--------------------------------------------------------------------------------
1 | class Person
2 | def initialize(@name : String)
3 | end
4 |
5 | def greet
6 | puts "Hi, I'm #{@name}"
7 | end
8 | end
9 |
10 | class Employee < Person
11 | end
12 |
13 | employee = Employee.new "John"
14 | employee.greet # => "Hi, I'm John"
15 | employee.is_a?(Person) # => true
16 |
17 | @[Link("m")]
18 | lib C
19 | # In C: double cos(double x)
20 | fun cos(value : Float64) : Float64
21 | end
22 |
23 | C.cos(1.5_f64) # => 0.0707372
24 |
25 | s = uninitialized String
26 | s = <<-'STR'
27 | \hello\world
28 | \hello\world
29 | STR
30 |
--------------------------------------------------------------------------------
/test/markup/sql/values-statement.expect.txt:
--------------------------------------------------------------------------------
1 | VALUES 1, 2 , 3;
2 |
3 | VALUES
4 | (1, 'Spock'),
5 | (2,'Kirk') ,
6 | (3, 'McCoy'),
7 | (4,'Scotty');
8 |
--------------------------------------------------------------------------------
/test/detect/autohotkey/default.txt:
--------------------------------------------------------------------------------
1 | ; hotkeys and hotstrings
2 | #a::WinSet, AlwaysOnTop, Toggle, A
3 | #Space::
4 | MsgBox, Percent sign (`%) need to be escaped.
5 | Run "C:\Program Files\some\program.exe"
6 | Gosub, label1
7 | return
8 | ::btw::by the way
9 | ; volume
10 | #Numpad8::Send {Volume_Up}
11 | #Numpad5::Send {Volume_Mute}
12 | #Numpad2::Send {Volume_Down}
13 |
14 | label1:
15 | if (Clipboard = "")
16 | {
17 | MsgBox, , Clipboard, Empty!
18 | }
19 | else
20 | {
21 | StringReplace, temp, Clipboard, old, new, All
22 | MsgBox, , Clipboard, %temp%
23 | }
24 | return
25 |
--------------------------------------------------------------------------------
/test/detect/sml/default.txt:
--------------------------------------------------------------------------------
1 | structure List : LIST =
2 | struct
3 |
4 | val op + = InlineT.DfltInt.+
5 |
6 | datatype list = datatype list
7 |
8 | exception Empty = Empty
9 |
10 | fun last [] = raise Empty
11 | | last [x] = x
12 | | last (_::r) = last r
13 |
14 | fun loop ([], []) = EQUAL
15 | | loop ([], _) = LESS
16 | | loop (_, []) = GREATER
17 | | loop (x :: xs, y :: ys) =
18 | (case compare (x, y) of
19 | EQUAL => loop (xs, ys)
20 | | unequal => unequal)
21 | in
22 | loop
23 | end
24 |
25 | end (* structure List *)
26 |
27 |
--------------------------------------------------------------------------------
/test/markup/java/gh1031.expect.txt:
--------------------------------------------------------------------------------
1 | public class DefaultDataDaoImpl {
2 | private List<AbstractCmrDataProcessor> cmrDataProcessors;
3 | }
4 |
5 | public class DefaultDataDaoImpl {
6 | private List<AbstractCmrDataProcessor, AbstractCmrDataProcessor> cmrDataProcessors;
7 | }
8 |
--------------------------------------------------------------------------------
/test/detect/mipsasm/default.txt:
--------------------------------------------------------------------------------
1 | .text
2 | .global AckermannFunc
3 |
4 | # Preconditions:
5 | # 1st parameter ($a0) m
6 | # 2nd parameter ($a1) n
7 | # Postconditions:
8 | # result in ($v0) = value of A(m,n)
9 |
10 | AckermannFunc:
11 | addi $sp, $sp, -8
12 | sw $s0, 4($sp)
13 | sw $ra, 0($sp)
14 |
15 | # move the parameter registers to temporary - no, only when nec.
16 |
17 | LABEL_IF: bne $a0, $zero, LABEL_ELSE_IF
18 |
19 | addi $v0, $a1, 1
20 |
21 | # jump to LABEL_DONE
22 | j LABEL_DONE
23 |
--------------------------------------------------------------------------------
/test/markup/matlab/block_comment.txt:
--------------------------------------------------------------------------------
1 | %{ evaluate_this = false; % Evaluated as regular single-line comment
2 | evaluate_this = true;
3 | %}
4 |
5 | evaluate_this = true;
6 |
7 | %{
8 | This is a multi-line comment
9 | evaluate_this = false;
10 | %{
11 | %}
12 |
13 | evaluate_this = true;
14 |
15 | %{
16 | Opening (%{) and closing (%}) block comment markers can be within a comment block
17 | %}
18 |
19 | evaluate_this = true;
20 |
21 | %{
22 | Indented block comments can be indented
23 | or not
24 | and whitespace can be added before or after the %{ and %}
25 | %}
26 |
27 | evaluate_this = true;
28 |
--------------------------------------------------------------------------------
/test/detect/abnf/default.txt:
--------------------------------------------------------------------------------
1 | ; line comment
2 |
3 | ruleset = [optional] *(group1 / group2 / SP) CRLF ; trailing comment
4 |
5 | group1 = alt1
6 | group1 =/ alt2
7 |
8 | alt1 = %x41-4D / %d78-90
9 |
10 | alt2 = %b00100001
11 |
12 | group2 = *1DIGIT / 2*HEXDIG / 3*4OCTET
13 |
14 | optional = hex-codes
15 | / literal
16 | / sensitive
17 | / insensitive
18 |
19 | hex-codes = %x68.65.6C.6C.6F
20 | literal = "string literal"
21 | sensitive = %s"case-sensitive string"
22 | insensitive = %i"case-insensitive string"
23 |
--------------------------------------------------------------------------------
/test/detect/mel/default.txt:
--------------------------------------------------------------------------------
1 | proc string[] getSelectedLights()
2 |
3 | {
4 | string $selectedLights[];
5 |
6 | string $select[] = `ls -sl -dag -leaf`;
7 |
8 | for ( $shape in $select )
9 | {
10 | // Determine if this is a light.
11 | //
12 | string $class[] = getClassification( `nodeType $shape` );
13 |
14 |
15 | if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) )
16 | {
17 | $selectedLights[ `size $selectedLights` ] = $shape;
18 | }
19 | }
20 |
21 | // Result is an array of all lights included in
22 |
23 | // current selection list.
24 | return $selectedLights;
25 | }
26 |
--------------------------------------------------------------------------------
/test/special/endsWithParentVariants.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | let utility = require('../utility');
4 |
5 | describe('ends with parent variants', function() {
6 | before(function() {
7 | const filename = utility.buildPath('fixtures', 'expect', 'endsWithParentVariants.txt'),
8 | testHTML = document.querySelectorAll('#ends-with-parent-variants .hljs');
9 |
10 | return utility.setupFile(filename, 'utf-8', this, testHTML);
11 | });
12 |
13 | it('should end on all variants', function() {
14 | const actual = this.blocks[0];
15 |
16 | actual.should.equal(this.expected);
17 | });
18 |
19 | });
20 |
--------------------------------------------------------------------------------
/src/languages/erb.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: ERB (Embedded Ruby)
3 | Requires: xml.js, ruby.js
4 | Author: Lucas Mazza
5 | Contributors: Kassio Borges
6 | Description: "Bridge" language defining fragments of Ruby in HTML within <% .. %>
7 | Category: template
8 | */
9 |
10 | function(hljs) {
11 | return {
12 | subLanguage: 'xml',
13 | contains: [
14 | hljs.COMMENT('<%#', '%>'),
15 | {
16 | begin: '<%[%=-]?', end: '[%-]?%>',
17 | subLanguage: 'ruby',
18 | excludeBegin: true,
19 | excludeEnd: true
20 | }
21 | ]
22 | };
23 | }
24 |
--------------------------------------------------------------------------------
/test/detect/cmake/default.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.8)
2 | project(cmake_example)
3 |
4 | # Show message on Linux platform
5 | if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
6 | message("Good choice, bro!")
7 | endif()
8 |
9 | # Tell CMake to run moc when necessary:
10 | set(CMAKE_AUTOMOC ON)
11 | # As moc files are generated in the binary dir,
12 | # tell CMake to always look for includes there:
13 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
14 |
15 | # Widgets finds its own dependencies.
16 | find_package(Qt5Widgets REQUIRED)
17 |
18 | add_executable(myproject main.cpp mainwindow.cpp)
19 | qt5_use_modules(myproject Widgets)
20 |
--------------------------------------------------------------------------------
/test/detect/cpp/comment.txt:
--------------------------------------------------------------------------------
1 | /*
2 | To use this program, compile it -- if you can -- and then type something like:
3 |
4 | chan -n 5000 -d 2 < input.txt
5 |
6 | In this case, it will produce 5000 words of output, checking two-word groups.
7 | (The explanation above describes two-word generation. If you type "-d 3",
8 | the program will find three-word groups, and so on. Greater depths make more
9 | sense, but they require more input text and take more time to process.)
10 |
11 | http://www.eblong.com/zarf/markov/
12 | */
13 |
14 |
15 | /* make cpp win deterministically over others with C block comments */
16 | cout << endl;
17 |
--------------------------------------------------------------------------------
/test/markup/typescript/class.expect.txt:
--------------------------------------------------------------------------------
1 | class Car extends Vehicle {
2 | constructor(speed, cost) {
3 | super(speed);
4 |
5 | var c = Symbol('cost');
6 | this[c] = cost;
7 |
8 | this.intro = `This is a car runs at
9 | ${speed}.`;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/test/markup/reasonml/pattern-matching.txt:
--------------------------------------------------------------------------------
1 | let message =
2 | switch (person1) {
3 | | School.Teacher => "Hello teacher!"
4 | | School.Director => "Hello director!"
5 | };
6 |
7 | let message =
8 | School.(
9 | switch (person1) {
10 | | Teacher => "Hello teacher!"
11 | | Director => "Hello director!"
12 | }
13 | );
14 |
15 | let readCacheServiceConfigAndDecode = (configJson) =>
16 | switch (configJson |> Js.Json.decodeObject) {
17 | | None => raise(Json.Decode.DecodeError("Invalid Cache Config"))
18 | | Some(data) =>
19 | data |> Js.Dict.map((. json) => CachingServiceConfig.decode(json))
20 | };
21 |
--------------------------------------------------------------------------------
/test/detect/mercury/default.txt:
--------------------------------------------------------------------------------
1 | % "Hello World" in Mercury.
2 | :- module hello.
3 |
4 |
5 | :- interface.
6 | :- import_module io.
7 |
8 | :- pred main(io::di, io::uo) is det.
9 |
10 |
11 | :- implementation.
12 |
13 | main(!IO) :-
14 | io.write_string("Hello, world\n", !IO).
15 |
16 | :- pred filter(pred(T), list(T), list(T), list(T) ).
17 | :- mode filter(in(pred(in) is semidet), in, out, out ) is det.
18 |
19 | filter(_, [], [], []).
20 | filter(P, [X | Xs], Ys, Zs) :-
21 | filter(P, Xs, Ys0, Zs0),
22 | ( if P(X) then Ys = [X | Ys0], Zs = Zs0
23 | else Ys = Ys0 , Zs = [X | Zs0]
24 | ).
25 |
--------------------------------------------------------------------------------
/test/markup/sql/join.txt:
--------------------------------------------------------------------------------
1 | SELECT
2 | left_table.col1 AS l_col1,
3 | left_table.col2 AS l_col2
4 | FROM
5 | VALUES (0, 10), (1, 11), (2, 12), (3,13), (4, 14), (5, 14) AS left_table
6 | ANTI JOIN
7 | VALUES (0, 10), (2, 12), (4, 14), (6, 16) AS right_table
8 | ON left_table.col1 = right_table.col1;
9 |
10 | SELECT
11 | left_table.col1 AS l_col1,
12 | left_table.col2 AS l_col2
13 | FROM
14 | VALUES (0, 10), (1, 11), (2, 12), (3,13), (4, 14), (5, 14) AS left_table
15 | LEFT SEMI JOIN
16 | VALUES (0, 10), (2, 12), (4, 14), (6, 16) AS right_table
17 | ON left_table.col1 = right_table.col1;
18 |
--------------------------------------------------------------------------------
/test/markup/subunit/subunit-testline.expect.txt:
--------------------------------------------------------------------------------
1 | test: test basicsuite1
2 | testing: test basicsuite1
3 | test test basicsuite1
4 | testing test basicsuite1
5 | test: test basic suite1
6 | testing: test basic suite1
7 | test test basic suite1
8 | testing test basic suite1
9 | testing test basic
10 | test test 222
11 |
--------------------------------------------------------------------------------
/test/detect/gauss/default.txt:
--------------------------------------------------------------------------------
1 | // This is a test
2 | #include pv.sdf
3 |
4 | proc (1) = calc(local__row, fin);
5 | if local__row;
6 | nr = local__row;
7 | else;
8 | k = colsf(fin);
9 | nr = floor(minc(maxbytes/(k*8*3.5)|maxvec/(k+1)));
10 | endif;
11 | retp(nr);
12 | endp;
13 |
14 | s = "{% test string %}";
15 |
16 | fn twopi=pi*2;
17 |
18 | /* Takes in multiple numbers.
19 | Output sum */
20 | keyword add(str);
21 | local tok,sum;
22 | sum = 0;
23 | do until str $== "";
24 | { tok, str } = token(str);
25 | sum = sum + stof(tok);
26 | endo;
27 | print "Sum is: " sum;
28 | endp;
29 |
--------------------------------------------------------------------------------
/test/detect/fix/default.txt:
--------------------------------------------------------------------------------
1 | 8=FIX.4.2␁9=0␁35=8␁49=SENDERTEST␁56=TARGETTEST␁34=00000001526␁52=20120429-13:30:08.137␁1=ABC12345␁11=2012abc1234␁14=100␁17=201254321␁20=0␁30=NYSE␁31=108.20␁32=100␁38=100␁39=2␁40=1␁47=A␁54=5␁55=BRK␁59=2␁60=20120429-13:30:08.000␁65=B␁76=BROKER␁84=0␁100=NYSE␁111=100␁150=2␁151=0␁167=CS␁377=N␁10000=SampleCustomTag␁10=123␁
2 |
3 | 8=FIX.4.29=035=849=SENDERTEST56=TARGETTEST34=0000000152652=20120429-13:30:08.1371=ABC1234511=2012abc123414=10017=20125432120=030=NYSE31=108.2032=10038=10039=240=147=A54=555=BRK59=260=20120429-13:30:08.00065=B76=BROKER84=0100=NYSE111=100150=2151=0167=CS377=N10000=SampleCustomTag10=123
4 |
--------------------------------------------------------------------------------
/test/markup/protobuf/message-message.expect.txt:
--------------------------------------------------------------------------------
1 | message Container {
2 | message Message {
3 | required int64 id = 1;
4 | }
5 | repeated Message messages = 1;
6 | optional int32 number = 2;
7 | }
8 |
--------------------------------------------------------------------------------
/test/markup/rust/numbers.expect.txt:
--------------------------------------------------------------------------------
1 | 123;
2 | 123usize;
3 | 123_usize;
4 | 0xff00;
5 | 0xff_u8;
6 | 0b1111111110010000;
7 | 0b1111_1111_1001_0000_i32;
8 | 0o764317;
9 | 0o764317_u16;
10 | 123.0;
11 | 0.1;
12 | 0.1f32;
13 | 12E+99_f64;
14 |
--------------------------------------------------------------------------------
/test/detect/yaml/default.txt:
--------------------------------------------------------------------------------
1 | ---
2 | # comment
3 | string_1: "Bar"
4 | string_2: 'bar'
5 | string_3: bar
6 | inline_keys_ignored: sompath/name/file.jpg
7 | keywords_in_yaml:
8 | - true
9 | - false
10 | - TRUE
11 | - FALSE
12 | - 21
13 | - 21.0
14 | - !!str 123
15 | "quoted_key": &foobar
16 | bar: foo
17 | foo:
18 | "foo": bar
19 |
20 | reference: *foobar
21 |
22 | multiline_1: |
23 | Multiline
24 | String
25 | multiline_2: >
26 | Multiline
27 | String
28 | multiline_3: "
29 | Multiline string
30 | "
31 |
32 | ansible_variables: "foo {{variable}}"
33 |
34 | array_nested:
35 | - a
36 | - b: 1
37 | c: 2
38 | - b
39 | - comment
40 |
--------------------------------------------------------------------------------
/test/detect/apache/default.txt:
--------------------------------------------------------------------------------
1 | # rewrite`s rules for wordpress pretty url
2 | LoadModule rewrite_module modules/mod_rewrite.so
3 | RewriteCond %{REQUEST_FILENAME} !-f
4 | RewriteCond %{REQUEST_FILENAME} !-d
5 | RewriteRule . index.php [NC,L]
6 |
7 | ExpiresActive On
8 | ExpiresByType application/x-javascript "access plus 1 days"
9 |
10 | Order Deny,Allow
11 | Allow from All
12 |
13 |
14 | RewriteMap map txt:map.txt
15 | RewriteMap lower int:tolower
16 | RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
17 | RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
18 | RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
19 |
20 |
--------------------------------------------------------------------------------
/test/detect/avrasm/default.txt:
--------------------------------------------------------------------------------
1 | ;* Title: Block Copy Routines
2 | ;* Version: 1.1
3 |
4 | .include "8515def.inc"
5 |
6 | rjmp RESET ;reset handle
7 |
8 | .def flashsize=r16 ;size of block to be copied
9 |
10 | flash2ram:
11 | lpm ;get constant
12 | st Y+,r0 ;store in SRAM and increment Y-pointer
13 | adiw ZL,1 ;increment Z-pointer
14 | dec flashsize
15 | brne flash2ram ;if not end of table, loop more
16 | ret
17 |
18 | .def ramtemp =r1 ;temporary storage register
19 | .def ramsize =r16 ;size of block to be copied
20 |
--------------------------------------------------------------------------------
/test/markup/typescript/module-id.expect.txt:
--------------------------------------------------------------------------------
1 | @Component({
2 | selector: 'my-example',
3 | directives: [SomeDirective],
4 | templateUrl: './my-example.component.html',
5 | moduleId: module.id,
6 | styles: [`
7 | .my-example {
8 | padding: 5px;
9 | }
10 | `]
11 | })
12 | export class MyExampleComponent {
13 | someProp: string = "blah";
14 | }
15 |
--------------------------------------------------------------------------------
/test/markup/aspectj/intertype-method.expect.txt:
--------------------------------------------------------------------------------
1 | public void MyClass.doSomething() throws Exception{
2 |
3 | }
4 | public void A.doSomething(int param1){
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/test/markup/sql/window-function.txt:
--------------------------------------------------------------------------------
1 | SELECT *
2 | FROM (
3 | SELECT
4 | posts.col1 AS emp_id,
5 | posts.col2 AS dept_id,
6 | posts.col3 AS posts,
7 | DENSE_RANK() OVER post_ranking AS rank
8 | FROM VALUES
9 | (1, 1 ,100),
10 | (2, 1 ,50),
11 | (8, 1 ,250),
12 | (3, 2 ,200),
13 | (4, 2 ,300),
14 | (9, 2 ,1000),
15 | (5, 3 ,300),
16 | (6, 3 ,100),
17 | (7, 3 ,400) AS posts
18 | WINDOW post_ranking AS (
19 | PARTITION BY posts.col2
20 | ORDER BY posts.col3 DESC
21 | ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
22 | )
23 | WHERE rank <= 2;
24 |
--------------------------------------------------------------------------------
/test/special/languageAlias.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | let _ = require('lodash');
4 | let utility = require('../utility');
5 |
6 | describe('language alias', function() {
7 | before(function() {
8 | const testHTML = document.querySelectorAll('#language-alias .hljs');
9 |
10 | this.blocks = _.map(testHTML, 'innerHTML');
11 | });
12 |
13 | it('should highlight as aliased language', function() {
14 | const filename = utility.buildPath('fixtures', 'expect',
15 | 'languagealias.txt'),
16 | actual = this.blocks[0];
17 |
18 | return utility.expectedFile(filename, 'utf-8', actual);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/test/detect/actionscript/default.txt:
--------------------------------------------------------------------------------
1 | package org.example.dummy {
2 | import org.dummy.*;
3 |
4 | /*define package inline interface*/
5 | public interface IFooBarzable {
6 | public function foo(... pairs):Array;
7 | }
8 |
9 | public class FooBar implements IFooBarzable {
10 | static private var cnt:uint = 0;
11 | private var bar:String;
12 |
13 | //constructor
14 | public function TestBar(bar:String):void {
15 | bar = bar;
16 | ++cnt;
17 | }
18 |
19 | public function foo(... pairs):Array {
20 | pairs.push(bar);
21 | return pairs;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/test/markup/rust/traits.expect.txt:
--------------------------------------------------------------------------------
1 | fn sqr(i: i32) { i * i }
2 | trait Minimum : Copy {}
3 | pub trait Builder where Self: Sized + Iterator<Item=Event> {}
4 |
--------------------------------------------------------------------------------
/test/markup/xquery/prolog_declarations.txt:
--------------------------------------------------------------------------------
1 | xquery version "3.1";
2 | (:~
3 | : @author Duncan Paterson
4 | : @version 1.0:)
5 |
6 | module namespace app="http://none";
7 |
8 | import module namespace config="http://config" at "config.xqm"; (: schema :)
9 |
10 |
11 | declare copy-namespaces no-preserve, inherit;
12 | (: switch to preserve, no-inherit:)
13 |
14 | declare %private variable $app:maxItems := 12;
15 | declare context item := doc("catalog.xml");
16 |
17 | declare %templates:wrap-all function app:helloworld($node as node(), $model as map(*), $name as xs:string?) {
18 | if ($name) then
19 | Hello {$name}!
20 | else
21 | ()
22 | };
23 |
--------------------------------------------------------------------------------
/test/detect/gcode/default.txt:
--------------------------------------------------------------------------------
1 | O003 (DIAMOND SQUARE)
2 | N2 G54 G90 G49 G80
3 | N3 M6 T1 (1.ENDMILL)
4 | N4 M3 S1800
5 | N5 G0 X-.6 Y2.050
6 | N6 G43 H1 Z.1
7 | N7 G1 Z-.3 F50.
8 | N8 G41 D1 Y1.45
9 | N9 G1 X0 F20.
10 | N10 G2 J-1.45
11 | (CUTTER COMP CANCEL)
12 | N11 G1 Z-.2 F50.
13 | N12 Y-.990
14 | N13 G40
15 | N14 G0 X-.6 Y1.590
16 | N15 G0 Z.1
17 | N16 M5 G49 G28 G91 Z0
18 | N17 CALL O9456
19 | N18 #500=0.004
20 | N19 #503=[#500+#501]
21 | N20 VC45=0.0006
22 | VS4=0.0007
23 | N21 G90 G10 L20 P3 X5.Y4. Z6.567
24 | N22 G0 X5000
25 | N23 IF [#1 LT 0.370] GOTO 49
26 | N24 X-0.678 Y+.990
27 | N25 G84.3 X-0.1
28 | N26 #4=#5*COS[45]
29 | N27 #4=#5*SIN[45]
30 | N28 VZOFZ=652.9658
31 | %
32 |
--------------------------------------------------------------------------------
/test/fixtures/expect/sublanguages.txt:
--------------------------------------------------------------------------------
1 | <? echo 'php'; ?>
2 | <body>
3 | <script>document.write('Legacy code');</script>
4 | </body>
5 |
--------------------------------------------------------------------------------
/test/markup/tap/yaml-block.txt:
--------------------------------------------------------------------------------
1 | TAP version 13
2 | ok - created Board
3 | ok
4 | ok
5 | ok
6 | ok
7 | ok
8 | ok
9 | ok
10 | ---
11 | message: "Board layout"
12 | severity: comment
13 | dump:
14 | board:
15 | - ' 16G 05C '
16 | - ' G N C C C G '
17 | - ' G C + '
18 | - '10C 01G 03C '
19 | - 'R N G G A G C C C '
20 | - ' R G C + '
21 | - ' 01G 17C 00C '
22 | - ' G A G G N R R N R '
23 | - ' G R G '
24 | ...
25 | ok - board has 7 tiles + starter tile
26 | 1..9
27 |
--------------------------------------------------------------------------------
/test/markup/coffeescript/regex.expect.txt:
--------------------------------------------------------------------------------
1 |
2 | x = /\//
3 | x = /\n/
4 | x = /ab\/ ab/
5 | x = f /6 * 2/ - 3
6 | x = f /foo * 2/gm
7 | x = if true then /\n/ else /[.,]+/
8 | x = ///^key-#{key}-\d+///
9 |
--------------------------------------------------------------------------------
/test/markup/ldif/schema.txt:
--------------------------------------------------------------------------------
1 | dn: cn=schema
2 | objectClass: top
3 | objectClass: ldapSubentry
4 | objectClass: subschema
5 | # Single-valued JSON attribute
6 | attributeTypes: ( example-json1-oid NAME 'json1'
7 | EQUALITY jsonObjectExactMatch SYNTAX 1.3.6.1.4.1.30221.2.3.4
8 | SINGLE-VALUE X-ORIGIN 'custom attribute' )
9 | # Multi-valued JSON attribute
10 | attributeTypes: ( example-mjson1-oid NAME 'mjson1'
11 | EQUALITY jsonObjectExactMatch SYNTAX 1.3.6.1.4.1.30221.2.3.4
12 | X-ORIGIN 'custom attribute' )
13 | objectClasses: ( example-application-oc-oid NAME 'example-application-oc'
14 | SUP top AUXILIARY MAY ( json1 $ mjson1 )
15 | X-ORIGIN 'custom auxiliary object class' )
16 |
--------------------------------------------------------------------------------
/test/detect/cos/default.txt:
--------------------------------------------------------------------------------
1 | #dim test as %Library.Integer
2 | SET test = 123.099
3 | set ^global = %request.Content
4 | Write "Current date """, $ztimestamp, """, result: ", test + ^global = 125.099
5 | do ##class(Cinema.Utils).AddShow("test") // class method call
6 | do ##super() ; another one-line comment
7 | d:(^global = 2) ..thisClassMethod(1, 2, "test")
8 | /*
9 | * Sub-languages support:
10 | */
11 | &sql( SELECT * FROM Cinema.Film WHERE Length > 2 )
12 | &js
15 | &html<
16 |
17 |
18 | Test
19 | >
20 |
21 | quit $$$OK
22 |
--------------------------------------------------------------------------------
/src/languages/ldif.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: LDIF
3 | Contributors: Jacob Childress
4 | Category: enterprise, config
5 | */
6 | function(hljs) {
7 | return {
8 | contains: [
9 | {
10 | className: 'attribute',
11 | begin: '^dn', end: ': ', excludeEnd: true,
12 | starts: {end: '$', relevance: 0},
13 | relevance: 10
14 | },
15 | {
16 | className: 'attribute',
17 | begin: '^\\w', end: ': ', excludeEnd: true,
18 | starts: {end: '$', relevance: 0}
19 | },
20 | {
21 | className: 'literal',
22 | begin: '^-', end: '$'
23 | },
24 | hljs.HASH_COMMENT_MODE
25 | ]
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/test/api/fixmarkup.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | let should = require('should');
4 | let hljs = require('../../build');
5 |
6 | describe('.fixmarkup()', function() {
7 | after(function() {
8 | hljs.configure({ useBR: false })
9 | })
10 |
11 | it('should not add "undefined" to the beginning of the result (#1452)', function() {
12 | hljs.configure({ useBR: true })
13 | const value = '{ "some": \n "json" }';
14 | const result = hljs.fixMarkup(value);
15 |
16 |
17 | result.should.equal(
18 | '{ "some":
"json" }'
19 | );
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/test/markup/diff/comments.expect.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @@ -1,8 +1,7 @@
6 | + Here we highlight correctly
7 |
8 | + Here too
9 |
10 | + Here we don't anymore after five '=' next to each other
11 |
--------------------------------------------------------------------------------
/test/markup/cos/embedded.expect.txt:
--------------------------------------------------------------------------------
1 |
4 | &sql(SELECT * FROM Cinema.Film WHERE Length > 2)
5 | &js<for (var i = 0; i < String("test").split("").length); ++i) { console.log(i); }>
6 |
--------------------------------------------------------------------------------
/test/markup/cpp/function-params.expect.txt:
--------------------------------------------------------------------------------
1 | int f(
2 | int a = 1,
3 | char* b = "2",
4 | double c = 3.0,
5 | ARRAY(int, 5) d,
6 | void* e __attribute__((unused))
7 | );
8 |
--------------------------------------------------------------------------------
/test/markup/pgsql/constraints.txt:
--------------------------------------------------------------------------------
1 | -- column_constraint, table_constraint:
2 |
3 | CONSTRAINT,
4 | NOT NULL, NULL,
5 | CHECK ( .. ) NO INHERIT,
6 | DEFAULT ..,
7 | EXCLUDE USING .. ( .. WITH .. ) .. WHERE ( .. ),
8 | GENERATED ALWAYS AS IDENTITY,
9 | GENERATED ALWAYS AS IDENTITY ( .. ),
10 | GENERATED BY DEFAULT AS IDENTITY,
11 | UNIQUE .., UNIQUE ( .. ),
12 | PRIMARY KEY .., PRIMARY KEY ( .. ),
13 | REFERENCES, REFERENCES .. ( .. ),
14 | MATCH FULL, MATCH PARTIAL, MATCH SIMPLE,
15 | ON DELETE .., ON UPDATE ..,
16 | DEFERRABLE, NOT DEFERRABLE, INITIALLY DEFERRED, INITIALLY IMMEDIATE,
17 | FOREIGN KEY ( .. ) REFERENCES,
18 | USING INDEX bar,
19 | INCLUDE ( .. ),
20 | WITH ( .. ),
21 | USING INDEX TABLESPACE;
22 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "lts/*"
4 | - "node"
5 | env:
6 | -
7 | - BROWSER=1
8 | - BROWSER=1 NOCOMPRESS=1
9 | script:
10 | - |
11 | export BUILD_PARAMS=""
12 |
13 | if [ "x$BROWSER" = "x1" ]; then
14 | export BUILD_PARAMS="$BUILD_PARAMS -t browser"
15 | else
16 | export BUILD_PARAMS="$BUILD_PARAMS -t node"
17 | fi
18 |
19 | if [ "x$NOCOMPRESS" = "x1" ]; then
20 | export BUILD_PARAMS="$BUILD_PARAMS -n"
21 | fi
22 |
23 | node tools/build.js $BUILD_PARAMS
24 |
25 | if [ "x$BROWSER" = "x1" ]; then
26 | npm run test-browser
27 | else
28 | npm run test
29 | fi
30 | sudo: false # Use container-based architecture
31 |
--------------------------------------------------------------------------------
/test/detect/ldif/default.txt:
--------------------------------------------------------------------------------
1 | # Example LDAP user
2 | dn: uid=user.0,ou=People,dc=example,dc=com
3 | objectClass: top
4 | objectClass: person
5 | objectClass: organizationalPerson
6 | objectClass: inetOrgPerson
7 | givenName: Morris
8 | sn: Day
9 | cn: Morris Day
10 | initials: MD
11 | employeeNumber: 0
12 | uid: user.0
13 | mail: user.0@example.com
14 | userPassword: password
15 | telephoneNumber: +1 042 100 3866
16 | homePhone: +1 039 680 4135
17 | pager: +1 284 199 0966
18 | mobile: +1 793 707 0251
19 | street: 90280 Spruce Street
20 | l: Minneapolis
21 | st: MN
22 | postalCode: 50401
23 | postalAddress: Morris Day$90280 Spruce Street$Minneapolis, MN 50401
24 | description: This is the description for Morris Day.
25 |
--------------------------------------------------------------------------------
/test/detect/protobuf/default.txt:
--------------------------------------------------------------------------------
1 | package languages.protobuf;
2 |
3 | option java_package = "org.highlightjs.languages.protobuf";
4 |
5 | message Customer {
6 | required int64 customer_id = 1;
7 | optional string name = 2;
8 | optional string real_name = 3 [default = "Anonymous"];
9 | optional Gender gender = 4;
10 | repeated string email_addresses = 5;
11 |
12 | optional bool is_admin = 6 [default = false]; // or should this be a repeated field in Account?
13 |
14 | enum Gender {
15 | MALE = 1,
16 | FEMALE = 2
17 | }
18 | }
19 |
20 | service CustomerSearch {
21 | rpc FirstMatch(CustomerRequest) returns (CustomerResponse);
22 | rpc AllMatches(CustomerRequest) returns (CustomerResponse);
23 | }
--------------------------------------------------------------------------------
/test/detect/lisp/default.txt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env csi
2 |
3 | (defun prompt-for-cd ()
4 | "Prompts
5 | for CD"
6 | (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6))
7 | (prompt-read "Artist" &rest)
8 | (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
9 | (if x (format t "yes") (format t "no" nil) ;and here comment
10 | )
11 | ;; second line comment
12 | '(+ 1 2)
13 | (defvar *lines*) ; list of all lines
14 | (position-if-not #'sys::whitespacep line :start beg))
15 | (quote (privet 1 2 3))
16 | '(hello world)
17 | (* 5 7)
18 | (1 2 34 5)
19 | (:use "aaaa")
20 | (let ((x 10) (y 20))
21 | (print (+ x y))
22 | )
--------------------------------------------------------------------------------
/test/markup/crystal/regexes.expect.txt:
--------------------------------------------------------------------------------
1 | if /foo/
2 | unless /foo/
3 | case /foo/
4 | select /foo/
5 | when /foo/
6 | while /foo/
7 | until /foo/
8 | +/foo/
9 |
10 |
11 | xif /foo/
12 | ifx /foo/
13 |
--------------------------------------------------------------------------------
/test/markup/javascript/class.expect.txt:
--------------------------------------------------------------------------------
1 | class Car extends Vehicle {
2 | constructor(speed, cost) {
3 | super(speed);
4 |
5 | var c = Symbol('cost');
6 | this[c] = cost;
7 |
8 | this.intro = `This is a car runs at
9 | ${speed}.`;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/test/detect/livecodeserver/default.txt:
--------------------------------------------------------------------------------
1 | 2000000000 then
21 | put "Welcome to the future!"
22 | else
23 | return "something"
24 | end if
25 | end myFunction
26 |
27 |
28 | --| END OF blog.lc
29 | --| Location: ./system/application/controllers/blog.lc
30 | ----------------------------------------------------------------------
31 |
--------------------------------------------------------------------------------
/test/detect/tcl/default.txt:
--------------------------------------------------------------------------------
1 | package json
2 |
3 | source helper.tcl
4 | # randomness verified by a die throw
5 | set ::rand 4
6 |
7 | proc give::recursive::count {base p} { ; # 2 mandatory params
8 | while {$p > 0} {
9 | set result [expr $result * $base]; incr p -1
10 | }
11 | return $result
12 | }
13 |
14 | set a {a}; set b "bcdef"; set lst [list "item"]
15 | puts [llength $a$b]
16 |
17 | set ::my::tid($id) $::my::tid(def)
18 | lappend lst $arr($idx) $::my::arr($idx) $ar(key)
19 | lreplace ::my::tid($id) 4 4
20 | puts $::rand ${::rand} ${::AWESOME::component::variable}
21 |
22 | puts "$x + $y is\t [expr $x + $y]"
23 |
24 | proc isprime x {
25 | expr {$x>1 && ![regexp {^(oo+?)\1+$} [string repeat o $x]]}
26 | }
27 |
--------------------------------------------------------------------------------
/test/markup/ruby/prompt.txt:
--------------------------------------------------------------------------------
1 | 2.0.0p0 :001 > ['some']
2 | => ["some"]
3 | 2.0.0p0 :002 > if true
4 | 2.0.0p0 :003?> "yop"
5 | 2.0.0p0 :004?> end
6 | => "yop"
7 |
8 | jruby-1.7.16 :001 > "RVM-Format"
9 |
10 | >> obj = OpenStruct.new :integer => 987, :symbol => :so_great
11 | => #
12 | >> [obj,obj,obj]
13 | => [#, #, #]
14 | >> {1 => obj, 2 => obj}
15 | => {1=>#, 2=>#}
16 | >> if 10 > 20
17 | >> "YEAH"
18 | >> else
19 | ?> "NO"
20 | >> end
21 | => "NO"
22 |
23 | irb(main):002:0> test = 1
24 |
--------------------------------------------------------------------------------
/test/detect/jboss-cli/default.txt:
--------------------------------------------------------------------------------
1 | jms-queue add --queue-address=myQueue --entries=queue/myQueue
2 |
3 | deploy /path/to/file.war
4 |
5 | /system-property=prop1:add(value=value1)
6 |
7 |
8 |
9 | /extension=org.jboss.as.modcluster:add
10 |
11 | ./foo=bar:remove
12 |
13 | /subsystem=security/security-domain=demo-realm/authentication=classic:add
14 |
15 | /subsystem=security/security-domain=demo-realm/authentication=classic/login-module=UsersRoles:add( \
16 | code=UsersRoles, \
17 | flag=required, \
18 | module-options= { \
19 | usersProperties=auth/demo-users.properties, \
20 | rolesProperties =auth/demo-roles.properties, \
21 | hashAlgorithm= MD5, \
22 | hashCharset="UTF-8" \
23 | } \
24 | )
25 |
--------------------------------------------------------------------------------
/test/detect/julia-repl/default.txt:
--------------------------------------------------------------------------------
1 | julia> function foo(x) x + 1 end
2 | foo (generic function with 1 method)
3 |
4 | julia> foo(42)
5 | 43
6 |
7 | julia> foo(42) === 43.
8 | false
9 |
10 |
11 | Here we match all three lines of code:
12 |
13 | julia> function foo(x::Float64)
14 | 42. - x
15 | end
16 | foo (generic function with 2 methods)
17 |
18 | julia> for x in Any[1, 2, 3.4]
19 | println("foo($x) = $(foo(x))")
20 | end
21 | foo(1) = 2
22 | foo(2) = 3
23 | foo(3.4) = 38.6
24 |
25 |
26 | ... unless it is not properly indented:
27 |
28 | julia> function foo(x)
29 | x + 1
30 | end
31 |
32 |
33 | Ordinary Julia code does not get highlighted:
34 |
35 | Pkg.add("Combinatorics")
36 | abstract type Foo end
37 |
--------------------------------------------------------------------------------
/test/detect/routeros/default.txt:
--------------------------------------------------------------------------------
1 | # Берем список DNS серверов из /ip dns
2 | # Проверяем их доступность,
3 | # и только рабочие прописываем в настройки DHCP сервера
4 | :global ActiveDNSServers []
5 | :local PingResult 0
6 | :foreach serv in=[/ip dns get servers] do={
7 | :do {:set PingResult [ping $serv count=3]} on-error={:set PingResult 0}
8 | :if ($PingResult=3) do={ :set ActiveDNSServers ($ActiveDNSServers,$serv) }
9 | # отладочный вывод в журнал
10 | :log info "Server: $serv, Ping-result: $PingResult";
11 | }
12 |
13 | /ip dhcp-server network set [find address=192.168.254.0/24] dns-server=$ActiveDNSServers
14 |
15 | #--- FIX TTL ----
16 | /ip firewall mangle chain=postrouting action=change-ttl new-ttl=set:128 comment="NAT hide"
17 |
18 |
--------------------------------------------------------------------------------
/test/detect/thrift/default.txt:
--------------------------------------------------------------------------------
1 | namespace * thrift.test
2 |
3 | /**
4 | * Docstring!
5 | */
6 | enum Numberz
7 | {
8 | ONE = 1,
9 | TWO,
10 | THREE,
11 | FIVE = 5,
12 | SIX,
13 | EIGHT = 8
14 | }
15 |
16 | const Numberz myNumberz = Numberz.ONE;
17 | // the following is expected to fail:
18 | // const Numberz urNumberz = ONE;
19 |
20 | typedef i64 UserId
21 |
22 | struct Msg
23 | {
24 | 1: string message,
25 | 2: i32 type
26 | }
27 | struct NestedListsI32x2
28 | {
29 | 1: list> integerlist
30 | }
31 | struct NestedListsI32x3
32 | {
33 | 1: list>> integerlist
34 | }
35 | service ThriftTest
36 | {
37 | void testVoid(),
38 | string testString(1: string thing),
39 | oneway void testInit()
40 | }
--------------------------------------------------------------------------------
/test/detect/ocaml/default.txt:
--------------------------------------------------------------------------------
1 | (* This is a
2 | multiline, (* nested *) comment *)
3 | type point = { x: float; y: float };;
4 | let some_string = "this is a string";;
5 | let rec length lst =
6 | match lst with
7 | [] -> 0
8 | | head :: tail -> 1 + length tail
9 | ;;
10 | exception Test;;
11 | type expression =
12 | Const of float
13 | | Var of string
14 | | Sum of expression * expression (* e1 + e2 *)
15 | | Diff of expression * expression (* e1 - e2 *)
16 | | Prod of expression * expression (* e1 * e2 *)
17 | | Quot of expression * expression (* e1 / e2 *)
18 | class point =
19 | object
20 | val mutable x = 0
21 | method get_x = x
22 | method private move d = x <- x + d
23 | end;;
24 |
--------------------------------------------------------------------------------
/test/markup/golo/default.expect.txt:
--------------------------------------------------------------------------------
1 | module hello
2 |
3 | function dyno = -> DynamicObject()
4 |
5 | struct human = { name }
6 |
7 | @annotated
8 | function main = |args| {
9 | let a = 1
10 | var b = 2
11 |
12 | println("hello")
13 |
14 | let john = human("John Doe")
15 | }
16 |
--------------------------------------------------------------------------------
/src/languages/bnf.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Backus–Naur Form
3 | Author: Oleg Efimov
4 | */
5 |
6 | function(hljs){
7 | return {
8 | contains: [
9 | // Attribute
10 | {
11 | className: 'attribute',
12 | begin: /, end: />/
13 | },
14 | // Specific
15 | {
16 | begin: /::=/,
17 | starts: {
18 | end: /$/,
19 | contains: [
20 | {
21 | begin: /, end: />/
22 | },
23 | // Common
24 | hljs.C_LINE_COMMENT_MODE,
25 | hljs.C_BLOCK_COMMENT_MODE,
26 | hljs.APOS_STRING_MODE,
27 | hljs.QUOTE_STRING_MODE
28 | ]
29 | }
30 | }
31 | ]
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/test/detect/axapta/default.txt:
--------------------------------------------------------------------------------
1 | class ExchRateLoadBatch extends RunBaseBatch {
2 | ExchRateLoad rbc;
3 | container currencies;
4 | boolean actual;
5 | boolean overwrite;
6 | date beg;
7 | date end;
8 |
9 | #define.CurrentVersion(5)
10 |
11 | #localmacro.CurrentList
12 | currencies,
13 | actual,
14 | beg,
15 | end
16 | #endmacro
17 | }
18 |
19 | public boolean unpack(container packedClass) {
20 | container base;
21 | boolean ret;
22 | Integer version = runbase::getVersion(packedClass);
23 |
24 | switch (version) {
25 | case #CurrentVersion:
26 | [version, #CurrentList] = packedClass;
27 | return true;
28 | default:
29 | return false;
30 | }
31 | return ret;
32 | }
33 |
--------------------------------------------------------------------------------
/test/detect/lua/default.txt:
--------------------------------------------------------------------------------
1 | --[[
2 | Simple signal/slot implementation
3 | ]]
4 | local signal_mt = {
5 | __index = {
6 | register = table.insert
7 | }
8 | }
9 | function signal_mt.__index:emit(... --[[ Comment in params ]])
10 | for _, slot in ipairs(self) do
11 | slot(self, ...)
12 | end
13 | end
14 | local function create_signal()
15 | return setmetatable({}, signal_mt)
16 | end
17 |
18 | -- Signal test
19 | local signal = create_signal()
20 | signal:register(function(signal, ...)
21 | print(...)
22 | end)
23 | signal:emit('Answer to Life, the Universe, and Everything:', 42)
24 |
25 | --[==[ [=[ [[
26 | Nested ]]
27 | multi-line ]=]
28 | comment ]==]
29 | [==[ Nested
30 | [=[ multi-line
31 | [[ string
32 | ]] ]=] ]==]
33 |
--------------------------------------------------------------------------------
/test/markup/cpp/function-title.expect.txt:
--------------------------------------------------------------------------------
1 | int main() {
2 | A a = new A();
3 | int b = b * sum(1, 2);
4 | if (a->check1())
5 | return 3;
6 | else if (a->check2())
7 | return 4;
8 | return a->result();
9 | }
10 |
--------------------------------------------------------------------------------
/test/markup/ruby/heredoc.expect.txt:
--------------------------------------------------------------------------------
1 | def foo()
2 | msg = <<-HTML
3 | <div>
4 | <h4>#{bar}</h4>
5 | </div>
6 | HTML
7 | end
8 |
9 | def baz()
10 | msg = <<~FOO
11 | <div>
12 | <h4>#{bar}</h4>
13 | </div>
14 | FOO
15 | end
16 |
--------------------------------------------------------------------------------
/test/detect/mojolicious/default.txt:
--------------------------------------------------------------------------------
1 | %layout 'bootstrap';
2 | % title "Import your subs";
3 | %= form_for '/settings/import' => (method => 'post', enctype => 'multipart/form-data') => begin
4 | %= file_field 'opmlfile' => multiple => 'true'
5 | %= submit_button 'Import', 'class' => 'btn'
6 | % end
7 |
8 | % if ($subs) {
9 |
10 | % for my $item (@$subs) {
11 | % my ($dir, $align) = ($item->{rtl}) ? ('rtl', 'right') : ('ltr', 'left');
12 | - rss
13 | <%== $item->{title} %>
14 |
15 | - Categories
16 | %= join q{, }, sort @{ $item->{categories} || [] };
17 |
18 |
19 | % }
20 |
21 |
--------------------------------------------------------------------------------
/test/detect/parser3/default.txt:
--------------------------------------------------------------------------------
1 | @CLASS
2 | base
3 |
4 | @USE
5 | module.p
6 |
7 | @BASE
8 | class
9 |
10 | # Comment for code
11 | @create[aParam1;aParam2][local1;local2]
12 | ^connect[mysql://host/database?ClientCharset=windows-1251]
13 | ^for[i](1;10){
14 | ^eval($i+10)
15 | ^connect[mysql://host/database]{
16 | $tab[^table::sql{select * from `table` where a='1'}]
17 | $var_Name[some${value}]
18 | }
19 | }
20 |
21 | ^rem{
22 | Multiline comment with code: $var
23 | ^while(true){
24 | ^for[i](1;10){
25 | ^sleep[]
26 | }
27 | }
28 | }
29 | ^taint[^#0A]
30 |
31 | @GET_base[]
32 | ## Comment for code
33 | # Isn't comment
34 | $result[$.hash_item1[one] $.hash_item2[two]]
35 |
--------------------------------------------------------------------------------
/test/markup/pony/match.expect.txt:
--------------------------------------------------------------------------------
1 | match foo
2 | | true => "it's true"
3 | | "bar" => "it's bar"
4 | | let x: I32 if x > 3 => "it's greater than 3"
5 | | let x: I32 => "it's less than or equal to 3"
6 | else
7 | "I don't know what it is"
8 | end
--------------------------------------------------------------------------------
/test/markup/fortran/numbers.expect.txt:
--------------------------------------------------------------------------------
1 | 1.d0
2 | -1.d0
3 | 1.d-5
4 | -1.D5
5 | 342.e+12
6 | 12.
7 | 12
8 | .23
9 | -.23
10 | 1.E4
11 | 1E4
12 | 1D-4
13 | var1
14 | va1r
15 | mo_tot_8 = 1./(0.4*log(float(elec_num_tot_8+0.4)))
--------------------------------------------------------------------------------
/src/languages/mojolicious.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: Mojolicious
3 | Requires: xml.js, perl.js
4 | Author: Dotan Dimet
5 | Description: Mojolicious .ep (Embedded Perl) templates
6 | Category: template
7 | */
8 | function(hljs) {
9 | return {
10 | subLanguage: 'xml',
11 | contains: [
12 | {
13 | className: 'meta',
14 | begin: '^__(END|DATA)__$'
15 | },
16 | // mojolicious line
17 | {
18 | begin: "^\\s*%{1,2}={0,2}", end: '$',
19 | subLanguage: 'perl'
20 | },
21 | // mojolicious block
22 | {
23 | begin: "<%{1,2}={0,2}",
24 | end: "={0,1}%>",
25 | subLanguage: 'perl',
26 | excludeBegin: true,
27 | excludeEnd: true
28 | }
29 | ]
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/test/detect/rib/default.txt:
--------------------------------------------------------------------------------
1 | FrameBegin 0
2 | Display "Scene" "framebuffer" "rgb"
3 | Option "searchpath" "shader" "+&:/home/kew"
4 | Option "trace" "int maxdepth" [4]
5 | Attribute "visibility" "trace" [1]
6 | Attribute "irradiance" "maxerror" [0.1]
7 | Attribute "visibility" "transmission" "opaque"
8 | Format 640 480 1.0
9 | ShadingRate 2
10 | PixelFilter "catmull-rom" 1 1
11 | PixelSamples 4 4
12 | Projection "perspective" "fov" 49.5502811377
13 | Scale 1 1 -1
14 |
15 | WorldBegin
16 |
17 | ReadArchive "Lamp.002_Light/instance.rib"
18 | Surface "plastic"
19 | ReadArchive "Cube.004_Mesh/instance.rib"
20 | # ReadArchive "Sphere.010_Mesh/instance.rib"
21 | # ReadArchive "Sphere.009_Mesh/instance.rib"
22 | ReadArchive "Sphere.006_Mesh/instance.rib"
23 |
24 | WorldEnd
25 | FrameEnd
26 |
--------------------------------------------------------------------------------
/test/detect/taggerscript/default.txt:
--------------------------------------------------------------------------------
1 | $if($is_video(),video,$if($is_lossless(),lossless,lossy))/
2 | $if($is_video(),
3 | $noop(Video track)
4 | $if($ne(%album%,[non-album tracks]),
5 | $if2(%albumartist%,%artist%) - %album%$if(%discsubtitle%, - %discsubtitle%)/%_discandtracknumber%%title%,
6 | Music Videos/%artist%/%artist% - %title%),
7 | $if($eq(%compilation%,1),
8 | $noop(Various Artist albums)
9 | $firstalphachar($if2(%albumartistsort%,%artistsort%))/$if2(%albumartist%,%artist%)/%album%$if(%_releasecomment%, \(%_releasecomment%\),)/%_discandtracknumber%%artist% - %title%,
10 | $noop(Single Artist Albums)
11 | $firstalphachar($if2(%albumartistsort%,%artistsort%))/$if2(%albumartist%,%artist%)/%album%$if(%_releasecomment%, \(%_releasecomment%\),)/%_discandtracknumber%%title%
12 | ))
13 |
--------------------------------------------------------------------------------
/test/markup/java/titles.expect.txt:
--------------------------------------------------------------------------------
1 | public class Greet {
2 | public Either<Integer, String> f(int val) {
3 | new Type();
4 | if (val) {
5 | return getType();
6 | } else if (!val) {
7 | throw getError();
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/markup/lasso/delimiters.expect.txt:
--------------------------------------------------------------------------------
1 | <div>
2 | [local(y::decimal = .57721)]
3 | [noprocess] <?lasso delimiters?> [until] [/noprocess]
4 | [no_square_brackets] skip subsequent [square brackets]
5 |
6 | <?=!#y ? true | `string`?>
7 | </div>
8 |
--------------------------------------------------------------------------------
/test/detect/diff/default.txt:
--------------------------------------------------------------------------------
1 | Index: languages/ini.js
2 | ===================================================================
3 | --- languages/ini.js (revision 199)
4 | +++ languages/ini.js (revision 200)
5 | @@ -1,8 +1,7 @@
6 | hljs.LANGUAGES.ini =
7 | {
8 | case_insensitive: true,
9 | - defaultMode:
10 | - {
11 | + defaultMode: {
12 | contains: ['comment', 'title', 'setting'],
13 | illegal: '[^\\s]'
14 | },
15 |
16 | *** /path/to/original timestamp
17 | --- /path/to/new timestamp
18 | ***************
19 | *** 1,3 ****
20 | --- 1,9 ----
21 | + This is an important
22 | + notice! It should
23 | + therefore be located at
24 | + the beginning of this
25 | + document!
26 |
27 | ! compress the size of the
28 | ! changes.
29 |
30 | It is important to spell
31 |
--------------------------------------------------------------------------------
/src/languages/fix.js:
--------------------------------------------------------------------------------
1 | /*
2 | Language: FIX
3 | Author: Brent Bradbury
4 | */
5 |
6 | function(hljs) {
7 | return {
8 | contains: [
9 | {
10 | begin: /[^\u2401\u0001]+/,
11 | end: /[\u2401\u0001]/,
12 | excludeEnd: true,
13 | returnBegin: true,
14 | returnEnd: false,
15 | contains: [
16 | {
17 | begin: /([^\u2401\u0001=]+)/,
18 | end: /=([^\u2401\u0001=]+)/,
19 | returnEnd: true,
20 | returnBegin: false,
21 | className: 'attr'
22 | },
23 | {
24 | begin: /=/,
25 | end: /([\u2401\u0001])/,
26 | excludeEnd: true,
27 | excludeBegin: true,
28 | className: 'string'
29 | }]
30 | }],
31 | case_insensitive: true
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/test/detect/glsl/default.txt:
--------------------------------------------------------------------------------
1 | // vertex shader
2 | #version 150
3 | in vec2 in_Position;
4 | in vec3 in_Color;
5 |
6 | out vec3 ex_Color;
7 | void main(void) {
8 | gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0);
9 | ex_Color = in_Color;
10 | }
11 |
12 |
13 | // geometry shader
14 | #version 150
15 |
16 | layout(triangles) in;
17 | layout(triangle_strip, max_vertices = 3) out;
18 |
19 | void main() {
20 | for(int i = 0; i < gl_in.length(); i++) {
21 | gl_Position = gl_in[i].gl_Position;
22 | EmitVertex();
23 | }
24 | EndPrimitive();
25 | }
26 |
27 |
28 | // fragment shader
29 | #version 150
30 | precision highp float;
31 |
32 | in vec3 ex_Color;
33 | out vec4 gl_FragColor;
34 |
35 | void main(void) {
36 | gl_FragColor = vec4(ex_Color, 1.0);
37 | }
38 |
--------------------------------------------------------------------------------
/test/markup/sql/tablesample.expect.txt:
--------------------------------------------------------------------------------
1 | SELECT * FROM orders TABLESAMPLE (500 ROWS);
2 |
3 | SELECT * FROM customers TABLESAMPLE (25 PERCENT);
4 |
5 | SELECT * FROM employees TABLESAMPLE (BUCKET 2 OUT OF 10);
6 |
--------------------------------------------------------------------------------
/test/detect/gherkin/default.txt:
--------------------------------------------------------------------------------
1 | # language: en
2 | Feature: Addition
3 | In order to avoid silly mistakes
4 | As a math idiot
5 | I want to be told the sum of two numbers
6 |
7 | @this_is_a_tag
8 | Scenario Outline: Add two numbers
9 | * I have a calculator
10 | Given I have entered into the calculator
11 | And I have entered into the calculator
12 | When I press