@@ -54,6 +54,9 @@ object Scanners {
54
54
/** the base of a number */
55
55
var base : Int = 0
56
56
57
+ /** Set to false to disable end marker alignment checks, used for outline parsing. */
58
+ var checkEndMarker : Boolean = true
59
+
57
60
def copyFrom (td : TokenData ): Unit = {
58
61
this .token = td.token
59
62
this .offset = td.offset
@@ -331,10 +334,12 @@ object Scanners {
331
334
def endMarkerScope [T ](tag : EndMarkerTag )(op : => T ): T =
332
335
val saved = openEndMarkers
333
336
openEndMarkers = (tag, currentRegion.indentWidth) :: openEndMarkers
334
- try op finally openEndMarkers = saved
337
+ try op
338
+ finally openEndMarkers = saved
335
339
336
340
/** If this token and the next constitute an end marker, skip them and check they
337
- * align with an opening construct with the same end marker tag.
341
+ * align with an opening construct with the same end marker tag,
342
+ * unless `checkEndMarker` is false.
338
343
*/
339
344
protected def skipEndMarker (width : IndentWidth ): Unit =
340
345
if next.token == IDENTIFIER && next.name == nme.end then
@@ -348,8 +353,9 @@ object Scanners {
348
353
openEndMarkers = rest
349
354
checkAligned()
350
355
case _ =>
351
- lexical.println(i " misaligned end marker $tag, $width, $openEndMarkers" )
352
- errorButContinue(" misaligned end marker" , start)
356
+ if checkEndMarker
357
+ lexical.println(i " misaligned end marker $tag, $width, $openEndMarkers" )
358
+ errorButContinue(" misaligned end marker" , start)
353
359
354
360
val skipTo = lookahead.charOffset
355
361
lookahead.nextToken()
0 commit comments