Comments

// Single line comment
/// Doc comments
/* Multiline
comment */

Strings

'C'; '\''; '\n'; '\u7FFF'; // Characters
"foo \"bar\" baz"; // String
r##"foo #"bar"# baz"##; // Raw string with # pairs
b'C'; b'\''; b'\n'; // Bytes
b"foo \"bar\" baz"; // Byte string
br##"foo #"bar"# baz"##; // Raw byte string with # pairs

Numbers

123i;                              // type int
123u;                              // type uint
123_u;                             // type uint
0xff_u8;                           // type u8
0o70_i16;                          // type i16
0b1111_1111_1001_0000_i32;         // type i32

123.0f64;        // type f64
0.1f64;          // type f64
0.1f32;          // type f32
12E+99_f64;      // type f64

Booleans

true; false;

Functions and macros

println!("x is {}", x);
fn next_two(x: int) -> (int, int) { (x + 1i, x + 2i) }
next_two(5i);
vec![1i, 2, 3];

Attributes

#![warn(unstable)]
#[test]
fn a_test() {
	// ...
}

Closure parameters and bitwise OR

let x = a | b;
let y = c || d;
let add_one = |x: int| -> int { 1i + x };
let printer = || { println!("x is: {}", x); };

Known failures

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

/* Nested block
	/* comments
	are */
not supported */

Delimiters of parameters for closures that don't use braces

|x| x + 1i;