
     1  ! Testing comment removal
     2  %begin
     3  
503 @ 4405:         LINE   2 "regression-run-tmp/semicomment.imp"
504 @ 4443:         BEGIN  _lev0id0 {lev=0 --> 1}

     4  %constintegerarray fred(0:2) = ;! A comment here???!
     5            1,2,
     6            ! comment?
     7            3
     8  
505 @ 4444:            LINE   4 "regression-run-tmp/semicomment.imp"
506 @ 4482:            PUSHI  #0x00000000
507 @ 4487:            PUSHI  #0x00000002
508 @ 4492:            BOUNDS
509 @ 4493:            DEF    FRED p1=V_0081 a/tf=1b b/format=1 c/ostate=112  type=1 (integer) form=11 (array) special=0 (<special:0>) linkage=2 (constant) spec=0 indirect=1 unass=0
510 @ 4509:            PUSHI  #0x00000001
511 @ 4514:            INIT   1
512 @ 4517:            PUSHI  #0x00000002
513 @ 4522:            INIT   1
514 @ 4525:            PUSHI  #0x00000003
515 @ 4530:            INIT   1

     9  %routine jim(%integer p,
    10               %integer q)
516 @ 4533:            LINE   9 "regression-run-tmp/semicomment.imp"
517 @ 4571:            DEF    JIM (_lev0id0_JIM) p1=V_0082 a/tf=7 b/format=0 c/ostate=0  type=0 (<type:0>) form=7 (routine) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0
518 @ 4586:               START  ( FORMAL PARAMETERS  {lev=2 --> 3, nested=0 --> 1}
519 @ 4587:                  DEF    P p1=V_0083 a/tf=11 b/format=1 c/ostate=0  type=1 (integer) form=1 (simple) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0
520 @ 4600:                  DEF    Q p1=V_0084 a/tf=11 b/format=1 c/ostate=0  type=1 (integer) form=1 (simple) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0
521 @ 4613:               FINISH ) {lev=2}

    11  %end
    12  
    13  
    14  ! Imp77 allows multiple blank lines following a continuation (%c or ',' or '=')
    15  
    16  %constc
    17  
    18  
522 @ 4614:               LINE   11 "regression-run-tmp/semicomment.imp"
523 @ 4652:            END    _lev0id0_JIM {lev=2 --> 1}

    19  %integerarray sheila(0:2) =
    20  
    21  
    22            1,2,
    23  
    24            3
    25  
    26  
524 @ 4653:            LINE   19 "regression-run-tmp/semicomment.imp"
525 @ 4691:            PUSHI  #0x00000000
526 @ 4696:            PUSHI  #0x00000002
527 @ 4701:            BOUNDS
528 @ 4702:            DEF    SHEILA p1=V_0083 a/tf=1b b/format=1 c/ostate=112  type=1 (integer) form=11 (array) special=0 (<special:0>) linkage=2 (constant) spec=0 indirect=1 unass=0
529 @ 4720:            PUSHI  #0x00000001
530 @ 4725:            INIT   1
531 @ 4728:            PUSHI  #0x00000002
532 @ 4733:            INIT   1
533 @ 4736:            PUSHI  #0x00000003
534 @ 4741:            INIT   1

    27  %switch lab(1:4)
535 @ 4744:            LINE   27 "regression-run-tmp/semicomment.imp"
536 @ 4782:            PUSHI  #0x00000001
537 @ 4787:            PUSHI  #0x00000004
538 @ 4792:            BOUNDS
539 @ 4793:            DEF    LAB p1=V_0084 a/tf=6 b/format=0 c/ostate=0  type=0 (<type:0>) form=6 (switch) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0

    28  %integer i
540 @ 4808:            LINE   28 "regression-run-tmp/semicomment.imp"
541 @ 4846:            DEF    I p1=V_0085 a/tf=11 b/format=1 c/ostate=0  type=1 (integer) form=1 (simple) special=0 (<special:0>) linkage=0 (auto) spec=0 indirect=0 unass=0

    29  %constinteger one=1, two=2, three=3
    30  
542 @ 4859:            LINE   29 "regression-run-tmp/semicomment.imp"

    31  i = sheila(2)
    32  
