| | 386 | ## |
| | 387 | ## Comment out block |
| | 388 | ## |
| | 389 | |
| | 390 | var _commentBlockStop as TokenRegexDef? |
| | 391 | var _commentBlockLine as TokenRegexDef? |
| | 392 | |
| | 393 | def onCOMMENT_BLOCK_START(tok as IToken) as IToken? |
| | 394 | #print '<> onCOMMENT_BLOCK_START', tok |
| | 395 | assert not _inCommentBlock |
| | 396 | # narrow the tokenizer's token defs to a new shorter set |
| | 397 | if _commentBlockStop is nil |
| | 398 | _commentBlockStop = TokenRegexDef('COMMENT_BLOCK_STOP', r'[^# \t]?\#\/.*$') |
| | 399 | _commentBlockLine = TokenRegexDef('COMMENT_BLOCK_LINE', '.*\n') |
| | 400 | t = List<of TokenDef>() |
| | 401 | t.add(_commentBlockStop) |
| | 402 | t.add(_commentBlockLine) |
| | 403 | .pushTokenDefs(t) |
| | 404 | _inCommentBlock = true |
| | 405 | return nil |
| | 406 | |
| | 407 | def onCOMMENT_BLOCK_LINE(tok as IToken) as IToken? |
| | 408 | #print '<> onCOMMENT_BLOCK_LINE', tok.lineNum |
| | 409 | assert _inCommentBlock, tok |
| | 410 | return nil |
| | 411 | |
| | 412 | def onCOMMENT_BLOCK_STOP(tok as IToken) as IToken? |
| | 413 | #print '<> onCOMMENT_BLOCK_STOP', tok.lineNum |
| | 414 | assert _inCommentBlock, tok |
| | 415 | _inCommentBlock = false |
| | 416 | .popTokenDefs |
| | 417 | return nil |
| | 418 | |