* give correct error locations for errors when specializing templates

* removed more germanisms
* better dumping of tokenbuf in ppudump

git-svn-id: trunk@5101 -
This commit is contained in:
florian 2006-10-30 23:28:06 +00:00
parent 0c6e1e4c44
commit bce905b106
15 changed files with 149 additions and 89 deletions

View File

@ -218,7 +218,7 @@ interface
RelocSectionSetExplicitly : boolean; RelocSectionSetExplicitly : boolean;
LinkTypeSetExplicitly : boolean; LinkTypeSetExplicitly : boolean;
akttokenpos, { position of the last token } current_tokenpos, { position of the last token }
current_filepos : tfileposinfo; { current position } current_filepos : tfileposinfo; { current position }
nwscreenname : string; nwscreenname : string;

View File

@ -303,7 +303,7 @@ implementation
oldtoken:=token; oldtoken:=token;
oldidtoken:=idtoken; oldidtoken:=idtoken;
old_block_type:=block_type; old_block_type:=block_type;
oldtokenpos:=akttokenpos; oldtokenpos:=current_tokenpos;
{ save cg } { save cg }
oldparse_only:=parse_only; oldparse_only:=parse_only;
{ save akt... state } { save akt... state }
@ -445,7 +445,7 @@ implementation
orgpattern:=oldorgpattern; orgpattern:=oldorgpattern;
token:=oldtoken; token:=oldtoken;
idtoken:=oldidtoken; idtoken:=oldidtoken;
akttokenpos:=oldtokenpos; current_tokenpos:=oldtokenpos;
block_type:=old_block_type; block_type:=old_block_type;
{ restore cg } { restore cg }
parse_only:=oldparse_only; parse_only:=oldparse_only;

View File

@ -131,7 +131,7 @@ implementation
else else
begin begin
if token=_END then if token=_END then
last_endtoken_filepos:=akttokenpos; last_endtoken_filepos:=current_tokenpos;
current_scanner.readtoken(true); current_scanner.readtoken(true);
end; end;
end; end;
@ -144,7 +144,7 @@ implementation
begin begin
try_to_consume:=true; try_to_consume:=true;
if token=_END then if token=_END then
last_endtoken_filepos:=akttokenpos; last_endtoken_filepos:=current_tokenpos;
current_scanner.readtoken(true); current_scanner.readtoken(true);
end; end;
end; end;

View File

