From 871ce6458f1e7d6822adada62213de4dd3dc64af Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Mon, 4 Oct 2021 21:45:51 +0200 Subject: [PATCH] Made the token list a table --- tokens.html | 524 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 317 insertions(+), 207 deletions(-) diff --git a/tokens.html b/tokens.html index c112300d07..c518abaee9 100644 --- a/tokens.html +++ b/tokens.html @@ -14,6 +14,27 @@ + @@ -31,247 +52,336 @@

Standard tokens

Sometimes, a language might use a particular name to refer to certain pieces of code, but which is not one of Prism's standard token names, such as function-defintion. Since function-definition is not a standard token, you might want to alias it with a standard token such as function, which is semantically similar in meaning, and will ensure that Prism's themes will highlight it.

-
-
keyword
-
Pre-defined and reserved words. -
for (const foo of bar) {
-	console.log(foo);
-	if (foo === 'foobar') {
-		break;
-	}
-}
-
if [ -d $directory ]; then
-	echo "Directory exists"
-else
-	echo "Directory does not exists"
-fi
- -
builtin
-
Functions/Methods/Classes/Types that are available out of the box. -
pi = round(float('3.14159'), 2)
-
interface SearchFunc {
-	(source: string, subString: string): boolean;
-}
- -
class-name
-
The name of a class, interface, trait, or type. -
class Rectangle extends Square {
-	constructor(length, breadth) {
-		super(length);
-		this.breadth = breadth;
-	}
+	
+		
+			
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+			
+			
+				
+				
+			
+		
+	
General purpose
keyword + Pre-defined and reserved words. + +
for (const foo of bar) {
+	if (foo === 'foobar') break;
+	await foo;
 }
-
public class CameraController : MonoBehaviour
-{
-	// TODO: Control camera
-}
- -
function
-
The name of a function or method. -
function isEven(number) {
+				
builtin + Functions/Methods/Classes/Types that are available out of the box. + +
pi = round(float('3.14159'), 2)
+
type SearchFunc = (source: string, subStr: string) => boolean;
+
class-name + The name of a class, interface, trait, or type. + +
class Rectangle extends Square { /* ... */ }
+
public class CameraController : MonoBehaviour { /* ... */ }
+
function + The name of a function or method. + +
function isEven(number) {
 	return Number(number) % 2 === 0;
 }
-
-function isOdd(number) {
-	return !isEven(number);
-}
- -
boolean
-
True and false, and pairs with similar concepts (e.g. yes and no). -
console.log(true === false); // prints false
-console.log(true === !false); // prints true
- -
number
-
A numerical value, regardless of base and order, and no matter real or imaginary. -
3.14159
-42
-0xdeadbeef
-1e100
-.001j
- -
string
-
Literal text, including numbers and symbols and maybe even more special characters. -
let greeting = 'Hello World!';
- -
char
-
A string that can comprise only a single character, enforced by the language. -
'A'
-'z'
-'0'
-'-'
-'\t'
-'\u{2728}'
- -
symbol
-
A primitive data type found in some languages, can be thought of as an identifier. -
#myFirstSymbol "#myFirstSymbol is a symbol in Smalltalk and is the same object as all other #myFirstSymbol symbols"
- -
regex
-
A regular expression. -
let regexPattern = /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/;
- -
url
-
A link to another page or resource. -
body {
+const isOdd = (number) => !isEven(number);
+
boolean + True and false, and pairs with similar concepts (e.g. yes and no). + +
console.log(true === false); // prints false
+console.log(true === !false); // prints true
+
number + A numerical value, regardless of base and order, and no matter real or imaginary. + +
print(3.14159 * 42)
+print(1e100 + .001j)
+return foo & 0xdeadbeef
+
string + Literal text, including numbers and symbols and maybe even more special characters. + +
let greeting = 'Hello World!';
+
char + A string that can comprise only a single character, enforced by the language. + +
['A', 'z', '0', '-', '\t', '\u{2728}']
+
symbol + A primitive data type found in some languages, can be thought of as an identifier. + +
#myFirstSymbol "#myFirstSymbol is a symbol in Smalltalk"
+
regex + A regular expression. + +
let entity = /&#x?[\da-f]{1,8};/;
+
url + A link to another page or resource. + +
body {
 	background: url(foo.png);
 }
-
[Prism](https://prismjs.com) is a cool syntax highlighter.
- -
operator
-
A symbol that represents an action or process, whether it's a mathematical operation, logical operation, and so on. -
x = y
-x *= y
-x !== y
-x++
--y
-x >>> y
-x || y
-z ? x : y
- -
variable
-
The name of a variable. This token is intended to be used sparingly. It's generally used on special variables (e.g. Less or Bash), not general variables from imperative and procedural programming languages (e.g. C, JavaScript, Python). -
@nice-blue: #5B83AD;
+					
[Prism](https://prismjs.com) is a cool syntax highlighter.
+
operator + A symbol that represents an action or process, whether it's a mathematical operation, logical operation, and so on. + +
x += (y + 4 >> -z === w) ? b ** c : ~a;
+
variable + The name of a variable. This token is intended to be used sparingly. It's generally used on special variables (e.g. Less or Bash), not general variables from imperative and procedural programming languages (e.g. C, JavaScript, Python). + +
@nice-blue: #5B83AD;
 @light-blue: lighten(@nice-blue, 20%);
-
echo $STRING
+					
echo $STRING
 args=("$@")
-echo ${args[0]} ${args[1]} ${args[2]}
- -
constant
-
The name of a constant. -
const PI = 3.14159;
-
const THING: u32 = 0xABAD1DEA;
-
fprintf( stdout, "hello world\n" );
- -
property
-
An attribute/characteristic or object/map key. -
body {
+echo ${args[0]} ${args[1]} ${args[2]}
+
constant + The name of a constant. + +
const PI = 3.14159;
+
const THING: u32 = 0xABAD1DEA;
+
fprintf(stdout, "hello world\n");
+
property + An attribute/characteristic or object/map key. + +
body {
 	color: red;
 	line-height: normal;
 }
-
{
-	"data": {
-		"labels": ["foo", "bar"],
-	},
+					
{
+	"data": { "labels": ["foo", "bar"], },
 	"error": null,
 	"status": "Ok"
-}
- -
punctuation
-
Punctuation such as brackets, parentheses, commas, and more. -
def median(pool):
-	'''Statistical median to demonstrate doctest.
-	>>> median([2, 9, 9, 7, 9, 2, 4, 5, 8])
-	7
-	'''
+}
+
punctuation + Punctuation such as brackets, parentheses, commas, and more. + +
def median(pool):
 	copy = sorted(pool)
 	size = len(copy)
 	if size % 2 == 1:
 		return copy[(size - 1) / 2]
 	else:
-		return (copy[size/2 - 1] + copy[size/2]) / 2
- -
important
-
Anything that is important and needs special highlighting. -
body {
+		return (copy[size/2 - 1] + copy[size/2]) / 2
+
important + Anything that is important and needs special highlighting. + +
body {
 	color: red !important;
 }
-
# This is a heading. Headings are important.
- -
comment
-
Code comments. -
<!-- Here's a comment -->
+					
# This is a heading. Headings are important.
+
comment + Code comments. + +
<!-- Here's a comment -->
 <style>
 	/* Here's another comment */
 </style>
 <script>
 // Here's yet another comment
-</script>
- -
inserted and deleted
-
Added or modified line and deleted line respectively, mainly for diffs. In general, also the idea of something being increased and decreased/removed respectively. -
--- qcli.yml	2014-12-16 11:43:41.000000000 +0800
-+++ /Users/uranusjr/Desktop/qcli.yml	2014-12-31 11:28:08.000000000 +0800
-@@ -4,5 +4,5 @@
-project:
-	sources: "src/*.cpp"
-	headers: "src/*.h"
--    qt: core
-+    qt: core gui
-public_headers: "src/*.h"
- -
bold
-
Bolded text. Mostly found in document-markup languages. -
**I am bolded text!**
- -
italic
-
Italicised text. Mostly found in document-markup languages. -
*I am italicised text!*
- -
tag
-
A markup tag (e.g. HTML and XML tags). -
<p>Hello World!</p>
- -
attr-name and attr-value
-
Kind of like a property of a markup tag and its value/argument respectively. -
<p id="greeting">Hello World!</p>
+</script>
+
Markup languages
tag + A markup tag (e.g. HTML and XML tags). + +
<p>Hello World!</p>
+
attr-name, attr-value + Kind of like a property of a markup tag and its value/argument respectively. + +
<p id="greeting">Hello World!</p>
 <video width="1280" height="720" allowfullscreen controls>
 	<source src="hello_world.mp4" type="video/mp4" />
-</video>
- -
namespace
-
Used to provide uniquely named elements and attributes in XML documents. Outside of markup languages, it is used to tokenize the package/namespace part of identifiers. -
<html:p foo:bar="baz" foo:weee></html:p>
-
namespace Foo.Bar {}
-using Foo.Bar;
-
class Foo extends foo.bar.Foo {
-	java.util.List<foo.bar.Foo.Bar> bar(foo.bar.Baz bat) throws java.lang.IOException {
-		throw new java.lang.UnsupportedOperationException("Not implemented");
+</video>
+
namespace + Used to provide uniquely named elements and attributes in XML documents. Outside of markup languages, it is used to tokenize the package/namespace part of identifiers. + +
<html:p foo:bar="baz" foo:weee></html:p>
+
class Foo extends foo.bar.Foo {
+	java.util.List<foo.bar.Foo.Bar> bar(foo.bar.Baz bat) {
+		throw new java.lang.UnsupportedOperationException();
 	}
 }
-
use std::collections::HashMap;
-use std::fmt;
-use std::sync::Arc;
- -
prolog
-
The first part of an XML document. -
<?xml version="1.0" encoding="utf-8"?>
-<svg></svg>
- -
doctype
-
Document type declaration, specific to markup languages. -
<!DOCTYPE html>
-<html></html>
- -
cdata
-
Character data, specific to markup languages. -
<ns1:description><![CDATA[
+					
use std::sync::Arc;
+
prolog + The first part of an XML document. + +
<?xml version="1.0" encoding="utf-8"?>
+<svg></svg>
+
doctype + Document type declaration, specific to markup languages. + +
<!DOCTYPE html>
+<html></html>
+
cdata + Character data, specific to markup languages. + +
<ns1:description><![CDATA[
   CDATA is <not> magical.
-]]></ns1:description>
- -
entity
-
Code used to display reserved characters in markup languages. -
&amp; &#x2665; &#160; &#x152;
- -
atrule
-
Literally @ rules (statements) in stylesheets. -
@font-family {
+]]></ns1:description>
+
entity + Code used to display reserved characters in markup languages. + +
&amp; &#x2665; &#160; &#x152;
+
Document-markup languages
bold + Bolded text. Mostly found in document-markup languages. + +
**I am bolded text!**
+
italic + Italicised text. Mostly found in document-markup languages. + +
*I am italicised text!*
+
Stylesheets
atrule + Literally @ rules (statements) in stylesheets. + +
@font-family {
 	font-family: Questrial;
 	src: url(questrial.otf);
 }
-
-@media screen and (min-width: 768px) {
-	/* rules here */
-}
- -
selector
-
Code that identifies or picks something out of a group to operate on, such as the names of HTML elements in stylesheets. -
section h1,
+@media screen and (min-width: 768px) { /* ... */ }
+
selector + Code that identifies or picks something out of a group to operate on, such as the names of HTML elements in stylesheets. + +
section h1,
 #features li strong,
 header h2,
-footer p {
-	/* styles here */
-}
- +footer p { /* ... */ } +
Diff
inserted, deleted + Added or modified line and deleted line respectively, mainly for diffs. In general, also the idea of something being increased and decreased/removed respectively. + +
--- bar.yml	2014-12-16 11:43:41 +0800
++++ /Users/foo/Desktop/bar.yml	2014-12-31 11:28:08 +0800
+@@ -4,5 +4,5 @@
+project:
+	sources: "src/*.cpp"
+	headers: "src/*.h"
+-    qt: core
++    qt: core gui
+public_headers: "src/*.h"
+