@@ -61,36 +61,45 @@ <h2>Simple Mode Demo</h2>
6161< p > Each state is an array of rules. A rule may have the following properties:</ p >
6262
6363< dl >
64- < dt > < code > regex</ code > </ dt >
64+ < dt > < code > < strong > regex</ strong > : string | RegExp </ code > </ dt >
6565 < dd > The regular expression that matches the token. May be a string
6666 or a regex object. When a regex, the < code > ignoreCase</ code > flag
6767 will be taken into account when matching the token. This regex
6868 should only capture groups when the < code > token</ code > property is
6969 an array.</ dd >
70- < dt > < code > token</ code > </ dt >
70+ < dt > < code > < strong > token</ strong > </ code > : string | null </ dt >
7171 < dd > An optional token style. Multiple styles can be specified by
7272 separating them with dots or spaces. When the < code > regex</ code > for
7373 this rule captures groups, it must capture < em > all</ em > of the
7474 string (since JS provides no way to find out where a group matched),
7575 and this property must hold an array of token styles that has one
7676 style for each matched group.</ dd >
77- < dt > < code > next</ code > </ dt >
77+ < dt > < code > < strong > next</ strong > : string </ code > </ dt >
7878 < dd > When a < code > next</ code > property is present, the mode will
79- transfer to another state when the token is encountered.</ dd >
80- < dt > < code > mode</ code > </ dt >
79+ transfer to the state named by the property when the token is
80+ encountered.</ dd >
81+ < dt > < code > < strong > push</ strong > : string</ code > </ dt >
82+ < dd > Like < code > next</ code > , but instead replacing the current state
83+ by the new state, the current state is kept on a stack, and can be
84+ returned to with the < code > pop</ code > directive.</ dd >
85+ < dt > < code > < strong > pop</ strong > : bool</ code > </ dt >
86+ < dd > When true, and there is another state on the state stack, will
87+ cause the mode to pop that state off the stack and transition to
88+ it.</ dd >
89+ < dt > < code > < strong > mode</ strong > : {spec, end, persistent}</ code > </ dt >
8190 < dd > Can be used to embed another mode inside a mode. When present,
8291 must hold an object with a < code > spec</ code > property that describes
8392 the embedded mode, and an optional < code > end</ code > end property
8493 that specifies the regexp that will end the extent of the mode. When
8594 a < code > persistent</ code > property is set (and true), the nested
8695 mode's state will be preserved between occurrences of the mode.</ dd >
87- < dt > < code > indent</ code > </ dt >
96+ < dt > < code > < strong > indent</ strong > : bool </ code > </ dt >
8897 < dd > When true, this token changes the indentation to be one unit
8998 more than the current line's indentation.</ dd >
90- < dt > < code > dedent</ code > </ dt >
99+ < dt > < code > < strong > dedent</ strong > : bool </ code > </ dt >
91100 < dd > When true, this token will pop one scope off the indentation
92101 stack.</ dd >
93- < dt > < code > dedentIfLineStart</ code > </ dt >
102+ < dt > < code > < strong > dedentIfLineStart</ strong > : bool </ code > </ dt >
94103 < dd > If a token has its < code > dedent</ code > property set, it will, by
95104 default, cause lines where it appears at the start to be dedented.
96105 Set this property to false to prevent that behavior.</ dd >
@@ -104,7 +113,7 @@ <h2>Simple Mode Demo</h2>
104113recognizes a few such properties:</ p >
105114
106115< dl >
107- < dt > < code > dontIndentStates</ code > </ dt >
116+ < dt > < code > < strong > dontIndentStates</ strong > : array<string> </ code > </ dt >
108117 < dd > An array of states in which the mode's auto-indentation should
109118 not take effect. Usually used for multi-line comment and string
110119 states.</ dd >
0 commit comments