@ -84,8 +84,8 @@ implementation
internalerror(9584582); internalerror(9584582);
hp:=nil; hp:=nil;
p:=comp_expr(true); p:=comp_expr(true);
storetokenpos:=akttokenpos; storetokenpos:=current_tokenpos;
akttokenpos:=filepos; current_tokenpos:=filepos;
case p.nodetype of case p.nodetype of
ordconstn: ordconstn:
begin begin
@ -148,7 +148,7 @@ implementation
else else
Message(parser_e_illegal_expression); Message(parser_e_illegal_expression);
end; end;
akttokenpos:=storetokenpos; current_tokenpos:=storetokenpos;
p.free; p.free;
readconstant:=hp; readconstant:=hp;
end; end;
@ -170,7 +170,7 @@ implementation
block_type:=bt_const; block_type:=bt_const;
repeat repeat
orgname:=orgpattern; orgname:=orgpattern;
filepos:=akttokenpos; filepos:=current_tokenpos;
consume(_ID); consume(_ID);
case token of case token of
@ -201,10 +201,10 @@ implementation
block_type:=bt_const; block_type:=bt_const;
skipequal:=false; skipequal:=false;
{ create symbol } { create symbol }
storetokenpos:=akttokenpos; storetokenpos:=current_tokenpos;
akttokenpos:=filepos; current_tokenpos:=filepos;
sym:=ttypedconstsym.create(orgname,hdef,(cs_typed_const_writable in current_settings.localswitches)); sym:=ttypedconstsym.create(orgname,hdef,(cs_typed_const_writable in current_settings.localswitches));
akttokenpos:=storetokenpos; current_tokenpos:=storetokenpos;
symtablestack.top.insert(sym); symtablestack.top.insert(sym);
{ procvar can have proc directives, but not type references } { procvar can have proc directives, but not type references }
if (hdef.deftype=procvardef) and if (hdef.deftype=procvardef) and
@ -312,8 +312,8 @@ implementation
begin begin
{ try to resolve the forward } { try to resolve the forward }
{ get the correct position for it } { get the correct position for it }
stpos:=akttokenpos; stpos:=current_tokenpos;
akttokenpos:=tforwarddef(hpd).forwardpos; current_tokenpos:=tforwarddef(hpd).forwardpos;
resolving_forward:=true; resolving_forward:=true;
make_ref:=false; make_ref:=false;
if not assigned(tforwarddef(hpd).tosymname) then if not assigned(tforwarddef(hpd).tosymname) then
@ -321,7 +321,7 @@ implementation
searchsym(tforwarddef(hpd).tosymname^,srsym,srsymtable); searchsym(tforwarddef(hpd).tosymname^,srsym,srsymtable);
make_ref:=true; make_ref:=true;
resolving_forward:=false; resolving_forward:=false;
akttokenpos:=stpos; current_tokenpos:=stpos;
{ we don't need the forwarddef anymore, dispose it } { we don't need the forwarddef anymore, dispose it }
hpd.free; hpd.free;
tabstractpointerdef(pd).pointeddef:=nil; { if error occurs } tabstractpointerdef(pd).pointeddef:=nil; { if error occurs }
@ -407,7 +407,7 @@ implementation
block_type:=bt_type; block_type:=bt_type;
typecanbeforward:=true; typecanbeforward:=true;
repeat repeat
defpos:=akttokenpos; defpos:=current_tokenpos;
istyperenaming:=false; istyperenaming:=false;
generictypelist:=nil; generictypelist:=nil;
generictokenbuf:=nil; generictokenbuf:=nil;
@ -477,11 +477,11 @@ implementation
referencing the type before it's really set it referencing the type before it's really set it
will give an error (PFV) } will give an error (PFV) }
hdef:=generrordef; hdef:=generrordef;
storetokenpos:=akttokenpos; storetokenpos:=current_tokenpos;
newtype:=ttypesym.create(orgtypename,hdef); newtype:=ttypesym.create(orgtypename,hdef);
symtablestack.top.insert(newtype); symtablestack.top.insert(newtype);
akttokenpos:=defpos; current_tokenpos:=defpos;
akttokenpos:=storetokenpos; current_tokenpos:=storetokenpos;
{ read the type definition } { read the type definition }
read_named_type(hdef,orgtypename,nil,generictypelist,false); read_named_type(hdef,orgtypename,nil,generictypelist,false);
{ update the definition of the type } { update the definition of the type }
@ -666,15 +666,15 @@ implementation
block_type:=bt_const; block_type:=bt_const;
repeat repeat
orgname:=orgpattern; orgname:=orgpattern;
filepos:=akttokenpos; filepos:=current_tokenpos;
consume(_ID); consume(_ID);
case token of case token of
_EQUAL: _EQUAL:
begin begin
consume(_EQUAL); consume(_EQUAL);
p:=comp_expr(true); p:=comp_expr(true);
storetokenpos:=akttokenpos; storetokenpos:=current_tokenpos;
akttokenpos:=filepos; current_tokenpos:=filepos;
sym:=nil; sym:=nil;
case p.nodetype of case p.nodetype of
ordconstn: ordconstn:
@ -699,7 +699,7 @@ implementation
else else
Message(parser_e_illegal_expression); Message(parser_e_illegal_expression);
end; end;
akttokenpos:=storetokenpos; current_tokenpos:=storetokenpos;
{ Support hint directives } { Support hint directives }
dummysymoptions:=[]; dummysymoptions:=[];
try_consume_hintdirective(dummysymoptions); try_consume_hintdirective(dummysymoptions);

View File

@ -96,9 +96,9 @@ implementation
not is_void(pd.returndef) and not is_void(pd.returndef) and
paramanager.ret_in_param(pd.returndef,pd.proccalloption) then paramanager.ret_in_param(pd.returndef,pd.proccalloption) then
begin begin
storepos:=akttokenpos; storepos:=current_tokenpos;
if pd.deftype=procdef then if pd.deftype=procdef then
akttokenpos:=tprocdef(pd).fileinfo; current_tokenpos:=tprocdef(pd).fileinfo;
{ For left to right add it at the end to be delphi compatible } { For left to right add it at the end to be delphi compatible }
if pd.proccalloption in (pushleftright_pocalls+[pocall_safecall]) then if pd.proccalloption in (pushleftright_pocalls+[pocall_safecall]) then
@ -112,7 +112,7 @@ implementation
if pd.deftype=procdef then if pd.deftype=procdef then
tprocdef(pd).funcretsym:=vs; tprocdef(pd).funcretsym:=vs;
akttokenpos:=storepos; current_tokenpos:=storepos;
end; end;
end; end;
@ -124,9 +124,9 @@ implementation
begin begin
if pd.parast.symtablelevel>normal_function_level then if pd.parast.symtablelevel>normal_function_level then
begin begin
storepos:=akttokenpos; storepos:=current_tokenpos;
if pd.deftype=procdef then if pd.deftype=procdef then
akttokenpos:=tprocdef(pd).fileinfo; current_tokenpos:=tprocdef(pd).fileinfo;
{ Generate result variable accessing function result, it { Generate result variable accessing function result, it
can't be put in a register since it must be accessable can't be put in a register since it must be accessable
@ -135,7 +135,7 @@ implementation
vs.varregable:=vr_none; vs.varregable:=vr_none;
pd.parast.insert(vs); pd.parast.insert(vs);
akttokenpos:=storepos; current_tokenpos:=storepos;
end; end;
end; end;
@ -160,8 +160,8 @@ implementation
assigned(tprocdef(pd)._class) and assigned(tprocdef(pd)._class) and
(pd.parast.symtablelevel=normal_function_level) then (pd.parast.symtablelevel=normal_function_level) then
begin begin
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=tprocdef(pd).fileinfo; current_tokenpos:=tprocdef(pd).fileinfo;
{ Generate VMT variable for constructor/destructor } { Generate VMT variable for constructor/destructor }
if pd.proctypeoption in [potype_constructor,potype_destructor] then if pd.proctypeoption in [potype_constructor,potype_destructor] then
@ -188,7 +188,7 @@ implementation
vs:=tparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]); vs:=tparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]);
pd.parast.insert(vs); pd.parast.insert(vs);
akttokenpos:=storepos; current_tokenpos:=storepos;
end; end;
end; end;
end; end;
@ -205,8 +205,8 @@ implementation
if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
not is_void(pd.returndef) then not is_void(pd.returndef) then
begin begin
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=pd.fileinfo; current_tokenpos:=pd.fileinfo;
{ We always need a localsymtable } { We always need a localsymtable }
if not assigned(pd.localst) then if not assigned(pd.localst) then
@ -243,7 +243,7 @@ implementation
tlocalsymtable(pd.localst).insert(aliasvs); tlocalsymtable(pd.localst).insert(aliasvs);
end; end;
akttokenpos:=storepos; current_tokenpos:=storepos;
end; end;
end; end;
@ -632,7 +632,7 @@ implementation
popclass : boolean; popclass : boolean;
begin begin
{ Save the position where this procedure really starts } { Save the position where this procedure really starts }
procstartfilepos:=akttokenpos; procstartfilepos:=current_tokenpos;
result:=false; result:=false;
pd:=nil; pd:=nil;
@ -656,8 +656,8 @@ implementation
(aclass.implementedinterfaces.count>0) and (aclass.implementedinterfaces.count>0) and
try_to_consume(_POINT) then try_to_consume(_POINT) then
begin begin
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=procstartfilepos; current_tokenpos:=procstartfilepos;
{ get interface syms} { get interface syms}
searchsym(sp,srsym,srsymtable); searchsym(sp,srsym,srsymtable);
if not assigned(srsym) then if not assigned(srsym) then
@ -665,7 +665,7 @@ implementation
identifier_not_found(orgsp); identifier_not_found(orgsp);
srsym:=generrorsym; srsym:=generrorsym;
end; end;
akttokenpos:=storepos; current_tokenpos:=storepos;
{ qualifier is interface? } { qualifier is interface? }
if (srsym.typ=typesym) and if (srsym.typ=typesym) and
(ttypesym(srsym).typedef.deftype=objectdef) then (ttypesym(srsym).typedef.deftype=objectdef) then
@ -693,19 +693,19 @@ implementation
try_to_consume(_POINT) then try_to_consume(_POINT) then
begin begin
{ search for object name } { search for object name }
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=procstartfilepos; current_tokenpos:=procstartfilepos;
searchsym(sp,srsym,srsymtable); searchsym(sp,srsym,srsymtable);
if not assigned(srsym) then if not assigned(srsym) then
begin begin
identifier_not_found(orgsp); identifier_not_found(orgsp);
srsym:=generrorsym; srsym:=generrorsym;
end; end;
akttokenpos:=storepos; current_tokenpos:=storepos;
{ consume proc name } { consume proc name }
sp:=pattern; sp:=pattern;
orgsp:=orgpattern; orgsp:=orgpattern;
procstartfilepos:=akttokenpos; procstartfilepos:=current_tokenpos;
consume(_ID); consume(_ID);
{ qualifier is class name ? } { qualifier is class name ? }
if (srsym.typ=typesym) and if (srsym.typ=typesym) and
@ -748,7 +748,7 @@ implementation
repeat repeat
searchagain:=false; searchagain:=false;
akttokenpos:=procstartfilepos; current_tokenpos:=procstartfilepos;
srsymtable:=symtablestack.top; srsymtable:=symtablestack.top;
srsym:=tsym(srsymtable.search(sp)); srsym:=tsym(srsymtable.search(sp));
@ -795,7 +795,7 @@ implementation
if not assigned(aprocsym) then if not assigned(aprocsym) then
begin begin
{ create a new procsym and set the real filepos } { create a new procsym and set the real filepos }
akttokenpos:=procstartfilepos; current_tokenpos:=procstartfilepos;
{ for operator we have only one procsym for each overloaded { for operator we have only one procsym for each overloaded
operation } operation }
if (potype=potype_operator) then if (potype=potype_operator) then

