Преглед на файлове

* support record fields separated by commas instead of semicolons in typed
constant record definitions in MacPas mode (patch by Adriaan van Os,
mantis #15764)

git-svn-id: trunk@14915 -

Jonas Maebe преди 15 години
родител
ревизия
78b9820e11
променени са 6 файла, в които са добавени 32 реда и са изтрити 0 реда
  1. 4 0
      .gitattributes
  2. 2 0
      compiler/ptconst.pas
  3. 6 0
      tests/test/ttypedrecord1.pp
  4. 7 0
      tests/test/ttypedrecord2.pp
  5. 6 0
      tests/test/ttypedrecord3.pp
  6. 7 0
      tests/test/ttypedrecord4.pp

+ 4 - 0
.gitattributes

@@ -9305,6 +9305,10 @@ tests/test/tsymlibrary1.pp svneol=native#text/pascal
 tests/test/ttpara1.pp svneol=native#text/plain
 tests/test/ttpara2.pp svneol=native#text/plain
 tests/test/ttypedarray1.pp svneol=native#text/pascal
+tests/test/ttypedrecord1.pp svneol=native#text/plain
+tests/test/ttypedrecord2.pp svneol=native#text/plain
+tests/test/ttypedrecord3.pp svneol=native#text/plain
+tests/test/ttypedrecord4.pp svneol=native#text/plain
 tests/test/tunaligned1.pp svneol=native#text/plain
 tests/test/tunistr1.pp svneol=native#text/plain
 tests/test/tunistr2.pp svneol=native#text/plain

+ 2 - 0
compiler/ptconst.pas

@@ -1176,6 +1176,8 @@ implementation
 
                   if token=_SEMICOLON then
                     consume(_SEMICOLON)
+                  else if (token=_COMMA) and (m_mac in current_settings.modeswitches) then
+                    consume(_COMMA)
                   else
                     break;
                 end;

+ 6 - 0
tests/test/ttypedrecord1.pp

@@ -0,0 +1,6 @@
+{$mode objfpc}
+program ttyperecord1;
+type RGB = record red, green, blue:	integer end;
+const kRGBBlack: RGB = ( red: 0; green: 0; blue: 0);
+begin
+end.

+ 7 - 0
tests/test/ttypedrecord2.pp

@@ -0,0 +1,7 @@
+{ %fail }
+{$mode objfpc}
+program ttyperecord2;
+type RGB = record red, green, blue:	integer end;
+const kRGBBlack: RGB = ( red: 0, green: 0, blue: 0);
+begin
+end.

+ 6 - 0
tests/test/ttypedrecord3.pp

@@ -0,0 +1,6 @@
+{$mode macpas}
+program ttyperecord3;
+type RGB = record red, green, blue:	integer end;
+const kRGBBlack: RGB = ( red: 0; green: 0; blue: 0);
+begin
+end.

+ 7 - 0
tests/test/ttypedrecord4.pp

@@ -0,0 +1,7 @@
+{$mode macpas}
+{ Mac Pascal uses commas as separators between record fields in typed constants }
+program ttyperecord4;
+type RGB = record red, green, blue:	integer end;
+const kRGBBlack: RGB = ( red: 0, green: 0, blue: 0);
+begin
+end.