mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-23 19:55:59 +02:00
+ list of keywords that are reserved in Java and the JVM, for future
checking by the parser git-svn-id: branches/jvmbackend@18312 -
This commit is contained in:
parent
94ed2ac649
commit
20c577103f
@ -591,9 +591,82 @@ const
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef jvm}
|
||||||
|
{ reserved JVM tokens: keywords, true/false, and "null"; the commented out
|
||||||
|
ones are also Pascal keywords in all modes }
|
||||||
|
njvmtokens = 40;
|
||||||
|
jvmreservedwords: array[1..njvmtokens] of string[12] =
|
||||||
|
(
|
||||||
|
// 'DO',
|
||||||
|
// 'IF',
|
||||||
|
// 'FOR',
|
||||||
|
'INT',
|
||||||
|
'NEW',
|
||||||
|
'TRY',
|
||||||
|
'BYTE',
|
||||||
|
// 'CASE',
|
||||||
|
'CHAR',
|
||||||
|
// 'ELSE',
|
||||||
|
// 'GOTO',
|
||||||
|
'LONG',
|
||||||
|
'NULL',
|
||||||
|
'THIS',
|
||||||
|
'VOID',
|
||||||
|
'BREAK',
|
||||||
|
'CATCH',
|
||||||
|
'CLASS',
|
||||||
|
// 'CONST',
|
||||||
|
'FINAL',
|
||||||
|
'FLOAT',
|
||||||
|
'SHORT',
|
||||||
|
'SUPER',
|
||||||
|
'THROW',
|
||||||
|
// 'WHILE',
|
||||||
|
'DOUBLE',
|
||||||
|
'IMPORT',
|
||||||
|
'NATIVE',
|
||||||
|
'PUBLIC',
|
||||||
|
'RETURN',
|
||||||
|
'STATIC',
|
||||||
|
'SWITCH',
|
||||||
|
'THROWS',
|
||||||
|
'BOOLEAN',
|
||||||
|
'DEFAULT',
|
||||||
|
'EXTENDS',
|
||||||
|
'FINALLY',
|
||||||
|
'PACKAGE',
|
||||||
|
'PRIVATE',
|
||||||
|
'ABSTRACT',
|
||||||
|
'CONTINUE',
|
||||||
|
'STRICTFP',
|
||||||
|
'VOLATILE',
|
||||||
|
// 'INTERFACE',
|
||||||
|
'PROTECTED',
|
||||||
|
'TRANSIENT',
|
||||||
|
'IMPLEMENTS',
|
||||||
|
'INSTANCEOF',
|
||||||
|
'SYNCHRONIZED'
|
||||||
|
);
|
||||||
|
|
||||||
|
jvmtokenlenmin = 3;
|
||||||
|
jvmtokenlenmax = 12;
|
||||||
|
|
||||||
|
type
|
||||||
|
tjvmtokenidxrec = record
|
||||||
|
first, last: longint;
|
||||||
|
end;
|
||||||
|
tjmvtokenarray=array[1..njvmtokens] of string[12];
|
||||||
|
pjvmtokenidx= ^tjvmtokenidx;
|
||||||
|
tjvmtokenidx=array[jvmtokenlenmin..jvmtokenlenmax] of tjvmtokenidxrec;
|
||||||
|
{$endif jvm}
|
||||||
|
|
||||||
var
|
var
|
||||||
tokeninfo:ptokenarray;
|
tokeninfo:ptokenarray;
|
||||||
tokenidx:ptokenidx;
|
tokenidx:ptokenidx;
|
||||||
|
{$ifdef jvm}
|
||||||
|
jvmtokenidx: pjvmtokenidx;
|
||||||
|
{$endif jvm}
|
||||||
|
|
||||||
|
|
||||||
procedure inittokens;
|
procedure inittokens;
|
||||||
procedure donetokens;
|
procedure donetokens;
|
||||||
@ -607,7 +680,7 @@ procedure create_tokenidx;
|
|||||||
length, so a search only will be done in that small part }
|
length, so a search only will be done in that small part }
|
||||||
var
|
var
|
||||||
t : ttoken;
|
t : ttoken;
|
||||||
i : longint;
|
i, j : longint;
|
||||||
c : char;
|
c : char;
|
||||||
begin
|
begin
|
||||||
fillchar(tokenidx^,sizeof(tokenidx^),0);
|
fillchar(tokenidx^,sizeof(tokenidx^),0);
|
||||||
@ -622,6 +695,16 @@ begin
|
|||||||
tokenidx^[i,c].last:=t;
|
tokenidx^[i,c].last:=t;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ifdef jvm}
|
||||||
|
fillchar(jvmtokenidx^,sizeof(jvmtokenidx^),0);
|
||||||
|
for j:=low(jvmreservedwords) to high(jvmreservedwords) do
|
||||||
|
begin
|
||||||
|
i:=length(jvmreservedwords[j]);
|
||||||
|
if jvmtokenidx^[i].first=0 then
|
||||||
|
jvmtokenidx^[i].first:=j;
|
||||||
|
jvmtokenidx^[i].last:=j;
|
||||||
|
end;
|
||||||
|
{$endif jvm}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -631,6 +714,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
tokeninfo:=@arraytokeninfo;
|
tokeninfo:=@arraytokeninfo;
|
||||||
new(tokenidx);
|
new(tokenidx);
|
||||||
|
{$ifdef jvm}
|
||||||
|
new(jvmtokenidx);
|
||||||
|
{$endif jvm}
|
||||||
create_tokenidx;
|
create_tokenidx;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -643,6 +729,10 @@ begin
|
|||||||
tokeninfo:=nil;
|
tokeninfo:=nil;
|
||||||
dispose(tokenidx);
|
dispose(tokenidx);
|
||||||
tokenidx:=nil;
|
tokenidx:=nil;
|
||||||
|
{$ifdef jvm}
|
||||||
|
dispose(jvmtokenidx);
|
||||||
|
jvmtokenidx:=nil;
|
||||||
|
{$endif jvm}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user