View File

@ -2123,7 +2123,7 @@ implementation
begin begin
oldp1:=nil; oldp1:=nil;
p1:=nil; p1:=nil;
filepos:=akttokenpos; filepos:=current_tokenpos;
again:=false; again:=false;
if token=_ID then if token=_ID then
begin begin
@ -2148,7 +2148,7 @@ implementation
if assigned(p1) then if assigned(p1) then
p1.fileinfo:=filepos; p1.fileinfo:=filepos;
oldp1:=p1; oldp1:=p1;
filepos:=akttokenpos; filepos:=current_tokenpos;
end; end;
{ handle post fix operators } { handle post fix operators }
postfixoperators(p1,again); postfixoperators(p1,again);
@ -2610,7 +2610,7 @@ implementation
((token<>_EQUAL) or accept_equal) then ((token<>_EQUAL) or accept_equal) then
begin begin
oldt:=token; oldt:=token;
filepos:=akttokenpos; filepos:=current_tokenpos;
consume(token); consume(token);
if pred_level=highest_precedence then if pred_level=highest_precedence then
p2:=factor(false) p2:=factor(false)
@ -2717,7 +2717,7 @@ implementation
{ get the resultdef for this expression } { get the resultdef for this expression }
if not assigned(p1.resultdef) then if not assigned(p1.resultdef) then
do_typecheckpass(p1); do_typecheckpass(p1);
filepos:=akttokenpos; filepos:=current_tokenpos;
if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
afterassignment:=true; afterassignment:=true;
oldp1:=p1; oldp1:=p1;

View File

@ -145,7 +145,7 @@ implementation
{ function styled new is handled in factor } { function styled new is handled in factor }
{ destructors have no parameters } { destructors have no parameters }
destructorname:=pattern; destructorname:=pattern;
destructorpos:=akttokenpos; destructorpos:=current_tokenpos;
consume(_ID); consume(_ID);
if (p.resultdef.deftype<>pointerdef) then if (p.resultdef.deftype<>pointerdef) then
@ -179,10 +179,10 @@ implementation
exit; exit;
end; end;
{ search cons-/destructor, also in parent classes } { search cons-/destructor, also in parent classes }
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=destructorpos; current_tokenpos:=destructorpos;
sym:=search_class_member(classh,destructorname); sym:=search_class_member(classh,destructorname);
akttokenpos:=storepos; current_tokenpos:=storepos;
{ the second parameter of new/dispose must be a call } { the second parameter of new/dispose must be a call }
{ to a cons-/destructor } { to a cons-/destructor }

