procedure TPasSyntaxTreeBuilder.AsmFragment;
begin
FStack.AddValuedChild(ntAsmFragment, Lexer.Token);
inherited;
end;
procedure TPasSyntaxTreeBuilder.AsmStatement;
var
Node, Child: TSyntaxNode;
ValuedNode: TValuedSyntaxNode absolute Node;
ValuedChild: TValuedSyntaxNode absolute Child;
Optional: string;
Previous: char;
begin
Node:= FStack.PushValuedNode(ntAsmStatement,'');
try
inherited;
Optional:= '';
Previous:= ' ';
for Child in Node.ChildNodes do begin
//Store the whole statement as well as the parts.
if (ValuedChild.Value[1] in [',', '+', '*', ']', ')', ' ','-']) or (Previous in ['(','[',',','+','*','-']) then Optional:= '';
Previous:= ValuedChild.Value[1];
ValuedNode.Value:= ValuedNode.Value + Optional + ValuedChild.Value;
Optional:= ' ';
end;
finally
FStack.Pop;
end;
end;
procedure TPasSyntaxTreeBuilder.AsmStatements; //renamed from statement -> statementS
begin
FStack.PushCompoundSyntaxNode(ntStatements).Attribute[anType]:= AttributeValues[atAsm];
try
inherited;
SetCurrentCompoundNodesEndPosition;
finally
FStack.Pop;
end;
end;
procedure TmwSimplePasPar.AsmStatements;
begin
Lexer.AsmCode := True;
Expected(ptAsm);
{ should be replaced with a Assembler lexer }
while TokenID <> ptEnd do begin
case FLexer.TokenID of
ptBegin, ptCase, ptEnd, ptIf, ptFunction, ptProcedure, ptRepeat, ptWhile: Break;
ptAddressOp:
begin
NextTokenAssembly;
NextTokenAssembly;
end;
ptDoubleAddressOp:
begin
NextTokenAssembly;
NextTokenAssembly;
end;
ptNull:
begin
Expected(ptEnd);
Exit;
end;
ptCRLF: //empty line
NextTokenAssembly;
else begin
AsmStatement;
Expected(ptCRLF);
end;
end; {case}
end; {while}
Lexer.AsmCode := False;
Expected(ptEnd);
end;
procedure TmwSimplePasPar.AsmStatement;
begin
while not(Lexer.TokenID in [ptCRLF]) do begin
AsmFragment;
end;
end;
procedure TmwSimplePasPar.AsmFragment;
begin
NextTokenAssembly;
end;
procedure TmwSimplePasPar.NextTokenAssembly;
begin
FLexer.NextNoJunkAssembly;
end;
procedure TmwBasePasLex.NextNoJunkAssembly;
begin
repeat
Next
until not IsJunkAssembly;
end;
function TmwBasePasLex.GetIsJunkAssembly: Boolean;
begin
//CRLF takes the place of ';'
Result := not(FTokenID in [ptCRLF]) and (
IsTokenIDJunk(FTokenID) or (FUseDefines and (FDefineStack > 0) and (TokenID <> ptNull))
);
end;
is recorded as:
The fix: