@@ -80,19 +80,6 @@ CodeMirror.defineMode('rst-base', function (config) {
8080 } ) ;
8181 }
8282
83- function AssertException ( message ) {
84- this . message = message ;
85- }
86-
87- AssertException . prototype . toString = function ( ) {
88- return 'AssertException: ' + this . message ;
89- } ;
90-
91- function assert ( expression , message ) {
92- if ( ! expression ) throw new AssertException ( message ) ;
93- return expression ;
94- }
95-
9683 ///////////////////////////////////////////////////////////////////////////
9784 ///////////////////////////////////////////////////////////////////////////
9885
@@ -185,12 +172,12 @@ CodeMirror.defineMode('rst-base', function (config) {
185172 switch ( stage ( state ) ) {
186173 case 0 :
187174 change ( state , to_normal , context ( rx_role_pre , 1 ) ) ;
188- assert ( stream . match ( / ^ : / ) ) ;
175+ stream . match ( / ^ : / ) ;
189176 token = 'meta' ;
190177 break ;
191178 case 1 :
192179 change ( state , to_normal , context ( rx_role_pre , 2 ) ) ;
193- assert ( stream . match ( rx_NAME ) ) ;
180+ stream . match ( rx_NAME ) ;
194181 token = 'keyword' ;
195182
196183 if ( stream . current ( ) . match ( / ^ (?: m a t h | l a t e x ) / ) ) {
@@ -199,7 +186,7 @@ CodeMirror.defineMode('rst-base', function (config) {
199186 break ;
200187 case 2 :
201188 change ( state , to_normal , context ( rx_role_pre , 3 ) ) ;
202- assert ( stream . match ( / ^ : ` / ) ) ;
189+ stream . match ( / ^ : ` / ) ;
203190 token = 'meta' ;
204191 break ;
205192 case 3 :
@@ -221,92 +208,89 @@ CodeMirror.defineMode('rst-base', function (config) {
221208 }
222209
223210 change ( state , to_normal , context ( rx_role_pre , 4 ) ) ;
224- assert ( stream . match ( rx_TEXT2 ) ) ;
211+ stream . match ( rx_TEXT2 ) ;
225212 token = 'string' ;
226213 break ;
227214 case 4 :
228215 change ( state , to_normal , context ( rx_role_pre , 5 ) ) ;
229- assert ( stream . match ( / ^ ` / ) ) ;
216+ stream . match ( / ^ ` / ) ;
230217 token = 'meta' ;
231218 break ;
232219 case 5 :
233220 change ( state , to_normal , context ( rx_role_pre , 6 ) ) ;
234- assert ( stream . match ( rx_TAIL ) ) ;
221+ stream . match ( rx_TAIL ) ;
235222 break ;
236223 default :
237224 change ( state , to_normal ) ;
238- assert ( stream . current ( ) == '' ) ;
239225 }
240226 } else if ( phase ( state ) == rx_role_suf ||
241227 stream . match ( rx_role_suf , false ) ) {
242228
243229 switch ( stage ( state ) ) {
244230 case 0 :
245231 change ( state , to_normal , context ( rx_role_suf , 1 ) ) ;
246- assert ( stream . match ( / ^ ` / ) ) ;
232+ stream . match ( / ^ ` / ) ;
247233 token = 'meta' ;
248234 break ;
249235 case 1 :
250236 change ( state , to_normal , context ( rx_role_suf , 2 ) ) ;
251- assert ( stream . match ( rx_TEXT2 ) ) ;
237+ stream . match ( rx_TEXT2 ) ;
252238 token = 'string' ;
253239 break ;
254240 case 2 :
255241 change ( state , to_normal , context ( rx_role_suf , 3 ) ) ;
256- assert ( stream . match ( / ^ ` : / ) ) ;
242+ stream . match ( / ^ ` : / ) ;
257243 token = 'meta' ;
258244 break ;
259245 case 3 :
260246 change ( state , to_normal , context ( rx_role_suf , 4 ) ) ;
261- assert ( stream . match ( rx_NAME ) ) ;
247+ stream . match ( rx_NAME ) ;
262248 token = 'keyword' ;
263249 break ;
264250 case 4 :
265251 change ( state , to_normal , context ( rx_role_suf , 5 ) ) ;
266- assert ( stream . match ( / ^ : / ) ) ;
252+ stream . match ( / ^ : / ) ;
267253 token = 'meta' ;
268254 break ;
269255 case 5 :
270256 change ( state , to_normal , context ( rx_role_suf , 6 ) ) ;
271- assert ( stream . match ( rx_TAIL ) ) ;
257+ stream . match ( rx_TAIL ) ;
272258 break ;
273259 default :
274260 change ( state , to_normal ) ;
275- assert ( stream . current ( ) == '' ) ;
276261 }
277262 } else if ( phase ( state ) == rx_role || stream . match ( rx_role , false ) ) {
278263
279264 switch ( stage ( state ) ) {
280265 case 0 :
281266 change ( state , to_normal , context ( rx_role , 1 ) ) ;
282- assert ( stream . match ( / ^ : / ) ) ;
267+ stream . match ( / ^ : / ) ;
283268 token = 'meta' ;
284269 break ;
285270 case 1 :
286271 change ( state , to_normal , context ( rx_role , 2 ) ) ;
287- assert ( stream . match ( rx_NAME ) ) ;
272+ stream . match ( rx_NAME ) ;
288273 token = 'keyword' ;
289274 break ;
290275 case 2 :
291276 change ( state , to_normal , context ( rx_role , 3 ) ) ;
292- assert ( stream . match ( / ^ : / ) ) ;
277+ stream . match ( / ^ : / ) ;
293278 token = 'meta' ;
294279 break ;
295280 case 3 :
296281 change ( state , to_normal , context ( rx_role , 4 ) ) ;
297- assert ( stream . match ( rx_TAIL ) ) ;
282+ stream . match ( rx_TAIL ) ;
298283 break ;
299284 default :
300285 change ( state , to_normal ) ;
301- assert ( stream . current ( ) == '' ) ;
302286 }
303287 } else if ( phase ( state ) == rx_substitution_ref ||
304288 stream . match ( rx_substitution_ref , false ) ) {
305289
306290 switch ( stage ( state ) ) {
307291 case 0 :
308292 change ( state , to_normal , context ( rx_substitution_ref , 1 ) ) ;
309- assert ( stream . match ( rx_substitution_text ) ) ;
293+ stream . match ( rx_substitution_text ) ;
310294 token = 'variable-2' ;
311295 break ;
312296 case 1 :
@@ -315,7 +299,6 @@ CodeMirror.defineMode('rst-base', function (config) {
315299 break ;
316300 default :
317301 change ( state , to_normal ) ;
318- assert ( stream . current ( ) == '' ) ;
319302 }
320303 } else if ( stream . match ( rx_footnote_ref ) ) {
321304 change ( state , to_normal ) ;
@@ -341,21 +324,20 @@ CodeMirror.defineMode('rst-base', function (config) {
341324 break ;
342325 case 1 :
343326 change ( state , to_normal , context ( rx_link_ref2 , 2 ) ) ;
344- assert ( stream . match ( / ^ ` / ) ) ;
327+ stream . match ( / ^ ` / ) ;
345328 token = 'link' ;
346329 break ;
347330 case 2 :
348331 change ( state , to_normal , context ( rx_link_ref2 , 3 ) ) ;
349- assert ( stream . match ( rx_TEXT2 ) ) ;
332+ stream . match ( rx_TEXT2 ) ;
350333 break ;
351334 case 3 :
352335 change ( state , to_normal , context ( rx_link_ref2 , 4 ) ) ;
353- assert ( stream . match ( / ^ ` _ / ) ) ;
336+ stream . match ( / ^ ` _ / ) ;
354337 token = 'link' ;
355338 break ;
356339 default :
357340 change ( state , to_normal ) ;
358- assert ( stream . current ( ) == '' ) ;
359341 }
360342 } else if ( stream . match ( rx_verbatim ) ) {
361343 change ( state , to_verbatim ) ;
@@ -380,34 +362,33 @@ CodeMirror.defineMode('rst-base', function (config) {
380362 switch ( stage ( state ) ) {
381363 case 0 :
382364 change ( state , to_explicit , context ( rx_substitution , 1 ) ) ;
383- assert ( stream . match ( rx_substitution_text ) ) ;
365+ stream . match ( rx_substitution_text ) ;
384366 token = 'variable-2' ;
385367 break ;
386368 case 1 :
387369 change ( state , to_explicit , context ( rx_substitution , 2 ) ) ;
388- assert ( stream . match ( rx_substitution_sepa ) ) ;
370+ stream . match ( rx_substitution_sepa ) ;
389371 break ;
390372 case 2 :
391373 change ( state , to_explicit , context ( rx_substitution , 3 ) ) ;
392- assert ( stream . match ( rx_substitution_name ) ) ;
374+ stream . match ( rx_substitution_name ) ;
393375 token = 'keyword' ;
394376 break ;
395377 case 3 :
396378 change ( state , to_explicit , context ( rx_substitution , 4 ) ) ;
397- assert ( stream . match ( rx_substitution_tail ) ) ;
379+ stream . match ( rx_substitution_tail ) ;
398380 token = 'meta' ;
399381 break ;
400382 default :
401383 change ( state , to_normal ) ;
402- assert ( stream . current ( ) == '' ) ;
403384 }
404385 } else if ( phase ( state ) == rx_directive ||
405386 stream . match ( rx_directive , false ) ) {
406387
407388 switch ( stage ( state ) ) {
408389 case 0 :
409390 change ( state , to_explicit , context ( rx_directive , 1 ) ) ;
410- assert ( stream . match ( rx_directive_name ) ) ;
391+ stream . match ( rx_directive_name ) ;
411392 token = 'keyword' ;
412393
413394 if ( stream . current ( ) . match ( / ^ (?: m a t h | l a t e x ) / ) )
@@ -417,7 +398,7 @@ CodeMirror.defineMode('rst-base', function (config) {
417398 break ;
418399 case 1 :
419400 change ( state , to_explicit , context ( rx_directive , 2 ) ) ;
420- assert ( stream . match ( rx_directive_tail ) ) ;
401+ stream . match ( rx_directive_tail ) ;
421402 token = 'meta' ;
422403
423404 if ( stream . match ( / ^ l a t e x \s * $ / ) || state . tmp_stex ) {
@@ -436,25 +417,23 @@ CodeMirror.defineMode('rst-base', function (config) {
436417 break ;
437418 default :
438419 change ( state , to_normal ) ;
439- assert ( stream . current ( ) == '' ) ;
440420 }
441421 } else if ( phase ( state ) == rx_link || stream . match ( rx_link , false ) ) {
442422
443423 switch ( stage ( state ) ) {
444424 case 0 :
445425 change ( state , to_explicit , context ( rx_link , 1 ) ) ;
446- assert ( stream . match ( rx_link_head ) ) ;
447- assert ( stream . match ( rx_link_name ) ) ;
426+ stream . match ( rx_link_head ) ;
427+ stream . match ( rx_link_name ) ;
448428 token = 'link' ;
449429 break ;
450430 case 1 :
451431 change ( state , to_explicit , context ( rx_link , 2 ) ) ;
452- assert ( stream . match ( rx_link_tail ) ) ;
432+ stream . match ( rx_link_tail ) ;
453433 token = 'meta' ;
454434 break ;
455435 default :
456436 change ( state , to_normal ) ;
457- assert ( stream . current ( ) == '' ) ;
458437 }
459438 } else if ( stream . match ( rx_footnote ) ) {
460439 change ( state , to_normal ) ;
0 commit comments