diff --git a/examples/prism-aspnet.html b/examples/prism-aspnet.html new file mode 100644 index 0000000000..cdc1fc3701 --- /dev/null +++ b/examples/prism-aspnet.html @@ -0,0 +1,39 @@ +
To use this language, use the class "language-aspnet".
+ +<%-- This is a comment --%>
+<%-- This is a
+multi-line comment --%>
+
+<%@ Page Title="Products" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ProductList.aspx.cs" Inherits="WingtipToys.ProductList" %>
+
+
+<%: Page.Title %>
+<a href="ProductDetails.aspx?productID=<%#:Item.ProductID%>">
+<span>
+ <%#:Item.ProductName%>
+</span>
+
+This requires the C# component to be loaded. + On this page, check C# before checking ASP.NET should make + the example below work properly.
+<script runat="server">
+ // The following variables are visible to all procedures
+ // within the script block.
+ String str;
+ int i;
+ int i2;
+
+ int DoubleIt(int inpt)
+ {
+ // The following variable is visible only within
+ // the DoubleIt procedure.
+ int factor = 2;
+
+ return inpt * factor;
+ }
+</script>
\ No newline at end of file
diff --git a/examples/prism-c.html b/examples/prism-c.html
new file mode 100644
index 0000000000..ae5e77d963
--- /dev/null
+++ b/examples/prism-c.html
@@ -0,0 +1,25 @@
+To use this language, use the class "language-c".
+ +"foo \"bar\" baz"
+'foo \'bar\' baz'
+"Multi-line strings ending with a \
+are supported too."
+
+# include <stdio.h>
+#define PG_locked 0
+#define PG_error 1
+
+
+#include <stdio.h>
+main(int argc, char *argv[])
+{
+ int c;
+ printf("Number of command line arguments passed: %d\n", argc);
+ for ( c = 0 ; c < argc ; c++)
+ printf("%d. Command line argument passed is %s\n", c+1, argv[c]);
+ return 0;
+}
\ No newline at end of file
diff --git a/examples/prism-cpp.html b/examples/prism-cpp.html
new file mode 100644
index 0000000000..054f4afd3e
--- /dev/null
+++ b/examples/prism-cpp.html
@@ -0,0 +1,64 @@
+To use this language, use the class "language-cpp".
+ +"foo \"bar\" baz"
+'foo \'bar\' baz'
+"Multi-line strings ending with a \
+are supported too."
+
+# include <stdio.h>
+#define PG_locked 0
+#define PG_error 1
+
+
+true;
+false;
+
+a and b;
+c bitand d;
+
+/*
+David Cary 2010-09-14
+quick demo for wikibooks
+public domain
+*/
+#include <iostream>
+#include <vector>
+using namespace std;
+
+vector<int> pick_vector_with_biggest_fifth_element(
+ vector<int> left,
+ vector<int> right
+){
+ if( (left[5]) < (right[5]) ){
+ return( right );
+ };
+ // else
+ return( left );
+}
+
+int vector_demo(void){
+ cout << "vector demo" << endl;
+ vector<int> left(7);
+ vector<int> right(7);
+
+ left[5] = 7;
+ right[5] = 8;
+ cout << left[5] << endl;
+ cout << right[5] << endl;
+ vector<int> biggest(
+ pick_vector_with_biggest_fifth_element( left, right )
+ );
+ cout << biggest[5] << endl;
+
+ return 0;
+}
+
+int main(void){
+ vector_demo();
+}
diff --git a/examples/prism-go.html b/examples/prism-go.html
new file mode 100644
index 0000000000..196dcf468e
--- /dev/null
+++ b/examples/prism-go.html
@@ -0,0 +1,71 @@
+To use this language, use the class "language-go".
+ +// This is a comment
+/* This is a comment
+on multiple lines */
+
+42
+0600
+0xBadFace
+170141183460469231731687303715884105727
+0.
+72.40
+072.40
+2.71828
+1.e+0
+6.67428e-11
+1E6
+.25
+.12345E+5
+0i
+011i
+0.i
+2.71828i
+1.e+0i
+6.67428e-11i
+1E6i
+.25i
+.12345E+5i
+
+'\t'
+'\000'
+'\x07'
+'\u12e4'
+'\U00101234'
+`abc`
+`multi-line
+string`
+"Hello, world!"
+"multi-line
+string"
+
+func(a, b int, z float64) bool { return a*b < int(z) }
+
+package main
+import "fmt"
+
+func sum(a []int, c chan int) {
+ sum := 0
+ for _, v := range a {
+ sum += v
+ }
+ c <- sum // send sum to c
+}
+
+func main() {
+ a := []int{7, 2, 8, -9, 4, 0}
+
+ c := make(chan int)
+ go sum(a[:len(a)/2], c)
+ go sum(a[len(a)/2:], c)
+ x, y := <-c, <-c // receive from c
+
+ fmt.Println(x, y, x+y)
+}
+
\ No newline at end of file
diff --git a/examples/prism-scheme.html b/examples/prism-scheme.html
new file mode 100644
index 0000000000..3b98271715
--- /dev/null
+++ b/examples/prism-scheme.html
@@ -0,0 +1,48 @@
+To use this language, use the class "language-scheme".
+ +; This is a comment
+
+#t
+#f
+
+"two \"quotes\" within"
+
+(lambda (x) (+ x 3))
+(apply vector 'a 'b '(c d e))
+
+
+;; Calculation of Hofstadter's male and female sequences as a list of pairs
+
+(define (hofstadter-male-female n)
+ (letrec ((female (lambda (n)
+ (if (= n 0)
+ 1
+ (- n (male (female (- n 1)))))))
+ (male (lambda (n)
+ (if (= n 0)
+ 0
+ (- n (female (male (- n 1))))))))
+ (let loop ((i 0))
+ (if (> i n)
+ '()
+ (cons (cons (female i)
+ (male i))
+ (loop (+ i 1)))))))
+
+(hofstadter-male-female 8)
+
+There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +
+ +"foo ; bar"
\ No newline at end of file
diff --git a/examples/prism-swift.html b/examples/prism-swift.html
new file mode 100644
index 0000000000..5bc1633a5c
--- /dev/null
+++ b/examples/prism-swift.html
@@ -0,0 +1,80 @@
+To use this language, use the class "language-swift".
+ +// this is a comment
+/* this is also a comment,
+but written over multiple lines */
+
+
+42
+-23
+3.14159
+0.1
+-273.15
+1.25e-2
+0xC.3p0
+1_000_000
+1_000_000.000_000_1
+
+let someString = "Some string literal value"
+var emptyString = ""
+
+for index in 1...5 {
+ println("\(index) times 5 is \(index * 5)")
+}
+for _ in 1...power {
+ answer *= base
+}
+while square < finalSquare {
+ // roll the dice
+ if ++diceRoll == 7 { diceRoll = 1 }
+ // move by the rolled amount
+ square += diceRoll
+ if square < board.count {
+ // if we're still on the board, move up or down for a snake or a ladder
+ square += board[square]
+ }
+}
+switch someCharacter {
+ case "a", "e", "i", "o", "u":
+ println("\(someCharacter) is a vowel")
+ case "b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
+ "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z":
+ println("\(someCharacter) is a consonant")
+ default:
+ println("\(someCharacter) is not a vowel or a consonant")
+}
+
+
+class MyViewController: UIViewController {
+ @IBOutlet weak var button: UIButton!
+ @IBOutlet var textFields: [UITextField]!
+ @IBAction func buttonTapped(AnyObject) {
+ println("button tapped!")
+ }
+}
+
+@IBDesignable
+class MyCustomView: UIView {
+ @IBInspectable var textColor: UIColor
+ @IBInspectable var iconHeight: CGFloat
+ /* ... */
+}
+
+There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +
+ +/* Nested block
+ /* comments
+ are */
+not supported */
\ No newline at end of file