inkling/consts.rs
1//! Constant markers used when parsing `Ink` lines.
2
3/************************
4 * Line content markers *
5 ************************/
6
7/// Marker for a non-sticky choice, which can only ever be followed once in the story.
8pub const CHOICE_MARKER: char = '*';
9
10/// Marker for a sticky choice, which can be followed multiple times in the story.
11pub const STICKY_CHOICE_MARKER: char = '+';
12
13/// Marker for a gather point.
14pub const GATHER_MARKER: char = '-';
15
16/// Marker for a divert to another knot, stitch or label in the story.
17pub const DIVERT_MARKER: &'static str = "->";
18
19/// Marker for glue which joins separate lines together without a newline character.
20pub const GLUE_MARKER: &'static str = "<>";
21
22/// Marker for a tag associated with a line in the story.
23///
24/// Multiple markers can be used in a single line. All text content between markers
25/// (or the end of the line) will be a single tag.
26pub const TAG_MARKER: char = '#';
27
28/********************
29 * Sequence markers *
30 ********************/
31
32/// Marker for a cycle alternative sequence.
33pub const CYCLE_MARKER: char = '&';
34
35/// Marker for a once-only alternative sequence.
36pub const ONCE_ONLY_MARKER: char = '!';
37
38/// Marker for a shuffle alternative sequence.
39pub const SHUFFLE_MARKER: char = '~';
40
41/// Marker for sequence item separator.
42pub const SEQUENCE_SEPARATOR: &'static str = "|";
43
44/****************
45 * Knot markers *
46 ****************/
47
48/// Marker for a knot, the main divisor of story content.
49pub const KNOT_MARKER: &'static str = "==";
50
51/// Marker for a stitch belonging to a knot.
52pub const STITCH_MARKER: &'static str = "=";
53
54/************************
55 * Comment line markers *
56 ************************/
57
58/// Marker for line comments, which will be ignored when parsing a story.
59pub const LINE_COMMENT_MARKER: &'static str = "//";
60
61/// Marker for line comments which will print a reminder message when encountered.
62pub const TODO_COMMENT_MARKER: &'static str = "TODO:";
63
64/*****************************
65 * Default names for objects *
66 *****************************/
67
68/// Default name for the root `Stitch` in a `Knot` and `Knot` in a `Story`.
69///
70/// Contains characters which are not allowed in addresses, so there can never be a conflict
71/// with a name in the `Ink` story.
72pub const ROOT_KNOT_NAME: &'static str = "$ROOT$";
73
74/// Name of knot that marks that a branch of story content is done.
75pub const DONE_KNOT: &'static str = "DONE";
76
77/// Name of knot that marks that the story is finished.
78pub const END_KNOT: &'static str = "END";
79
80/**********************
81 * Meta data variable *
82 **********************/
83
84/// Marker for constant variable.
85pub const CONST_MARKER: &'static str = "CONST";
86
87/// Marker for external function signature.
88pub const EXTERNAL_FUNCTION_MARKER: &'static str = "EXTERNAL";
89
90/// Marker for include of another file.
91pub const INCLUDE_MARKER: &'static str = "INCLUDE";
92
93/// Marker for global variable.
94pub const VARIABLE_MARKER: &'static str = "VAR";
95
96/// Names which cannot be used by variables, knots or stitches.
97pub const RESERVED_KEYWORDS: &[&'static str] = &[
98 "ELSE", "NOT", "TRUE", "FALSE", "AND", "OR", "FUNCTION", "RETURN",
99];