Преглед на файлове

+ adding operators "|" and "&" for macpas

olle преди 21 години
родител
ревизия
98df0978e1
променени са 3 файла, в които са добавени 42 реда и са изтрити 11 реда
  1. 10 5
      compiler/pexpr.pas
  2. 24 5
      compiler/scanner.pas
  3. 8 1
      compiler/tokens.pas

+ 10 - 5
compiler/pexpr.pas

@@ -2231,9 +2231,9 @@ implementation
       { Warning these stay be ordered !! }
       operator_levels:array[Toperator_precedence] of set of Ttoken=
          ([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_OP_IN,_OP_IS],
-          [_PLUS,_MINUS,_OP_OR,_OP_XOR],
+          [_PLUS,_MINUS,_OP_OR,_PIPE,_OP_XOR],
           [_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,
-           _OP_AS,_OP_AND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR],
+           _OP_AS,_OP_AND,_AMPERSAND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR],
           [_STARSTAR] );
 
     function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):tnode;
@@ -2289,9 +2289,11 @@ implementation
                  p1:=cinnode.create(p1,p2);
                _OP_IS :
                  p1:=cisnode.create(p1,p2);
-               _OP_OR :
+               _OP_OR,
+               _PIPE {macpas only} :
                  p1:=caddnode.create(orn,p1,p2);
-               _OP_AND :
+               _OP_AND,
+               _AMPERSAND {macpas only} :
                  p1:=caddnode.create(andn,p1,p2);
                _OP_DIV :
                  p1:=cmoddivnode.create(divn,p1,p2);
@@ -2453,7 +2455,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.161  2004-07-05 21:49:43  olle
+  Revision 1.162  2004-07-05 23:25:34  olle
+    + adding operators "|" and "&" for macpas
+
+  Revision 1.161  2004/07/05 21:49:43  olle
     + macpas style: exit, cycle, leave
     + macpas compiler directive: PUSH POP
 

+ 24 - 5
compiler/scanner.pas

@@ -2388,14 +2388,20 @@ implementation
 
              '&' :
                begin
-                 if not(m_fpc in aktmodeswitches) then
-                  Illegal_Char(c)
-                 else
+                 if m_fpc in aktmodeswitches then
                   begin
                     readnumber;
                     token:=_INTCONST;
                     goto exit_label;
-                  end;
+                  end
+                 else if m_mac in aktmodeswitches then
+                  begin
+                    readchar;
+                    token:=_AMPERSAND;
+                    goto exit_label;
+                  end
+                 else
+                  Illegal_Char(c);
                end;
 
              '0'..'9' :
@@ -2589,6 +2595,16 @@ implementation
                  goto exit_label;
                end;
 
+             '|' :
+               if m_mac in aktmodeswitches then
+                begin
+                  readchar;
+                  token:=_PIPE;
+                  goto exit_label;
+                end
+               else
+                Illegal_Char(c);
+
              '=' :
                begin
                  readchar;
@@ -3145,7 +3161,10 @@ exit_label:
 end.
 {
   $Log$
-  Revision 1.80  2004-06-20 08:55:30  florian
+  Revision 1.81  2004-07-05 23:25:34  olle
+    + adding operators "|" and "&" for macpas
+
+  Revision 1.80  2004/06/20 08:55:30  florian
     * logs truncated
 
   Revision 1.79  2004/05/23 20:55:38  peter

+ 8 - 1
compiler/tokens.pas

@@ -68,6 +68,8 @@ type
     _KLAMMERAFFE,
     _POINTPOINT,
     _POINTPOINTPOINT,
+    _PIPE,
+    _AMPERSAND,
     _EOF,
     _ID,
     _NOID,
@@ -296,6 +298,8 @@ const
       (str:'@'             ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'..'            ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'...'           ;special:true ;keyword:m_none;op:NOTOKEN),
+      (str:'|'             ;special:true ;keyword:m_none;op:NOTOKEN),
+      (str:'&'             ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'end of file'   ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'identifier'    ;special:true ;keyword:m_none;op:NOTOKEN),
       (str:'non identifier';special:true ;keyword:m_none;op:NOTOKEN),
@@ -514,7 +518,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.30  2004-06-20 08:55:30  florian
+  Revision 1.31  2004-07-05 23:25:34  olle
+    + adding operators "|" and "&" for macpas
+
+  Revision 1.30  2004/06/20 08:55:30  florian
     * logs truncated
 
   Revision 1.29  2004/06/16 20:07:10  florian