pike.git / src / lex.c

version» Context lines:

pike.git/src/lex.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: lex.c,v 1.55 1998/06/07 12:26:51 grubba Exp $"); + RCSID("$Id: lex.c,v 1.56 1998/10/09 17:56:32 hubbe Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "constants.h"   #include "hashtable.h"   #include "stuff.h"   #include "pike_memory.h"   #include "interpret.h"
pike.git/src/lex.c:355:    switch(c=GETC())    {    case 0:    lex.pos--;    yyerror("Unexpected end of file\n");    return 0;       case '0': case '1': case '2': case '3':    case '4': case '5': case '6': case '7':    c-='0'; -  if(LOOK()<'0' || LOOK()>'8') return c; +  while(LOOK()>='0' && LOOK()<='8')    c=c*8+(GETC()-'0'); -  if(LOOK()<'0' || LOOK()>'8') return c; -  c=c*8+(GETC()-'0'); +     return c;       case 'r': return '\r';    case 'n': return '\n';    case 't': return '\t';    case 'b': return '\b';       case '\n':    lex.current_line++;    return '\n';    -  +     case 'x': -  +  c=0; +  while(1) +  {    switch(LOOK())    {    default: return c;    case '0': case '1': case '2': case '3':    case '4': case '5': case '6': case '7':    case '8': case '9': -  c=GETC()-'0'; +  c=c*16+GETC()-'0';    break;       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': -  c=GETC()-'a'+10; +  c=c*16+GETC()-'a'+10;    break;       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': -  c=GETC()-'A'+10; +  c=c*16+GETC()-'A'+10;    break;    } -  +  } +  +  case 'd': +  c=0; +  while(1) +  {    switch(LOOK())    {    default: return c;    case '0': case '1': case '2': case '3':    case '4': case '5': case '6': case '7':    case '8': case '9': -  c=c*16+GETC()-'0'; +  c=c*10+GETC()-'0';    break; -  -  case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': -  c=c*16+GETC()-'a'+10; -  break; -  -  case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': -  c=c*16+GETC()-'A'+10; -  break; +     } -  return c; -  +     } -  +  }    return c;   }      static struct pike_string *readstring(void)   {    int c; -  dynamic_buffer tmp; -  initialize_buf(&tmp); +  struct string_builder tmp; +  init_string_builder(&tmp,0);       while(1)    {    switch(c=GETC())    {    case 0:    lex.pos--;    yyerror("End of file in string.");    break;       case '\n':    lex.current_line++;    yyerror("Newline in string.");    break;       case '\\': -  low_my_putchar(char_const(),&tmp); +  string_builder_putchar(&tmp,char_const());    continue;       case '"':    break;       default: -  low_my_putchar(c,&tmp); +  string_builder_putchar(&tmp,c);    continue;    }    break;    } -  return low_free_buf(&tmp); +  return finish_string_builder(&tmp);   }      int yylex(YYSTYPE *yylval)   #if LEXDEBUG>4   {    int t;    int yylex2(YYSTYPE *);    t=yylex2(yylval);    if(t<256)    {