Branch: Tag:

1997-10-11

1997-10-11 06:49:20 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

right-side operator overloading implemented

Rev: src/array.c:1.18
Rev: src/interpret.c:1.49
Rev: src/lex.c:1.28
Rev: src/modules/Gmp/mpz_glue.c:1.23
Rev: src/modules/Gmp/testsuite.in:1.7
Rev: src/operators.c:1.20
Rev: src/program.c:1.43
Rev: src/program.h:1.21

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: lex.c,v 1.27 1997/09/08 01:03:24 hubbe Exp $"); + RCSID("$Id: lex.c,v 1.28 1997/10/11 06:48:23 hubbe Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"
1673:    case '`':    {    char *tmp; +  int offset=2; +  if(GOBBLE('`')) offset--; +  if(GOBBLE('`')) offset--; +     switch(GETC())    { -  case '+': tmp="`+"; break; -  case '/': tmp="`/"; break; -  case '%': tmp="`%"; break; -  case '*': tmp="`*"; break; -  case '&': tmp="`&"; break; -  case '|': tmp="`|"; break; -  case '^': tmp="`^"; break; -  case '~': tmp="`~"; break; +  case '+': tmp="```+"; break; +  case '/': tmp="```/"; break; +  case '%': tmp="```%"; break; +  case '*': tmp="```*"; break; +  case '&': tmp="```&"; break; +  case '|': tmp="```|"; break; +  case '^': tmp="```^"; break; +  case '~': tmp="```~"; break;    case '<': -  if(GOBBLE('<')) { tmp="`<<"; break; } -  if(GOBBLE('=')) { tmp="`<="; break; } -  tmp="`<"; +  if(GOBBLE('<')) { tmp="```<<"; break; } +  if(GOBBLE('=')) { tmp="```<="; break; } +  tmp="```<";    break;       case '>': -  if(GOBBLE('>')) { tmp="`>>"; break; } -  if(GOBBLE('=')) { tmp="`>="; break; } -  tmp="`>"; +  if(GOBBLE('>')) { tmp="```>>"; break; } +  if(GOBBLE('=')) { tmp="```>="; break; } +  tmp="```>";    break;       case '!': -  if(GOBBLE('=')) { tmp="`!="; break; } -  tmp="`!"; +  if(GOBBLE('=')) { tmp="```!="; break; } +  tmp="```!";    break;       case '=': -  if(GOBBLE('=')) { tmp="`=="; break; } -  tmp="`="; +  if(GOBBLE('=')) { tmp="```=="; break; } +  tmp="```=";    break;       case '(':    if(GOBBLE(')'))    { -  tmp="`()"; +  tmp="```()";    break;    }    yyerror("Illegal ` identifier."); -  tmp=""; +  tmp="``";    break;       case '-':    if(GOBBLE('>'))    { -  tmp="`->"; -  if(GOBBLE('=')) tmp="`->="; +  tmp="```->"; +  if(GOBBLE('=')) tmp="```->=";    }else{ -  tmp="`-"; +  tmp="```-";    }    break;       case '[':    if(GOBBLE(']'))    { -  tmp="`[]"; -  if(GOBBLE('=')) tmp="`[]="; +  tmp="```[]"; +  if(GOBBLE('=')) tmp="```[]=";    break;    }       default:    yyerror("Illegal ` identifier."); -  tmp=""; +  tmp="``";    break;       }       if(literal)    { -  yylval->str=buf; +  yylval->str=tmp+offset;    }else{ -  yylval->string=make_shared_string(tmp); +  yylval->string=make_shared_string(tmp+offset);    }    return F_IDENTIFIER;    }