### NSIS Initialization Function Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/nsis/default.txt Shows an example of an NSIS `.onInit` function, which runs when the installer starts. It demonstrates printing messages to the log, including variables, newline characters, and escaping special characters like the dollar sign. ```nsis Function .onInit DetailPrint "The install button reads $(^InstallBtn)" DetailPrint 'Here comes a$\n$\rline-break!' DetailPrint `Escape the dollar-sign: $$` FunctionEnd ``` -------------------------------- ### Dockerfile Setup Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/dockerfile/default.expect.txt This snippet details the Dockerfile instructions for setting up the environment. It includes base image, maintainer information, arguments, copying configuration, installing packages, creating directories, setting environment variables, user, exposed ports, volumes, working directory, and the default command. ```dockerfile FROM ubuntu MAINTAINER laurent@docker.com ARG debug=0 COPY www.conf /etc/php5/fpm/pool.d/ RUN apt-get update && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql RUN mkdir /tmp/sessions ENV APPLICATION_ENV dev USER www-data EXPOSE 80 VOLUME ["/var/www/html"] WORKDIR "/var/www/html" CMD [ "/usr/sbin/php5-fpm", "-F" ] ``` -------------------------------- ### NSIS Installer Configuration Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/nsis/default.txt Demonstrates basic NSIS installer setup, including defining the installer name, output file, execution level, CRC check, and conditional installation directory based on architecture (x64). ```nsis ; Includes !include MUI2.nsh ; Defines !define x64 "true" ; Settings Name "installer_name" OutFile "installer_name.exe" RequestExecutionLevel user CRCCheck on !ifdef ${x64} InstallDir "$PROGRAMFILES64\installer_name" !else InstallDir "$PROGRAMFILES\installer_name" !endif ; Pages !insertmacro MUI_PAGE_INSTFILES ; Sections Section "section_name" section_index nsExec::ExecToLog "calc.exe" SectionEnd ``` -------------------------------- ### Processing Setup and Draw Functions Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/processing/default.txt Provides the basic setup and draw loop for a Processing sketch. The setup function initializes the display size and creates a graphics buffer, while the draw function handles background clearing. ```processing PGraphics pg; String load; void setup() { size(displayWidth, displayHeight, P3D); pg = createGraphics(displayWidth*2,displayHeight,P2D); pg.beginDraw(); pg.background(255,255,255); //pg.smooth(8); pg.endDraw(); } void draw(){ background(255); } ``` -------------------------------- ### Ordinary Julia Code Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/julia-repl/default.txt Shows examples of ordinary Julia code that is not intended for highlighting, such as package installation and type definitions. ```julia Pkg.add("Combinatorics") abstract type Foo end ``` -------------------------------- ### PHP Highlight Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/swift/multiline-string.txt A basic example of PHP code, demonstrating variable declaration. ```php var a = not actually code ``` -------------------------------- ### dsconfig Command Reference Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/dsconfig/default.expect.txt This section provides a reference for `dsconfig` commands used in the examples, detailing their purpose and common parameters. ```APIDOC dsconfig: A command-line tool for configuring Directory Server. create-client-connection-policy: Creates a new client connection policy. Parameters: --policy-name : The name of the policy. --set : Sets a property for the policy. --reset : Resets a property to its default value. set-access-control-handler-prop: Modifies properties of the access control handler. Parameters: --add : Adds a property or value. --remove : Removes a property or value. Global ACI Syntax: (target="")(targetattr="")(version 3.0; acl ""; allow() groupdn="";) delete-log-publisher: Deletes a specified log publisher. Parameters: --publisher-name : The name of the log publisher to delete. ``` -------------------------------- ### Get PowerShell Process Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.expect.txt Retrieves the PowerShell process using the Get-Process cmdlet. This is a basic example of process management in PowerShell. ```powershell Get-Process PowerShell ``` -------------------------------- ### Install highlight.php with Composer Source: https://github.com/scrivo/highlight.php/blob/master/README.md This command installs the highlight.php library using Composer, the dependency manager for PHP. It's the recommended way to add the library to your project. ```bash composer require scrivo/highlight.php ``` -------------------------------- ### Scrivo Basic Syntax Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/golo/default.txt Demonstrates Scrivo's module, function, struct, and variable declarations. Includes creating a dynamic object, defining a struct, and printing output. ```scrivo module hello function dyno = -> DynamicObject() struct human = { name } @annotated function main = |args| { let a = 1 var b = 2 println("hello") let john = human("John Doe") } ``` -------------------------------- ### Get PowerShell Process Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.txt Retrieves the PowerShell process using Get-Process. ```powershell function Get-PowerShellProcess { Get-Process PowerShell } ``` -------------------------------- ### Dockerfile for Scrivo Highlight PHP Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/dockerfile/default.txt This snippet details the Dockerfile used to build the Scrivo Highlight PHP image. It includes base image, maintainer information, argument definitions, file copying, package installation, directory creation, environment variable setup, user configuration, port exposure, volume definition, working directory, and the default command. ```dockerfile FROM ubuntu MAINTAINER laurent@docker.com ARG debug=0 COPY www.conf /etc/php5/fpm/pool.d/ RUN apt-get update \ && apt-get install -y php5-fpm php-apc php5-curl php5-gd php5-intl php5-mysql RUN mkdir /tmp/sessions ENV APPLICATION_ENV dev USER www-data EXPOSE 80 VOLUME ["/var/www/html"] WORKDIR "/var/www/html" CMD [ "/usr/sbin/php5-fpm", "-F" ] ``` -------------------------------- ### Lisp List Literals and Usage Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/lisp/default.txt Provides examples of Lisp list literals and a usage example with the `:use` keyword, commonly found in package definitions. ```lisp (1 2 34 5) (:use "aaaa") ``` -------------------------------- ### Function Lookup Examples Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cpp/function-declarations.txt Demonstrates different ways to look up strings using C++ functions. Includes examples with `decltype(auto)` and void return types. ```cpp decltype(auto) look_up_a_string_1() { return lookup1(); } void look_up_a_string_2() { return lookup2(); } ``` -------------------------------- ### PHP Main Function Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cpp/function-title.txt Demonstrates a typical PHP main execution block with variable assignment, function calls, conditional logic, and object method invocation. ```php int main() { A a = new A(); int b = b * sum(1, 2); if (a->check1()) return 3; else if (a->check2()) return 4; return a->result(); } ``` -------------------------------- ### Main Function with Signal Connection and Verbatim String Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/vala/default.txt The main function illustrates the entry point of the program. It includes an example of a verbatim string literal, instantiation of the 'Foo' class, connecting callbacks to a signal, and emitting the signal. This covers signal handling and string formatting. ```PHP /* * Entry point can be outside class */ void main () { var long_string = """ Example of \"verbatim string\". Same as in @\"string\" in C# """; var foo = new Foo (); foo.some_event.connect (callback_a); // connecting the callback functions foo.some_event.connect (callback_b); foo.method (); } ``` -------------------------------- ### PHP YAML Block Node Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/yaml/block.expect.txt Demonstrates a YAML block node in PHP, showing how to represent multi-line strings and comments within a YAML structure. ```php once twice start-key: | # ****************************************************************************** # * COMMENT BLOCK HERE * # ****************************************************************************** with-indicator: |3 fff ggg with-chomp: |- jjj kkk with-both: |3- ggg hhh # not a comment # comment starts here YAML; // In a real scenario, you would parse this YAML string using a library like Symfony\Component\Yaml\Yaml // For demonstration, we'll just print it. // echo $yamlString; ?> ``` -------------------------------- ### Scrivo: Function Composition Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/livescript/default.txt Shows function composition using the '>>' operator, chaining functions together to create a new function that applies them in sequence. ```scrivo # Function composition last-three = reverse >> take-three >> reverse last-three [1 to 8] ``` -------------------------------- ### PHP Basic Output Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/ruby/prompt.txt Demonstrates basic output in PHP, showing how to display a string. ```php 2.0.0p0 :001 > ['some'] => ["some"] ``` -------------------------------- ### Get Tile Value Function Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cpp/function-declarations.txt Provides examples of a function to get a tile value, demonstrating the use of `int8_t` for the return type. Includes both a declaration and a definition. ```cpp int8t Get_Tile_Value() {} int8_t Get_Tile_Value() {} ``` -------------------------------- ### Scrivo: Class Definition and Usage Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/livescript/default.txt Illustrates defining a class with a constructor, properties, and methods. Shows how to instantiate the class and access its members. ```scrivo class A (num) -> @x = num property: 1 method: (y) -> @x + @property + y a = new A 3 a.x #=> 3 a.property #=> 1 a.method 6 #=> 10 ``` -------------------------------- ### PHP Syntax Highlighting Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/ini/comments.expect.txt This example demonstrates basic PHP syntax highlighting. It includes different types of comments (line comments starting with # and ;), attribute assignments with string and numeric values, and section headers. Comments are shown on separate lines and on the same line as code. ```php # Comment ; ini-style comment x = "abc" # Comment on same line y = 123 ; Comment on same line [table] ; Comment on same line ``` -------------------------------- ### PHP Pattern Matching with Switch Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/reasonml/pattern-matching.expect.txt Demonstrates how to use switch statements for pattern matching in PHP. This example shows matching against different cases of a 'person1' variable within a 'School' context. ```php "Hello teacher!", School::Director => "Hello director!", }; $message = School::( match ($person1) { Teacher => "Hello teacher!", Director => "Hello director!", } ); ?> ``` -------------------------------- ### Create Highlight Instance Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/pony/creator.expect.txt This snippet demonstrates how to create a new highlight instance using the 'create' method. It initializes the instance with an environment and a name. ```php new create(env: Env, name: String) => _env = env _name = name ``` -------------------------------- ### PHP Syntax Highlighting Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/ini/comments.txt This snippet showcases various comment styles in PHP, including single-line comments starting with '#', ';', and '//', as well as inline comments. It also demonstrates variable assignment. ```php # Comment ; ini-style comment x = "abc" # Comment on same line y = 123 ; Comment on same line [table] ; Comment on same line ``` -------------------------------- ### CSS Attribute and Universal Selectors Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/css/sample.txt Shows advanced CSS selectors, including attribute selectors targeting href attributes containing 'example' and universal selectors targeting elements with a language attribute starting with 'en'. ```css a[href*="example"], * [lang^=en] { font-size: 2em; } ``` -------------------------------- ### Get Array Function Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/typescript/functions.txt A function that returns an array of numbers. Demonstrates type hinting for return values. ```php function getArray(): number[] { return [1, 2]; } ``` -------------------------------- ### PHP Script Initialization Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/javascript/shebang.expect.txt This snippet shows a basic PHP script that starts with a shebang line and initializes an integer variable 'a' to 1. ```php #!/usr/bin/env node var a = 1; ``` -------------------------------- ### PHP Variable Naming Conventions Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/fortran/numbers.expect.txt Illustrates valid and invalid variable naming conventions in PHP. Variables starting with numbers or containing invalid characters are not allowed. ```php ``` -------------------------------- ### Scrivo Highlight Initialization Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/pony/creator.txt Demonstrates the constructor for the Scrivo Highlight class, showing how to initialize it with an environment and a name. This is the primary way to create a new instance of the highlighter. ```php new create(env: Env, name: String) => _env = env _name = name ``` -------------------------------- ### Highlighting Variable Names in PHP Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/fortran/numbers.txt Illustrates the highlighting of valid and invalid variable names in PHP, focusing on patterns that start with letters or underscores and contain alphanumeric characters or underscores. ```php ``` -------------------------------- ### Hash Table Initialization Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.txt Creates and initializes a hash table with key-value pairs. ```powershell $hash = @{ SomeKey = 'SomeValue' SomeKey2 = 'SomeValue2' SomeKey3 = 'SomeValue3' } ``` -------------------------------- ### Create Client Connection Policy Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/dsconfig/default.expect.txt Demonstrates creating a client connection policy with various properties, including quoted and unquoted values, and different evaluation criteria. The `dsconfig` keyword is optional. ```bash dsconfig create-client-connection-policy \ --policy-name "Restrictive Client Connection Policy" \ --set "description:Restrictive Client Connection Policy" \ --set "enabled:true" --set "evaluation-order-index:1000" \ --set "connection-criteria:User.0 Connection Criteria" \ --set "maximum-concurrent-connections:2" \ --set "maximum-connection-duration:1 s" \ --set "maximum-idle-connection-duration:1 s" \ --set "maximum-operation-count-per-connection:1000" create-client-connection-policy \ --policy-name "Another Client Connection Policy" \ --set "enabled:true" --set "evaluation-order-index:100" \ --set 'connection-criteria:User.1 Connection Criteria' --reset maximum-concurrent-connections ``` -------------------------------- ### PHP Code Highlighting with Scrivo Highlight Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/cmake/default.txt This snippet shows a basic PHP implementation for highlighting code using the Scrivo Highlight library. It assumes the library is correctly installed and accessible. ```php highlight($code); echo $highlightedCode; ?> ``` -------------------------------- ### WebClient Initialization Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.txt Initializes a System.Net.WebClient object for web requests. ```powershell $client = New-Object System.Net.WebClient ``` -------------------------------- ### SQL TABLESAMPLE by Rows Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/sql/tablesample.expect.txt This snippet demonstrates how to select a specific number of rows from a table using the TABLESAMPLE clause with the ROWS option. It's useful for getting a fixed-size random sample. ```sql SELECT * FROM orders TABLESAMPLE (500 ROWS); ``` -------------------------------- ### FIX Message with SOH Delimiter Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/fix/default.txt This snippet shows a standard FIX message using the Start of Header (SOH) character (\u0001) as a field delimiter. It represents a New Order Single (MsgType=D) or Execution Report (MsgType=8) with various financial data fields. ```FIX 8=FIX.4.2\u00019=0\u000135=8\u000149=SENDERTEST\u000156=TARGETTEST\u000134=00000001526\u000152=20120429-13:30:08.137\u00011=ABC12345\u000111=2012abc1234\u000114=100\u000117=201254321\u000120=0\u000130=NYSE\u000131=108.20\u000132=100\u000138=100\u000139=2\u000140=1\u000147=A\u000154=5\u000155=BRK\u000159=2\u000160=20120429-13:30:08.000\u000165=B\u000176=BROKER\u000184=0\u0001100=NYSE\u0001111=100\u0001150=2\u0001151=0\u0001167=CS\u0001377=N\u000110000=SampleCustomTag\u000110=123\u0001 ``` -------------------------------- ### Entrypoint (ENTRYPOINT) Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/dockerfile/default.txt Configures a container that will run as an executable. It allows you to configure a container that will run as an executable. ```dockerfile ENTRYPOINT ["executable", "param1", "param2"] ENTRYPOINT command param1 param2 ``` -------------------------------- ### Scala String Interpolation Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/scala/default.txt An example of string interpolation in Scala, creating a formatted string with a variable. ```scala def interp(n: Int): String = s"there are $n ${color} balloons. " ``` -------------------------------- ### PHP Program Main Method Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/vbnet/default.txt Demonstrates the Main method in a PHP class, including conditional logic, loops, error handling, collections, threading, and LINQ-like operations. It covers various language features within a single execution flow. ```PHP public static function Main(array $args, ...$arr) { // On Error Resume Next if (static::ABC) { while (static::ABC) { Console::WriteLine(); } // Assuming Console::WriteLine exists for ($i = 0; $i <= 1000; $i += 123) { try { // System.Windows.Forms.MessageBox::Show(intval("1")->toString()); // Assuming MessageBox and toString exist } catch (Exception $ex) { // What are you doing? Well... $exp = $ex; // REM ORZ return; } } } else { $l = new System.Collections.Generic.List(); // SyncLock l if (is_decimal($l) && $l !== null) { // RemoveHandler button1.Paint, delegate } $d = new System.Threading.Thread('ThreadProc'); // Assuming ThreadProc is a callable $a = function($x, $y) { return $x + $y; }; $u = array_map(function($x) { return substr($x, 2, 4); }, array_filter($l, function($x) { return strlen($x) > 0; })); // End SyncLock do { Laugh(); } while (static::$hello == 4); // Assuming Laugh() exists } } } ?> ``` -------------------------------- ### PF Macros and Options Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/pf/default.txt Defines macros for network interfaces, TCP services, and ICMP types, along with basic PF options like block policy and logging. ```shell # macros int_if="xl0" tcp_services="{ 22, 113 }" icmp_types="echoreq" comp3="192.168.0.3" # options set block-policy return set loginterface egress set skip on lo ``` -------------------------------- ### LDAP User Modification Example 1 Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/ldif/default.txt An example of an LDAP modification entry to replace specific attributes for a user. ```LDIF dn: CN=John Smith,OU=Legal,DC=example,DC=com changetype: modify replace: employeeID employeeID: 1234 - replace: employeeNumber employeeNumber: 98722 - replace: extensionAttribute6 extensionAttribute6: JSmith98 - ``` -------------------------------- ### LDAP User Modification Example 2 Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/ldif/default.txt Another example of an LDAP modification entry, demonstrating attribute replacements for a different user. ```LDIF dn: CN=Jane Smith,OU=Accounting,DC=example,DC=com changetype: modify replace: employeeID employeeID: 5678 - replace: employeeNumber employeeNumber: 76543 - replace: extensionAttribute6 extensionAttribute6: JSmith14 - ``` -------------------------------- ### Hello World Example in C++ Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/cpp/default.txt A basic C++ program that prints 'Hello, World!' multiple times within a loop. It also demonstrates the use of `unordered_map` and `vector`, and includes a comment indicating a potential error with a backslash character. The program returns an integer value derived from arithmetic operations. ```cpp #include #include #include #include int main(int argc, char *argv[]) { /* An annoying "Hello World" example */ for (auto i = 0; i < 0xFFFF; i++) std::cout << "Hello, World!" << std::endl; char c = '\n'; std::unordered_map > m; m["key"] = "\\\\"; // this is an error return -2e3 + 12l; } ``` -------------------------------- ### Hash Table Initialization Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.expect.txt Creates a hash table named $hash with three key-value pairs. Demonstrates the syntax for initializing and populating a hash table in PowerShell. ```powershell $hash = @{ SomeKey = 'SomeValue' SomeKey2 = 'SomeValue2' SomeKey3 = 'SomeValue3' } ``` -------------------------------- ### PHP Highlight Basics Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/subunit/subunit-testline.expect.txt Demonstrates basic PHP highlighting with different keyword and string combinations. These snippets are useful for testing syntax highlighting engines. ```php test: test basicsuite1 testing: test basicsuite1 test test basicsuite1 testing test basicsuite1 test: test basic suite1 testing: test basic suite1 test test basic suite1 testing test basic suite1 testing test basic test test 222 ``` -------------------------------- ### Scrivo Page Setup and Background Display Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/xl/default.txt Sets the page title, clears the screen with a black color, and scales the hand element. It then proceeds to display a background image with complex transformations. ```Scrivo page "A nice car", clear_color 0, 0, 0, 1 hand_scale -> 0.3 // Display the background image background -4000, ``` -------------------------------- ### PHP String and Character Literals Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/go/strings.expect.txt This example demonstrates the declaration of string and character variables in PHP. It includes examples of Unicode characters, escaped double quotes, single quotes, backslashes, and newline characters within a string literal. ```php ``` -------------------------------- ### Scrivo Basic Syntax Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/golo/default.expect.txt This snippet demonstrates the basic syntax of Scrivo, including module declaration, function definition with dynamic objects, struct definition, and a main function with variable declaration and output. ```scrivo module hello function dyno = -> DynamicObject() struct human = { name } @annotated function main = |args| { let a = 1 var b = 2 println("hello") let john = human("John Doe") } ``` -------------------------------- ### Scrivo String Concatenation Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/reasonml/literals.expect.txt Provides an example of string concatenation in Scrivo using the '++' operator. ```scrivo let str = "a" ++ "b"; ``` -------------------------------- ### Scrivo Animation and Theme Setup Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/xl/default.txt Imports necessary animation and theme modules, and sets the active theme for the project. This establishes the visual style and animation capabilities. ```Scrivo import Animate import SeasonsGreetingsTheme theme "SeasonsGreetings" ``` -------------------------------- ### PHP Associative Array Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/javascript/object-attr.expect.txt This example demonstrates how to define key-value pairs within a PHP array, including string keys, literal boolean values, and inline comments. It highlights common syntax used for configuration or data structures. ```php { "key": value, // with comment "key2": value, "key-3": value, "key4": false ? undefined : true } ``` -------------------------------- ### Running Unit Tests Source: https://github.com/scrivo/highlight.php/blob/master/CONTRIBUTING.md This command executes the unit tests for the highlight.php project using PHPUnit. Ensure PHPUnit is installed and accessible in your environment. ```bash php nunit . ``` -------------------------------- ### PureBASIC Syntax Highlighting Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/purebasic/default.txt This snippet demonstrates various PureBASIC syntax elements such as enumerations, constants, string literals, escaped strings, macros, procedure declarations, and conditional statements. It serves as a comprehensive example for syntax highlighting. ```purebasic ; PureBASIC 5 - Syntax Highlighting Example Enumeration Test 3 Step 10 #Constant_One ; Will be 3 #Constant_Two ; Will be 13 EndEnumeration A.i = #Constant_One B = A + 3 STRING.s = SomeProcedure("Hello World", 2, #Empty$, #Null$) ESCAPED_STRING$ = ~"An escaped (\\) string!\nNewline..." FixedString.s{5} = "12345" Macro XCase(Type, Text) Type#Case(Text) EndMacro StrangeProcedureCall ("This command is split " + "over two lines") ; Line continuation example If B > 3 : X$ = "Concatenation of commands" : Else : X$ = "Using colons" : EndIf Declare.s Attach(String1$, String2$) Procedure.s Attach(String1$, String2$) ProcedureReturn String1$+" "+String2$ EndProcedure ``` -------------------------------- ### Flix Syntax Highlighting Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/flix/default.txt This snippet demonstrates various Flix language features including namespaces, literals (Bool, Char, Float, Int, Str), relations, lattices, indexes, enums, functions, and rules. It serves as a comprehensive example for syntax highlighting. ```flix /** * An example of Flix for syntax highlighting. */ // Here is a namespace. namespace a.b.c { // Here are some literals. def b: Bool = true def c: Char = 'a' def f: Float = 1.23 def i: Int = 42 def s: Str = "string" // Here are some relations. rel LitStm(r: Str, c: Int) rel AddStm(r: Str, x: Str, y: Str) rel DivStm(r: Str, x: Str, y: Str) // Here is a lattice. lat LocalVar(k: Str, v: Constant) // Here is an index. index LitStm{{r}, {r, c}} // Here is an enum. enum Constant { case Top, case Cst(Int), case Bot } // Here is a function. def leq(e1: Constant, e2: Constant): Bool = match (e1, e2) with { case (Constant.Bot, _) => true case (Constant.Cst(n1), Constant.Cst(n2)) => n1 == n2 case (_, Constant.Top) => true case _ => false } // Here are some rules. LocalVar(r, alpha(c)) :- LitStm(r, c). LocalVar(r, sum(v1, v2)) :- AddStm(r, x, y), LocalVar(x, v1), LocalVar(y, v2). } ``` -------------------------------- ### WebClient Usage and Process Termination Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/powershell/misc.expect.txt Demonstrates creating a System.Net.WebClient object, accessing command line arguments, retrieving the 'notepad' process, and terminating it. Also shows string manipulation. ```powershell $client = New-Object System.Net.WebClient [System.Environment]::Commandline $notepad = Get-Process notepad $notepad.Kill() 'this is rocket science'.Replace('rocket', 'rock') ``` -------------------------------- ### CSS @supports and @media Queries Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/css/sample.txt Demonstrates conditional CSS styling using @supports to check for flex display support and @media queries to apply styles based on screen width and orientation. ```css @supports (display: flex) { @media screen and (min-width: 900px) { article { display: flex; } } } @media only screen and (orientation: landscape) { body { background-color: lightblue; } } ``` -------------------------------- ### PHP Function with Block Argument Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/elixir/function-title.expect.txt An example of a PHP function that takes a block argument and executes IO.puts. ```php ``` -------------------------------- ### PHP Class Definition with Namespace Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cs/titles.txt This snippet shows a basic PHP class 'Greet' within the 'Foo' namespace. It demonstrates class declaration, namespace usage, inheritance, and method definitions. ```php namespace Foo // namespace { public class Greet : Base, Other // class { public Greet(string who) // function { Who = who; } int[] f(int val = 0) { new Type(); return getType(); throw getError(); await Stuff(); } } } ``` -------------------------------- ### Get Selected Lights in Maya Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/mel/default.txt This MEL script iterates through the current selection in Maya, identifies objects classified as lights, and returns an array containing the names of all selected lights. It uses the `ls` command to get the selection and `getClassification` to determine the object type. ```MEL proc string[] getSelectedLights() { string $selectedLights[]; string $select[] = `ls -sl -dag -leaf`; for ( $shape in $select ) { // Determine if this is a light. // string $class[] = getClassification( `nodeType $shape` ); if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) ) { $selectedLights[ `size $selectedLights` ] = $shape; } } // Result is an array of all lights included in // current selection list. return $selectedLights; } ``` -------------------------------- ### HTTP Request and Response Handling Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/go/swift-like.txt This Go code snippet defines a function `makeRequest` that performs an HTTP request and handles the response. It takes the HTTP method, URL, and a callback function as arguments. The callback function receives an error and an io.ReadCloser for the response body. The `main` function demonstrates calling `makeRequest` to fetch data from 'http://ipinfo.io/json' and prints the response body to standard output. ```go package main import ( "io" "net/http" "os" ) func makeRequest(method string, url string, cb func(error, io.ReadCloser)) { req, _ := http.NewRequest(method, url, nil) resp, err := http.DefaultClient.Do(req) if err != nil { cb(err, nil) } else { cb(err, resp.Body) } } func main() { makeRequest("GET", "http://ipinfo.io/json", func(err error, body io.ReadCloser) { defer body.Close() io.Copy(os.Stdout, body) }) } ``` -------------------------------- ### String Concatenation in Scrivo Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/reasonml/literals.txt Provides an example of concatenating two string literals using the '++' operator in Scrivo. ```scrivo let str = "a" ++ "b"; ``` -------------------------------- ### JavaScript Variable Declaration Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/javascript/inline-languages.expect.txt A basic JavaScript snippet showing variable declaration and assignment, following the CSS example. ```javascript // Ensure that we're back in JavaScript mode. var foo = 10; ``` -------------------------------- ### Scrivo Blog Command Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/livecodeserver/default.txt Defines a 'blog' command within the Scrivo application. It initializes a test variable and loads helpers. ```lc command blog -- simple comment put "Hello World!" into sTest # ANOTHER COMMENT put "form,url,asset" into tHelpers rigLoadHelper tHelpers end blog ``` -------------------------------- ### PHP Constructor Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/pony/method.expect.txt Illustrates the creation of a constructor for a class, initializing an 'hunger' property with an I32 value. ```php new create(hunger: I32) => _hunger = hunger ``` -------------------------------- ### Scala List of Symbols Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/scala/default.txt An example of creating a Scala List of Symbols, commonly used for identifiers or enumerated values. ```scala val actions: List[Symbol] = 'init :: 'read :: 'write :: 'close :: Nil ``` -------------------------------- ### JavaScript Loop Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/cos/default.txt A simple JavaScript for loop that iterates through the characters of the string 'test', logging the index in each iteration. ```javascript for (var i = 0; i < String("test").split("").length); ++i) { console.log(i); } ``` -------------------------------- ### PHP Block Node Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/yaml/block.txt Demonstrates a basic block node structure in PHP, including compact and sequence styles. ```php # Compact - one # sequence - two # Compact mapping one: two ``` -------------------------------- ### SAS Example Code Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/sas/default.txt This snippet contains a full SAS program that illustrates data input, processing, macro usage, and cleanup operations. It includes setting options, defining libraries, creating datasets, and managing macros. ```sas /********************************************************************** * Program: example.sas * Purpose: SAS Example for HighlightJS Plug-in **********************************************************************/ %put Started at %sysfunc(putn(%sysfunc(datetime()), datetime.)); options errors = 20 /* Maximum number of prints of repeat errors */ fullstimer /* Detailed timer after each step execution */ ; %let maindir = /path/to/maindir; %let outdir = &maindir/out.; systask command "mkdir -p &outdir." wait; libname main "&maindir" access = readonly; data testing; input name $ number delimiter = ","; datalines; John,1 Mary,2 Jane,3 ; if number > 1 then final = 0; else do; final = 1; end; run; %macro testMacro(positional, named = value); %put positional = &positional.; %put named = &named.; %mend testMacro; %testMacro(positional, named = value); dm 'clear log output odsresults'; proc datasets lib = work kill noprint; quit; libname _all_ clear; data _null_; set sashelp.macro( keep = name where = (scope = "global"); ); call symdel(name); run; ``` -------------------------------- ### TypeScript Syntax Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/typescript/inline-languages.txt A snippet showing variable declaration and assignment in TypeScript, indicating a switch back to TypeScript mode. ```javascript // Ensure that we're back in TypeScript mode. var foo = 10; ``` -------------------------------- ### XQuery Basic Structure and Variable Assignment Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/xquery/direct_method.txt Demonstrates the basic structure of an XQuery document, including version declaration and variable assignment using 'let'. It also shows how to create XML elements and embed expressions within them. ```xquery xquery version "3.1"; let $var := "rooting" out 1 or 2 root causes return disable highlight for a name such as root { for $name in $var return $name as xs:string } return to unhighlighted order of things. "rooting" out root causes ``` -------------------------------- ### User (USER) Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/dockerfile/default.txt Sets the user name and optionally the group name to use when running the image, and for any RUN, CMD and ENTRYPOINT instructions that follow it. ```dockerfile USER daemon ``` -------------------------------- ### SQL Query Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cos/embedded.txt An example of an embedded SQL query to select films longer than a specified length from the Cinema.Film table. ```sql SELECT * FROM Cinema.Film WHERE Length > 2 ``` -------------------------------- ### Multiline Twig Comments Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/twig/default.txt This demonstrates how multiline comments are handled in Twig. Markup within comments is not highlighted, as shown by the example. ```twig {# Comments may be long and multiline. Markup is not highlighted within comments. #} ``` -------------------------------- ### Hello World in Mercury Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/mercury/default.txt A basic 'Hello World' program written in Mercury. It demonstrates the fundamental structure of a Mercury program and how to perform string output. ```mercury % "Hello World" in Mercury. :- module hello. :- interface. :- import_module io. :- pred main(io::di, io::uo) is det. :- implementation. main(!IO) :- io.write_string("Hello, world\n", !IO). ``` -------------------------------- ### Scrivo: List Comprehensions and Piping Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/livescript/default.txt Demonstrates list comprehensions for creating new lists based on existing ones, combined with piping for sequential data transformation. Includes sorting and JSON stringification. ```scrivo # List comprehensions and piping const t1 = * id: 1 name: 'george' * id: 2 name: 'mike' * id: 3 name: 'donald' const t2 = * id: 2 age: 21 * id: 1 age: 20 * id: 3 age: 26 [{id:id1, name, age} for {id:id1, name} in t1 for {id:id2, age} in t2 where id1 is id2] |> sort-by \id |> JSON.stringify ``` -------------------------------- ### Scrivo: Simple Function Definition Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/livescript/default.txt A basic example of defining a function in Scrivo that takes two arguments and returns their sum. ```scrivo ~function add x, y @result = x + y ``` -------------------------------- ### SQL Query Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/cos/default.txt Executes a SQL SELECT statement to retrieve all columns from the 'Cinema.Film' table where the 'Length' is greater than 2. ```sql SELECT * FROM Cinema.Film WHERE Length > 2 ``` -------------------------------- ### PHP Match Expression Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/pony/match.expect.txt This example demonstrates a PHP match expression that evaluates an input variable 'foo' against several patterns. It includes literal string and boolean matches, as well as conditional matches using 'let' bindings with type hints and conditions. The 'else' clause provides a default case. ```php match foo | true => "it's true" | "bar" => "it's bar" | let x: I32 if x > 3 => "it's greater than 3" | let x: I32 => "it's less than or equal to 3" else "I don't know what it is" end ``` -------------------------------- ### Run Program and Gosub Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/autohotkey/default.txt Defines a hotkey (#Space) that displays a message box, runs an external program, and calls a subroutine named 'label1'. Demonstrates escaping special characters like '%'. ```AutoHotkey #Space:: MsgBox, Percent sign (`%) need to be escaped. Run "C:\Program Files\some\program.exe" Gosub, label1 return ``` -------------------------------- ### Scrivo Scripting with PHP Syntax Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/cos/basic.expect.txt This snippet demonstrates core Scrivo scripting functionalities such as setting global and local variables, writing output to the console, and executing conditional logic. It also shows how to call class methods within the Scrivo environment. The code is presented with PHP syntax highlighting. ```php SET test = 1 set ^global = 2 Write "Current date "", $ztimestamp, "", result: ", test + ^global = 3 if (^global = 2) { do ##class(Cinema.Utils).AddShow("test") // line comment } d:(^global = 2) ..thisClassMethod(1, 2, "test") ``` -------------------------------- ### Basic HTML Rendering Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/typescript/inline-languages.expect.txt Shows a simple example of rendering an HTML div element with an ID attribute using the html tag. ```html html`
Hello world
` ``` -------------------------------- ### Executing Shell Commands in PHP Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/shell/plain-prompt.expect.txt Demonstrates how to execute shell commands, such as starting a shell session, within a PHP script. This snippet shows the output of commands like 'foo' and '/bin/sh'. ```bash > foo > /bin/sh ``` -------------------------------- ### HTML Structure Example Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/detect/cos/default.txt A basic HTML5 document structure including a head with a meta tag and a body with simple text content. ```html Test ``` -------------------------------- ### Create New Instance with Name Source: https://github.com/scrivo/highlight.php/blob/master/test/Highlight/markup/pony/prime.expect.txt This snippet shows how to instantiate a new object, likely within the Scrivo framework, by providing a string name and appending 'a' to it. It highlights basic object creation and string manipulation in PHP. ```php new create(name': String) => name = name' + 'a' ```