mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 16:22:34 +02:00
+ constant postfixoperator_tokens
+ check for postfix operators after string contants, resolves #23136 git-svn-id: trunk@22929 -
This commit is contained in:
parent
2038a607ac
commit
bc4a8ac63e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12967,6 +12967,7 @@ tests/webtbs/tw2305.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2306.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2307.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2311.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23136.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2317.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2318.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23185.pp svneol=native#text/pascal
|
||||
|
@ -2814,6 +2814,11 @@ implementation
|
||||
begin
|
||||
p1:=cstringconstnode.createpchar(ansistring2pchar(cstringpattern),length(cstringpattern));
|
||||
consume(_CSTRING);
|
||||
if token in postfixoperator_tokens then
|
||||
begin
|
||||
again:=true;
|
||||
postfixoperators(p1,again,getaddr);
|
||||
end;
|
||||
end;
|
||||
|
||||
_CCHAR :
|
||||
@ -2826,6 +2831,11 @@ implementation
|
||||
begin
|
||||
p1:=cstringconstnode.createunistr(patternw);
|
||||
consume(_CWSTRING);
|
||||
if token in postfixoperator_tokens then
|
||||
begin
|
||||
again:=true;
|
||||
postfixoperators(p1,again,getaddr);
|
||||
end;
|
||||
end;
|
||||
|
||||
_CWCHAR:
|
||||
@ -2842,7 +2852,7 @@ implementation
|
||||
if try_to_consume(_LKLAMMER) then
|
||||
begin
|
||||
p1:=factor(true,false);
|
||||
if token in [_CARET,_POINT,_LECKKLAMMER] then
|
||||
if token in postfixoperator_tokens then
|
||||
begin
|
||||
again:=true;
|
||||
postfixoperators(p1,again,getaddr);
|
||||
@ -2852,7 +2862,7 @@ implementation
|
||||
end
|
||||
else
|
||||
p1:=factor(true,false);
|
||||
if token in [_CARET,_POINT,_LECKKLAMMER] then
|
||||
if token in postfixoperator_tokens then
|
||||
begin
|
||||
again:=true;
|
||||
postfixoperators(p1,again,getaddr);
|
||||
@ -2875,9 +2885,9 @@ implementation
|
||||
consume(_LKLAMMER);
|
||||
p1:=comp_expr(true,false);
|
||||
consume(_RKLAMMER);
|
||||
{ it's not a good solution }
|
||||
{ but (a+b)^ makes some problems }
|
||||
if token in [_CARET,_POINT,_LECKKLAMMER] then
|
||||
{ it's not a good solution
|
||||
but (a+b)^ makes some problems }
|
||||
if token in postfixoperator_tokens then
|
||||
begin
|
||||
again:=true;
|
||||
postfixoperators(p1,again,getaddr);
|
||||
|
@ -299,6 +299,8 @@ const
|
||||
tokenlenmin = 1;
|
||||
tokenlenmax = 18;
|
||||
|
||||
postfixoperator_tokens = [_CARET,_POINT,_LECKKLAMMER];
|
||||
|
||||
{ last operator which can be overloaded, the first_overloaded should
|
||||
be declared directly after NOTOKEN }
|
||||
first_overloaded = succ(NOTOKEN);
|
||||
|
14
tests/webtbs/tw23136.pp
Normal file
14
tests/webtbs/tw23136.pp
Normal file
@ -0,0 +1,14 @@
|
||||
var
|
||||
ws:widestring;
|
||||
s:string;
|
||||
begin
|
||||
s:='Aajsljaklsja'[1];
|
||||
if s<>'A' then
|
||||
halt(1);
|
||||
|
||||
ws:=#1234#134#312[1];
|
||||
if ws<>#1234 then
|
||||
halt(1);
|
||||
|
||||
writeln('ok');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user