View File

@ -923,7 +923,7 @@ implementation
srsymtable : tsymtable; srsymtable : tsymtable;
s : stringid; s : stringid;
begin begin
filepos:=akttokenpos; filepos:=current_tokenpos;
case token of case token of
_GOTO : _GOTO :
begin begin
@ -1088,7 +1088,7 @@ implementation
begin begin
first:=nil; first:=nil;
filepos:=akttokenpos; filepos:=current_tokenpos;
consume(starttoken); consume(starttoken);
while not(token in [_END,_FINALIZATION]) do while not(token in [_END,_FINALIZATION]) do
@ -1189,7 +1189,7 @@ implementation
{ because the END is already read we need to get the { because the END is already read we need to get the
last_endtoken_filepos here (PFV) } last_endtoken_filepos here (PFV) }
last_endtoken_filepos:=akttokenpos; last_endtoken_filepos:=current_tokenpos;
assembler_block:=p; assembler_block:=p;
end; end;

View File

@ -1701,7 +1701,7 @@ implementation
internalerror(200512111); internalerror(200512111);
oldcurrent_filepos:=current_filepos; oldcurrent_filepos:=current_filepos;
current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo; current_filepos:=tprocdef(tprocdef(hp).genericdef).fileinfo;
akttokenpos:=current_filepos; current_tokenpos:=current_filepos;
current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf); current_scanner.startreplaytokens(tprocdef(tprocdef(hp).genericdef).generictokenbuf);
read_proc_body(nil,tprocdef(hp)); read_proc_body(nil,tprocdef(hp));
current_filepos:=oldcurrent_filepos; current_filepos:=oldcurrent_filepos;

View File

@ -168,7 +168,7 @@ implementation
begin begin
s:=pattern; s:=pattern;
sorg:=orgpattern; sorg:=orgpattern;
pos:=akttokenpos; pos:=current_tokenpos;
{ use of current parsed object: { use of current parsed object:
- classes can be used also in classes - classes can be used also in classes
- objects can be parameters } - objects can be parameters }
@ -617,7 +617,7 @@ implementation
aktenumdef:=tenumdef.create; aktenumdef:=tenumdef.create;
repeat repeat
s:=orgpattern; s:=orgpattern;
defpos:=akttokenpos; defpos:=current_tokenpos;
consume(_ID); consume(_ID);
{ only allow assigning of specific numbers under fpc mode } { only allow assigning of specific numbers under fpc mode }
if not(m_tp7 in current_settings.modeswitches) and if not(m_tp7 in current_settings.modeswitches) and
@ -659,10 +659,10 @@ implementation
else else
inc(l); inc(l);
first := false; first := false;
storepos:=akttokenpos; storepos:=current_tokenpos;
akttokenpos:=defpos; current_tokenpos:=defpos;
tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l)); tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,l));
akttokenpos:=storepos; current_tokenpos:=storepos;
until not try_to_consume(_COMMA); until not try_to_consume(_COMMA);
def:=aktenumdef; def:=aktenumdef;
consume(_RKLAMMER); consume(_RKLAMMER);

View File

