Skip to content

Commit

Permalink
Use //! for script docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Jul 24, 2022
1 parent e8d6e3f commit 45acb65
Show file tree
Hide file tree
Showing 28 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/event_handler_js/script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Implementation of the Event Handler With State Pattern - JS Style
//! Implementation of the Event Handler With State Pattern - JS Style

/// Initialize user-provided state.
fn init() {
Expand Down
2 changes: 1 addition & 1 deletion examples/event_handler_main/script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Implementation of the Event Handler With State Pattern - Main Style
//! Implementation of the Event Handler With State Pattern - Main Style

/// Initialize user-provided state (shadows system-provided state, if any).
fn init() {
Expand Down
2 changes: 1 addition & 1 deletion examples/event_handler_map/script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Implementation of the Event Handler With State Pattern - Map Style
//! Implementation of the Event Handler With State Pattern - Map Style

/// Initialize user-provided state.
/// State is stored inside an object map bound to 'state'.
Expand Down
2 changes: 1 addition & 1 deletion scripts/assignment.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script contains a single assignment statement.
//! This script contains a single assignment statement.

let x = 78;

Expand Down
2 changes: 2 additions & 0 deletions scripts/doc-comments.rhai
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! This script illustrates how to put doc-comments on functions.

/// The function `foo`, which prints `hello, world!` and a magic number,
/// accepts three parameters.
///
Expand Down
4 changes: 2 additions & 2 deletions scripts/fibonacci.rhai
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This script calculates the n-th Fibonacci number using a really dumb algorithm
// to test the speed of the scripting engine.
//! This script calculates the n-th Fibonacci number using a really dumb algorithm
//! to test the speed of the scripting engine.

const TARGET = 28;
const REPEAT = 5;
Expand Down
2 changes: 1 addition & 1 deletion scripts/for1.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs for-loops.
//! This script runs for-loops.

let arr = [1, true, 123.456, "hello", 3, 42];

Expand Down
2 changes: 1 addition & 1 deletion scripts/for2.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs for-loops
//! This script runs for-loops

const MAX = 1_000_000;

Expand Down
2 changes: 1 addition & 1 deletion scripts/for3.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs for-loops with closures.
//! This script runs for-loops with closures.

const MAX = 100;
const CHECK = ((MAX - 1) ** 2) * MAX;
Expand Down
2 changes: 1 addition & 1 deletion scripts/function_decl1.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script defines a function and calls it.
//! This script defines a function and calls it.

fn call_me() {
return 3;
Expand Down
2 changes: 1 addition & 1 deletion scripts/function_decl2.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script defines a function with two parameters and local variables.
//! This script defines a function with two parameters and local variables.

let a = 3;

Expand Down
3 changes: 1 addition & 2 deletions scripts/function_decl3.rhai
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// This script defines a function with many parameters.
//
//! This script defines a function with many parameters.

const KEY = 38;

Expand Down
2 changes: 1 addition & 1 deletion scripts/function_decl4.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script defines a function that acts as a method.
//! This script defines a function that acts as a method.

// Use 'this' to refer to the object of a method call
fn action(x, y) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/if1.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs if statements.
//! This script runs if statements.

let a = 42;
let b = 123;
Expand Down
2 changes: 1 addition & 1 deletion scripts/if2.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs an if expression.
//! This script runs an if expression.

let a = 42;
let b = 123;
Expand Down
2 changes: 1 addition & 1 deletion scripts/loop.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs an infinite loop, ending it with a break statement.
//! This script runs an infinite loop, ending it with a break statement.

let x = 10;

Expand Down
2 changes: 1 addition & 1 deletion scripts/mat_mul.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script simulates multi-dimensional matrix calculations.
//! This script simulates multi-dimensional matrix calculations.

const SIZE = 50;

Expand Down
2 changes: 1 addition & 1 deletion scripts/module.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script imports an external script as a module.
//! This script imports an external script as a module.

import "loop" as x;

Expand Down
2 changes: 1 addition & 1 deletion scripts/oop.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script simulates object-oriented programming (OOP) techniques using closures.
//! This script simulates object-oriented programming (OOP) techniques using closures.

// External variable that will be captured.
let last_value = ();
Expand Down
2 changes: 1 addition & 1 deletion scripts/op1.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs a single expression.
//! This script runs a single expression.

print("The result should be 46:");

Expand Down
2 changes: 1 addition & 1 deletion scripts/op2.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs a complex expression.
//! This script runs a complex expression.

print("The result should be 182:");

Expand Down
2 changes: 1 addition & 1 deletion scripts/op3.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs a complex expression.
//! This script runs a complex expression.

print("The result should be 230:");

Expand Down
2 changes: 1 addition & 1 deletion scripts/primes.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script uses the Sieve of Eratosthenes to calculate prime numbers.
//! This script uses the Sieve of Eratosthenes to calculate prime numbers.

let now = timestamp();

Expand Down
2 changes: 1 addition & 1 deletion scripts/speed_test.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs 1 million iterations to test the speed of the scripting engine.
//! This script runs 1 million iterations to test the speed of the scripting engine.

let now = timestamp();
let x = 1_000_000;
Expand Down
2 changes: 1 addition & 1 deletion scripts/string.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script tests string operations.
//! This script tests string operations.

print("hello");
print("this\nis \\ nice"); // escape sequences
Expand Down
2 changes: 1 addition & 1 deletion scripts/strings_map.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script tests object maps and strings.
//! This script tests object maps and strings.

print("Ready... Go!");

Expand Down
2 changes: 1 addition & 1 deletion scripts/switch.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs a switch statement in a for-loop.
//! This script runs a switch statement in a for-loop.

let arr = [42, 123.456, "hello", true, "hey", 'x', 999, 1, 2, 3, 4];

Expand Down
2 changes: 1 addition & 1 deletion scripts/while.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This script runs a while loop.
//! This script runs a while loop.

let x = 10;

Expand Down

0 comments on commit 45acb65

Please sign in to comment.