From 4606637f88ae9fc841484880f61f26c713628942 Mon Sep 17 00:00:00 2001 From: mike lowis Date: Thu, 8 Apr 2021 23:16:18 -0400 Subject: [PATCH] reformatted predefined types. Broken, but close --- lib/obnc/Files.obn | 54 +- lib/obnc/FilesTest.obn | 34 +- lib/obnc/In.obn | 14 +- lib/obnc/InTest.obn | 8 +- lib/obnc/Input.obn | 12 +- lib/obnc/Input0.obn | 8 +- lib/obnc/Input0Test.obn | 4 +- lib/obnc/InputTest.obn | 10 +- lib/obnc/Math.obn | 40 +- lib/obnc/Out.obn | 10 +- lib/obnc/Strings.obn | 38 +- lib/obnc/StringsTest.obn | 4 +- lib/obnc/XYplane.obn | 18 +- lib/obnc/XYplaneTest.obn | 6 +- src/Oberon.y | 20 +- src/Table.c | 10 +- src/y.tab.c | 1234 +++++++++-------- src/y.tab.h | 11 +- tests/obnc/failing-at-compile-time/A.obn | 4 +- .../T2PointerToNonRecord.obn | 2 +- .../T2RedeclaredField.obn | 4 +- .../T2RepeatedParameterIdent.obn | 2 +- .../T2WrongResolvedType.obn | 2 +- .../T3RepeatedField.obn | 2 +- .../failing-at-compile-time/T3RepeatedVar.obn | 2 +- .../T4InvalidProcedureComparison.obn | 2 +- .../T4TypeGuardOnNonVarParamRecord.obn | 2 +- .../T5AssignPredefinedProcedure.obn | 2 +- .../T5FunctionProcedureStatement.obn | 2 +- .../T5InvalidArrayAssignment.obn | 4 +- .../T5NonConstForLoopInc.obn | 2 +- .../T5StringAssignment.obn | 2 +- .../T5StructValueParamAssignment.obn | 2 +- .../T6ExtendedPointerVarParam.obn | 4 +- .../T6ForgottenReturnType.obn | 4 +- .../T6LocalParamTypeRef.obn | 2 +- .../T6NonScalarResultType.obn | 2 +- .../T6ReadOnlyParam.obn | 4 +- .../T7AccessNonExportedField.obn | 2 +- .../T7ExportLocalIdent.obn | 2 +- .../failing-at-runtime/T4FailingTypeGuard.obn | 2 +- .../T5AssignStringToOpenArray.obn | 4 +- .../T5OpenArrayAssignment.obn | 4 +- tests/obnc/passing/A.obn | 21 +- tests/obnc/passing/B.obn | 2 +- tests/obnc/passing/OBNC.obn | 6 +- tests/obnc/passing/T1ConstantDeclarations.obn | 12 +- tests/obnc/passing/T2TypeDeclarations.obn | 12 +- tests/obnc/passing/T3VariableDeclarations.obn | 2 +- tests/obnc/passing/T4Expressions.obn | 62 +- tests/obnc/passing/T5Statements.obn | 92 +- tests/obnc/passing/T5SystemStatements.obn | 22 +- .../obnc/passing/T6ProcedureDeclarations.obn | 48 +- tests/obnc/passing/T7Modules.obn | 4 +- tests/obnc/passing/lib/Local.obn | 4 +- tests/obnc/passing/lib1/Local.obn | 4 +- tests/obncdoc/ExportedFeatures.obn | 20 +- tests/obncdoc/NoExportedFeatures.obn | 4 +- 58 files changed, 1004 insertions(+), 912 deletions(-) diff --git a/lib/obnc/Files.obn b/lib/obnc/Files.obn index a544cba..d3fec23 100644 --- a/lib/obnc/Files.obn +++ b/lib/obnc/Files.obn @@ -17,19 +17,19 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co Handle = record end; Rider* = record - eof*: BOOLEAN; - res*: INTEGER; + eof*: Bool; + res*: Int; base: File; - pos: INTEGER + pos: Int end; - procedure Old*(name: array of CHAR): File; + procedure Old*(name: array of Char): File; (**Old(fn) searches the name fn in the directory and returns the corresponding file. If the name is not found, it returns nil.*) return nil end Old; - procedure New*(name: array of CHAR): File; + procedure New*(name: array of Char): File; (**New(fn) creates and returns a new file. The name fn is remembered for the later use of the operation Register. The file is only entered into the directory when Register is called.*) return nil end New; @@ -50,34 +50,34 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Purge; - procedure Delete*(name: array of CHAR; var res: INTEGER); + procedure Delete*(name: array of Char; var res: Int); (**Delete(fn, res) removes the directory entry for the file fn without deleting the file. If res = 0 the file has been successfully deleted. If there are variables referring to the file while Delete is called, they can still be used.*) end Delete; - procedure Rename*(old, new: array of CHAR; var res: INTEGER); + procedure Rename*(old, new: array of Char; var res: Int); (**Rename(oldfn, newfn, res) renames the directory entry oldfn to newfn. If res = 0 the file has been successfully renamed. If there are variables referring to the file while Rename is called, they can still be used.*) end Rename; - procedure Length*(f: File): INTEGER; + procedure Length*(f: File): Int; (**returns the number of bytes in file f*) return 0 end Length; - procedure GetDate*(f: File; var t, d: INTEGER); + procedure GetDate*(f: File; var t, d: Int); (**returns the time t and date d of the last modification of file f. The encoding is: hour = t div 4096; minute = t div 64 mod 64; second = t mod 64; year = d div 512; month = d div 32 mod 16; day = d mod 32.*) end GetDate; - procedure Set*(var r: Rider; f: File; pos: INTEGER); + procedure Set*(var r: Rider; f: File; pos: Int); (**sets the rider r to position pos in file f. The field r.eof is set to false. The operation requires that 0 <= pos <= Length(f)*) end Set; - procedure Pos*(var r: Rider): INTEGER; + procedure Pos*(var r: Rider): Int; (**returns the position of the rider r*) return 0 end Pos; @@ -88,27 +88,27 @@ operation requires that 0 <= pos <= Length(f)*) return nil end Base; - procedure Read*(var r: Rider; var x: BYTE); + procedure Read*(var r: Rider; var x: Byte); (**reads the next byte x from rider r and advances r accordingly*) end Read; - procedure ReadInt*(var r: Rider; var i: INTEGER); + procedure ReadInt*(var r: Rider; var i: Int); (**reads an integer i from rider r and advances r accordingly.*) end ReadInt; - procedure ReadReal*(var r: Rider; var x: REAL); + procedure ReadReal*(var r: Rider; var x: Real); (**reads a real number x from rider r and advances r accordingly.*) end ReadReal; - procedure ReadNum*(var r: Rider; var i: INTEGER); + procedure ReadNum*(var r: Rider; var i: Int); (**reads an integer i from rider r and advances r accordingly. The number i is compactly encoded*) end ReadNum; - procedure ReadString*(var r: Rider; var s: array of CHAR); + procedure ReadString*(var r: Rider; var s: array of Char); (**reads a sequence of characters (including the terminating 0X) from rider r and returns it in s. The rider is advanced accordingly. The actual parameter corresponding to s must be long enough to hold the character sequence plus the terminating 0X.*) end ReadString; @@ -118,37 +118,37 @@ operation requires that 0 <= pos <= Length(f)*) end ReadSet; - procedure ReadBool*(var r: Rider; var b: BOOLEAN); -(**reads a Boolean value b from rider r and advances r accordingly*) + procedure ReadBool*(var r: Rider; var b: Bool); +(**reads a Bool value b from rider r and advances r accordingly*) end ReadBool; - procedure ReadBytes*(var r: Rider; var buf: array of BYTE; n: INTEGER); + procedure ReadBytes*(var r: Rider; var buf: array of Byte; n: Int); (**reads n bytes into buffer buf starting at the rider position r. The rider is advanced accordingly. If less than n bytes could be read, r.res contains the number of requested but unread bytes.*) end ReadBytes; - procedure Write*(var r: Rider; x: BYTE); + procedure Write*(var r: Rider; x: Byte); (**writes the byte x to rider r and advances r accordingly*) end Write; - procedure WriteInt*(var r: Rider; i: INTEGER); + procedure WriteInt*(var r: Rider; i: Int); (**writes the integer i to rider r and advances r accordingly*) end WriteInt; - procedure WriteReal*(var r: Rider; x: REAL); + procedure WriteReal*(var r: Rider; x: Real); (**writes the real number x to rider r and advances r accordingly*) end WriteReal; - procedure WriteNum*(var r: Rider; i: INTEGER); + procedure WriteNum*(var r: Rider; i: Int); (**writes the integer i to rider r and advances r accordingly. The number i is compactly encoded.*) end WriteNum; - procedure WriteString*(var r: Rider; s: array of CHAR); + procedure WriteString*(var r: Rider; s: array of Char); (**writes the sequence of characters s (including the terminating 0X) to rider r and advances r accordingly*) end WriteString; @@ -158,12 +158,12 @@ operation requires that 0 <= pos <= Length(f)*) end WriteSet; - procedure WriteBool*(var r: Rider; b: BOOLEAN); -(**writes the Boolean value b to rider r and advances r accordingly.*) + procedure WriteBool*(var r: Rider; b: Bool); +(**writes the Bool value b to rider r and advances r accordingly.*) end WriteBool; - procedure WriteBytes*(var r: Rider; var buf: array of BYTE; n: INTEGER); + procedure WriteBytes*(var r: Rider; var buf: array of Byte; n: Int); (**writes the first n bytes from buf to rider r and advances r accordingly. r.res contains the number of bytes that could not be written (e.g., due to a disk full error).*) end WriteBytes; diff --git a/lib/obnc/FilesTest.obn b/lib/obnc/FilesTest.obn index a6f619e..b703e04 100644 --- a/lib/obnc/FilesTest.obn +++ b/lib/obnc/FilesTest.obn @@ -40,9 +40,9 @@ module FilesTest; procedure TestRegister; var f: Files.File; r: Files.Rider; - res: INTEGER; + res: Int; - procedure IsRider(var r: Files.Rider): BOOLEAN; + procedure IsRider(var r: Files.Rider): Bool; return r is Files.Rider end IsRider; begin @@ -101,7 +101,7 @@ module FilesTest; procedure TestDelete; var f: Files.File; - res: INTEGER; + res: Int; begin f := Files.New("DeleteTest"); ASSERT(f # nil); @@ -117,7 +117,7 @@ module FilesTest; procedure TestRename; var f: Files.File; - res: INTEGER; + res: Int; begin f := Files.New("RenameTest"); ASSERT(f # nil); @@ -140,7 +140,7 @@ module FilesTest; procedure TestLength; var f: Files.File; - res: INTEGER; + res: Int; begin f := Files.New("LengthTest"); ASSERT(f # nil); @@ -153,8 +153,8 @@ module FilesTest; procedure TestDate; var f: Files.File; - t, d: INTEGER; - hour, minute, second, year, month, day: INTEGER; + t, d: Int; + hour, minute, second, year, month, day: Int; begin f := Files.Old("FilesTest.obn"); ASSERT(f # nil); @@ -215,7 +215,7 @@ module FilesTest; procedure TestReadWrite; var f: Files.File; r: Files.Rider; - b: BYTE; + b: Byte; begin f := Files.New("ReadWriteTest"); ASSERT(f # nil); @@ -234,7 +234,7 @@ module FilesTest; procedure TestReadWriteInt; var f: Files.File; r: Files.Rider; - i: INTEGER; + i: Int; begin f := Files.New("ReadWriteIntTest"); ASSERT(f # nil); @@ -259,7 +259,7 @@ module FilesTest; procedure TestReadWriteReal; var f: Files.File; r: Files.Rider; - x: REAL; + x: Real; begin f := Files.New("ReadWriteRealTest"); ASSERT(f # nil); @@ -284,7 +284,7 @@ module FilesTest; procedure TestReadWriteNum; var f: Files.File; r: Files.Rider; - i: INTEGER; + i: Int; begin f := Files.New("ReadWriteNumTest"); ASSERT(f # nil); @@ -309,7 +309,7 @@ module FilesTest; procedure TestReadWriteString; var f: Files.File; r: Files.Rider; - s: array 32 of CHAR; + s: array 32 of Char; begin f := Files.New("ReadWriteStringTest"); ASSERT(f # nil); @@ -367,7 +367,7 @@ module FilesTest; procedure TestReadWriteBool; var f: Files.File; r: Files.Rider; - b: BOOLEAN; + b: Bool; begin f := Files.New("ReadWriteBoolTest"); ASSERT(f # nil); @@ -392,8 +392,8 @@ module FilesTest; procedure TestReadWriteBytes; var f: Files.File; r: Files.Rider; - buf: array 4 of BYTE; - i: INTEGER; + buf: array 4 of Byte; + i: Int; begin for i := 0 to LEN(buf) - 1 do buf[i] := i + 1 end; @@ -434,7 +434,7 @@ begin TestDelete; TestRename; TestLength; - if SYSTEM.SIZE(INTEGER) >= 4 then + if SYSTEM.SIZE(Int) >= 4 then TestDate end; TestSet; @@ -443,7 +443,7 @@ begin TestReadWrite; TestReadWriteInt; TestReadWriteReal; - if SYSTEM.SIZE(INTEGER) >= 4 then + if SYSTEM.SIZE(Int) >= 4 then TestReadWriteNum; end; TestReadWriteString; diff --git a/lib/obnc/In.obn b/lib/obnc/In.obn index 2785130..608d1c0 100644 --- a/lib/obnc/In.obn +++ b/lib/obnc/In.obn @@ -11,19 +11,19 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co (*implemented in C*) - var Done*: BOOLEAN; (**status of last operation*) + var Done*: Bool; (**status of last operation*) procedure Open*; (**included for compatibility with "The Oakwood Guidelines". On a typical Unix-like system, stdin cannot be rewinded. If Open is called when the file position is not at the beginning of stdin, the program aborts.*) end Open; - procedure Char*(var ch: CHAR); + procedure Char*(var ch: Char); (**returns in ch the character at the current position*) end Char; - procedure Int*(var i: INTEGER); + procedure Int*(var i: Int); (**returns in i the integer constant at the current position according to the format integer = digit {digit} | digit {hexDigit} "H". @@ -32,7 +32,7 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Int; - procedure Real*(var x: REAL); + procedure Real*(var x: Real); (**returns in x the real constant at the current position according to the format real = digit {digit} "." {digit} [ScaleFactor]. @@ -41,7 +41,7 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Real; - procedure String*(var str: array of CHAR); + procedure String*(var str: array of Char); (**returns in str the string at the current position according to the format string = """ {character} """ | digit {hexdigit} "X" . @@ -49,12 +49,12 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end String; - procedure Name*(var name: array of CHAR); + procedure Name*(var name: array of Char); (**Name(s) returns in s the sequence of graphical (non-whitespace) characters at the current position*) end Name; - procedure Line*(var line: array of CHAR); + procedure Line*(var line: array of Char); (**Line(s) returns in s the sequence of characters from the current position to the end of the line. NOTE: This procedure is an extension to The Oakwood Guidelines.*) end Line; diff --git a/lib/obnc/InTest.obn b/lib/obnc/InTest.obn index 7b3e11d..1c148eb 100644 --- a/lib/obnc/InTest.obn +++ b/lib/obnc/InTest.obn @@ -23,10 +23,10 @@ module InTest; eps = 0.001; var - ch: CHAR; - n: INTEGER; - x: REAL; - s: array 12 of CHAR; + ch: Char; + n: Int; + x: Real; + s: array 12 of Char; begin In.Char(ch); diff --git a/lib/obnc/Input.obn b/lib/obnc/Input.obn index 9179a1d..10986c1 100644 --- a/lib/obnc/Input.obn +++ b/lib/obnc/Input.obn @@ -13,26 +13,26 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co import Input0; - var TimeUnit*: INTEGER; (**clock ticks per second*) + var TimeUnit*: Int; (**clock ticks per second*) - procedure Available*(): INTEGER; + procedure Available*(): Int; (**returns the number of characters in the keyboard buffer*) return 0 (*dummy value*) end Available; - procedure Read*(var ch: CHAR); + procedure Read*(var ch: Char); (**returns (and removes) the next character from the keyboard buffer. If the buffer is empty, Read waits until a key is pressed.*) end Read; - procedure Mouse*(var keys: SET; var x, y: INTEGER); + procedure Mouse*(var keys: SET; var x, y: Int); (**returns the current mouse position (x, y) in pixels relative to the lower left corner of the screen. keys is the set of the currently pressed mouse keys (left = 2, middle = 1, right = 0).*) end Mouse; - procedure SetMouseLimits*(w, h: INTEGER); + procedure SetMouseLimits*(w, h: Int); (**defines the rectangle where the mouse moves (in pixels). Subsequent calls to the operation Mouse will return coordinates for x in the range 0 .. w - 1 and y in the range 0 .. h - 1.*) end SetMouseLimits; - procedure Time*(): INTEGER; + procedure Time*(): Int; (**returns the time elapsed since system startup in units of size 1 / TimeUnit seconds*) return 0 (*dummy value*) end Time; diff --git a/lib/obnc/Input0.obn b/lib/obnc/Input0.obn index 232b0f7..bfc153a 100644 --- a/lib/obnc/Input0.obn +++ b/lib/obnc/Input0.obn @@ -11,18 +11,18 @@ Implements a subset of basic module Input applicable to console applications. Im (*implemented in C*) - var TimeUnit*: INTEGER; (**clock ticks per second*) + var TimeUnit*: Int; (**clock ticks per second*) - procedure Available*(): INTEGER; + procedure Available*(): Int; (**returns the number of characters in the keyboard buffer*) return 0 end Available; - procedure Read*(var ch: CHAR); + procedure Read*(var ch: Char); (**returns (and removes) the next character from the keyboard buffer. If the buffer is empty, Read waits until a key is pressed.*) end Read; - procedure Time*(): INTEGER; + procedure Time*(): Int; (**returns the time elapsed since system startup in units of size 1 / TimeUnit seconds*) return 0 end Time; diff --git a/lib/obnc/Input0Test.obn b/lib/obnc/Input0Test.obn index 3b9c8a5..1e8764f 100644 --- a/lib/obnc/Input0Test.obn +++ b/lib/obnc/Input0Test.obn @@ -20,7 +20,7 @@ module Input0Test; import Input := Input0, Out; procedure TestAvailable; - var n: INTEGER; ch: CHAR; + var n: Int; ch: Char; begin Out.String("Press abc..."); Out.Ln; @@ -39,7 +39,7 @@ module Input0Test; procedure TestRead; - var ch: CHAR; + var ch: Char; begin Out.String("Press space ... "); Out.Ln; diff --git a/lib/obnc/InputTest.obn b/lib/obnc/InputTest.obn index bef218b..6f9e6f4 100644 --- a/lib/obnc/InputTest.obn +++ b/lib/obnc/InputTest.obn @@ -20,7 +20,7 @@ module InputTest; import Input, Out, XYplane; procedure TestAvailable; - var n: INTEGER; ch: CHAR; + var n: Int; ch: Char; begin Out.String("Press any key ... "); Out.Ln; @@ -35,7 +35,7 @@ module InputTest; procedure TestRead; - var ch: CHAR; + var ch: Char; begin Out.String("Press space ... "); Out.Ln; @@ -53,9 +53,9 @@ module InputTest; end TestRead; - procedure TestButton(button: INTEGER); - var buttonLabels: array 3, 8 of CHAR; - buttons: SET; x, y: INTEGER; + procedure TestButton(button: Int); + var buttonLabels: array 3, 8 of Char; + buttons: SET; x, y: Int; begin buttonLabels[0] := "right"; buttonLabels[1] := "middle"; diff --git a/lib/obnc/Math.obn b/lib/obnc/Math.obn index db3c8d7..4e6a86a 100644 --- a/lib/obnc/Math.obn +++ b/lib/obnc/Math.obn @@ -16,115 +16,115 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co e* = 2.71828182845905; dummy = 0.0; - procedure sqrt*(x: REAL): REAL; + procedure sqrt*(x: Real): Real; (**returns the square root of x, where x must be positive*) return dummy end sqrt; - procedure power*(base, exp: REAL): REAL; + procedure power*(base, exp: Real): Real; (**returns base raised to exp*) return dummy end power; - procedure exp*(x: REAL): REAL; + procedure exp*(x: Real): Real; (**returns the constant e raised to x*) return dummy end exp; - procedure ln*(x: REAL): REAL; + procedure ln*(x: Real): Real; (**returns the natural logarithm of x with base e*) return dummy end ln; - procedure log*(x, base: REAL): REAL; + procedure log*(x, base: Real): Real; (**log(x, b) returns the logarithm of x with base b*) return dummy end log; - procedure round*(x: REAL): REAL; -(**returns x rounded to the nearest integer. If the fraction part of x is in range 0.0 to 0.5 then the result is the largest integer not greater than x, otherwise the result is x rounded up to the next highest whole number. Note that integer values cannot always be exactly represented in REAL format.*) + procedure round*(x: Real): Real; +(**returns x rounded to the nearest integer. If the fraction part of x is in range 0.0 to 0.5 then the result is the largest integer not greater than x, otherwise the result is x rounded up to the next highest whole number. Note that integer values cannot always be exactly represented in Real format.*) return dummy end round; - procedure sin*(x: REAL): REAL; + procedure sin*(x: Real): Real; (**returns the sine of a radian value x*) return dummy end sin; - procedure cos*(x: REAL): REAL; + procedure cos*(x: Real): Real; (**returns the cosine of a radian value x*) return dummy end cos; - procedure tan*(x: REAL): REAL; + procedure tan*(x: Real): Real; (**returns the tangent of a radian value x*) return dummy end tan; - procedure arcsin*(x: REAL): REAL; + procedure arcsin*(x: Real): Real; (**returns the inverse sine of x in radians, where -1 <= x <= 1*) return dummy end arcsin; - procedure arccos*(x: REAL): REAL; + procedure arccos*(x: Real): Real; (**returns the inverse cosine of x in radians, where -1 <= x <= 1*) return dummy end arccos; - procedure arctan*(x: REAL): REAL; + procedure arctan*(x: Real): Real; (**returns the inverse tangent of x in radians, where -1 <= x <= 1*) return dummy end arctan; - procedure arctan2*(y, x: REAL): REAL; + procedure arctan2*(y, x: Real): Real; (**returns the inverse tangent in radians of y/x based on the signs of both values to determine the correct quadrant.*) return dummy end arctan2; - procedure sinh*(x: REAL): REAL; + procedure sinh*(x: Real): Real; (**returns the hyperbolic sine of x*) return dummy end sinh; - procedure cosh*(x: REAL): REAL; + procedure cosh*(x: Real): Real; (**returns the hyperbolic cosine of x*) return dummy end cosh; - procedure tanh*(x: REAL): REAL; + procedure tanh*(x: Real): Real; (**returns the hyperbolic tangent of x*) return dummy end tanh; - procedure arcsinh*(x: REAL): REAL; + procedure arcsinh*(x: Real): Real; (**returns the inverse hyperbolic sine of x*) return dummy end arcsinh; - procedure arccosh*(x: REAL): REAL; + procedure arccosh*(x: Real): Real; (**returns the inverse hyperbolic cosine of x*) return dummy end arccosh; - procedure arctanh*(x: REAL): REAL; + procedure arctanh*(x: Real): Real; (**returns the inverse hyperbolic tangent of x*) return dummy end arctanh; diff --git a/lib/obnc/Out.obn b/lib/obnc/Out.obn index 02497cb..56f205c 100644 --- a/lib/obnc/Out.obn +++ b/lib/obnc/Out.obn @@ -16,27 +16,27 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Open; - procedure Char*(ch: CHAR); + procedure Char*(ch: Char); (**writes the character ch to the end of the output stream*) end Char; - procedure String*(s: array of CHAR); + procedure String*(s: array of Char); (**writes the null-terminated character sequence s to the end of the output stream (without 0X).*) end String; - procedure Int*(i, n: INTEGER); + procedure Int*(i, n: Int); (**writes the integer i to the end of the output stream. If the textual representation of i requires m characters, i is right adjusted in a field of Max(n, m) characters padded with blanks at the left end. A plus sign is not written.*) end Int; - procedure Hex*(i: INTEGER); + procedure Hex*(i: Int); (**writes the integer i to the end of the output stream as a zero-padded unsigned hexadecimal number with a leading space. NOTE: This procedure is an extension to The Oakwood Guidelines.*) end Hex; - procedure Real*(x: REAL; n: INTEGER); + procedure Real*(x: Real; n: Int); (**writes the real number x to the end of the output stream using an exponential form. If the textual representation of x requires m characters (including a two-digit signed exponent), x is right adjusted in a field of Max(n, m) characters padded with blanks at the left end. A plus sign of the mantissa is not written.*) end Real; diff --git a/lib/obnc/Strings.obn b/lib/obnc/Strings.obn index d9b1b4a..30a10ab 100644 --- a/lib/obnc/Strings.obn +++ b/lib/obnc/Strings.obn @@ -9,9 +9,9 @@ module Strings; Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Compiler Developers". All character arrays are assumed to contain 0X as a terminator and positions start at 0.*) - procedure Length*(s: array of CHAR): INTEGER; + procedure Length*(s: array of Char): Int; (**Length(s) returns the number of characters in s up to and excluding the first 0X.*) - var i: INTEGER; + var i: Int; begin i := 0; while s[i] # 0X do @@ -21,16 +21,16 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Length; - procedure Min(a, b: INTEGER): INTEGER; + procedure Min(a, b: Int): Int; begin if a > b then a := b end return a end Min; - procedure Insert*(source: array of CHAR; pos: INTEGER; var dest: array of CHAR); + procedure Insert*(source: array of Char; pos: Int; var dest: array of Char); (**Insert(src, pos, dst) inserts the string src into the string dst at position pos (0 <= pos <= Length(dst)). If pos = Length(dst), src is appended to dst. If the size of dst is not large enough to hold the result of the operation, the result is truncated so that dst is always terminated with a 0X.*) - var sourceLength, destLength, newLength: INTEGER; - i, lim: INTEGER; + var sourceLength, destLength, newLength: Int; + i, lim: Int; begin destLength := Length(dest); ASSERT(pos >= 0); @@ -53,10 +53,10 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Insert; - procedure Append*(extra: array of CHAR; var dest: array of CHAR); + procedure Append*(extra: array of Char; var dest: array of Char); (**Append(s, dst) has the same effect as Insert(s, Length(dst), dst).*) - var destLength, newLength: INTEGER; - i: INTEGER; + var destLength, newLength: Int; + i: Int; begin destLength := Length(dest); newLength := Min(destLength + Length(extra), LEN(dest) - 1); @@ -68,9 +68,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Append; - procedure Delete*(var s: array of CHAR; pos, n: INTEGER); + procedure Delete*(var s: array of Char; pos, n: Int); (**Delete(s, pos, n) deletes n characters from s starting at position pos (0 <= pos <= Length(s)). If n > Length(s) - pos, the new length of s is pos.*) - var length, n1, i: INTEGER; + var length, n1, i: Int; begin length := Length(s); ASSERT(pos >= 0); @@ -84,9 +84,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Delete; - procedure Replace*(source: array of CHAR; pos: INTEGER; var dest: array of CHAR); + procedure Replace*(source: array of Char; pos: Int; var dest: array of Char); (**Replace(src, pos, dst) has the same effect as Delete(dst, pos, Length(src)) followed by an Insert(src, pos, dst).*) - var destLength, n, i: INTEGER; + var destLength, n, i: Int; begin destLength := Length(dest); ASSERT(pos >= 0); @@ -105,9 +105,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Replace; - procedure Extract*(source: array of CHAR; pos, n: INTEGER; var dest: array of CHAR); + procedure Extract*(source: array of Char; pos, n: Int; var dest: array of Char); (**Extract(src, pos, n, dst) extracts a substring dst with n characters from position pos (0 <= pos <= Length(src)) in src. If n > Length(src) - pos, dst is only the part of src from pos to the end of src, i.e. Length(src) - 1. If the size of dst is not large enough to hold the result of the operation, the result is truncated so that dst is always terminated with a 0X.*) - var sourceLength, n1, i: INTEGER; + var sourceLength, n1, i: Int; begin sourceLength := Length(source); ASSERT(pos >= 0); @@ -121,9 +121,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Extract; - procedure Pos*(pattern, s: array of CHAR; pos: INTEGER): INTEGER; + procedure Pos*(pattern, s: array of Char; pos: Int): Int; (**Pos(pat, s, pos) returns the position of the first occurrence of pat in s. Searching starts at position pos (0 <= pos <= Length(s)). If pat is not found, -1 is returned.*) - var idxs, idxp, result: INTEGER; + var idxs, idxp, result: Int; begin ASSERT(pos >= 0); ASSERT(pos < LEN(s)); @@ -148,9 +148,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Pos; - procedure Cap*(var s: array of CHAR); + procedure Cap*(var s: array of Char); (**Cap(s) replaces each lower case letter within s by its upper case equivalent.*) - var i: INTEGER; + var i: Int; begin i := 0; while s[i] # 0X do diff --git a/lib/obnc/StringsTest.obn b/lib/obnc/StringsTest.obn index 4067ad8..1958cc4 100644 --- a/lib/obnc/StringsTest.obn +++ b/lib/obnc/StringsTest.obn @@ -20,8 +20,8 @@ module StringsTest; import Strings; var - shortStr: array 4 of CHAR; - s: array 14 of CHAR; + shortStr: array 4 of Char; + s: array 14 of Char; begin (*test Length*) diff --git a/lib/obnc/XYplane.obn b/lib/obnc/XYplane.obn index 4148559..c85f4c8 100644 --- a/lib/obnc/XYplane.obn +++ b/lib/obnc/XYplane.obn @@ -19,8 +19,8 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co erase* = 0; var - X*, Y*: INTEGER; (**X = 0 and Y = 0. Included for compatibility with The Oakwood Guidelines.*) - W*, H*: INTEGER; (**width and height of the drawing plane in pixels*) + X*, Y*: Int; (**X = 0 and Y = 0. Included for compatibility with The Oakwood Guidelines.*) + W*, H*: Int; (**width and height of the drawing plane in pixels*) procedure Open*; (**initializes the drawing plane*) @@ -30,29 +30,29 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co (**erases all pixels in the drawing plane*) end Clear; - procedure Dot*(x, y, mode: INTEGER); + procedure Dot*(x, y, mode: Int); (**Dot(x, y, m) draws or erases the pixel at the coordinates (x, y) relative to the lower left corner of the plane. If m = draw the pixel is drawn, if m = erase the pixel is erased.*) end Dot; - procedure IsDot*(x, y: INTEGER): BOOLEAN; + procedure IsDot*(x, y: Int): Bool; (**returns true if the pixel at the coordinates (x, y) relative to the lower left corner of the screen is drawn, otherwise it returns false*) return false (*dummy value*) end IsDot; - procedure Key*(): CHAR; + procedure Key*(): Char; (**reads the keyboard. If a key was pressed prior to invocation, its character value is returned, otherwise the result is 0X.*) return CHR(0) (*dummy value*) end Key; - procedure SetSize*(width, height: INTEGER); + procedure SetSize*(width, height: Int); (**sets the width and height of the drawing plane. The setting takes effect when Open is called. NOTE: This procedure is an extension to The Oakwood Guidelines.*) end SetSize; - procedure UseColor*(color: INTEGER); + procedure UseColor*(color: Int); (**sets the red, green and blue components of the drawing color as a three-byte value. NOTE: This procedure is an extension to The Oakwood Guidelines.*) end UseColor; - procedure Color*(x, y: INTEGER): INTEGER; + procedure Color*(x, y: Int): Int; (**returns the color of the pixel at the coordinates (x, y). NOTE: This procedure is an extension to The Oakwood Guidelines.*) return 0 (*dummy value*) end Color; @@ -66,7 +66,7 @@ module drawpixels; import Input, XYplane; var - x, y: INTEGER; + x, y: Int; keys: SET; begin diff --git a/lib/obnc/XYplaneTest.obn b/lib/obnc/XYplaneTest.obn index e4a404a..1d2ef37 100644 --- a/lib/obnc/XYplaneTest.obn +++ b/lib/obnc/XYplaneTest.obn @@ -19,8 +19,8 @@ module XYplaneTest; import XYplane; - procedure TestPosition(x, y: INTEGER); - var withinBounds: BOOLEAN; + procedure TestPosition(x, y: Int); + var withinBounds: Bool; begin withinBounds := (x >= 0) & (x < XYplane.W) & (y >= 0) & (y < XYplane.H); @@ -34,7 +34,7 @@ module XYplaneTest; procedure Run; - var x, y, w, h: INTEGER; + var x, y, w, h: Int; begin x := XYplane.X; y := XYplane.Y; diff --git a/src/Oberon.y b/src/Oberon.y index 86855a4..e9d7ea9 100644 --- a/src/Oberon.y +++ b/src/Oberon.y @@ -322,7 +322,7 @@ TypeDeclaration: YYABORT; } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($2)); + Oberon_PrintError("error: 8 undeclared identifier: %s", Trees_Name($2)); YYABORT; } } @@ -360,7 +360,7 @@ ArrayType: reversedLengths = Trees_Right(reversedLengths); } while (reversedLengths != NULL); } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($2)); + Oberon_PrintError("error: 10 undeclared identifier: %s", Trees_Name($2)); exit(EXIT_FAILURE); } } @@ -472,7 +472,7 @@ BaseType: YYABORT; } } else { - Oberon_PrintError("error: undeclared identifier: %s", name); + Oberon_PrintError("error: 11 undeclared identifier: %s", name); YYABORT; } } @@ -683,7 +683,7 @@ VariableDeclaration: Generate_VariableDeclaration($1); } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($3)); + Oberon_PrintError("error: 1 undeclared identifier: %s", Trees_Name($3)); exit(EXIT_FAILURE); } } @@ -1588,7 +1588,7 @@ label: assert(0); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($1)); + Oberon_PrintError("error: 2 undeclared identifier: %s", Trees_Name($1)); YYABORT; } } @@ -1949,7 +1949,7 @@ ResultTypeOpt: } } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($2)); + Oberon_PrintError("error: 3 undeclared identifier: %s", Trees_Name($2)); YYABORT; } } @@ -2024,7 +2024,7 @@ FormalType: $1 = Trees_Right($1); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name($2)); + Oberon_PrintError("error: 4 undeclared identifier: %s", Trees_Name($2)); exit(EXIT_FAILURE); } } @@ -2628,7 +2628,7 @@ static Trees_Node Designator(const char identName[], Trees_Node selectorList) qualidentSym = Table_At(qualidentName); qualidentSelectorList = Trees_Right(selectorList); if (qualidentSym == NULL) { - Oberon_PrintError("error: undeclared identifier: %s", qualidentName); + Oberon_PrintError("error: 5 undeclared identifier: %s", qualidentName); exit(EXIT_FAILURE); } } else { @@ -2641,7 +2641,7 @@ static Trees_Node Designator(const char identName[], Trees_Node selectorList) } } else { - Oberon_PrintError("error: undeclared identifier: %s", identName); + Oberon_PrintError("error: 6 undeclared identifier: %s", identName); exit(EXIT_FAILURE); } } @@ -2785,7 +2785,7 @@ static void SetSelectorTypes(Trees_Node identType, Trees_Node designator, int *p exit(EXIT_FAILURE); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name(extendedType)); + Oberon_PrintError("error: 7 undeclared identifier: %s", Trees_Name(extendedType)); exit(EXIT_FAILURE); } } else { diff --git a/src/Table.c b/src/Table.c index c41eda2..48104b5 100644 --- a/src/Table.c +++ b/src/Table.c @@ -82,9 +82,9 @@ void Table_Init(void) {"ABS", TREES_PROCEDURE_KIND, TREES_ABS_PROC}, {"ASR", TREES_PROCEDURE_KIND, TREES_ASR_PROC}, {"ASSERT", TREES_PROCEDURE_KIND, TREES_ASSERT_PROC}, - {"BOOLEAN", TREES_TYPE_KIND, TREES_BOOLEAN_TYPE}, - {"BYTE", TREES_TYPE_KIND, TREES_BYTE_TYPE}, - {"CHAR", TREES_TYPE_KIND, TREES_CHAR_TYPE}, + {"Bool", TREES_TYPE_KIND, TREES_BOOLEAN_TYPE}, + {"Byte", TREES_TYPE_KIND, TREES_BYTE_TYPE}, + {"Char", TREES_TYPE_KIND, TREES_CHAR_TYPE}, {"CHR", TREES_PROCEDURE_KIND, TREES_CHR_PROC}, {"DEC", TREES_PROCEDURE_KIND, TREES_DEC_PROC}, {"EXCL", TREES_PROCEDURE_KIND, TREES_EXCL_PROC}, @@ -92,14 +92,14 @@ void Table_Init(void) {"FLT", TREES_PROCEDURE_KIND, TREES_FLT_PROC}, {"INC", TREES_PROCEDURE_KIND, TREES_INC_PROC}, {"INCL", TREES_PROCEDURE_KIND, TREES_INCL_PROC}, - {"INTEGER", TREES_TYPE_KIND, TREES_INTEGER_TYPE}, + {"Int", TREES_TYPE_KIND, TREES_INTEGER_TYPE}, {"LEN", TREES_PROCEDURE_KIND, TREES_LEN_PROC}, {"LSL", TREES_PROCEDURE_KIND, TREES_LSL_PROC}, {"NEW", TREES_PROCEDURE_KIND, TREES_NEW_PROC}, {"ODD", TREES_PROCEDURE_KIND, TREES_ODD_PROC}, {"ORD", TREES_PROCEDURE_KIND, TREES_ORD_PROC}, {"PACK", TREES_PROCEDURE_KIND, TREES_PACK_PROC}, - {"REAL", TREES_TYPE_KIND, TREES_REAL_TYPE}, + {"Real", TREES_TYPE_KIND, TREES_REAL_TYPE}, {"ROR", TREES_PROCEDURE_KIND, TREES_ROR_PROC}, {"SET", TREES_TYPE_KIND, TREES_SET_TYPE}, {"UNPK", TREES_PROCEDURE_KIND, TREES_UNPK_PROC}}; diff --git a/src/y.tab.c b/src/y.tab.c index 2f1b119..47c2449 100644 --- a/src/y.tab.c +++ b/src/y.tab.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.3.2. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.3.2" +#define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -66,7 +66,7 @@ /* First part of user prologue. */ -#line 18 "Oberon.y" /* yacc.c:337 */ +#line 18 "Oberon.y" #include "Config.h" #include "Error.h" @@ -155,7 +155,17 @@ static void CheckCaseLabelUniqueness(Trees_Node label); static void ExportSymbolTable(const char symfilePath[]); -#line 159 "y.tab.c" /* yacc.c:337 */ +#line 159 "y.tab.c" + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus @@ -176,8 +186,8 @@ static void ExportSymbolTable(const char symfilePath[]); # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ +/* Use api.header.include to #include this header + instead of duplicating it here. */ #ifndef YY_YY_Y_TAB_H_INCLUDED # define YY_YY_Y_TAB_H_INCLUDED /* Debug traces. */ @@ -285,10 +295,9 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 107 "Oberon.y" /* yacc.c:352 */ +#line 107 "Oberon.y" const char *ident; OBNC_INTEGER integer; @@ -296,9 +305,9 @@ union YYSTYPE const char *string; Trees_Node node; -#line 300 "y.tab.c" /* yacc.c:352 */ -}; +#line 309 "y.tab.c" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 @@ -317,28 +326,75 @@ int yyparse (void); # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T @@ -346,7 +402,7 @@ typedef short yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -354,7 +410,19 @@ typedef short yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -368,22 +436,20 @@ typedef short yytype_int16; # endif #endif -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # endif #endif -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - #ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif #endif /* Suppress unused-variable warnings by "using" E. */ @@ -395,11 +461,11 @@ typedef short yytype_int16; #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -412,6 +478,20 @@ typedef short yytype_int16; # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE @@ -488,17 +568,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -511,11 +591,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -527,12 +607,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -558,14 +638,15 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 300 + /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ -static const yytype_uint8 yytranslate[] = +static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -602,7 +683,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { 0, 221, 221, 225, 232, 250, 255, 264, 268, 278, 294, 309, 332, 342, 343, 344, 345, 346, 350, 370, @@ -670,7 +751,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = +static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -682,14 +763,14 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -132 +#define YYPACT_NINF (-132) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-132))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -166 +#define YYTABLE_NINF (-166) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -912,7 +993,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const yytype_int8 yyr2[] = { 0, 2, 1, 3, 2, 1, 0, 1, 1, 3, 1, 2, 2, 1, 1, 1, 1, 1, 2, 3, @@ -1018,7 +1099,9 @@ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) if (yytype < YYNTOKENS) YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1042,7 +1125,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1065,19 +1148,19 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - unsigned long yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], + yystos[+yyssp[yyi + 1 - yynrhs]], &yyvsp[(yyi + 1) - (yynrhs)] ); YYFPRINTF (stderr, "\n"); @@ -1122,13 +1205,13 @@ int yydebug; # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ -static YYSIZE_T +static YYPTRDIFF_T yystrlen (const char *yystr) { - YYSIZE_T yylen; + YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; @@ -1164,12 +1247,12 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYSIZE_T +static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - YYSIZE_T yyn = 0; + YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1200,10 +1283,10 @@ yytnamerr (char *yyres, const char *yystr) do_not_strip_quotes: ; } - if (! yyres) + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else return yystrlen (yystr); - - return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); } # endif @@ -1216,19 +1299,19 @@ yytnamerr (char *yyres, const char *yystr) *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ + /* Actual size of YYARG. */ int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then @@ -1255,7 +1338,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, */ if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { @@ -1280,7 +1365,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1307,7 +1393,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else @@ -1337,8 +1425,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } else { - yyp++; - yyformat++; + ++yyp; + ++yyformat; } } return 0; @@ -1381,7 +1469,7 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; @@ -1393,16 +1481,16 @@ yyparse (void) to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYSIZE_T yystacksize; + YYPTRDIFF_T yystacksize; int yyn; int yyresult; @@ -1416,7 +1504,7 @@ yyparse (void) /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1448,10 +1536,14 @@ yynewstate: /*--------------------------------------------------------------------. -| yynewstate -- set current state (the top of the stack) to yystate. | +| yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: - *yyssp = (yytype_int16) yystate; + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE @@ -1459,23 +1551,23 @@ yysetstate: #else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); + YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ + yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; @@ -1489,9 +1581,10 @@ yysetstate: yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1505,16 +1598,16 @@ yysetstate: yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - if (yystate == YYFINAL) YYACCEPT; @@ -1574,15 +1667,13 @@ yybackup: /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1617,25 +1708,25 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: -#line 222 "Oberon.y" /* yacc.c:1652 */ - { + case 2: +#line 222 "Oberon.y" + { (yyval.node) = Trees_NewIdent((yyvsp[0].ident)); } -#line 1626 "y.tab.c" /* yacc.c:1652 */ +#line 1717 "y.tab.c" break; case 3: -#line 226 "Oberon.y" /* yacc.c:1652 */ - { +#line 226 "Oberon.y" + { (yyval.node) = Trees_NewIdent(Util_String("%s.%s", (yyvsp[-2].ident), (yyvsp[0].ident))); } -#line 1634 "y.tab.c" /* yacc.c:1652 */ +#line 1725 "y.tab.c" break; case 4: -#line 233 "Oberon.y" /* yacc.c:1652 */ - { +#line 233 "Oberon.y" + { if (! Table_LocallyDeclared((yyvsp[-1].ident)) || (recordDeclarationStack != NULL)) { (yyval.node) = Trees_NewIdent((yyvsp[-1].ident)); if ((yyvsp[0].integer)) { @@ -1649,44 +1740,44 @@ yyreduce: YYABORT; } } -#line 1653 "y.tab.c" /* yacc.c:1652 */ +#line 1744 "y.tab.c" break; case 5: -#line 251 "Oberon.y" /* yacc.c:1652 */ - { +#line 251 "Oberon.y" + { (yyval.integer) = 1; } -#line 1661 "y.tab.c" /* yacc.c:1652 */ +#line 1752 "y.tab.c" break; case 6: -#line 255 "Oberon.y" /* yacc.c:1652 */ - { +#line 255 "Oberon.y" + { (yyval.integer) = 0; } -#line 1669 "y.tab.c" /* yacc.c:1652 */ +#line 1760 "y.tab.c" break; case 7: -#line 265 "Oberon.y" /* yacc.c:1652 */ - { +#line 265 "Oberon.y" + { (yyval.node) = Trees_NewInteger((yyvsp[0].integer)); } -#line 1677 "y.tab.c" /* yacc.c:1652 */ +#line 1768 "y.tab.c" break; case 8: -#line 269 "Oberon.y" /* yacc.c:1652 */ - { +#line 269 "Oberon.y" + { (yyval.node) = Trees_NewReal((yyvsp[0].real)); } -#line 1685 "y.tab.c" /* yacc.c:1652 */ +#line 1776 "y.tab.c" break; case 9: -#line 279 "Oberon.y" /* yacc.c:1652 */ - { +#line 279 "Oberon.y" + { if (! (Trees_Exported((yyvsp[-2].node)) && Trees_Local((yyvsp[-2].node)))) { Trees_SetKind(TREES_CONSTANT_KIND, (yyvsp[-2].node)); Trees_SetType(Trees_Type((yyvsp[0].node)), (yyvsp[-2].node)); @@ -1698,12 +1789,12 @@ yyreduce: YYABORT; } } -#line 1702 "y.tab.c" /* yacc.c:1652 */ +#line 1793 "y.tab.c" break; case 10: -#line 295 "Oberon.y" /* yacc.c:1652 */ - { +#line 295 "Oberon.y" + { if (IsConstExpression((yyvsp[0].node))) { (yyval.node) = (yyvsp[0].node); } else { @@ -1711,12 +1802,12 @@ yyreduce: YYABORT; } } -#line 1715 "y.tab.c" /* yacc.c:1652 */ +#line 1806 "y.tab.c" break; case 11: -#line 310 "Oberon.y" /* yacc.c:1652 */ - { +#line 310 "Oberon.y" + { Trees_Node sourceType; sourceType = ResolvedType((yyvsp[0].node), 1); @@ -1731,27 +1822,27 @@ yyreduce: YYABORT; } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 8 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); YYABORT; } } -#line 1739 "y.tab.c" /* yacc.c:1652 */ +#line 1830 "y.tab.c" break; case 12: -#line 333 "Oberon.y" /* yacc.c:1652 */ - { +#line 333 "Oberon.y" + { Trees_SetKind(TREES_TYPE_KIND, (yyvsp[-1].node)); currentTypeIdentdef = (yyvsp[-1].node); Table_Put((yyvsp[-1].node)); (yyval.node) = (yyvsp[-1].node); } -#line 1750 "y.tab.c" /* yacc.c:1652 */ +#line 1841 "y.tab.c" break; case 18: -#line 351 "Oberon.y" /* yacc.c:1652 */ - { +#line 351 "Oberon.y" + { Trees_Node reversedLengths, length; (yyval.node) = ResolvedType((yyvsp[0].node), 0); @@ -1763,43 +1854,43 @@ yyreduce: reversedLengths = Trees_Right(reversedLengths); } while (reversedLengths != NULL); } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 10 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); exit(EXIT_FAILURE); } } -#line 1771 "y.tab.c" /* yacc.c:1652 */ +#line 1862 "y.tab.c" break; case 19: -#line 371 "Oberon.y" /* yacc.c:1652 */ - { +#line 371 "Oberon.y" + { if ((currentTypeIdentdef != NULL) && (Trees_Type(currentTypeIdentdef) == NULL)) { Trees_SetType(Trees_NewLeaf(ARRAY), currentTypeIdentdef); /*incomplete type*/ } (yyval.node) = (yyvsp[-1].node); } -#line 1782 "y.tab.c" /* yacc.c:1652 */ +#line 1873 "y.tab.c" break; case 20: -#line 381 "Oberon.y" /* yacc.c:1652 */ - { +#line 381 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), NULL); } -#line 1790 "y.tab.c" /* yacc.c:1652 */ +#line 1881 "y.tab.c" break; case 21: -#line 385 "Oberon.y" /* yacc.c:1652 */ - { +#line 385 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), (yyvsp[-2].node)); } -#line 1798 "y.tab.c" /* yacc.c:1652 */ +#line 1889 "y.tab.c" break; case 22: -#line 392 "Oberon.y" /* yacc.c:1652 */ - { +#line 392 "Oberon.y" + { if (Types_IsInteger(Trees_Type((yyvsp[0].node)))) { if (IsInteger((yyvsp[0].node))) { if (Trees_Integer((yyvsp[0].node)) <= 0) { @@ -1815,49 +1906,49 @@ yyreduce: YYABORT; } } -#line 1819 "y.tab.c" /* yacc.c:1652 */ +#line 1910 "y.tab.c" break; case 23: -#line 412 "Oberon.y" /* yacc.c:1652 */ - { +#line 412 "Oberon.y" + { recordDeclarationStack = Trees_Right(recordDeclarationStack); (yyval.node) = Types_NewRecord(Types_RecordBaseType((yyvsp[-2].node)), (yyvsp[-1].node)); } -#line 1828 "y.tab.c" /* yacc.c:1652 */ +#line 1919 "y.tab.c" break; case 24: -#line 420 "Oberon.y" /* yacc.c:1652 */ - { +#line 420 "Oberon.y" + { (yyval.node) = Types_NewRecord((yyvsp[0].node), NULL); if ((currentTypeIdentdef != NULL) && (Trees_Type(currentTypeIdentdef) == NULL)) { Trees_SetType((yyval.node), currentTypeIdentdef); } recordDeclarationStack = Trees_NewNode(TREES_NOSYM, (yyval.node), recordDeclarationStack); } -#line 1840 "y.tab.c" /* yacc.c:1652 */ +#line 1931 "y.tab.c" break; case 25: -#line 431 "Oberon.y" /* yacc.c:1652 */ - { +#line 431 "Oberon.y" + { (yyval.node) = (yyvsp[-1].node); } -#line 1848 "y.tab.c" /* yacc.c:1652 */ +#line 1939 "y.tab.c" break; case 26: -#line 435 "Oberon.y" /* yacc.c:1652 */ - { +#line 435 "Oberon.y" + { (yyval.node) = NULL; } -#line 1856 "y.tab.c" /* yacc.c:1652 */ +#line 1947 "y.tab.c" break; case 27: -#line 442 "Oberon.y" /* yacc.c:1652 */ - { +#line 442 "Oberon.y" + { const char *name; Trees_Node symbol; @@ -1890,41 +1981,41 @@ yyreduce: YYABORT; } } else { - Oberon_PrintError("error: undeclared identifier: %s", name); + Oberon_PrintError("error: 11 undeclared identifier: %s", name); YYABORT; } } -#line 1898 "y.tab.c" /* yacc.c:1652 */ +#line 1989 "y.tab.c" break; case 28: -#line 483 "Oberon.y" /* yacc.c:1652 */ - { +#line 483 "Oberon.y" + { Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/ (yyval.node) = (yyvsp[0].node); } -#line 1907 "y.tab.c" /* yacc.c:1652 */ +#line 1998 "y.tab.c" break; case 29: -#line 488 "Oberon.y" /* yacc.c:1652 */ - { +#line 488 "Oberon.y" + { (yyval.node) = NULL; } -#line 1915 "y.tab.c" /* yacc.c:1652 */ +#line 2006 "y.tab.c" break; case 30: -#line 495 "Oberon.y" /* yacc.c:1652 */ - { +#line 495 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_FIELD_LIST_SEQUENCE, (yyvsp[0].node), NULL); } -#line 1923 "y.tab.c" /* yacc.c:1652 */ +#line 2014 "y.tab.c" break; case 31: -#line 499 "Oberon.y" /* yacc.c:1652 */ - { +#line 499 "Oberon.y" + { Trees_Node currSeq, currList, currSeqList; const char *seqIdentName, *listIdentName; @@ -1948,12 +2039,12 @@ yyreduce: } (yyval.node) = Trees_NewNode(TREES_FIELD_LIST_SEQUENCE, (yyvsp[0].node), (yyvsp[-2].node)); } -#line 1952 "y.tab.c" /* yacc.c:1652 */ +#line 2043 "y.tab.c" break; case 32: -#line 527 "Oberon.y" /* yacc.c:1652 */ - { +#line 527 "Oberon.y" + { Trees_Node type, tail, ident, p, directBaseType, baseTypeField, baseType; (yyval.node) = NULL; @@ -1998,31 +2089,31 @@ yyreduce: YYABORT; } } -#line 2002 "y.tab.c" /* yacc.c:1652 */ +#line 2093 "y.tab.c" break; case 33: -#line 576 "Oberon.y" /* yacc.c:1652 */ - { +#line 576 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_IDENT_LIST, (yyvsp[0].node), NULL); } -#line 2010 "y.tab.c" /* yacc.c:1652 */ +#line 2101 "y.tab.c" break; case 34: -#line 580 "Oberon.y" /* yacc.c:1652 */ - { +#line 580 "Oberon.y" + { Trees_Node reversedIdents; reversedIdents = Trees_NewNode(TREES_IDENT_LIST, (yyvsp[0].node), (yyvsp[-2].node)); (yyval.node) = reversedIdents; } -#line 2021 "y.tab.c" /* yacc.c:1652 */ +#line 2112 "y.tab.c" break; case 35: -#line 590 "Oberon.y" /* yacc.c:1652 */ - { +#line 590 "Oberon.y" + { const char *baseTypeName; Trees_Node declaredBaseType; @@ -2053,46 +2144,46 @@ yyreduce: YYABORT; } } -#line 2057 "y.tab.c" /* yacc.c:1652 */ +#line 2148 "y.tab.c" break; case 36: -#line 625 "Oberon.y" /* yacc.c:1652 */ - { +#line 625 "Oberon.y" + { if ((currentTypeIdentdef != NULL) && (Trees_Type(currentTypeIdentdef) == NULL)) { Trees_SetType(Types_NewPointer(NULL), currentTypeIdentdef); /*incomplete type*/ } } -#line 2067 "y.tab.c" /* yacc.c:1652 */ +#line 2158 "y.tab.c" break; case 37: -#line 634 "Oberon.y" /* yacc.c:1652 */ - { +#line 634 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); } -#line 2075 "y.tab.c" /* yacc.c:1652 */ +#line 2166 "y.tab.c" break; case 38: -#line 641 "Oberon.y" /* yacc.c:1652 */ - { +#line 641 "Oberon.y" + { (yyval.node) = NULL; } -#line 2083 "y.tab.c" /* yacc.c:1652 */ +#line 2174 "y.tab.c" break; case 40: -#line 649 "Oberon.y" /* yacc.c:1652 */ - { +#line 649 "Oberon.y" + { (yyval.node) = Trees_NewLeaf(PROCEDURE); } -#line 2091 "y.tab.c" /* yacc.c:1652 */ +#line 2182 "y.tab.c" break; case 41: -#line 659 "Oberon.y" /* yacc.c:1652 */ - { +#line 659 "Oberon.y" + { Trees_Node type, identList, ident; type = ResolvedType((yyvsp[0].node), 0); @@ -2119,16 +2210,16 @@ yyreduce: Generate_VariableDeclaration((yyvsp[-2].node)); } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 1 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); exit(EXIT_FAILURE); } } -#line 2127 "y.tab.c" /* yacc.c:1652 */ +#line 2218 "y.tab.c" break; case 43: -#line 698 "Oberon.y" /* yacc.c:1652 */ - { +#line 698 "Oberon.y" + { Trees_Node expA, expB, typeA, typeB; int op = (int) (yyvsp[-1].integer); @@ -2171,76 +2262,76 @@ yyreduce: YYABORT; } } -#line 2175 "y.tab.c" /* yacc.c:1652 */ +#line 2266 "y.tab.c" break; case 44: -#line 745 "Oberon.y" /* yacc.c:1652 */ - { +#line 745 "Oberon.y" + { (yyval.integer) = '='; } -#line 2183 "y.tab.c" /* yacc.c:1652 */ +#line 2274 "y.tab.c" break; case 45: -#line 749 "Oberon.y" /* yacc.c:1652 */ - { +#line 749 "Oberon.y" + { (yyval.integer) = '#'; } -#line 2191 "y.tab.c" /* yacc.c:1652 */ +#line 2282 "y.tab.c" break; case 46: -#line 753 "Oberon.y" /* yacc.c:1652 */ - { +#line 753 "Oberon.y" + { (yyval.integer) = '<'; } -#line 2199 "y.tab.c" /* yacc.c:1652 */ +#line 2290 "y.tab.c" break; case 47: -#line 757 "Oberon.y" /* yacc.c:1652 */ - { +#line 757 "Oberon.y" + { (yyval.integer) = LE; } -#line 2207 "y.tab.c" /* yacc.c:1652 */ +#line 2298 "y.tab.c" break; case 48: -#line 761 "Oberon.y" /* yacc.c:1652 */ - { +#line 761 "Oberon.y" + { (yyval.integer) = '>'; } -#line 2215 "y.tab.c" /* yacc.c:1652 */ +#line 2306 "y.tab.c" break; case 49: -#line 765 "Oberon.y" /* yacc.c:1652 */ - { +#line 765 "Oberon.y" + { (yyval.integer) = GE; } -#line 2223 "y.tab.c" /* yacc.c:1652 */ +#line 2314 "y.tab.c" break; case 50: -#line 769 "Oberon.y" /* yacc.c:1652 */ - { +#line 769 "Oberon.y" + { (yyval.integer) = IN; } -#line 2231 "y.tab.c" /* yacc.c:1652 */ +#line 2322 "y.tab.c" break; case 51: -#line 773 "Oberon.y" /* yacc.c:1652 */ - { +#line 773 "Oberon.y" + { (yyval.integer) = IS; } -#line 2239 "y.tab.c" /* yacc.c:1652 */ +#line 2330 "y.tab.c" break; case 52: -#line 780 "Oberon.y" /* yacc.c:1652 */ - { +#line 780 "Oberon.y" + { int op = (int) (yyvsp[-1].integer); (yyval.node) = (yyvsp[0].node); if (op >= 0) { @@ -2261,12 +2352,12 @@ yyreduce: } } } -#line 2265 "y.tab.c" /* yacc.c:1652 */ +#line 2356 "y.tab.c" break; case 53: -#line 802 "Oberon.y" /* yacc.c:1652 */ - { +#line 802 "Oberon.y" + { int op = (int) (yyvsp[-1].integer); (yyval.node) = NULL; @@ -2291,60 +2382,60 @@ yyreduce: } assert((yyval.node) != NULL); } -#line 2295 "y.tab.c" /* yacc.c:1652 */ +#line 2386 "y.tab.c" break; case 54: -#line 831 "Oberon.y" /* yacc.c:1652 */ - { +#line 831 "Oberon.y" + { (yyval.integer) = '+'; } -#line 2303 "y.tab.c" /* yacc.c:1652 */ +#line 2394 "y.tab.c" break; case 55: -#line 835 "Oberon.y" /* yacc.c:1652 */ - { +#line 835 "Oberon.y" + { (yyval.integer) = '-'; } -#line 2311 "y.tab.c" /* yacc.c:1652 */ +#line 2402 "y.tab.c" break; case 56: -#line 839 "Oberon.y" /* yacc.c:1652 */ - { +#line 839 "Oberon.y" + { (yyval.integer) = -1; } -#line 2319 "y.tab.c" /* yacc.c:1652 */ +#line 2410 "y.tab.c" break; case 57: -#line 846 "Oberon.y" /* yacc.c:1652 */ - { +#line 846 "Oberon.y" + { (yyval.integer) = '+'; } -#line 2327 "y.tab.c" /* yacc.c:1652 */ +#line 2418 "y.tab.c" break; case 58: -#line 850 "Oberon.y" /* yacc.c:1652 */ - { +#line 850 "Oberon.y" + { (yyval.integer) = '-'; } -#line 2335 "y.tab.c" /* yacc.c:1652 */ +#line 2426 "y.tab.c" break; case 59: -#line 854 "Oberon.y" /* yacc.c:1652 */ - { +#line 854 "Oberon.y" + { (yyval.integer) = OR; } -#line 2343 "y.tab.c" /* yacc.c:1652 */ +#line 2434 "y.tab.c" break; case 61: -#line 862 "Oberon.y" /* yacc.c:1652 */ - { +#line 862 "Oberon.y" + { int op = (int) (yyvsp[-1].integer); (yyval.node) = NULL; @@ -2370,94 +2461,94 @@ yyreduce: assert((yyval.node) != NULL); } -#line 2374 "y.tab.c" /* yacc.c:1652 */ +#line 2465 "y.tab.c" break; case 62: -#line 892 "Oberon.y" /* yacc.c:1652 */ - { +#line 892 "Oberon.y" + { (yyval.integer) = '*'; } -#line 2382 "y.tab.c" /* yacc.c:1652 */ +#line 2473 "y.tab.c" break; case 63: -#line 896 "Oberon.y" /* yacc.c:1652 */ - { +#line 896 "Oberon.y" + { (yyval.integer) = '/'; } -#line 2390 "y.tab.c" /* yacc.c:1652 */ +#line 2481 "y.tab.c" break; case 64: -#line 900 "Oberon.y" /* yacc.c:1652 */ - { +#line 900 "Oberon.y" + { (yyval.integer) = DIV; } -#line 2398 "y.tab.c" /* yacc.c:1652 */ +#line 2489 "y.tab.c" break; case 65: -#line 904 "Oberon.y" /* yacc.c:1652 */ - { +#line 904 "Oberon.y" + { (yyval.integer) = MOD; } -#line 2406 "y.tab.c" /* yacc.c:1652 */ +#line 2497 "y.tab.c" break; case 66: -#line 908 "Oberon.y" /* yacc.c:1652 */ - { +#line 908 "Oberon.y" + { (yyval.integer) = '&'; } -#line 2414 "y.tab.c" /* yacc.c:1652 */ +#line 2505 "y.tab.c" break; case 68: -#line 916 "Oberon.y" /* yacc.c:1652 */ - { +#line 916 "Oberon.y" + { (yyval.node) = Trees_NewString((yyvsp[0].string)); } -#line 2422 "y.tab.c" /* yacc.c:1652 */ +#line 2513 "y.tab.c" break; case 69: -#line 920 "Oberon.y" /* yacc.c:1652 */ - { +#line 920 "Oberon.y" + { (yyval.node) = Trees_NewLeaf(NIL); Trees_SetType(Trees_NewLeaf(TREES_NIL_TYPE), (yyval.node)); } -#line 2431 "y.tab.c" /* yacc.c:1652 */ +#line 2522 "y.tab.c" break; case 70: -#line 925 "Oberon.y" /* yacc.c:1652 */ - { +#line 925 "Oberon.y" + { (yyval.node) = Trees_NewBoolean(1); } -#line 2439 "y.tab.c" /* yacc.c:1652 */ +#line 2530 "y.tab.c" break; case 71: -#line 929 "Oberon.y" /* yacc.c:1652 */ - { +#line 929 "Oberon.y" + { (yyval.node) = Trees_NewBoolean(0); } -#line 2447 "y.tab.c" /* yacc.c:1652 */ +#line 2538 "y.tab.c" break; case 72: -#line 933 "Oberon.y" /* yacc.c:1652 */ - { +#line 933 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); Trees_SetType(Trees_NewLeaf(TREES_SET_TYPE), (yyval.node)); } -#line 2456 "y.tab.c" /* yacc.c:1652 */ +#line 2547 "y.tab.c" break; case 73: -#line 939 "Oberon.y" /* yacc.c:1652 */ - { +#line 939 "Oberon.y" + { const int isFunctionCall = 1; Trees_Node designator, actualParameters, ident; @@ -2476,21 +2567,21 @@ yyreduce: } assert((yyval.node) != NULL); } -#line 2480 "y.tab.c" /* yacc.c:1652 */ +#line 2571 "y.tab.c" break; case 74: -#line 959 "Oberon.y" /* yacc.c:1652 */ - { +#line 959 "Oberon.y" + { CheckIsValueExpression((yyvsp[-1].node)); (yyval.node) = (yyvsp[-1].node); } -#line 2489 "y.tab.c" /* yacc.c:1652 */ +#line 2580 "y.tab.c" break; case 75: -#line 964 "Oberon.y" /* yacc.c:1652 */ - { +#line 964 "Oberon.y" + { (yyval.node) = NULL; CheckIsValueExpression((yyvsp[0].node)); if (Types_ExpressionCompatible('~', Trees_Type((yyvsp[0].node)), NULL)) { @@ -2506,12 +2597,12 @@ yyreduce: } assert((yyval.node) != NULL); } -#line 2510 "y.tab.c" /* yacc.c:1652 */ +#line 2601 "y.tab.c" break; case 76: -#line 985 "Oberon.y" /* yacc.c:1652 */ - { +#line 985 "Oberon.y" + { Trees_Node designator, identType, actualParameters; int parameterListFound; /*possibly empty*/ @@ -2527,12 +2618,12 @@ yyreduce: (yyval.node) = designator; } } -#line 2531 "y.tab.c" /* yacc.c:1652 */ +#line 2622 "y.tab.c" break; case 77: -#line 1005 "Oberon.y" /* yacc.c:1652 */ - { +#line 1005 "Oberon.y" + { Trees_Node curr; if ((Trees_Symbol((yyvsp[0].node)) == '[') && (Trees_Right((yyvsp[0].node)) != NULL)) { /*multi-dimensional element selector*/ @@ -2549,32 +2640,32 @@ yyreduce: (yyval.node) = Trees_NewNode(Trees_Symbol((yyvsp[0].node)), Trees_Left((yyvsp[0].node)), (yyvsp[-1].node)); } } -#line 2553 "y.tab.c" /* yacc.c:1652 */ +#line 2644 "y.tab.c" break; case 78: -#line 1023 "Oberon.y" /* yacc.c:1652 */ - { +#line 1023 "Oberon.y" + { (yyval.node) = NULL; } -#line 2561 "y.tab.c" /* yacc.c:1652 */ +#line 2652 "y.tab.c" break; case 79: -#line 1030 "Oberon.y" /* yacc.c:1652 */ - { +#line 1030 "Oberon.y" + { Trees_Node field; field = Trees_NewIdent((yyvsp[0].ident)); Trees_SetKind(TREES_FIELD_KIND, field); (yyval.node) = Trees_NewNode('.', field, NULL); } -#line 2573 "y.tab.c" /* yacc.c:1652 */ +#line 2664 "y.tab.c" break; case 80: -#line 1038 "Oberon.y" /* yacc.c:1652 */ - { +#line 1038 "Oberon.y" + { Trees_Node curr, exp; /*create one selector node per index*/ @@ -2591,53 +2682,53 @@ yyreduce: curr = Trees_Right(curr); } while (curr != NULL); } -#line 2595 "y.tab.c" /* yacc.c:1652 */ +#line 2686 "y.tab.c" break; case 81: -#line 1056 "Oberon.y" /* yacc.c:1652 */ - { +#line 1056 "Oberon.y" + { (yyval.node) = Trees_NewNode('^', NULL, NULL); } -#line 2603 "y.tab.c" /* yacc.c:1652 */ +#line 2694 "y.tab.c" break; case 82: -#line 1061 "Oberon.y" /* yacc.c:1652 */ - { +#line 1061 "Oberon.y" + { Trees_ReverseList(&(yyvsp[-1].node)); /*correct order*/ (yyval.node) = Trees_NewNode('(', (yyvsp[-1].node), NULL); } -#line 2612 "y.tab.c" /* yacc.c:1652 */ +#line 2703 "y.tab.c" break; case 83: -#line 1066 "Oberon.y" /* yacc.c:1652 */ - { +#line 1066 "Oberon.y" + { (yyval.node) = Trees_NewNode('(', NULL, NULL); } -#line 2620 "y.tab.c" /* yacc.c:1652 */ +#line 2711 "y.tab.c" break; case 84: -#line 1073 "Oberon.y" /* yacc.c:1652 */ - { +#line 1073 "Oberon.y" + { (yyval.node) = Trees_NewSet(0x0u); } -#line 2628 "y.tab.c" /* yacc.c:1652 */ +#line 2719 "y.tab.c" break; case 85: -#line 1077 "Oberon.y" /* yacc.c:1652 */ - { +#line 1077 "Oberon.y" + { (yyval.node) = (yyvsp[-1].node); } -#line 2636 "y.tab.c" /* yacc.c:1652 */ +#line 2727 "y.tab.c" break; case 87: -#line 1085 "Oberon.y" /* yacc.c:1652 */ - { +#line 1085 "Oberon.y" + { if ((Trees_Symbol((yyvsp[-2].node)) == TREES_SET_CONSTANT) && (Trees_Symbol((yyvsp[0].node)) == TREES_SET_CONSTANT)) { (yyval.node) = Trees_NewSet(Trees_Set((yyvsp[-2].node)) | Trees_Set((yyvsp[0].node))); @@ -2646,12 +2737,12 @@ yyreduce: Trees_SetType(Trees_NewLeaf(TREES_SET_TYPE), (yyval.node)); } } -#line 2650 "y.tab.c" /* yacc.c:1652 */ +#line 2741 "y.tab.c" break; case 88: -#line 1098 "Oberon.y" /* yacc.c:1652 */ - { +#line 1098 "Oberon.y" + { OBNC_INTEGER i; Trees_Node type; @@ -2670,12 +2761,12 @@ yyreduce: YYABORT; } } -#line 2674 "y.tab.c" /* yacc.c:1652 */ +#line 2765 "y.tab.c" break; case 89: -#line 1118 "Oberon.y" /* yacc.c:1652 */ - { +#line 1118 "Oberon.y" + { CheckIsValueExpression((yyvsp[-2].node)); CheckIsValueExpression((yyvsp[0].node)); (yyval.node) = NULL; @@ -2695,41 +2786,41 @@ yyreduce: YYABORT; } } -#line 2699 "y.tab.c" /* yacc.c:1652 */ +#line 2790 "y.tab.c" break; case 90: -#line 1142 "Oberon.y" /* yacc.c:1652 */ - { +#line 1142 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_EXP_LIST, (yyvsp[0].node), NULL); Trees_SetType(Trees_Type((yyvsp[0].node)), (yyval.node)); } -#line 2708 "y.tab.c" /* yacc.c:1652 */ +#line 2799 "y.tab.c" break; case 91: -#line 1147 "Oberon.y" /* yacc.c:1652 */ - { +#line 1147 "Oberon.y" + { Trees_Node reversedList; reversedList = Trees_NewNode(TREES_EXP_LIST, (yyvsp[0].node), (yyvsp[-2].node)); (yyval.node) = reversedList; Trees_SetType(Trees_Type((yyvsp[0].node)), (yyval.node)); } -#line 2720 "y.tab.c" /* yacc.c:1652 */ +#line 2811 "y.tab.c" break; case 99: -#line 1168 "Oberon.y" /* yacc.c:1652 */ - { +#line 1168 "Oberon.y" + { (yyval.node) = NULL; } -#line 2728 "y.tab.c" /* yacc.c:1652 */ +#line 2819 "y.tab.c" break; case 100: -#line 1175 "Oberon.y" /* yacc.c:1652 */ - { +#line 1175 "Oberon.y" + { Trees_Node designator, ident, designatorType, exp; CheckIsValueExpression((yyvsp[0].node)); @@ -2767,12 +2858,12 @@ yyreduce: assert(0); } } -#line 2771 "y.tab.c" /* yacc.c:1652 */ +#line 2862 "y.tab.c" break; case 101: -#line 1218 "Oberon.y" /* yacc.c:1652 */ - { +#line 1218 "Oberon.y" + { const int isFunctionCall = 0; Trees_Node designator, actualParameters; @@ -2786,45 +2877,45 @@ yyreduce: HandleProcedureCall(designator, actualParameters, isFunctionCall, &(yyval.node)); assert((yyval.node) != NULL); } -#line 2790 "y.tab.c" /* yacc.c:1652 */ +#line 2881 "y.tab.c" break; case 102: -#line 1236 "Oberon.y" /* yacc.c:1652 */ - { +#line 1236 "Oberon.y" + { Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/ (yyval.node) = (yyvsp[0].node); } -#line 2799 "y.tab.c" /* yacc.c:1652 */ +#line 2890 "y.tab.c" break; case 103: -#line 1244 "Oberon.y" /* yacc.c:1652 */ - { +#line 1244 "Oberon.y" + { if ((yyvsp[0].node) == NULL) { (yyval.node) = NULL; } else { (yyval.node) = Trees_NewNode(TREES_STATEMENT_SEQUENCE, (yyvsp[0].node), NULL); } } -#line 2811 "y.tab.c" /* yacc.c:1652 */ +#line 2902 "y.tab.c" break; case 104: -#line 1252 "Oberon.y" /* yacc.c:1652 */ - { +#line 1252 "Oberon.y" + { if ((yyvsp[0].node) != NULL) { (yyval.node) = Trees_NewNode(TREES_STATEMENT_SEQUENCE, (yyvsp[0].node), (yyvsp[-2].node)); } else { (yyval.node) = (yyvsp[-2].node); } } -#line 2823 "y.tab.c" /* yacc.c:1652 */ +#line 2914 "y.tab.c" break; case 105: -#line 1263 "Oberon.y" /* yacc.c:1652 */ - { +#line 1263 "Oberon.y" + { Trees_Node currElsif, currExp, currThen, currStmt; if ((yyvsp[-2].node) == NULL) { @@ -2843,12 +2934,12 @@ yyreduce: (yyval.node) = Trees_NewNode(IF, (yyvsp[-5].node), Trees_NewNode(THEN, (yyvsp[-3].node), (yyval.node))); } } -#line 2847 "y.tab.c" /* yacc.c:1652 */ +#line 2938 "y.tab.c" break; case 106: -#line 1286 "Oberon.y" /* yacc.c:1652 */ - { +#line 1286 "Oberon.y" + { CheckIsValueExpression((yyvsp[0].node)); if (Types_IsBoolean(Trees_Type((yyvsp[0].node)))) { (yyval.node) = (yyvsp[0].node); @@ -2857,44 +2948,44 @@ yyreduce: YYABORT; } } -#line 2861 "y.tab.c" /* yacc.c:1652 */ +#line 2952 "y.tab.c" break; case 107: -#line 1299 "Oberon.y" /* yacc.c:1652 */ - { +#line 1299 "Oberon.y" + { (yyval.node) = Trees_NewNode(ELSIF, (yyvsp[-2].node), Trees_NewNode(THEN, (yyvsp[0].node), (yyvsp[-4].node))); } -#line 2869 "y.tab.c" /* yacc.c:1652 */ +#line 2960 "y.tab.c" break; case 108: -#line 1303 "Oberon.y" /* yacc.c:1652 */ - { +#line 1303 "Oberon.y" + { (yyval.node) = NULL; } -#line 2877 "y.tab.c" /* yacc.c:1652 */ +#line 2968 "y.tab.c" break; case 109: -#line 1310 "Oberon.y" /* yacc.c:1652 */ - { +#line 1310 "Oberon.y" + { (yyval.node) = Trees_NewNode(ELSE, (yyvsp[0].node), NULL); } -#line 2885 "y.tab.c" /* yacc.c:1652 */ +#line 2976 "y.tab.c" break; case 110: -#line 1314 "Oberon.y" /* yacc.c:1652 */ - { +#line 1314 "Oberon.y" + { (yyval.node) = NULL; } -#line 2893 "y.tab.c" /* yacc.c:1652 */ +#line 2984 "y.tab.c" break; case 111: -#line 1321 "Oberon.y" /* yacc.c:1652 */ - { +#line 1321 "Oberon.y" + { Trees_Node expType, caseVariable; if ((yyvsp[-1].node) != NULL) { @@ -2911,12 +3002,12 @@ yyreduce: } (yyval.node) = Trees_NewNode(CASE, (yyvsp[-3].node), (yyvsp[-1].node)); } -#line 2915 "y.tab.c" /* yacc.c:1652 */ +#line 3006 "y.tab.c" break; case 112: -#line 1342 "Oberon.y" /* yacc.c:1652 */ - { +#line 1342 "Oberon.y" + { Trees_Node typeStruct, caseVariable; CheckIsValueExpression((yyvsp[0].node)); @@ -2950,24 +3041,24 @@ yyreduce: YYABORT; } } -#line 2954 "y.tab.c" /* yacc.c:1652 */ +#line 3045 "y.tab.c" break; case 113: -#line 1380 "Oberon.y" /* yacc.c:1652 */ - { +#line 1380 "Oberon.y" + { if ((yyvsp[0].node) != NULL) { (yyval.node) = Trees_NewNode(TREES_CASE_REP, (yyvsp[0].node), NULL); } else { (yyval.node) = NULL; } } -#line 2966 "y.tab.c" /* yacc.c:1652 */ +#line 3057 "y.tab.c" break; case 114: -#line 1388 "Oberon.y" /* yacc.c:1652 */ - { +#line 1388 "Oberon.y" + { if ((yyvsp[0].node) != NULL) { if ((yyvsp[-2].node) != NULL) { (yyval.node) = Trees_NewNode(TREES_CASE_REP, (yyvsp[0].node), (yyvsp[-2].node)); @@ -2978,37 +3069,37 @@ yyreduce: (yyval.node) = NULL; } } -#line 2982 "y.tab.c" /* yacc.c:1652 */ +#line 3073 "y.tab.c" break; case 115: -#line 1403 "Oberon.y" /* yacc.c:1652 */ - { +#line 1403 "Oberon.y" + { Trees_ReverseList(&(yyvsp[-2].node)); /*correct order*/ (yyval.node) = Trees_NewNode(TREES_CASE, (yyvsp[-2].node), (yyvsp[0].node)); } -#line 2991 "y.tab.c" /* yacc.c:1652 */ +#line 3082 "y.tab.c" break; case 116: -#line 1408 "Oberon.y" /* yacc.c:1652 */ - { +#line 1408 "Oberon.y" + { (yyval.node) = NULL; } -#line 2999 "y.tab.c" /* yacc.c:1652 */ +#line 3090 "y.tab.c" break; case 117: -#line 1415 "Oberon.y" /* yacc.c:1652 */ - { +#line 1415 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_CASE_LABEL_LIST, (yyvsp[0].node), NULL); } -#line 3007 "y.tab.c" /* yacc.c:1652 */ +#line 3098 "y.tab.c" break; case 118: -#line 1419 "Oberon.y" /* yacc.c:1652 */ - { +#line 1419 "Oberon.y" + { switch (Trees_Symbol((yyvsp[0].node))) { case INTEGER: case TREES_CHAR_CONSTANT: @@ -3020,12 +3111,12 @@ yyreduce: YYABORT; } } -#line 3024 "y.tab.c" /* yacc.c:1652 */ +#line 3115 "y.tab.c" break; case 119: -#line 1435 "Oberon.y" /* yacc.c:1652 */ - { +#line 1435 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); CheckCaseLabelUniqueness((yyvsp[0].node)); assert(caseLabelsStack != NULL); @@ -3033,12 +3124,12 @@ yyreduce: Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), Trees_Left(caseLabelsStack)), Trees_Right(caseLabelsStack)); } -#line 3037 "y.tab.c" /* yacc.c:1652 */ +#line 3128 "y.tab.c" break; case 120: -#line 1444 "Oberon.y" /* yacc.c:1652 */ - { +#line 1444 "Oberon.y" + { const int rangeLenMax = 255; int leftSym, rightSym; OBNC_INTEGER rangeMin, rangeMax; @@ -3081,12 +3172,12 @@ yyreduce: Trees_NewNode(TREES_NOSYM, (yyval.node), Trees_Left(caseLabelsStack)), Trees_Right(caseLabelsStack)); } -#line 3085 "y.tab.c" /* yacc.c:1652 */ +#line 3176 "y.tab.c" break; case 121: -#line 1491 "Oberon.y" /* yacc.c:1652 */ - { +#line 1491 "Oberon.y" + { if (Types_IsInteger(Trees_Type(Trees_Left(caseExpressionStack)))) { (yyval.node) = Trees_NewInteger((yyvsp[0].integer)); } else { @@ -3094,12 +3185,12 @@ yyreduce: YYABORT; } } -#line 3098 "y.tab.c" /* yacc.c:1652 */ +#line 3189 "y.tab.c" break; case 122: -#line 1500 "Oberon.y" /* yacc.c:1652 */ - { +#line 1500 "Oberon.y" + { if (Types_IsChar(Trees_Type(Trees_Left(caseExpressionStack)))) { if (strlen((yyvsp[0].string)) <= 1) { (yyval.node) = Trees_NewChar((yyvsp[0].string)[0]); @@ -3112,12 +3203,12 @@ yyreduce: YYABORT; } } -#line 3116 "y.tab.c" /* yacc.c:1652 */ +#line 3207 "y.tab.c" break; case 123: -#line 1514 "Oberon.y" /* yacc.c:1652 */ - { +#line 1514 "Oberon.y" + { Trees_Node caseExp, constValue, caseVariable; (yyval.node) = Table_At(Trees_Name((yyvsp[0].node))); @@ -3194,40 +3285,40 @@ yyreduce: assert(0); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 2 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); YYABORT; } } -#line 3202 "y.tab.c" /* yacc.c:1652 */ +#line 3293 "y.tab.c" break; case 124: -#line 1599 "Oberon.y" /* yacc.c:1652 */ - { +#line 1599 "Oberon.y" + { (yyval.node) = Trees_NewNode(WHILE, (yyvsp[-4].node), Trees_NewNode(DO, (yyvsp[-2].node), (yyvsp[-1].node))); } -#line 3210 "y.tab.c" /* yacc.c:1652 */ +#line 3301 "y.tab.c" break; case 125: -#line 1606 "Oberon.y" /* yacc.c:1652 */ - { +#line 1606 "Oberon.y" + { (yyval.node) = Trees_NewNode(ELSIF, (yyvsp[-2].node), Trees_NewNode(THEN, (yyvsp[0].node), (yyvsp[-4].node))); } -#line 3218 "y.tab.c" /* yacc.c:1652 */ +#line 3309 "y.tab.c" break; case 126: -#line 1610 "Oberon.y" /* yacc.c:1652 */ - { +#line 1610 "Oberon.y" + { (yyval.node) = NULL; } -#line 3226 "y.tab.c" /* yacc.c:1652 */ +#line 3317 "y.tab.c" break; case 127: -#line 1617 "Oberon.y" /* yacc.c:1652 */ - { +#line 1617 "Oberon.y" + { CheckIsValueExpression((yyvsp[0].node)); (yyval.node) = NULL; if (Types_IsBoolean(Trees_Type((yyvsp[0].node)))) { @@ -3237,12 +3328,12 @@ yyreduce: YYABORT; } } -#line 3241 "y.tab.c" /* yacc.c:1652 */ +#line 3332 "y.tab.c" break; case 128: -#line 1632 "Oberon.y" /* yacc.c:1652 */ - { +#line 1632 "Oberon.y" + { Trees_Node byExp; if ((yyvsp[-3].node) != NULL) { @@ -3256,12 +3347,12 @@ yyreduce: (yyvsp[-4].node), Trees_NewNode(BY, byExp, (yyvsp[-1].node)))); } -#line 3260 "y.tab.c" /* yacc.c:1652 */ +#line 3351 "y.tab.c" break; case 129: -#line 1650 "Oberon.y" /* yacc.c:1652 */ - { +#line 1650 "Oberon.y" + { Trees_Node ctrlVar, ctrlVarType; CheckIsValueExpression((yyvsp[0].node)); @@ -3284,24 +3375,24 @@ yyreduce: YYABORT; } } -#line 3288 "y.tab.c" /* yacc.c:1652 */ +#line 3379 "y.tab.c" break; case 130: -#line 1676 "Oberon.y" /* yacc.c:1652 */ - { +#line 1676 "Oberon.y" + { CheckIsValueExpression((yyvsp[0].node)); if (! Types_IsInteger(Trees_Type((yyvsp[0].node)))) { Oberon_PrintError("error: integer expression expected as upper limit"); YYABORT; } } -#line 3300 "y.tab.c" /* yacc.c:1652 */ +#line 3391 "y.tab.c" break; case 131: -#line 1687 "Oberon.y" /* yacc.c:1652 */ - { +#line 1687 "Oberon.y" + { if (Types_IsInteger(Trees_Type((yyvsp[0].node)))) { if (IsInteger((yyvsp[0].node))) { if (Trees_Integer((yyvsp[0].node)) == 0) { @@ -3317,20 +3408,20 @@ yyreduce: YYABORT; } } -#line 3321 "y.tab.c" /* yacc.c:1652 */ +#line 3412 "y.tab.c" break; case 132: -#line 1704 "Oberon.y" /* yacc.c:1652 */ - { +#line 1704 "Oberon.y" + { (yyval.node) = NULL; } -#line 3329 "y.tab.c" /* yacc.c:1652 */ +#line 3420 "y.tab.c" break; case 133: -#line 1714 "Oberon.y" /* yacc.c:1652 */ - { +#line 1714 "Oberon.y" + { Trees_Node procIdent, procType, resultType, procStatements, returnExp; const char *procName; @@ -3376,12 +3467,12 @@ yyreduce: YYABORT; } } -#line 3380 "y.tab.c" /* yacc.c:1652 */ +#line 3471 "y.tab.c" break; case 134: -#line 1764 "Oberon.y" /* yacc.c:1652 */ - { +#line 1764 "Oberon.y" + { Trees_Node paramList, param; (yyval.node) = NULL; @@ -3398,12 +3489,12 @@ yyreduce: Generate_ProcedureHeading((yyvsp[-1].node)); (yyval.node) = (yyvsp[-1].node); } -#line 3402 "y.tab.c" /* yacc.c:1652 */ +#line 3493 "y.tab.c" break; case 135: -#line 1785 "Oberon.y" /* yacc.c:1652 */ - { +#line 1785 "Oberon.y" + { if (! (Trees_Exported((yyvsp[0].node)) && Trees_Local((yyvsp[0].node)))) { Trees_SetKind(TREES_PROCEDURE_KIND, (yyvsp[0].node)); Table_Put((yyvsp[0].node)); @@ -3414,44 +3505,44 @@ yyreduce: } (yyval.node) = (yyvsp[0].node); } -#line 3418 "y.tab.c" /* yacc.c:1652 */ +#line 3509 "y.tab.c" break; case 136: -#line 1800 "Oberon.y" /* yacc.c:1652 */ - { +#line 1800 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); } -#line 3426 "y.tab.c" /* yacc.c:1652 */ +#line 3517 "y.tab.c" break; case 137: -#line 1804 "Oberon.y" /* yacc.c:1652 */ - { +#line 1804 "Oberon.y" + { (yyval.node) = NULL; } -#line 3434 "y.tab.c" /* yacc.c:1652 */ +#line 3525 "y.tab.c" break; case 138: -#line 1811 "Oberon.y" /* yacc.c:1652 */ - { +#line 1811 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); } -#line 3442 "y.tab.c" /* yacc.c:1652 */ +#line 3533 "y.tab.c" break; case 139: -#line 1815 "Oberon.y" /* yacc.c:1652 */ - { +#line 1815 "Oberon.y" + { (yyval.node) = NULL; } -#line 3450 "y.tab.c" /* yacc.c:1652 */ +#line 3541 "y.tab.c" break; case 145: -#line 1836 "Oberon.y" /* yacc.c:1652 */ - { +#line 1836 "Oberon.y" + { Trees_Node unresolvedPointerType, undeclaredBaseType; if (unresolvedPointerTypes != NULL) { @@ -3461,62 +3552,62 @@ yyreduce: YYABORT; } } -#line 3465 "y.tab.c" /* yacc.c:1652 */ +#line 3556 "y.tab.c" break; case 146: -#line 1847 "Oberon.y" /* yacc.c:1652 */ - { +#line 1847 "Oberon.y" + { (yyval.node) = NULL; } -#line 3473 "y.tab.c" /* yacc.c:1652 */ +#line 3564 "y.tab.c" break; case 147: -#line 1854 "Oberon.y" /* yacc.c:1652 */ - { +#line 1854 "Oberon.y" + { unresolvedPointerTypes = NULL; } -#line 3481 "y.tab.c" /* yacc.c:1652 */ +#line 3572 "y.tab.c" break; case 156: -#line 1881 "Oberon.y" /* yacc.c:1652 */ - { +#line 1881 "Oberon.y" + { (yyval.node) = Types_NewProcedure((yyvsp[-2].node), (yyvsp[0].node)); } -#line 3489 "y.tab.c" /* yacc.c:1652 */ +#line 3580 "y.tab.c" break; case 157: -#line 1888 "Oberon.y" /* yacc.c:1652 */ - { +#line 1888 "Oberon.y" + { Trees_ReverseList(&(yyvsp[0].node)); /*correct order*/ (yyval.node) = (yyvsp[0].node); } -#line 3498 "y.tab.c" /* yacc.c:1652 */ +#line 3589 "y.tab.c" break; case 158: -#line 1893 "Oberon.y" /* yacc.c:1652 */ - { +#line 1893 "Oberon.y" + { (yyval.node) = NULL; } -#line 3506 "y.tab.c" /* yacc.c:1652 */ +#line 3597 "y.tab.c" break; case 159: -#line 1900 "Oberon.y" /* yacc.c:1652 */ - { +#line 1900 "Oberon.y" + { (yyval.node) = (yyvsp[0].node); Trees_ReverseList(&(yyval.node)); } -#line 3515 "y.tab.c" /* yacc.c:1652 */ +#line 3606 "y.tab.c" break; case 160: -#line 1905 "Oberon.y" /* yacc.c:1652 */ - { +#line 1905 "Oberon.y" + { Trees_Node p, p1; const char *paramName, *paramName1; @@ -3545,12 +3636,12 @@ yyreduce: } while (p != NULL); /*$$ in reversed order*/ } -#line 3549 "y.tab.c" /* yacc.c:1652 */ +#line 3640 "y.tab.c" break; case 161: -#line 1938 "Oberon.y" /* yacc.c:1652 */ - { +#line 1938 "Oberon.y" + { (yyval.node) = ResolvedType((yyvsp[0].node), 0); if ((yyval.node) != NULL) { if (Trees_Symbol((yyval.node)) == IDENT) { @@ -3564,24 +3655,24 @@ yyreduce: } } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 3 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); YYABORT; } } -#line 3572 "y.tab.c" /* yacc.c:1652 */ +#line 3663 "y.tab.c" break; case 162: -#line 1957 "Oberon.y" /* yacc.c:1652 */ - { +#line 1957 "Oberon.y" + { (yyval.node) = NULL; } -#line 3580 "y.tab.c" /* yacc.c:1652 */ +#line 3671 "y.tab.c" break; case 163: -#line 1964 "Oberon.y" /* yacc.c:1652 */ - { +#line 1964 "Oberon.y" + { Trees_Node curr, ident; Trees_ReverseList(&(yyvsp[-2].node)); /*correct order*/ @@ -3596,36 +3687,36 @@ yyreduce: (yyval.node) = (yyvsp[-2].node); } -#line 3600 "y.tab.c" /* yacc.c:1652 */ +#line 3691 "y.tab.c" break; case 164: -#line 1983 "Oberon.y" /* yacc.c:1652 */ - { +#line 1983 "Oberon.y" + { (yyval.integer) = TREES_VAR_PARAM_KIND; } -#line 3608 "y.tab.c" /* yacc.c:1652 */ +#line 3699 "y.tab.c" break; case 165: -#line 1987 "Oberon.y" /* yacc.c:1652 */ - { +#line 1987 "Oberon.y" + { (yyval.integer) = TREES_VALUE_PARAM_KIND; } -#line 3616 "y.tab.c" /* yacc.c:1652 */ +#line 3707 "y.tab.c" break; case 166: -#line 1994 "Oberon.y" /* yacc.c:1652 */ - { +#line 1994 "Oberon.y" + { (yyval.node) = Trees_NewNode(TREES_IDENT_LIST, Trees_NewIdent((yyvsp[0].ident)), NULL); } -#line 3624 "y.tab.c" /* yacc.c:1652 */ +#line 3715 "y.tab.c" break; case 167: -#line 1998 "Oberon.y" /* yacc.c:1652 */ - { +#line 1998 "Oberon.y" + { Trees_Node curr; const char *identName; @@ -3642,12 +3733,12 @@ yyreduce: (yyval.node) = Trees_NewNode(TREES_IDENT_LIST, Trees_NewIdent((yyvsp[0].ident)), (yyvsp[-2].node)); } -#line 3646 "y.tab.c" /* yacc.c:1652 */ +#line 3737 "y.tab.c" break; case 168: -#line 2019 "Oberon.y" /* yacc.c:1652 */ - { +#line 2019 "Oberon.y" + { (yyval.node) = ResolvedType((yyvsp[0].node), 0); if ((yyval.node) != NULL) { while ((yyvsp[-1].node) != NULL) { @@ -3655,32 +3746,32 @@ yyreduce: (yyvsp[-1].node) = Trees_Right((yyvsp[-1].node)); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name((yyvsp[0].node))); + Oberon_PrintError("error: 4 undeclared identifier: %s", Trees_Name((yyvsp[0].node))); exit(EXIT_FAILURE); } } -#line 3663 "y.tab.c" /* yacc.c:1652 */ +#line 3754 "y.tab.c" break; case 169: -#line 2035 "Oberon.y" /* yacc.c:1652 */ - { +#line 2035 "Oberon.y" + { (yyval.node) = Trees_NewNode(ARRAY, NULL, (yyvsp[-2].node)); } -#line 3671 "y.tab.c" /* yacc.c:1652 */ +#line 3762 "y.tab.c" break; case 170: -#line 2039 "Oberon.y" /* yacc.c:1652 */ - { +#line 2039 "Oberon.y" + { (yyval.node) = NULL; } -#line 3679 "y.tab.c" /* yacc.c:1652 */ +#line 3770 "y.tab.c" break; case 171: -#line 2049 "Oberon.y" /* yacc.c:1652 */ - { +#line 2049 "Oberon.y" + { const char *symfilePath; if (strcmp((yyvsp[-1].ident), inputModuleName) == 0) { @@ -3702,12 +3793,12 @@ yyreduce: YYABORT; } } -#line 3706 "y.tab.c" /* yacc.c:1652 */ +#line 3797 "y.tab.c" break; case 172: -#line 2076 "Oberon.y" /* yacc.c:1652 */ - { +#line 2076 "Oberon.y" + { if (strcmp((yyvsp[0].ident), inputModuleName) == 0) { if (parseMode != OBERON_IMPORT_LIST_MODE) { Generate_ModuleHeading(); @@ -3717,32 +3808,32 @@ yyreduce: YYABORT; } } -#line 3721 "y.tab.c" /* yacc.c:1652 */ +#line 3812 "y.tab.c" break; case 173: -#line 2090 "Oberon.y" /* yacc.c:1652 */ - { +#line 2090 "Oberon.y" + { if (parseMode == OBERON_IMPORT_LIST_MODE) { YYACCEPT; } } -#line 3731 "y.tab.c" /* yacc.c:1652 */ +#line 3822 "y.tab.c" break; case 174: -#line 2096 "Oberon.y" /* yacc.c:1652 */ - { +#line 2096 "Oberon.y" + { if (parseMode == OBERON_IMPORT_LIST_MODE) { YYACCEPT; } } -#line 3741 "y.tab.c" /* yacc.c:1652 */ +#line 3832 "y.tab.c" break; case 175: -#line 2105 "Oberon.y" /* yacc.c:1652 */ - { +#line 2105 "Oberon.y" + { const char *impfilePath; Trees_Node moduleAndDirPath, module, p; FILE *impFile; @@ -3774,36 +3865,36 @@ yyreduce: } } } -#line 3778 "y.tab.c" /* yacc.c:1652 */ +#line 3869 "y.tab.c" break; case 176: -#line 2141 "Oberon.y" /* yacc.c:1652 */ - { +#line 2141 "Oberon.y" + { if ((yyvsp[0].node) != NULL) { (yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), NULL); } else { (yyval.node) = NULL; } } -#line 3790 "y.tab.c" /* yacc.c:1652 */ +#line 3881 "y.tab.c" break; case 177: -#line 2149 "Oberon.y" /* yacc.c:1652 */ - { +#line 2149 "Oberon.y" + { if ((yyvsp[0].node) != NULL) { (yyval.node) = Trees_NewNode(TREES_NOSYM, (yyvsp[0].node), (yyvsp[-2].node)); } else { (yyval.node) = (yyvsp[-2].node); } } -#line 3802 "y.tab.c" /* yacc.c:1652 */ +#line 3893 "y.tab.c" break; case 178: -#line 2160 "Oberon.y" /* yacc.c:1652 */ - { +#line 2160 "Oberon.y" + { static Maps_Map importedModules = NULL; const char *module, *qualifier, *symbolFileDir, *symbolFileName, *moduleDirPath; Trees_Node qualifierSym, moduleIdent; @@ -3874,35 +3965,36 @@ yyreduce: YYABORT; } } -#line 3878 "y.tab.c" /* yacc.c:1652 */ +#line 3969 "y.tab.c" break; case 179: -#line 2235 "Oberon.y" /* yacc.c:1652 */ - { +#line 2235 "Oberon.y" + { (yyval.ident) = (yyvsp[0].ident); } -#line 3886 "y.tab.c" /* yacc.c:1652 */ +#line 3977 "y.tab.c" break; case 180: -#line 2239 "Oberon.y" /* yacc.c:1652 */ - { +#line 2239 "Oberon.y" + { (yyval.ident) = NULL; } -#line 3894 "y.tab.c" /* yacc.c:1652 */ +#line 3985 "y.tab.c" break; case 181: -#line 2246 "Oberon.y" /* yacc.c:1652 */ - { +#line 2246 "Oberon.y" + { Generate_ModuleStatements((yyvsp[0].node)); } -#line 3902 "y.tab.c" /* yacc.c:1652 */ +#line 3993 "y.tab.c" break; -#line 3906 "y.tab.c" /* yacc.c:1652 */ +#line 3997 "y.tab.c" + default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3965,7 +4057,7 @@ yyerrlab: { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; @@ -4120,7 +4212,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[+*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -4133,7 +4225,7 @@ yyreturn: #endif return yyresult; } -#line 2251 "Oberon.y" /* yacc.c:1918 */ +#line 2251 "Oberon.y" void Oberon_Init(void) @@ -4316,7 +4408,9 @@ static Trees_Node ResolvedType(Trees_Node type, int isTypeDecl) result = NULL; if (Trees_Symbol(type) == IDENT) { name = Trees_Name(type); + fprintf(stderr,"%s\n", name); identDef = Table_At(name); + fprintf(stderr,"%p\n", identDef); if (identDef != NULL) { if (Trees_Kind(identDef) == TREES_TYPE_KIND) { typeStruct = Types_Structure(identDef); @@ -4514,7 +4608,7 @@ static Trees_Node Designator(const char identName[], Trees_Node selectorList) qualidentSym = Table_At(qualidentName); qualidentSelectorList = Trees_Right(selectorList); if (qualidentSym == NULL) { - Oberon_PrintError("error: undeclared identifier: %s", qualidentName); + Oberon_PrintError("error: 5 undeclared identifier: %s", qualidentName); exit(EXIT_FAILURE); } } else { @@ -4527,7 +4621,7 @@ static Trees_Node Designator(const char identName[], Trees_Node selectorList) } } else { - Oberon_PrintError("error: undeclared identifier: %s", identName); + Oberon_PrintError("error: 6 undeclared identifier: %s", identName); exit(EXIT_FAILURE); } } @@ -4671,7 +4765,7 @@ static void SetSelectorTypes(Trees_Node identType, Trees_Node designator, int *p exit(EXIT_FAILURE); } } else { - Oberon_PrintError("error: undeclared identifier: %s", Trees_Name(extendedType)); + Oberon_PrintError("error: 7 undeclared identifier: %s", Trees_Name(extendedType)); exit(EXIT_FAILURE); } } else { diff --git a/src/y.tab.h b/src/y.tab.h index c709f39..009c171 100644 --- a/src/y.tab.h +++ b/src/y.tab.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.3.2. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -141,10 +141,9 @@ extern int yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - union YYSTYPE { -#line 107 "Oberon.y" /* yacc.c:1921 */ +#line 107 "Oberon.y" const char *ident; OBNC_INTEGER integer; @@ -152,9 +151,9 @@ union YYSTYPE const char *string; Trees_Node node; -#line 156 "y.tab.h" /* yacc.c:1921 */ -}; +#line 155 "y.tab.h" +}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/tests/obnc/failing-at-compile-time/A.obn b/tests/obnc/failing-at-compile-time/A.obn index 59d4d1e..3817954 100644 --- a/tests/obnc/failing-at-compile-time/A.obn +++ b/tests/obnc/failing-at-compile-time/A.obn @@ -21,8 +21,8 @@ module A; P* = pointer to record end; var - n*: INTEGER; - r*: record f: INTEGER end; + n*: Int; + r*: record f: Int end; p*: P; end A. diff --git a/tests/obnc/failing-at-compile-time/T2PointerToNonRecord.obn b/tests/obnc/failing-at-compile-time/T2PointerToNonRecord.obn index 4a589e5..23ace0c 100644 --- a/tests/obnc/failing-at-compile-time/T2PointerToNonRecord.obn +++ b/tests/obnc/failing-at-compile-time/T2PointerToNonRecord.obn @@ -18,6 +18,6 @@ along with OBNC. If not, see .*) module T2PointerToNonRecord; type - P = pointer to array 10 of INTEGER; + P = pointer to array 10 of Int; end T2PointerToNonRecord. diff --git a/tests/obnc/failing-at-compile-time/T2RedeclaredField.obn b/tests/obnc/failing-at-compile-time/T2RedeclaredField.obn index 1f1db6c..68f8be4 100644 --- a/tests/obnc/failing-at-compile-time/T2RedeclaredField.obn +++ b/tests/obnc/failing-at-compile-time/T2RedeclaredField.obn @@ -19,11 +19,11 @@ module T2RedeclaredField; type T = record - f: INTEGER + f: Int end; T1 = record (T) - f: INTEGER + f: Int end; end T2RedeclaredField. diff --git a/tests/obnc/failing-at-compile-time/T2RepeatedParameterIdent.obn b/tests/obnc/failing-at-compile-time/T2RepeatedParameterIdent.obn index a54a249..360ced9 100644 --- a/tests/obnc/failing-at-compile-time/T2RepeatedParameterIdent.obn +++ b/tests/obnc/failing-at-compile-time/T2RepeatedParameterIdent.obn @@ -18,6 +18,6 @@ along with OBNC. If not, see .*) module T2RepeatedParameterIdent; type - Proc = procedure (x: INTEGER; x: INTEGER); + Proc = procedure (x: Int; x: Int); end T2RepeatedParameterIdent. diff --git a/tests/obnc/failing-at-compile-time/T2WrongResolvedType.obn b/tests/obnc/failing-at-compile-time/T2WrongResolvedType.obn index 4472d7c..2e0c6a2 100644 --- a/tests/obnc/failing-at-compile-time/T2WrongResolvedType.obn +++ b/tests/obnc/failing-at-compile-time/T2WrongResolvedType.obn @@ -19,6 +19,6 @@ module T2WrongResolvedType; type P = pointer to T; - T = INTEGER; + T = Int; end T2WrongResolvedType. diff --git a/tests/obnc/failing-at-compile-time/T3RepeatedField.obn b/tests/obnc/failing-at-compile-time/T3RepeatedField.obn index 239b1da..067b1da 100644 --- a/tests/obnc/failing-at-compile-time/T3RepeatedField.obn +++ b/tests/obnc/failing-at-compile-time/T3RepeatedField.obn @@ -19,7 +19,7 @@ module T3RepeatedField; var x: record - f, f: INTEGER + f, f: Int end; end T3RepeatedField. diff --git a/tests/obnc/failing-at-compile-time/T3RepeatedVar.obn b/tests/obnc/failing-at-compile-time/T3RepeatedVar.obn index 02fb99c..b0d3f43 100644 --- a/tests/obnc/failing-at-compile-time/T3RepeatedVar.obn +++ b/tests/obnc/failing-at-compile-time/T3RepeatedVar.obn @@ -18,6 +18,6 @@ along with OBNC. If not, see .*) module T3RepeatedVar; var - x, x: INTEGER; + x, x: Int; end T3RepeatedVar. diff --git a/tests/obnc/failing-at-compile-time/T4InvalidProcedureComparison.obn b/tests/obnc/failing-at-compile-time/T4InvalidProcedureComparison.obn index 8b26dcb..b5752b8 100644 --- a/tests/obnc/failing-at-compile-time/T4InvalidProcedureComparison.obn +++ b/tests/obnc/failing-at-compile-time/T4InvalidProcedureComparison.obn @@ -20,7 +20,7 @@ module T4InvalidProcedureComparison; procedure P; end P; - procedure Q(x: INTEGER); + procedure Q(x: Int); end Q; begin diff --git a/tests/obnc/failing-at-compile-time/T4TypeGuardOnNonVarParamRecord.obn b/tests/obnc/failing-at-compile-time/T4TypeGuardOnNonVarParamRecord.obn index 197663f..eb3cfb2 100644 --- a/tests/obnc/failing-at-compile-time/T4TypeGuardOnNonVarParamRecord.obn +++ b/tests/obnc/failing-at-compile-time/T4TypeGuardOnNonVarParamRecord.obn @@ -18,7 +18,7 @@ along with OBNC. If not, see .*) module T4TypeGuardOnNonVarParamRecord; type - T = record f: INTEGER end; + T = record f: Int end; var x: T; diff --git a/tests/obnc/failing-at-compile-time/T5AssignPredefinedProcedure.obn b/tests/obnc/failing-at-compile-time/T5AssignPredefinedProcedure.obn index 0e5e730..88ed092 100644 --- a/tests/obnc/failing-at-compile-time/T5AssignPredefinedProcedure.obn +++ b/tests/obnc/failing-at-compile-time/T5AssignPredefinedProcedure.obn @@ -17,7 +17,7 @@ along with OBNC. If not, see .*) module T5AssignPredefinedProcedure; - var p: procedure (x: INTEGER): BOOLEAN; + var p: procedure (x: Int): Bool; begin p := ODD diff --git a/tests/obnc/failing-at-compile-time/T5FunctionProcedureStatement.obn b/tests/obnc/failing-at-compile-time/T5FunctionProcedureStatement.obn index 06010b1..da625b8 100644 --- a/tests/obnc/failing-at-compile-time/T5FunctionProcedureStatement.obn +++ b/tests/obnc/failing-at-compile-time/T5FunctionProcedureStatement.obn @@ -17,7 +17,7 @@ along with OBNC. If not, see .*) module T5FunctionProcedureStatement; - procedure F(): INTEGER; + procedure F(): Int; return 0 end F; diff --git a/tests/obnc/failing-at-compile-time/T5InvalidArrayAssignment.obn b/tests/obnc/failing-at-compile-time/T5InvalidArrayAssignment.obn index feafc70..a6b4c8a 100644 --- a/tests/obnc/failing-at-compile-time/T5InvalidArrayAssignment.obn +++ b/tests/obnc/failing-at-compile-time/T5InvalidArrayAssignment.obn @@ -18,8 +18,8 @@ along with OBNC. If not, see .*) module T5InvalidArrayAssignment; var - s: array 32 of CHAR; - t: array 32 of CHAR; + s: array 32 of Char; + t: array 32 of Char; begin s := "test"; diff --git a/tests/obnc/failing-at-compile-time/T5NonConstForLoopInc.obn b/tests/obnc/failing-at-compile-time/T5NonConstForLoopInc.obn index 85e9bf2..3155c03 100644 --- a/tests/obnc/failing-at-compile-time/T5NonConstForLoopInc.obn +++ b/tests/obnc/failing-at-compile-time/T5NonConstForLoopInc.obn @@ -17,7 +17,7 @@ along with OBNC. If not, see .*) module T5NonConstForLoopInc; - var i: INTEGER; + var i: Int; begin for i := 1 to 10 by i do end diff --git a/tests/obnc/failing-at-compile-time/T5StringAssignment.obn b/tests/obnc/failing-at-compile-time/T5StringAssignment.obn index 9f33c88..9618576 100644 --- a/tests/obnc/failing-at-compile-time/T5StringAssignment.obn +++ b/tests/obnc/failing-at-compile-time/T5StringAssignment.obn @@ -17,7 +17,7 @@ along with OBNC. If not, see .*) module T5StringAssignment; - var s: array 4 of CHAR; + var s: array 4 of Char; begin s := "help" (*null character won't fit*) diff --git a/tests/obnc/failing-at-compile-time/T5StructValueParamAssignment.obn b/tests/obnc/failing-at-compile-time/T5StructValueParamAssignment.obn index b9265ea..2d80951 100644 --- a/tests/obnc/failing-at-compile-time/T5StructValueParamAssignment.obn +++ b/tests/obnc/failing-at-compile-time/T5StructValueParamAssignment.obn @@ -18,7 +18,7 @@ along with OBNC. If not, see .*) module T5StructValueParamAssignment; type - String = array 32 of CHAR; + String = array 32 of Char; procedure P(s: String); begin diff --git a/tests/obnc/failing-at-compile-time/T6ExtendedPointerVarParam.obn b/tests/obnc/failing-at-compile-time/T6ExtendedPointerVarParam.obn index bf23475..120d4ae 100644 --- a/tests/obnc/failing-at-compile-time/T6ExtendedPointerVarParam.obn +++ b/tests/obnc/failing-at-compile-time/T6ExtendedPointerVarParam.obn @@ -18,8 +18,8 @@ along with OBNC. If not, see .*) module T6ExtendedPointerVarParam; type - Ta = record a : INTEGER end; - Tb = record (Ta) b : INTEGER end; + Ta = record a : Int end; + Tb = record (Ta) b : Int end; Pa = pointer to Ta; Pb = pointer to Tb; diff --git a/tests/obnc/failing-at-compile-time/T6ForgottenReturnType.obn b/tests/obnc/failing-at-compile-time/T6ForgottenReturnType.obn index 642cde6..30cc3b8 100644 --- a/tests/obnc/failing-at-compile-time/T6ForgottenReturnType.obn +++ b/tests/obnc/failing-at-compile-time/T6ForgottenReturnType.obn @@ -17,8 +17,8 @@ along with OBNC. If not, see .*) module T6ForgottenReturnType; - procedure F(m: INTEGER); - var n: INTEGER; + procedure F(m: Int); + var n: Int; begin n := F(0) return n diff --git a/tests/obnc/failing-at-compile-time/T6LocalParamTypeRef.obn b/tests/obnc/failing-at-compile-time/T6LocalParamTypeRef.obn index 1a4f01e..6ffabb5 100644 --- a/tests/obnc/failing-at-compile-time/T6LocalParamTypeRef.obn +++ b/tests/obnc/failing-at-compile-time/T6LocalParamTypeRef.obn @@ -18,7 +18,7 @@ along with OBNC. If not, see .*) module T6LocalParamTypeRef; procedure P; - type T = INTEGER; + type T = Int; procedure Q(x: T): T; return 0 diff --git a/tests/obnc/failing-at-compile-time/T6NonScalarResultType.obn b/tests/obnc/failing-at-compile-time/T6NonScalarResultType.obn index 4e3a36e..8890118 100644 --- a/tests/obnc/failing-at-compile-time/T6NonScalarResultType.obn +++ b/tests/obnc/failing-at-compile-time/T6NonScalarResultType.obn @@ -18,7 +18,7 @@ along with OBNC. If not, see .*) module T6NonScalarResultType; type - String = array 60 of CHAR; + String = array 60 of Char; procedure P(): String; var s: String; diff --git a/tests/obnc/failing-at-compile-time/T6ReadOnlyParam.obn b/tests/obnc/failing-at-compile-time/T6ReadOnlyParam.obn index bf85e1d..68c2bc1 100644 --- a/tests/obnc/failing-at-compile-time/T6ReadOnlyParam.obn +++ b/tests/obnc/failing-at-compile-time/T6ReadOnlyParam.obn @@ -17,11 +17,11 @@ along with OBNC. If not, see .*) module T6ReadOnlyParam; - procedure P(var a: array of INTEGER); + procedure P(var a: array of Int); end P; - procedure Q(a: array of INTEGER); + procedure Q(a: array of Int); begin P(a) end Q; diff --git a/tests/obnc/failing-at-compile-time/T7AccessNonExportedField.obn b/tests/obnc/failing-at-compile-time/T7AccessNonExportedField.obn index 963d85b..b33b0f7 100644 --- a/tests/obnc/failing-at-compile-time/T7AccessNonExportedField.obn +++ b/tests/obnc/failing-at-compile-time/T7AccessNonExportedField.obn @@ -20,7 +20,7 @@ module T7AccessNonExportedField; import A; var - n: INTEGER; + n: Int; begin n := A.r.f diff --git a/tests/obnc/failing-at-compile-time/T7ExportLocalIdent.obn b/tests/obnc/failing-at-compile-time/T7ExportLocalIdent.obn index a0ad82d..98372ba 100644 --- a/tests/obnc/failing-at-compile-time/T7ExportLocalIdent.obn +++ b/tests/obnc/failing-at-compile-time/T7ExportLocalIdent.obn @@ -18,7 +18,7 @@ along with OBNC. If not, see .*) module T7ExportLocalIdent; procedure P; - var x*: INTEGER; + var x*: Int; end P; end T7ExportLocalIdent. diff --git a/tests/obnc/failing-at-runtime/T4FailingTypeGuard.obn b/tests/obnc/failing-at-runtime/T4FailingTypeGuard.obn index e494df8..ab0dd9e 100644 --- a/tests/obnc/failing-at-runtime/T4FailingTypeGuard.obn +++ b/tests/obnc/failing-at-runtime/T4FailingTypeGuard.obn @@ -21,7 +21,7 @@ module T4FailingTypeGuard; T = record end; T1 = record (T) - f: INTEGER + f: Int end; var diff --git a/tests/obnc/failing-at-runtime/T5AssignStringToOpenArray.obn b/tests/obnc/failing-at-runtime/T5AssignStringToOpenArray.obn index a23f6b3..74dbb83 100644 --- a/tests/obnc/failing-at-runtime/T5AssignStringToOpenArray.obn +++ b/tests/obnc/failing-at-runtime/T5AssignStringToOpenArray.obn @@ -18,9 +18,9 @@ along with OBNC. If not, see .*) module T5AssignStringToOpenArray; var - str: array 4 of CHAR; + str: array 4 of Char; - procedure P(var s: array of CHAR); + procedure P(var s: array of Char); begin s := "test" end P; diff --git a/tests/obnc/failing-at-runtime/T5OpenArrayAssignment.obn b/tests/obnc/failing-at-runtime/T5OpenArrayAssignment.obn index bc325a6..21e0484 100644 --- a/tests/obnc/failing-at-runtime/T5OpenArrayAssignment.obn +++ b/tests/obnc/failing-at-runtime/T5OpenArrayAssignment.obn @@ -18,9 +18,9 @@ along with OBNC. If not, see .*) module T5OpenArrayAssignment; var - s1: array 8 of CHAR; + s1: array 8 of Char; - procedure P(s: array of CHAR); + procedure P(s: array of Char); begin s1 := s end P; diff --git a/tests/obnc/passing/A.obn b/tests/obnc/passing/A.obn index 1f600d5..826dd0b 100644 --- a/tests/obnc/passing/A.obn +++ b/tests/obnc/passing/A.obn @@ -31,8 +31,7 @@ module A; setConst* = {0, 2, 3, 5}; type - Integer = INTEGER; - String = array 256 of CHAR; + String = array 256 of Char; EmptyRecord* = record end; EmptyExtendedRecord* = record (EmptyRecord) end; EmptyPointer* = pointer to record end; @@ -50,21 +49,21 @@ module A; Proc2* = procedure (): List; Proc3* = procedure (n: Node): List; Proc4* = procedure (n, n1: Node): List; - Proc5* = procedure (n: Node; i: INTEGER); - Proc6* = procedure (n, n1: Node; i: INTEGER); + Proc5* = procedure (n: Node; i: Int); + Proc6* = procedure (n, n1: Node; i: Int); T* = B.T; P1* = B.P1; var - boolVar*: BOOLEAN; - charVar*: CHAR; - intVar*: Integer; - realVar* : REAL; - byteVar*: BYTE; + boolVar*: Bool; + charVar*: Char; + intVar*: Int; + realVar* : Real; + byteVar*: Byte; setVar*: SET; strVar*: String; recVar*, recVar1: record - f*: INTEGER + f*: Int end; ptrVar*: pointer to Node; procVar*: procedure (s: String); @@ -78,7 +77,7 @@ module A; end Q; - procedure R*(A: array of array of INTEGER); + procedure R*(A: array of array of Int); end R; diff --git a/tests/obnc/passing/B.obn b/tests/obnc/passing/B.obn index b03b917..c514147 100644 --- a/tests/obnc/passing/B.obn +++ b/tests/obnc/passing/B.obn @@ -23,7 +23,7 @@ module B; T* = record (C1.T) end; P1* = pointer to record (C1.P0) end; U* = pointer to UDesc; - UDesc* = record f*: INTEGER end; + UDesc* = record f*: Int end; CTAlias* = C1.T; procedure P*(var x: CTAlias); diff --git a/tests/obnc/passing/OBNC.obn b/tests/obnc/passing/OBNC.obn index 19d9a69..e0166e7 100644 --- a/tests/obnc/passing/OBNC.obn +++ b/tests/obnc/passing/OBNC.obn @@ -22,13 +22,13 @@ module OBNC; (*should not cause a conflict with system C module OBNC*) const b* = true; type - OBNC = record f: INTEGER end; + OBNC = record f: Int end; var - a: array 1 of INTEGER; + a: array 1 of Int; x: OBNC; - procedure Q(OBNC: array of INTEGER); + procedure Q(OBNC: array of Int); end Q; begin diff --git a/tests/obnc/passing/T1ConstantDeclarations.obn b/tests/obnc/passing/T1ConstantDeclarations.obn index 064dd30..54c67b4 100644 --- a/tests/obnc/passing/T1ConstantDeclarations.obn +++ b/tests/obnc/passing/T1ConstantDeclarations.obn @@ -35,12 +35,12 @@ module T1ConstantDeclarations; var p: procedure; - b: BOOLEAN; - ch: CHAR; - s: array 8 of CHAR; - i: INTEGER; - x: REAL; - j: BYTE; + b: Bool; + ch: Char; + s: array 8 of Char; + i: Int; + x: Real; + j: Byte; A: SET; begin diff --git a/tests/obnc/passing/T2TypeDeclarations.obn b/tests/obnc/passing/T2TypeDeclarations.obn index 4dc17a5..4de46c6 100644 --- a/tests/obnc/passing/T2TypeDeclarations.obn +++ b/tests/obnc/passing/T2TypeDeclarations.obn @@ -20,7 +20,7 @@ module T2TypeDeclarations; const left = 0; type - String = array 32 of CHAR; + String = array 32 of Char; StringAlias = String; ProcTable = array 1 of procedure; @@ -35,13 +35,13 @@ module T2TypeDeclarations; end; IntegerNode = pointer to record (Element) - value: INTEGER + value: Int end; List = pointer to Node; List1 = pointer to Node; Node = record - elem: INTEGER; + elem: Int; next: List; next1: pointer to Node; next2: List1; @@ -56,10 +56,10 @@ module T2TypeDeclarations; end; ProcRecArray = array 10 of record - f: procedure (x: ArrayRecPtr): INTEGER + f: procedure (x: ArrayRecPtr): Int end; - T = record i: INTEGER end; + T = record i: Int end; var s: String; @@ -112,7 +112,7 @@ module T2TypeDeclarations; procedure TestScope; type P = pointer to T; - T = record f: INTEGER end; + T = record f: Int end; var x: P; y: T; begin diff --git a/tests/obnc/passing/T3VariableDeclarations.obn b/tests/obnc/passing/T3VariableDeclarations.obn index cd8380c..9b06f43 100644 --- a/tests/obnc/passing/T3VariableDeclarations.obn +++ b/tests/obnc/passing/T3VariableDeclarations.obn @@ -19,7 +19,7 @@ module T3VariableDeclarations; type Vector = record - x, y: REAL + x, y: Real end; ShapeDesc = record diff --git a/tests/obnc/passing/T4Expressions.obn b/tests/obnc/passing/T4Expressions.obn index 638ce79..c89eb11 100644 --- a/tests/obnc/passing/T4Expressions.obn +++ b/tests/obnc/passing/T4Expressions.obn @@ -19,14 +19,14 @@ module T4Expressions; import Out, SYSTEM; - procedure IncReturnZero(var x: INTEGER): INTEGER; + procedure IncReturnZero(var x: Int): Int; begin INC(x) return 0 end IncReturnZero; - procedure IncReturnEmpty(var x: INTEGER): SET; + procedure IncReturnEmpty(var x: Int): SET; begin INC(x) return {} @@ -34,15 +34,15 @@ module T4Expressions; procedure TestDesignators; - var s: array 32 of CHAR; - A: array 3, 4 of INTEGER; - i, j: INTEGER; + var s: array 32 of Char; + A: array 3, 4 of Int; + i, j: Int; a: array 10 of pointer to record - a: array 10 of INTEGER; - f: procedure (): INTEGER + a: array 10 of Int; + f: procedure (): Int end; - procedure F(): INTEGER; + procedure F(): Int; return 1 end F; @@ -68,7 +68,7 @@ module T4Expressions; procedure TestSetConstructors; var - a, b, i, j: INTEGER; + a, b, i, j: Int; A: SET; begin a := 4; @@ -91,14 +91,14 @@ Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; T = pointer to record end; T1 = pointer to record (T) end; - var b, b1: BOOLEAN; - ch, ch1: CHAR; - i, j, n: INTEGER; - x: REAL; - y: BYTE; + var b, b1: Bool; + ch, ch1: Char; + i, j, n: Int; + x: Real; + y: Byte; A, B: SET; - str: array 24 of CHAR; - strs: array 2, 32 of CHAR; + str: array 24 of Char; + strs: array 2, 32 of Char; t: T; t1: T1; begin @@ -249,10 +249,10 @@ Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; procedure TestAdditiveOperations; const eps = 0.01; - var b: BOOLEAN; - n: INTEGER; - x: REAL; - y: BYTE; + var b: Bool; + n: Int; + x: Real; + y: Byte; A: SET; begin (*booleans*) @@ -291,7 +291,7 @@ Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; ASSERT(-x + 1.0 <= eps); ASSERT(-x - 1.0 >= -2.0 - eps); ASSERT(-x - 1.0 <= -2.0 + eps); - if SYSTEM.SIZE(REAL) > 8 then + if SYSTEM.SIZE(Real) > 8 then x := 2.0E+308; (*greater than maximum value of binary64*) ASSERT(x > 1.0E+308); ASSERT(x < 3.0E+308) @@ -317,10 +317,10 @@ Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; procedure TestMultiplicativeOperations; const eps = 0.01; - var b: BOOLEAN; - i, j, n: INTEGER; - x: REAL; - y: BYTE; + var b: Bool; + i, j, n: Int; + x: Real; + y: Byte; A: SET; begin (*booleans*) @@ -388,12 +388,12 @@ Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; ordConst = ORD(true); chrConst = CHR(0); - var a: array 10 of CHAR; - b: BOOLEAN; - ch: CHAR; - i, j, k: INTEGER; - r: REAL; - x: BYTE; + var a: array 10 of Char; + b: Bool; + ch: Char; + i, j, k: Int; + r: Real; + x: Byte; s: SET; begin ASSERT(ABS(-1) = 1); diff --git a/tests/obnc/passing/T5Statements.obn b/tests/obnc/passing/T5Statements.obn index d8539bf..b0bcbab 100644 --- a/tests/obnc/passing/T5Statements.obn +++ b/tests/obnc/passing/T5Statements.obn @@ -23,30 +23,30 @@ module T5Statements; Shape = pointer to ShapeDesc; ShapeDesc = record - x, y: REAL + x, y: Real end; Rectangle = pointer to RectangleDesc; RectangleDesc = record (ShapeDesc) - w, h: REAL + w, h: Real end; Circle = pointer to CircleDesc; CircleDesc = record (ShapeDesc) - r: REAL + r: Real end; - String = array 256 of CHAR; + String = array 256 of Char; var - globalInteger: INTEGER; + globalInteger: Int; procedure TestBasicAssignments; - var b, b1: BOOLEAN; - ch, ch1: CHAR; - n, n1: INTEGER; - x, x1: REAL; - y, y1: BYTE; + var b, b1: Bool; + ch, ch1: Char; + n, n1: Int; + x, x1: Real; + y, y1: Byte; A, A1: SET; begin b := true; @@ -80,17 +80,17 @@ module T5Statements; procedure TestArrayAssignments; - var str, str1: array 60 of CHAR; + var str, str1: array 60 of Char; strs, strs1: array 2 of String; strs2: array 1, 2 of String; - procedure AssignString(var s: array of CHAR); + procedure AssignString(var s: array of Char); begin s := "hello" end AssignString; - procedure AssignOpenArray(s: array of CHAR); - var t: array 128 of CHAR; + procedure AssignOpenArray(s: array of Char); + var t: array 128 of Char; begin t := s; ASSERT(t = s) @@ -132,7 +132,7 @@ module T5Statements; procedure TestRecordAssignments; const eps = 0.01; - var foo, bar: record ch: CHAR; i: INTEGER end; + var foo, bar: record ch: Char; i: Int end; s: ShapeDesc; r: RectangleDesc; c: CircleDesc; @@ -192,35 +192,35 @@ module T5Statements; procedure P; end P; - procedure P1(n: INTEGER); + procedure P1(n: Int); end P1; - procedure P2(n: INTEGER; x: REAL); + procedure P2(n: Int; x: Real); end P2; - procedure F(): INTEGER; + procedure F(): Int; return 0 end F; - procedure F1(n: INTEGER): INTEGER; + procedure F1(n: Int): Int; return 0 end F1; - procedure F2(var n: INTEGER; x: REAL; s: array of CHAR): INTEGER; + procedure F2(var n: Int; x: Real; s: array of Char): Int; return 0 end F2; procedure TestProcedureAssignments; type PT = procedure; - PT1 = procedure (n: INTEGER); - PT2 = procedure (n: INTEGER; x: REAL); - FT = procedure (): INTEGER; - FT1 = procedure (n: INTEGER): INTEGER; - FT2 = procedure (var n: INTEGER; x: REAL; s: array of CHAR): INTEGER; + PT1 = procedure (n: Int); + PT2 = procedure (n: Int; x: Real); + FT = procedure (): Int; + FT1 = procedure (n: Int): Int; + FT2 = procedure (var n: Int; x: Real; s: array of Char): Int; var p: PT; p1: PT1; p2: PT2; f: FT; f1: FT1; f2, g2: FT2; - n: INTEGER; + n: Int; procedure Local; end Local; @@ -250,26 +250,26 @@ module T5Statements; procedure TestProcedureCalls; - var s: array 16 of CHAR; + var s: array 16 of Char; p0: pointer to T0; p1: pointer to T1; procedure P1; end P1; - procedure P2(n: INTEGER); + procedure P2(n: Int); end P2; - procedure P3(a, b: INTEGER); + procedure P3(a, b: Int); end P3; - procedure P4(a: INTEGER; b: INTEGER); + procedure P4(a: Int; b: Int); end P4; - procedure P5(ch: CHAR); + procedure P5(ch: Char); end P5; - procedure P6(s: array of CHAR); + procedure P6(s: array of Char); end P6; procedure P7(var t: T0); @@ -295,14 +295,14 @@ module T5Statements; procedure TestPredeclaredProperProcedures; const eps = 0.01; - var n, i, j: INTEGER; + var n, i, j: Int; A: SET; - x: REAL; - a: array 1 of REAL; - b: array 1 of INTEGER; - v: pointer to record f: INTEGER end; + x: Real; + a: array 1 of Real; + b: array 1 of Int; + v: pointer to record f: Int end; - procedure IncReturnZero(var x: INTEGER): INTEGER; + procedure IncReturnZero(var x: Int): Int; begin INC(x) return 0 @@ -369,7 +369,7 @@ module T5Statements; procedure TestIfStatements; - var n: INTEGER; + var n: Int; begin n := 0; if n = 0 then @@ -400,8 +400,8 @@ module T5Statements; C = 0; var - n: INTEGER; - ch: CHAR; + n: Int; + ch: Char; sp: Shape; rp: Rectangle; c: CircleDesc; @@ -462,7 +462,7 @@ module T5Statements; procedure TestWhileStatements; - var n, n1, i: INTEGER; + var n, n1, i: Int; begin n := 0; i := 1; @@ -493,7 +493,7 @@ module T5Statements; procedure TestRepeatStatements; - var n, i: INTEGER; + var n, i: Int; begin n:= 0; i := 1; @@ -505,7 +505,7 @@ module T5Statements; end TestRepeatStatements; - procedure IncGlobalIntegerReturnOne(): INTEGER; + procedure IncGlobalIntegerReturnOne(): Int; begin INC(globalInteger) return 1 @@ -513,8 +513,8 @@ module T5Statements; procedure TestForStatements; - var n, i: INTEGER; - x: REAL; + var n, i: Int; + x: Real; begin n := 0; for i := 1 to 10 do diff --git a/tests/obnc/passing/T5SystemStatements.obn b/tests/obnc/passing/T5SystemStatements.obn index 487bee4..558f187 100644 --- a/tests/obnc/passing/T5SystemStatements.obn +++ b/tests/obnc/passing/T5SystemStatements.obn @@ -20,20 +20,20 @@ module T5SystemStatements; import SYSTEM; procedure Test; - const byte = SYSTEM.VAL(BYTE, 100); - type Array = array 2 of INTEGER; + const byte = SYSTEM.VAL(Byte, 100); + type Array = array 2 of Int; Pointer = pointer to record end; - var b, b1: BOOLEAN; - ch, ch1: CHAR; - i, i1: INTEGER; - r, r1: REAL; - x, x1: BYTE; - xs: array 2 of BYTE; + var b, b1: Bool; + ch, ch1: Char; + i, i1: Int; + r, r1: Real; + x, x1: Byte; + xs: array 2 of Byte; s, s1: SET; a, a1: Array; - a2: array SYSTEM.SIZE(Array) + 1 of INTEGER; + a2: array SYSTEM.SIZE(Array) + 1 of Int; begin - ASSERT(SYSTEM.SIZE(INTEGER) = SYSTEM.SIZE(Pointer)); + ASSERT(SYSTEM.SIZE(Int) = SYSTEM.SIZE(Pointer)); (*ADR, PUT, GET*) b := true; @@ -84,7 +84,7 @@ module T5SystemStatements; (*VAL*) xs[0] := 1; xs[1] := 2; - SYSTEM.PUT(SYSTEM.ADR(xs), SYSTEM.VAL(BYTE, 37)); + SYSTEM.PUT(SYSTEM.ADR(xs), SYSTEM.VAL(Byte, 37)); ASSERT(xs[0] = 37); ASSERT(xs[1] = 2); diff --git a/tests/obnc/passing/T6ProcedureDeclarations.obn b/tests/obnc/passing/T6ProcedureDeclarations.obn index 7f67a67..f6c113a 100644 --- a/tests/obnc/passing/T6ProcedureDeclarations.obn +++ b/tests/obnc/passing/T6ProcedureDeclarations.obn @@ -18,14 +18,14 @@ along with OBNC. If not, see .*) module T6ProcedureDeclarations; type - Row = array 20 of INTEGER; - Matrix = array 10, 20 of INTEGER; - Ptr = pointer to record f: INTEGER end; + Row = array 20 of Int; + Matrix = array 10, 20 of Int; + Ptr = pointer to record f: Int end; Proc = procedure; T0 = record end; T1 = record (T0) end; T2 = record (T1) - f: INTEGER + f: Int end; procedure TestValueParameters; @@ -34,7 +34,7 @@ module T6ProcedureDeclarations; A: Matrix; B: array 10 of Row; - procedure P(x: INTEGER); + procedure P(x: Int); begin x := 0 end P; @@ -105,24 +105,24 @@ module T6ProcedureDeclarations; procedure TestOpenArrayParameters; var - a: array 2 of INTEGER; - M: array 2, 3 of INTEGER; - T: array 2, 3, 4 of INTEGER; - c, i, j, k: INTEGER; + a: array 2 of Int; + M: array 2, 3 of Int; + T: array 2, 3, 4 of Int; + c, i, j, k: Int; - procedure P(a: array of INTEGER); - var i: INTEGER; + procedure P(a: array of Int); + var i: Int; begin for i := 0 to LEN(a) - 1 do ASSERT(a[i] = i + 1) end end P; - procedure Q(M: array of array of INTEGER); - var a: array 3 of INTEGER; + procedure Q(M: array of array of Int); + var a: array 3 of Int; - procedure Inner(M: array of array of INTEGER); - var c, i, j: INTEGER; + procedure Inner(M: array of array of Int); + var c, i, j: Int; begin c := 0; for i := 0 to LEN(M) - 1 do @@ -133,8 +133,8 @@ module T6ProcedureDeclarations; end; end Inner; - procedure Inner1(row: array of INTEGER); - var c, j: INTEGER; + procedure Inner1(row: array of Int); + var c, j: Int; begin c := LEN(row); for j := 0 to LEN(row) - 1 do @@ -149,8 +149,8 @@ module T6ProcedureDeclarations; a := M[1] end Q; - procedure R(var T: array of array of array of INTEGER); - var c, i, j, k: INTEGER; + procedure R(var T: array of array of array of Int); + var c, i, j, k: Int; begin c := 0; for i := 0 to LEN(T) - 1 do @@ -209,12 +209,12 @@ module T6ProcedureDeclarations; procedure TestLocalProcedures; - var s: INTEGER; + var s: Int; - procedure Sum(n: INTEGER): INTEGER; + procedure Sum(n: Int): Int; - procedure Inner(i, acc: INTEGER): INTEGER; - var result: INTEGER; + procedure Inner(i, acc: Int): Int; + var result: Int; begin if i >= 1 then result := Inner(i - 1, acc + i) @@ -237,7 +237,7 @@ module T6ProcedureDeclarations; type List = pointer to Node; Node = record - item: INTEGER; + item: Int; next: List end; Proc = procedure (x: List): List; diff --git a/tests/obnc/passing/T7Modules.obn b/tests/obnc/passing/T7Modules.obn index da4ec90..09b9526 100644 --- a/tests/obnc/passing/T7Modules.obn +++ b/tests/obnc/passing/T7Modules.obn @@ -31,12 +31,12 @@ module T7Modules; ListExt = pointer to record (A.List) end; var - intVar: INTEGER; + intVar: Int; w: B.T; x: B1.T; y: A.Nested; list: A.List; - matrix: array 2, 3 of INTEGER; + matrix: array 2, 3 of Int; x0: B.P0; x1: B1.P1; t: B1.T; diff --git a/tests/obnc/passing/lib/Local.obn b/tests/obnc/passing/lib/Local.obn index 8124790..9bb490e 100644 --- a/tests/obnc/passing/lib/Local.obn +++ b/tests/obnc/passing/lib/Local.obn @@ -18,10 +18,10 @@ along with OBNC. If not, see .*) module Local; type - T* = record f*: INTEGER end; + T* = record f*: Int end; var - x*: INTEGER; + x*: Int; procedure P*; end P; diff --git a/tests/obnc/passing/lib1/Local.obn b/tests/obnc/passing/lib1/Local.obn index 8124790..9bb490e 100644 --- a/tests/obnc/passing/lib1/Local.obn +++ b/tests/obnc/passing/lib1/Local.obn @@ -18,10 +18,10 @@ along with OBNC. If not, see .*) module Local; type - T* = record f*: INTEGER end; + T* = record f*: Int end; var - x*: INTEGER; + x*: Int; procedure P*; end P; diff --git a/tests/obncdoc/ExportedFeatures.obn b/tests/obncdoc/ExportedFeatures.obn index 2aa6789..e794ebf 100644 --- a/tests/obncdoc/ExportedFeatures.obn +++ b/tests/obncdoc/ExportedFeatures.obn @@ -8,32 +8,32 @@ module ExportedFeatures; (**documentation...*) t = 37; type - T0 = INTEGER; + T0 = Int; (*documentation...*) T* = record f*: record (**documentation...*) - g: INTEGER; - h*: INTEGER + g: Int; + h*: Int end; - g: REAL + g: Real end; T1* = record (T) (*documentation...*) - h: INTEGER + h: Int end; T2 = record - (*f*: INTEGER*) + (*f*: Int*) end; var x*, y: T; (**documentation...*) z, u*: F.File; - procedure P*(x: INTEGER; - y: REAL; - z: BYTE); + procedure P*(x: Int; + y: Real; + z: Byte); (**documentation, documentation...*) end P; @@ -44,7 +44,7 @@ documentation...*) end Q; - procedure R*((**in/out*) var x: INTEGER; (**out*) var y: REAL; (*out*) var z: BYTE); + procedure R*((**in/out*) var x: Int; (**out*) var y: Real; (*out*) var z: Byte); (**documentation...*) end R; diff --git a/tests/obncdoc/NoExportedFeatures.obn b/tests/obncdoc/NoExportedFeatures.obn index 55524d9..6911ffd 100644 --- a/tests/obncdoc/NoExportedFeatures.obn +++ b/tests/obncdoc/NoExportedFeatures.obn @@ -6,10 +6,10 @@ module NoExportedFeatures; alpha = M.pi; (*documentation*) type - Int = INTEGER; + Int = Int; var - x: INTEGER; + x: Int; procedure P; end P; -- 2.49.0