@ -67,7 +67,7 @@ interface
tcompile_time_predicate = function(var valuedescr: String) : Boolean; tcompile_time_predicate = function(var valuedescr: String) : Boolean;
tspecialgenerictoken = (ST_LOADSETTINGS); tspecialgenerictoken = (ST_LOADSETTINGS,ST_LINE,ST_COLUMN,ST_FILEINDEX);
tscannerfile = class tscannerfile = class
public public
@ -91,6 +91,9 @@ interface
{ last settings we stored } { last settings we stored }
last_settings : tsettings; last_settings : tsettings;
{ last filepos we stored }
last_filepos : tfileposinfo;
comment_level, comment_level,
yylexcount : longint; yylexcount : longint;
lastasmgetchar : char; lastasmgetchar : char;
@ -1829,6 +1832,7 @@ In case not, the value returned can be arbitrary.
internalerror(200511173); internalerror(200511173);
recordtokenbuf:=buf; recordtokenbuf:=buf;
fillchar(last_settings,sizeof(last_settings),0); fillchar(last_settings,sizeof(last_settings),0);
fillchar(last_filepos,sizeof(last_filepos),0);
end; end;
@ -1853,6 +1857,30 @@ In case not, the value returned can be arbitrary.
recordtokenbuf.write(current_settings,sizeof(current_settings)); recordtokenbuf.write(current_settings,sizeof(current_settings));
last_settings:=current_settings; last_settings:=current_settings;
end; end;
{ file pos changes? }
if current_tokenpos.line<>last_filepos.line then
begin
recordtokenbuf.write(_GENERICSPECIALTOKEN,1);
recordtokenbuf.write(ST_LINE,1);
recordtokenbuf.write(current_tokenpos.line,sizeof(current_tokenpos.line));
last_filepos.line:=current_tokenpos.line;
end;
if current_tokenpos.column<>last_filepos.column then
begin
recordtokenbuf.write(_GENERICSPECIALTOKEN,1);
recordtokenbuf.write(ST_COLUMN,1);
recordtokenbuf.write(current_tokenpos.column,sizeof(current_tokenpos.column));
last_filepos.column:=current_tokenpos.column;
end;
if current_tokenpos.fileindex<>last_filepos.fileindex then
begin
recordtokenbuf.write(_GENERICSPECIALTOKEN,1);
recordtokenbuf.write(ST_FILEINDEX,1);
recordtokenbuf.write(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
last_filepos.fileindex:=current_tokenpos.fileindex;
end;
recordtokenbuf.write(token,1); recordtokenbuf.write(token,1);
if token=_ID then if token=_ID then
recordtokenbuf.write(idtoken,1); recordtokenbuf.write(idtoken,1);
@ -1892,8 +1920,6 @@ In case not, the value returned can be arbitrary.
{ install buffer } { install buffer }
replaytokenbuf:=buf; replaytokenbuf:=buf;
fillchar(last_settings,sizeof(last_settings),0);
{ reload next token } { reload next token }
replaytokenbuf.seek(0); replaytokenbuf.seek(0);
replaytoken; replaytoken;
@ -1950,9 +1976,13 @@ In case not, the value returned can be arbitrary.
replaytokenbuf.read(specialtoken,1); replaytokenbuf.read(specialtoken,1);
case specialtoken of case specialtoken of
ST_LOADSETTINGS: ST_LOADSETTINGS:
begin
replaytokenbuf.read(current_settings,sizeof(current_settings)); replaytokenbuf.read(current_settings,sizeof(current_settings));
end ST_LINE:
replaytokenbuf.read(current_tokenpos.line,sizeof(current_tokenpos.line));
ST_COLUMN:
replaytokenbuf.read(current_tokenpos.column,sizeof(current_tokenpos.column));
ST_FILEINDEX:
replaytokenbuf.read(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
else else
internalerror(2006103010); internalerror(2006103010);
end; end;
@ -2082,11 +2112,11 @@ In case not, the value returned can be arbitrary.
{ load the values of tokenpos and lasttokenpos } { load the values of tokenpos and lasttokenpos }
begin begin
lasttokenpos:=inputstart+(inputpointer-inputbuffer); lasttokenpos:=inputstart+(inputpointer-inputbuffer);
akttokenpos.line:=line_no; current_tokenpos.line:=line_no;
akttokenpos.column:=lasttokenpos-lastlinepos; current_tokenpos.column:=lasttokenpos-lastlinepos;
akttokenpos.fileindex:=inputfile.ref_index; current_tokenpos.fileindex:=inputfile.ref_index;
akttokenpos.moduleindex:=current_module.unit_index; current_tokenpos.moduleindex:=current_module.unit_index;
current_filepos:=akttokenpos; current_filepos:=current_tokenpos;
end; end;
@ -2149,12 +2179,12 @@ In case not, the value returned can be arbitrary.
{ update for status and call the show status routine, { update for status and call the show status routine,
but don't touch current_filepos ! } but don't touch current_filepos ! }
oldcurrent_filepos:=current_filepos; oldcurrent_filepos:=current_filepos;
oldtokenpos:=akttokenpos; oldtokenpos:=current_tokenpos;
gettokenpos; { update for v_status } gettokenpos; { update for v_status }
inc(status.compiledlines); inc(status.compiledlines);
ShowStatus; ShowStatus;
current_filepos:=oldcurrent_filepos; current_filepos:=oldcurrent_filepos;
akttokenpos:=oldtokenpos; current_tokenpos:=oldtokenpos;
end; end;
end; end;

View File

@ -3263,7 +3263,7 @@ implementation
refcount:=0; refcount:=0;
if (cs_browser in current_settings.moduleswitches) and make_ref then if (cs_browser in current_settings.moduleswitches) and make_ref then
begin begin
defref:=tref.create(defref,@akttokenpos); defref:=tref.create(defref,@current_tokenpos);
inc(refcount); inc(refcount);
end; end;
lastref:=defref; lastref:=defref;

View File

@ -1640,7 +1640,7 @@ implementation
if (cs_browser in current_settings.moduleswitches) then if (cs_browser in current_settings.moduleswitches) then
begin begin
newref:=tref.create(sym.lastref,@akttokenpos); newref:=tref.create(sym.lastref,@current_tokenpos);
{ for symbols that are in tables without browser info or syssyms } { for symbols that are in tables without browser info or syssyms }
if sym.refcount=0 then if sym.refcount=0 then
begin begin

View File

@ -311,10 +311,10 @@ implementation
refs:=0; refs:=0;
lastwritten:=nil; lastwritten:=nil;
refcount:=0; refcount:=0;
fileinfo:=akttokenpos; fileinfo:=current_tokenpos;
if (cs_browser in current_settings.moduleswitches) and make_ref then if (cs_browser in current_settings.moduleswitches) and make_ref then
begin begin
defref:=tref.create(defref,@akttokenpos); defref:=tref.create(defref,@current_tokenpos);
inc(refcount); inc(refcount);
end; end;
lastref:=defref; lastref:=defref;

View File

@ -58,6 +58,9 @@ type
); );
tprocinfoflags=set of tprocinfoflag; tprocinfoflags=set of tprocinfoflag;
{ copied from scanner.pas }
tspecialgenerictoken = (ST_LOADSETTINGS,ST_LINE,ST_COLUMN,ST_FILEINDEX);
{ Copied from systems.pas } { Copied from systems.pas }
tsystemcpu= tsystemcpu=
( (
@ -873,6 +876,7 @@ begin
write(space,' Tokens: '); write(space,' Tokens: ');
while i<tokenbufsize do while i<tokenbufsize do
begin begin
if ttoken(tokenbuf[i])<>_GENERICSPECIALTOKEN then
write(arraytokeninfo[ttoken(tokenbuf[i])].str); write(arraytokeninfo[ttoken(tokenbuf[i])].str);
case ttoken(tokenbuf[i]) of case ttoken(tokenbuf[i]) of
_CWCHAR, _CWCHAR,
@ -901,6 +905,9 @@ begin
_ID : _ID :
begin begin
inc(i); inc(i);
inc(i);
write(' ',pshortstring(@tokenbuf[i])^);
inc(i,tokenbuf[i]+1);
{ {
replaytokenbuf.read(orgpattern[0],1); replaytokenbuf.read(orgpattern[0],1);
replaytokenbuf.read(orgpattern[1],length(orgpattern)); replaytokenbuf.read(orgpattern[1],length(orgpattern));
@ -910,9 +917,32 @@ begin
_GENERICSPECIALTOKEN: _GENERICSPECIALTOKEN:
begin begin
inc(i); inc(i);
case tspecialgenerictoken(tokenbuf[i]) of
ST_LOADSETTINGS:
begin
inc(i); inc(i);
write('Settings');
inc(i,sizeof(tsettings)); inc(i,sizeof(tsettings));
end;
ST_LINE:
begin
inc(i);
write('Line: ',pdword(@tokenbuf[i])^);
inc(i,4);
end;
ST_COLUMN:
begin
inc(i);
write('Col: ',pword(@tokenbuf[i])^);
inc(i,2);
end;
ST_FILEINDEX:
begin
inc(i);
write('File: ',pword(@tokenbuf[i])^);
inc(i,2);
end;
end;
{ {
replaytokenbuf.read(specialtoken,1); replaytokenbuf.read(specialtoken,1);
case specialtoken of case specialtoken of