patch.weird_oper

application/octet-stream

Filename: patch.weird_oper
Type: application/octet-stream
Part: 0
Message: Re: [HACKERS] Postgres' lexer
*** scan.l-nobug	Thu Sep  2 16:48:23 1999
--- scan.l	Thu Sep  2 17:14:47 1999
***************
*** 86,91 ****
--- 86,92 ----
  %x xd
  %x xh
  %x xq
+ %x xm
  
  /* Binary number
   */
***************
*** 143,148 ****
--- 144,150 ----
  self			[,()\[\].;$\:\+\-\*\/\%\<\>\=\|]
  op_and_self		[\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
  operator		{op_and_self}+
+ uminus -
  
  /* we do not allow unary minus in numbers. 
   * instead we pass it verbatim to parser. there it gets
***************
*** 278,283 ****
--- 280,299 ----
  
  {self}			{ 	return yytext[0]; }
  
+ {operator}/-[\.0-9]     {
+ 					BEGIN(xm);
+ 					if (strcmp((char*)yytext,"!=") == 0)
+ 						yylval.str = pstrdup("<>"); /* compatability */
+ 					else
+ 						yylval.str = pstrdup((char*)yytext);
+ 					return Op;
+ 				}
+ 				
+ <xm>{uminus}	{
+ 								BEGIN(INITIAL);
+ 								return yytext[0];
+ 							}
+ 							
  {operator}		{
  					if (strcmp((char*)yytext,"!=") == 0)
  						yylval.str = pstrdup("<>"); /* compatability */