2007-05-30 01:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbcompdf.h
  * harbour/include/hbexprb.c
  * harbour/source/common/expropt1.c
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
  * harbour/source/macro/macro.y
  * harbour/source/macro/macro.yyc
    ! fixed bug in operator precedence - seems that it existed from
      beginning and partially were fixed in xHarbour. This code exploits
      the problem:
            #define EOL chr(13)+chr(10)
            #command ? [<x,...>] => [outstd( <x> );]outstd(EOL)
            #command TEST <exp> => BEGIN SEQUENCE     ;
                                 ;   ? <exp>          ;
                                 ; RECOVER USING oErr ;
                                 ;   ? "Error:", oErr:subCode, ;
                                       oErr:description, oErr:operation ;
                                 ; END
            proc main()
            local oErr, s1:="X", s2:="Y", t:=.T.
            errorBlock({|oErr|break(oErr)})
            TEST t != s1 $ s2
            TEST t == s1 $ s2
            TEST t =  s1 $ s2
            TEST t <  s1 $ s2
            TEST t <= s1 $ s2
            TEST t >  s1 $ s2
            TEST t >= s1 $ s2
            TEST s1 $ s2 != t
            TEST s1 $ s2 == t
            TEST s1 $ s2 =  t
            TEST s1 $ s2 >  t
            TEST s1 $ s2 <  t
            TEST s1 $ s2 >= t
            TEST s1 $ s2 <= t
            return
This commit is contained in:
Przemyslaw Czerpak
2007-05-29 23:04:09 +00:00
parent 99aa308fdb
commit defb63f5f2
8 changed files with 838 additions and 798 deletions

View File

@@ -8,6 +8,44 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-05-30 01:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcompdf.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
! fixed bug in operator precedence - seems that it existed from
beginning and partially were fixed in xHarbour. This code exploits
the problem:
#define EOL chr(13)+chr(10)
#command ? [<x,...>] => [outstd( <x> );]outstd(EOL)
#command TEST <exp> => BEGIN SEQUENCE ;
; ? <exp> ;
; RECOVER USING oErr ;
; ? "Error:", oErr:subCode, ;
oErr:description, oErr:operation ;
; END
proc main()
local oErr, s1:="X", s2:="Y", t:=.T.
errorBlock({|oErr|break(oErr)})
TEST t != s1 $ s2
TEST t == s1 $ s2
TEST t = s1 $ s2
TEST t < s1 $ s2
TEST t <= s1 $ s2
TEST t > s1 $ s2
TEST t >= s1 $ s2
TEST s1 $ s2 != t
TEST s1 $ s2 == t
TEST s1 $ s2 = t
TEST s1 $ s2 > t
TEST s1 $ s2 < t
TEST s1 $ s2 >= t
TEST s1 $ s2 <= t
return
2007-05-29 10:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/makefile.vc
* synced with BETA branch

View File

@@ -326,12 +326,12 @@ typedef enum
HB_EO_NOT,
HB_EO_EQUAL, /* relational operators */
HB_EO_EQ,
HB_EO_NE,
HB_EO_IN,
HB_EO_LT,
HB_EO_GT,
HB_EO_LE,
HB_EO_GE,
HB_EO_NE,
HB_EO_IN,
HB_EO_PLUS, /* addition */
HB_EO_MINUS,
HB_EO_MULT, /* multiple */

View File

@@ -189,12 +189,12 @@ const HB_EXPR_FUNC_PTR hb_comp_ExprTable[ HB_EXPR_COUNT ] = {
hb_compExprUseNot,
hb_compExprUseEqual, /* relational operators */
hb_compExprUseEQ,
hb_compExprUseNE,
hb_compExprUseIN,
hb_compExprUseLT,
hb_compExprUseGT,
hb_compExprUseLE,
hb_compExprUseGE,
hb_compExprUseNE,
hb_compExprUseIN,
hb_compExprUsePlus, /* addition */
hb_compExprUseMinus,
hb_compExprUseMult, /* multiple */

View File

@@ -101,12 +101,12 @@ static const char * s_OperTable[ HB_EXPR_COUNT ] = {
".NOT.",
"=", /* relational operators */
"==",
"!=",
"$",
"<",
">",
"<=",
">=",
"!=",
"$",
"+", /* addition */
"-",
"*", /* multiple */
@@ -165,12 +165,12 @@ static const BYTE s_PrecedTable[ HB_EXPR_COUNT ] = {
HB_ET_NIL, /* HB_EO_NOT, */
HB_EO_EQUAL, /* HB_EO_EQUAL, relational operators */
HB_EO_EQUAL, /* HB_EO_EQ, */
HB_EO_EQUAL, /* HB_EO_LT, */
HB_EO_EQUAL, /* HB_EO_GT, */
HB_EO_EQUAL, /* HB_EO_LE, */
HB_EO_EQUAL, /* HB_EO_GE, */
HB_EO_EQUAL, /* HB_EO_NE, */
HB_EO_EQUAL, /* HB_EO_IN, */
HB_EO_LT, /* HB_EO_IN, */
HB_EO_LT, /* HB_EO_LT, */
HB_EO_LT, /* HB_EO_GT, */
HB_EO_LT, /* HB_EO_LE, */
HB_EO_LT, /* HB_EO_GE, */
HB_EO_PLUS, /* HB_EO_PLUS, addition */
HB_EO_PLUS, /* HB_EO_MINUS, */
HB_EO_MULT, /* HB_EO_MULT, multiple */

View File

@@ -173,9 +173,9 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
/*the lowest precedence*/
/*postincrement and postdecrement*/
%left POST
%left POST
/*assigment - from right to left*/
%right INASSIGN
%right INASSIGN
%right PLUSEQ MINUSEQ
%right MULTEQ DIVEQ MODEQ
%right EXPEQ
@@ -184,17 +184,18 @@ extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management fun
%right AND
%right NOT
/*relational operators*/
%right '=' '<' '>' EQ NE1 NE2 LE GE '$'
%right '=' EQ NE1 NE2
%right '<' '>' LE GE '$'
/*mathematical operators*/
%right '+' '-'
%right '*' '/' '%'
%right POWER
%right UNARY
%right UNARY
/*preincrement and predecrement*/
%right PRE
/*special operators*/
%right ALIASOP '&' '@'
%right '\n' ';' ','
%right '\n' ';' ','
/*the highest precedence*/
%type <string> IdentName IDENTIFIER MACROVAR MACROTEXT CompTimeStr InAlias

File diff suppressed because it is too large Load Diff

View File

@@ -185,7 +185,8 @@ static void hb_macroIdentNew( HB_COMP_DECL, char * );
%right AND
%right NOT
/*relational operators*/
%right '=' '<' '>' EQ NE1 NE2 LE GE '$'
%right '=' EQ NE1 NE2
%right '<' '>' LE GE '$'
/*mathematical operators*/
%right '+' '-'
%right '*' '/' '%'
@@ -195,7 +196,7 @@ static void hb_macroIdentNew( HB_COMP_DECL, char * );
%right PRE
/*special operators*/
%right ALIASOP '&' '@'
%right ','
%right ','
/*the highest precedence*/
%type <string> IDENTIFIER MACROVAR MACROTEXT

File diff suppressed because it is too large Load Diff