|
@@ -307,7 +307,7 @@ TYPE
|
|
position: reference position (offset) of the input stream , for error output
|
|
position: reference position (offset) of the input stream , for error output
|
|
diagnostics: error output object
|
|
diagnostics: error output object
|
|
*)
|
|
*)
|
|
- PROCEDURE & InitializeScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics );
|
|
|
|
|
|
+ PROCEDURE & InitializeScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; pos: Position; diagnostics: Diagnostics.Diagnostics );
|
|
BEGIN
|
|
BEGIN
|
|
NEW(stringMaker,1024);
|
|
NEW(stringMaker,1024);
|
|
stringWriter := stringMaker.GetWriter();
|
|
stringWriter := stringMaker.GetWriter();
|
|
@@ -319,15 +319,14 @@ TYPE
|
|
ch := " ";
|
|
ch := " ";
|
|
case := Unknown;
|
|
case := Unknown;
|
|
firstIdentifier := TRUE;
|
|
firstIdentifier := TRUE;
|
|
|
|
+ SELF.position := pos;
|
|
|
|
+ DEC(position.start, 1); (* one symbol lookahead *)
|
|
IF reader = NIL THEN ch := EOT ELSE GetNextCharacter END;
|
|
IF reader = NIL THEN ch := EOT ELSE GetNextCharacter END;
|
|
IF Trace THEN D.Str( "New scanner " ); D.Ln; END;
|
|
IF Trace THEN D.Str( "New scanner " ); D.Ln; END;
|
|
- SELF.position.start := position;
|
|
|
|
- SELF.position.line := 1;
|
|
|
|
- SELF.position.linepos := 0;
|
|
|
|
IF source = "" THEN SELF.position.reader := reader END;
|
|
IF source = "" THEN SELF.position.reader := reader END;
|
|
useLineNumbers := FALSE;
|
|
useLineNumbers := FALSE;
|
|
END InitializeScanner;
|
|
END InitializeScanner;
|
|
-
|
|
|
|
|
|
+
|
|
PROCEDURE ResetCase*; (*! needs a better naming ! *)
|
|
PROCEDURE ResetCase*; (*! needs a better naming ! *)
|
|
BEGIN
|
|
BEGIN
|
|
firstIdentifier := TRUE; case := Unknown;
|
|
firstIdentifier := TRUE; case := Unknown;
|
|
@@ -1001,7 +1000,7 @@ TYPE
|
|
VAR
|
|
VAR
|
|
startContext-: Context;
|
|
startContext-: Context;
|
|
|
|
|
|
- PROCEDURE &InitAssemblerScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics );
|
|
|
|
|
|
+ PROCEDURE &InitAssemblerScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: Position; diagnostics: Diagnostics.Diagnostics );
|
|
BEGIN
|
|
BEGIN
|
|
InitializeScanner(source,reader,position,diagnostics);
|
|
InitializeScanner(source,reader,position,diagnostics);
|
|
GetContext(startContext);
|
|
GetContext(startContext);
|
|
@@ -1190,15 +1189,23 @@ TYPE
|
|
|
|
|
|
(** return a new scanner on a stream, error output via diagnostics **)
|
|
(** return a new scanner on a stream, error output via diagnostics **)
|
|
PROCEDURE NewScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics ): Scanner;
|
|
PROCEDURE NewScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics ): Scanner;
|
|
- VAR s: Scanner;
|
|
|
|
|
|
+ VAR s: Scanner; pos: Position;
|
|
BEGIN
|
|
BEGIN
|
|
- NEW( s, source, reader, position, diagnostics ); RETURN s;
|
|
|
|
|
|
+ pos.start := position;
|
|
|
|
+ pos.end := position;
|
|
|
|
+ pos.line := 1;
|
|
|
|
+ pos.linepos := 0;
|
|
|
|
+ NEW( s, source, reader, pos, diagnostics ); RETURN s;
|
|
END NewScanner;
|
|
END NewScanner;
|
|
|
|
|
|
PROCEDURE NewAssemblerScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics ): AssemblerScanner;
|
|
PROCEDURE NewAssemblerScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics ): AssemblerScanner;
|
|
- VAR s: AssemblerScanner;
|
|
|
|
|
|
+ VAR s: AssemblerScanner;pos: Position;
|
|
BEGIN
|
|
BEGIN
|
|
- NEW( s, source, reader, position, diagnostics ); RETURN s;
|
|
|
|
|
|
+ pos.start := position;
|
|
|
|
+ pos.end := position;
|
|
|
|
+ pos.line := 1;
|
|
|
|
+ pos.linepos := 0;
|
|
|
|
+ NEW( s, source, reader, pos, diagnostics ); RETURN s;
|
|
END NewAssemblerScanner;
|
|
END NewAssemblerScanner;
|
|
|
|
|
|
PROCEDURE SymbolToString*(CONST symbol: Symbol; case: LONGINT; VAR str: ARRAY OF CHAR);
|
|
PROCEDURE SymbolToString*(CONST symbol: Symbol; case: LONGINT; VAR str: ARRAY OF CHAR);
|