mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:11:23 +02:00
+ oppower
This commit is contained in:
parent
977081b2d7
commit
e0cc4f9bed
@ -68,7 +68,10 @@ unit pexpr;
|
|||||||
read as - (1**4) and not (-1)**4 PM }
|
read as - (1**4) and not (-1)**4 PM }
|
||||||
|
|
||||||
type
|
type
|
||||||
Toperator_precedence=(opcompare,opaddition,opmultiply);
|
Toperator_precedence=(opcompare,opaddition,opmultiply,oppower);
|
||||||
|
|
||||||
|
const
|
||||||
|
highest_precedence = oppower;
|
||||||
|
|
||||||
function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;forward;
|
function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;forward;
|
||||||
|
|
||||||
@ -1869,7 +1872,7 @@ _LECKKLAMMER : begin
|
|||||||
end;
|
end;
|
||||||
_MINUS : begin
|
_MINUS : begin
|
||||||
consume(_MINUS);
|
consume(_MINUS);
|
||||||
p1:=sub_expr(opmultiply,false);
|
p1:=sub_expr(oppower,false);
|
||||||
p1:=gensinglenode(unaryminusn,p1);
|
p1:=gensinglenode(unaryminusn,p1);
|
||||||
end;
|
end;
|
||||||
_NOT : begin
|
_NOT : begin
|
||||||
@ -1953,7 +1956,8 @@ _LECKKLAMMER : begin
|
|||||||
([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_OP_IN,_OP_IS],
|
([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_OP_IN,_OP_IS],
|
||||||
[_PLUS,_MINUS,_OP_OR,_OP_XOR],
|
[_PLUS,_MINUS,_OP_OR,_OP_XOR],
|
||||||
[_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,
|
[_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,
|
||||||
_OP_AS,_OP_AND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR]);
|
_OP_AS,_OP_AND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR],
|
||||||
|
[_STARSTAR] );
|
||||||
|
|
||||||
function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
|
function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
|
||||||
{Reads a subexpression while the operators are of the current precedence
|
{Reads a subexpression while the operators are of the current precedence
|
||||||
@ -1965,7 +1969,7 @@ _LECKKLAMMER : begin
|
|||||||
oldt : Ttoken;
|
oldt : Ttoken;
|
||||||
filepos : tfileposinfo;
|
filepos : tfileposinfo;
|
||||||
begin
|
begin
|
||||||
if pred_level=opmultiply then
|
if pred_level=highest_precedence then
|
||||||
p1:=factor(false)
|
p1:=factor(false)
|
||||||
else
|
else
|
||||||
p1:=sub_expr(succ(pred_level),true);
|
p1:=sub_expr(succ(pred_level),true);
|
||||||
@ -1976,7 +1980,7 @@ _LECKKLAMMER : begin
|
|||||||
oldt:=token;
|
oldt:=token;
|
||||||
filepos:=tokenpos;
|
filepos:=tokenpos;
|
||||||
consume(token);
|
consume(token);
|
||||||
if pred_level=opmultiply then
|
if pred_level=highest_precedence then
|
||||||
p2:=factor(false)
|
p2:=factor(false)
|
||||||
else
|
else
|
||||||
p2:=sub_expr(succ(pred_level),true);
|
p2:=sub_expr(succ(pred_level),true);
|
||||||
@ -2135,7 +2139,10 @@ _LECKKLAMMER : begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.170 2000-03-14 15:50:19 pierre
|
Revision 1.171 2000-03-16 15:13:03 pierre
|
||||||
|
+ oppower
|
||||||
|
|
||||||
|
Revision 1.170 2000/03/14 15:50:19 pierre
|
||||||
* - 1**4 = -1 fix
|
* - 1**4 = -1 fix
|
||||||
|
|
||||||
Revision 1.169 2000/02/13 14:21:50 jonas
|
Revision 1.169 2000/02/13 14:21:50 jonas
|
||||||
|
Loading…
Reference in New Issue
Block a user