Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt |
— | — | @@ -342,6 +342,8 @@ |
343 | 343 | |
344 | 344 | // Start of line |
345 | 345 | sol = (newline / & { return pos === 0; } { return true; }) |
| 346 | + // Eat multi-line comments, so that syntax after still matches as if it |
| 347 | + // was actually preceded by a newline |
346 | 348 | cn:(c:comment n:newline? { |
347 | 349 | if ( n !== '' ) { |
348 | 350 | return [c, {type: 'TEXT', value: n}]; |
— | — | @@ -349,8 +351,21 @@ |
350 | 352 | return [c]; |
351 | 353 | } |
352 | 354 | } |
353 | | - )* { |
354 | | - return [{type: 'NEWLINE'}].concat(cn); |
| 355 | + )* |
| 356 | + // Eat includeonly/noinclude at start of line, so that start-of-line |
| 357 | + // syntax after it still matches |
| 358 | + ni:(space* "<" c:"/"? t:("includeonly" / "noinclude") ">" {return [c, t]} )? |
| 359 | + { |
| 360 | + var niToken = []; |
| 361 | + if ( ni !== '') { |
| 362 | + if ( ni[0] === '/' ) { |
| 363 | + niToken = [{type: 'ENDTAG', name: ni[1]}]; |
| 364 | + } else { |
| 365 | + niToken = [{type: 'TAG', name: ni[1]}]; |
| 366 | + } |
| 367 | + } |
| 368 | + |
| 369 | + return [{type: 'NEWLINE'}].concat(cn, niToken); |
355 | 370 | } |
356 | 371 | |
357 | 372 | eof = & { return isEOF(pos); } { return true; } |
— | — | @@ -419,9 +434,6 @@ |
420 | 435 | / pre |
421 | 436 | |
422 | 437 | |
423 | | - |
424 | | - |
425 | | -// TODO: convert inline content to annotations! |
426 | 438 | para |
427 | 439 | = s1:sol s2:sol c:inlineline { |
428 | 440 | return s1.concat(s2, [{type: 'TAG', name: 'p'}], c); |