compiler:

- add mode switch extendedrecords to allow/disallow extended records syntax, add this mode switch to delphi mode by default
  - disable/enable extended records parsing based on extendedreocrds mode switch

git-svn-id: branches/paul/extended_records@16561 -
This commit is contained in:
paul 2010-12-13 07:03:53 +00:00
parent 11d4eddf67
commit 726ea27bc0
4 changed files with 14 additions and 5 deletions

View File

@ -52,7 +52,7 @@ interface
[m_delphi,m_all,m_class,m_objpas,m_result,m_string_pchar,
m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
m_out,m_default_para,m_duplicate_names,m_hintdirective,m_add_pointer,
m_property,m_default_inline,m_except];
m_property,m_default_inline,m_except,m_extended_records];
fpcmodeswitches =
[m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
m_cvar_support,m_initfinal,m_add_pointer,m_hintdirective,

View File

@ -273,7 +273,8 @@ interface
m_objectivec1, { support interfacing with Objective-C (1.0) }
m_objectivec2, { support interfacing with Objective-C (2.0) }
m_nested_procvars, { support nested procedural variables }
m_non_local_goto { support non local gotos (like iso pascal) }
m_non_local_goto, { support non local gotos (like iso pascal) }
m_extended_records { extended record syntax with visibility sections, methods and properties }
);
tmodeswitches = set of tmodeswitch;
@ -393,7 +394,8 @@ interface
'OBJECTIVEC1',
'OBJECTIVEC2',
'NESTEDPROCVARS',
'NONLOCALGOTO');
'NONLOCALGOTO',
'EXTENDEDRECORDS');
type

View File

@ -1411,7 +1411,8 @@ implementation
sc:=TFPObjectList.create(false);
recstlist:=TFPObjectList.create(false);;
while (token=_ID) and
not(([vd_object,vd_record]*options<>[]) and
not(((vd_object in options) or
((vd_record in options) and (m_extended_records in current_settings.modeswitches))) and
(idtoken in [_PUBLIC,_PRIVATE,_PUBLISHED,_PROTECTED,_STRICT])) do
begin
visibility:=symtablestack.top.currentvisibility;

View File

@ -832,7 +832,13 @@ implementation
symtablestack.push(recst);
{ parse record }
consume(_RECORD);
parse_record_members;
if m_extended_records in current_settings.modeswitches then
parse_record_members
else
begin
read_record_fields([vd_record]);
consume(_END);
end;
{ make the record size aligned }
recst.addalignmentpadding;
{ restore symtable stack }