mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-18 18:31:41 +02:00
+ macpas style: exit, cycle, leave
+ macpas compiler directive: PUSH POP
This commit is contained in:
parent
4b0b17a5aa
commit
ff36adb056
@ -60,6 +60,8 @@ const
|
||||
in_exit = 48;
|
||||
in_copy_x = 49;
|
||||
in_initialize_x = 50;
|
||||
in_leave = 51; {macpas}
|
||||
in_cycle = 52; {macpas}
|
||||
|
||||
{ Internal constant functions }
|
||||
in_const_trunc = 100;
|
||||
@ -109,7 +111,11 @@ const
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 2004-06-20 08:55:29 florian
|
||||
Revision 1.14 2004-07-05 21:49:43 olle
|
||||
+ macpas style: exit, cycle, leave
|
||||
+ macpas compiler directive: PUSH POP
|
||||
|
||||
Revision 1.13 2004/06/20 08:55:29 florian
|
||||
* logs truncated
|
||||
|
||||
Revision 1.12 2004/02/02 20:41:59 florian
|
||||
|
@ -293,6 +293,10 @@ scan_f_include_deep_ten=02062_F_Including include files exceeds a depth of 16.
|
||||
% When including include files the files have been nested to a level of 16.
|
||||
% The compiler will expand no further, since this may be a sign that
|
||||
% recursion is used.
|
||||
scan_e_too_many_push=02063_F_Too many levels of PUSH
|
||||
% A maximum of 20 levels is allowed. This error occur only in mode MacPas.
|
||||
scan_e_too_many_pop=02064_E_A POP without a preceding PUSH
|
||||
% This error occur only in mode MacPas.
|
||||
% \end{description}
|
||||
#
|
||||
# Parser
|
||||
@ -965,6 +969,8 @@ parser_e_invalid_qualifier=03205_E_Illegal qualifier
|
||||
parser_e_upper_lower_than_lower=03206_E_High range limit < low range limit
|
||||
% You are declaring a subrange, and the lower limit is higher than the high
|
||||
% limit of the range.
|
||||
parser_e_macpas_exit_wrong_param=03207_E_Exit's parameter must be the name of the procedure it is used in
|
||||
% Non local exit is not allowed. This error occur only in mode MacPas.
|
||||
% \end{description}
|
||||
#
|
||||
# Type Checking
|
||||
|
@ -76,6 +76,8 @@ const
|
||||
scan_w_appname_not_support=02060;
|
||||
scan_e_string_exceeds_255_chars=02061;
|
||||
scan_f_include_deep_ten=02062;
|
||||
scan_e_too_many_push=02063;
|
||||
scan_e_too_many_pop=02064;
|
||||
parser_e_syntax_error=03000;
|
||||
parser_e_dont_nest_interrupt=03004;
|
||||
parser_w_proc_directive_ignored=03005;
|
||||
@ -265,6 +267,7 @@ const
|
||||
parser_e_invalid_integer=03204;
|
||||
parser_e_invalid_qualifier=03205;
|
||||
parser_e_upper_lower_than_lower=03206;
|
||||
parser_e_macpas_exit_wrong_param=03207;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -639,9 +642,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 36707;
|
||||
MsgTxtSize = 36852;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
17,63,207,59,57,46,99,20,35,60,
|
||||
17,65,208,59,57,46,99,20,35,60,
|
||||
40,1,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -330,39 +330,84 @@ implementation
|
||||
|
||||
in_exit :
|
||||
begin
|
||||
if try_to_consume(_LKLAMMER) then
|
||||
begin
|
||||
p1:=comp_expr(true);
|
||||
consume(_RKLAMMER);
|
||||
if (block_type=bt_except) then
|
||||
begin
|
||||
Message(parser_e_exit_with_argument_not__possible);
|
||||
{ recovery }
|
||||
p1.free;
|
||||
p1:=nil;
|
||||
end
|
||||
else if (not assigned(current_procinfo) or
|
||||
is_void(current_procinfo.procdef.rettype.def)) then
|
||||
begin
|
||||
Message(parser_e_void_function);
|
||||
{ recovery }
|
||||
p1.free;
|
||||
p1:=nil;
|
||||
end;
|
||||
end
|
||||
else
|
||||
p1:=nil;
|
||||
statement_syssym:=cexitnode.create(p1);
|
||||
if try_to_consume(_LKLAMMER) then
|
||||
begin
|
||||
if not (m_mac in aktmodeswitches) then
|
||||
begin
|
||||
p1:=comp_expr(true);
|
||||
consume(_RKLAMMER);
|
||||
if (block_type=bt_except) then
|
||||
begin
|
||||
Message(parser_e_exit_with_argument_not__possible);
|
||||
{ recovery }
|
||||
p1.free;
|
||||
p1:=nil;
|
||||
end
|
||||
else if (not assigned(current_procinfo) or
|
||||
is_void(current_procinfo.procdef.rettype.def)) then
|
||||
begin
|
||||
Message(parser_e_void_function);
|
||||
{ recovery }
|
||||
p1.free;
|
||||
p1:=nil;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if not (current_procinfo.procdef.procsym.name = pattern) then
|
||||
Message(parser_e_macpas_exit_wrong_param);
|
||||
consume(_ID);
|
||||
consume(_RKLAMMER);
|
||||
p1:=nil;
|
||||
end
|
||||
end
|
||||
else
|
||||
p1:=nil;
|
||||
statement_syssym:=cexitnode.create(p1);
|
||||
end;
|
||||
|
||||
in_break :
|
||||
begin
|
||||
statement_syssym:=cbreaknode.create;
|
||||
if not (m_mac in aktmodeswitches) then
|
||||
statement_syssym:=cbreaknode.create
|
||||
else
|
||||
begin
|
||||
Message1(sym_e_id_not_found, orgpattern);
|
||||
statement_syssym:=cerrornode.create;
|
||||
end;
|
||||
end;
|
||||
|
||||
in_continue :
|
||||
begin
|
||||
statement_syssym:=ccontinuenode.create;
|
||||
if not (m_mac in aktmodeswitches) then
|
||||
statement_syssym:=ccontinuenode.create
|
||||
else
|
||||
begin
|
||||
Message1(sym_e_id_not_found, orgpattern);
|
||||
statement_syssym:=cerrornode.create;
|
||||
end;
|
||||
end;
|
||||
|
||||
in_leave :
|
||||
begin
|
||||
if m_mac in aktmodeswitches then
|
||||
statement_syssym:=cbreaknode.create
|
||||
else
|
||||
begin
|
||||
Message1(sym_e_id_not_found, orgpattern);
|
||||
statement_syssym:=cerrornode.create;
|
||||
end;
|
||||
end;
|
||||
|
||||
in_cycle :
|
||||
begin
|
||||
if m_mac in aktmodeswitches then
|
||||
statement_syssym:=ccontinuenode.create
|
||||
else
|
||||
begin
|
||||
Message1(sym_e_id_not_found, orgpattern);
|
||||
statement_syssym:=cerrornode.create;
|
||||
end;
|
||||
end;
|
||||
|
||||
in_typeof_x :
|
||||
@ -2408,7 +2453,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.160 2004-06-29 20:59:43 peter
|
||||
Revision 1.161 2004-07-05 21:49:43 olle
|
||||
+ macpas style: exit, cycle, leave
|
||||
+ macpas compiler directive: PUSH POP
|
||||
|
||||
Revision 1.160 2004/06/29 20:59:43 peter
|
||||
* don't allow assigned(tobject) anymore, it is useless since it
|
||||
is always true
|
||||
|
||||
|
@ -81,6 +81,8 @@ implementation
|
||||
p.insert(tsyssym.create('Break',in_break));
|
||||
p.insert(tsyssym.create('Exit',in_exit));
|
||||
p.insert(tsyssym.create('Continue',in_continue));
|
||||
p.insert(tsyssym.create('Leave',in_leave)); {macpas only}
|
||||
p.insert(tsyssym.create('Cycle',in_cycle)); {macpas only}
|
||||
p.insert(tsyssym.create('Dec',in_dec_x));
|
||||
p.insert(tsyssym.create('Inc',in_inc_x));
|
||||
p.insert(tsyssym.create('Str',in_str_x_string));
|
||||
@ -536,7 +538,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.70 2004-06-20 08:55:30 florian
|
||||
Revision 1.71 2004-07-05 21:49:43 olle
|
||||
+ macpas style: exit, cycle, leave
|
||||
+ macpas compiler directive: PUSH POP
|
||||
|
||||
Revision 1.70 2004/06/20 08:55:30 florian
|
||||
* logs truncated
|
||||
|
||||
Revision 1.69 2004/06/16 20:07:09 florian
|
||||
|
@ -39,6 +39,12 @@ implementation
|
||||
fmodule,
|
||||
rabase;
|
||||
|
||||
const
|
||||
localswitchesstackmax = 20;
|
||||
|
||||
var
|
||||
localswitchesstack: array[0..localswitchesstackmax] of tlocalswitches;
|
||||
localswitchesstackpos: Integer = 0;
|
||||
|
||||
{*****************************************************************************
|
||||
Helpers
|
||||
@ -704,6 +710,21 @@ implementation
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure dir_pop;
|
||||
|
||||
begin
|
||||
if localswitchesstackpos < 1 then
|
||||
Message(scan_e_too_many_pop);
|
||||
|
||||
if not localswitcheschanged then
|
||||
nextaktlocalswitches:=aktlocalswitches;
|
||||
|
||||
Dec(localswitchesstackpos);
|
||||
nextaktlocalswitches:= localswitchesstack[localswitchesstackpos];
|
||||
|
||||
localswitcheschanged:=true;
|
||||
end;
|
||||
|
||||
procedure dir_profile;
|
||||
var
|
||||
mac : tmacro;
|
||||
@ -719,6 +740,22 @@ implementation
|
||||
mac.defined:=(cs_profile in aktmoduleswitches);
|
||||
end;
|
||||
|
||||
procedure dir_push;
|
||||
|
||||
begin
|
||||
if localswitchesstackpos > localswitchesstackmax then
|
||||
Message(scan_e_too_many_push);
|
||||
|
||||
if localswitcheschanged then
|
||||
begin
|
||||
aktlocalswitches:=nextaktlocalswitches;
|
||||
localswitcheschanged:=false;
|
||||
end;
|
||||
|
||||
localswitchesstack[localswitchesstackpos]:= aktlocalswitches;
|
||||
Inc(localswitchesstackpos);
|
||||
end;
|
||||
|
||||
procedure dir_rangechecks;
|
||||
begin
|
||||
do_delphiswitch('R');
|
||||
@ -975,6 +1012,7 @@ implementation
|
||||
AddDirective('DEBUGINFO',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_debuginfo);
|
||||
AddDirective('DESCRIPTION',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_description);
|
||||
AddDirective('ERROR',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_error);
|
||||
AddDirective('ERRORC',directive_mac, {$ifdef FPCPROCVAR}@{$endif}dir_error);
|
||||
AddDirective('EXTENDEDSYNTAX',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_extendedsyntax);
|
||||
AddDirective('EXTERNALSYM',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_externalsym);
|
||||
AddDirective('FATAL',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_fatal);
|
||||
@ -1014,7 +1052,9 @@ implementation
|
||||
{$IFDEF TestVarsets}
|
||||
AddDirective('PACKSET',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_packset);
|
||||
{$ENDIF}
|
||||
AddDirective('POP',directive_mac, {$ifdef FPCPROCVAR}@{$endif}dir_pop);
|
||||
AddDirective('PROFILE',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_profile);
|
||||
AddDirective('PUSH',directive_mac, {$ifdef FPCPROCVAR}@{$endif}dir_push);
|
||||
AddDirective('R',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_resource);
|
||||
AddDirective('RANGECHECKS',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_rangechecks);
|
||||
AddDirective('REFERENCEINFO',directive_all, {$ifdef FPCPROCVAR}@{$endif}dir_referenceinfo);
|
||||
@ -1045,7 +1085,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.37 2004-06-20 08:55:30 florian
|
||||
Revision 1.38 2004-07-05 21:49:43 olle
|
||||
+ macpas style: exit, cycle, leave
|
||||
+ macpas compiler directive: PUSH POP
|
||||
|
||||
Revision 1.37 2004/06/20 08:55:30 florian
|
||||
* logs truncated
|
||||
|
||||
Revision 1.36 2004/06/16 20:07:09 florian
|
||||
|
Loading…
Reference in New Issue
Block a user