diff --git a/compiler/pbase.pas b/compiler/pbase.pas index 59ccae5ff6..4521d79411 100644 --- a/compiler/pbase.pas +++ b/compiler/pbase.pas @@ -33,6 +33,10 @@ interface ; const + { tokens that end a block or statement. And don't require + a ; on the statement before } + endtokens = [_SEMICOLON,_END,_ELSE,_UNTIL]; + { true, if we are after an assignement } afterassignment : boolean = false; @@ -167,7 +171,7 @@ implementation end; - { check if a symbol contains the hint directive, and if so gives out a hint + { check if a symbol contains the hint directive, and if so gives out a hint if required. } procedure check_hints(const srsym: tsym); @@ -263,7 +267,10 @@ implementation end. { $Log$ - Revision 1.22 2002-12-05 19:28:05 carl + Revision 1.23 2003-03-17 18:55:30 peter + * allow more tokens instead of only semicolon after inherited + + Revision 1.22 2002/12/05 19:28:05 carl - remove lower in hint Revision 1.21 2002/11/30 11:12:48 carl diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 9d0507f904..3a3a54e060 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -1783,7 +1783,7 @@ implementation classh:=procinfo._class.childof; { if inherited; only then we need the method with the same name } - if token=_SEMICOLON then + if token in endtokens then begin hs:=aktprocsym.name; anon_inherited:=true; @@ -2340,7 +2340,10 @@ implementation end. { $Log$ - Revision 1.103 2003-03-17 16:54:41 peter + Revision 1.104 2003-03-17 18:55:30 peter + * allow more tokens instead of only semicolon after inherited + + Revision 1.103 2003/03/17 16:54:41 peter * support DefaultHandler and anonymous inheritance fixed for message methods diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 90e3e66ac8..2a110b230c 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -276,11 +276,11 @@ implementation { concats instruction } instruc:=cstatementnode.create(p,instruc); - if not((token=_ELSE) or (token=_OTHERWISE) or (token=_END)) then + if not(token in [_ELSE,_OTHERWISE,_END]) then consume(_SEMICOLON); - until (token=_ELSE) or (token=_OTHERWISE) or (token=_END); + until (token in [_ELSE,_OTHERWISE,_END]); - if (token=_ELSE) or (token=_OTHERWISE) then + if (token in [_ELSE,_OTHERWISE]) then begin if not try_to_consume(_ELSE) then consume(_OTHERWISE); @@ -488,7 +488,7 @@ implementation paddr:=nil; pframe:=nil; consume(_RAISE); - if not(token in [_SEMICOLON,_END,_ELSE]) then + if not(token in endtokens) then begin { object } pobj:=comp_expr(true); @@ -683,19 +683,18 @@ implementation if not try_to_consume(_SEMICOLON) then break; consume_emptystats; - until (token=_END) or (token=_ELSE); - if token=_ELSE then - { catch the other exceptions } + until (token in [_END,_ELSE]); + if try_to_consume(_ELSE) then begin - consume(_ELSE); - p_default:=statements_til_end; + { catch the other exceptions } + p_default:=statements_til_end; end else consume(_END); end else - { catch all exceptions } begin + { catch all exceptions } p_default:=statements_til_end; end; dec(statement_level); @@ -1127,7 +1126,10 @@ implementation end. { $Log$ - Revision 1.86 2003-02-19 22:00:14 daniel + Revision 1.87 2003-03-17 18:55:30 peter + * allow more tokens instead of only semicolon after inherited + + Revision 1.86 2003/02/19 22:00:14 daniel * Code generator converted to new register notation - Horribily outdated todo.txt removed