543 @ 4897:            LINE   31 "regression-run-tmp/semicomment.imp"
544 @ 4935:            PUSH   I
545 @ 4938:            PUSH   SHEILA
546 @ 4941:            PUSHI  #0x00000002
547 @ 4946:            ACCESS
548 @ 4947:            ASSVAL

    33  lab(':'+one+two-':'):  !    i=9
    34                                          ;! %commc
    35                                           ! %ment { here
549 @ 4948:            LINE   33 "regression-run-tmp/semicomment.imp"
550 @ 4986:            PUSHI  #0x00000003
551 @ 4991:            SLABEL 132

    36  print string("test 0"); newline
552 @ 4994:            LINE   36 "regression-run-tmp/semicomment.imp"
553 @ 5032:            PUSH   PRINTSTRING
554 @ 5035:            PUSHS  "test 0"
555 @ 5043:            ASSPAR
556 @ 5044:            CALL  
557 @ 5045:            LINE   36 "regression-run-tmp/semicomment.imp"
558 @ 5083:            PUSH   NEWLINE
559 @ 5086:            CALL  

    37  print string("If there is output mentioning test 0 above, test 0 passed"); newline
    38  
    39  %comment %c {}
560 @ 5087:            LINE   37 "regression-run-tmp/semicomment.imp"
561 @ 5125:            PUSH   PRINTSTRING
562 @ 5128:            PUSHS  "If there is output mentioning test 0 above, test 0 passed"
563 @ 5187:            ASSPAR
564 @ 5188:            CALL  
565 @ 5189:            LINE   37 "regression-run-tmp/semicomment.imp"
566 @ 5227:            PUSH   NEWLINE
567 @ 5230:            CALL  

    40  print string("test 1"); newline   ;! The {} after the %c nullifies the continuation.
568 @ 5231:            LINE   40 "regression-run-tmp/semicomment.imp"
569 @ 5269:            PUSH   PRINTSTRING
570 @ 5272:            PUSHS  "test 1"
571 @ 5280:            ASSPAR
572 @ 5281:            CALL  
573 @ 5282:            LINE   40 "regression-run-tmp/semicomment.imp"
574 @ 5320:            PUSH   NEWLINE
575 @ 5323:            CALL  

    41  print string("If there is output mentioning test 1 above, test 1 passed"); newline
    42  
    43  %comment %c
    44  print string("test 2a failed - this is part of the comment above") %and newline; print string("test 2b failed - semicolons should not be honoured in %comments"); newline
576 @ 5324:            LINE   41 "regression-run-tmp/semicomment.imp"
577 @ 5362:            PUSH   PRINTSTRING
578 @ 5365:            PUSHS  "If there is output mentioning test 1 above, test 1 passed"
579 @ 5424:            ASSPAR
580 @ 5425:            CALL  
581 @ 5426:            LINE   41 "regression-run-tmp/semicomment.imp"
582 @ 5464:            PUSH   NEWLINE
583 @ 5467:            CALL  

    45  print string("If there is no output mentioning test 2 above, test2 passed"); newline
    46  ! Trailing space below:
    47  %comment %c 
584 @ 5468:            LINE   45 "regression-run-tmp/semicomment.imp"
585 @ 5506:            PUSH   PRINTSTRING
586 @ 5509:            PUSHS  "If there is no output mentioning test 2 above, test2 passed"
587 @ 5570:            ASSPAR
588 @ 5571:            CALL  
589 @ 5572:            LINE   45 "regression-run-tmp/semicomment.imp"
590 @ 5610:            PUSH   NEWLINE
591 @ 5613:            CALL  

    48  print string("test 3"); newline
592 @ 5614:            LINE   48 "regression-run-tmp/semicomment.imp"
593 @ 5652:            PUSH   PRINTSTRING
594 @ 5655:            PUSHS  "test 3"
595 @ 5663:            ASSPAR
596 @ 5664:            CALL  
597 @ 5665:            LINE   48 "regression-run-tmp/semicomment.imp"
598 @ 5703:            PUSH   NEWLINE
599 @ 5706:            CALL  

    49  print string("If there is output mentioning test 3 above, test 3 passed"); newline
    50  
    51  ! Trailing tab below:
    52  %comment %c      
600 @ 5707:            LINE   49 "regression-run-tmp/semicomment.imp"
601 @ 5745:            PUSH   PRINTSTRING
602 @ 5748:            PUSHS  "If there is output mentioning test 3 above, test 3 passed"
603 @ 5807:            ASSPAR
604 @ 5808:            CALL  
605 @ 5809:            LINE   49 "regression-run-tmp/semicomment.imp"
606 @ 5847:            PUSH   NEWLINE
607 @ 5850:            CALL  

    53  print string("test 4"); newline
608 @ 5851:            LINE   53 "regression-run-tmp/semicomment.imp"
609 @ 5889:            PUSH   PRINTSTRING
610 @ 5892:            PUSHS  "test 4"
611 @ 5900:            ASSPAR
612 @ 5901:            CALL  
613 @ 5902:            LINE   53 "regression-run-tmp/semicomment.imp"
614 @ 5940:            PUSH   NEWLINE
615 @ 5943:            CALL  

    54  print string("If there is output mentioning test 4 above, test 4 passed"); newline
    55  
    56  
616 @ 5944:            LINE   54 "regression-run-tmp/semicomment.imp"
617 @ 5982:            PUSH   PRINTSTRING
618 @ 5985:            PUSHS  "If there is output mentioning test 4 above, test 4 passed"
619 @ 6044:            ASSPAR
620 @ 6045:            CALL  
621 @ 6046:            LINE   54 "regression-run-tmp/semicomment.imp"
622 @ 6084:            PUSH   NEWLINE
623 @ 6087:            CALL  

    57  lab(':'+two+two*':'-':'*3): %comment %c
    58  error?
    59  
    60                                          %comment ' { again
    61                                          %comment   { 'again
    62                                          %comment   { again } '
    63  
    64  %comment %c
    65  
    66  This this part of the comment in Imp77!
    67  
    68  ! %c
624 @ 6088:            LINE   57 "regression-run-tmp/semicomment.imp"
625 @ 6126:            PUSHI  #0x00000002
626 @ 6131:            SLABEL 132

    69  print string("Note that %c is not honoured within a '!' comment..."); newline
    70  
    71  !  a comment with an unbalanced ' is a problem
627 @ 6134:            LINE   69 "regression-run-tmp/semicomment.imp"
628 @ 6172:            PUSH   PRINTSTRING
629 @ 6175:            PUSHS  "Note that %c is not honoured within a '!' comment..."
630 @ 6229:            ASSPAR
631 @ 6230:            CALL  
632 @ 6231:            LINE   69 "regression-run-tmp/semicomment.imp"
633 @ 6269:            PUSH   NEWLINE
634 @ 6272:            CALL  

    72  print string("test 5 passed"); newline
    73  
    74  {  a comment with an unbalanced ' is a problem
635 @ 6273:            LINE   72 "regression-run-tmp/semicomment.imp"
636 @ 6311:            PUSH   PRINTSTRING
637 @ 6314:            PUSHS  "test 5 passed"
638 @ 6329:            ASSPAR
639 @ 6330:            CALL  
640 @ 6331:            LINE   72 "regression-run-tmp/semicomment.imp"
641 @ 6369:            PUSH   NEWLINE
642 @ 6372:            CALL  

    75  print string("test 6 passed"); newline
    76  
    77  {  a comment with an unbalanced ' is a problem }
643 @ 6373:            LINE   75 "regression-run-tmp/semicomment.imp"
644 @ 6411:            PUSH   PRINTSTRING
645 @ 6414:            PUSHS  "test 6 passed"
646 @ 6429:            ASSPAR
647 @ 6430:            CALL  
648 @ 6431:            LINE   75 "regression-run-tmp/semicomment.imp"
649 @ 6469:            PUSH   NEWLINE
650 @ 6472:            CALL  

    78  print string("test 7 passed"); newline
    79  
    80  %comment  a comment with an unbalanced ' is a problem
651 @ 6473:            LINE   78 "regression-run-tmp/semicomment.imp"
652 @ 6511:            PUSH   PRINTSTRING
653 @ 6514:            PUSHS  "test 7 passed"
654 @ 6529:            ASSPAR
655 @ 6530:            CALL  
656 @ 6531:            LINE   78 "regression-run-tmp/semicomment.imp"
657 @ 6569:            PUSH   NEWLINE
658 @ 6572:            CALL  

    81  print string("test 8 passed"); newline
    82  
659 @ 6573:            LINE   81 "regression-run-tmp/semicomment.imp"
660 @ 6611:            PUSH   PRINTSTRING
661 @ 6614:            PUSHS  "test 8 passed"
662 @ 6629:            ASSPAR
663 @ 6630:            CALL  
664 @ 6631:            LINE   81 "regression-run-tmp/semicomment.imp"
665 @ 6669:            PUSH   NEWLINE
666 @ 6672:            CALL  

    83  lab(*):
    84  !}
    85  
    86  ! The conclusion from these tests is that "!" or "{" after a label don't need special handling
    87  ! but that we should pass "%comment" through untouched
    88  
    89  ! And that whitespace characters after "%c" are significant.
    90  
667 @ 6673:            LINE   83 "regression-run-tmp/semicomment.imp"
668 @ 6711:            DEFSW  132

    91  %end{}%of%pro %gram
    92  
    93  
669 @ 6714:            LINE   91 "regression-run-tmp/semicomment.imp"
670 @ 6752:         END    _lev0id0 {lev=1 --> 0}
671 @ 6753:         END     {lev=0 --> -1}
672 @ 6754: 

