%option noyywrap
%{
#define YY_INPUT(buf,result,max_size) \
   { \
   int c = *ptr++; \
   result = (c == EOF) ? YY_NULL : (buf[0] = c, 1 ); \
   }
%}
%%
"'"[^\']+"'"           {yytext[yyleng-1] = '\0'; yylval = (int) yytext+1;
			return( STRING );   }
"$"[0-9A-Fa-f]+       {yylval=atoh( &yytext[1] ); return( HEXNUMBER ); }
[0-9][0-9A-Fa-f]+"h" |
[0-9][0-9A-Fa-f]+"H"  {yytext[yyleng-1]=0; yylval=atoh(yytext );
                       return( HEXNUMBER ); }
"%"[0-1]+             {yylval=atob( &yytext[1] ); return( BINARYNUMBER );}
[0-1]+"b" |
[0-1]+"B"             {yytext[yyleng-1]=0; yylval=atob( yytext );
                       return( BINARYNUMBER  ); }
[0-9]+                {yylval=atoi( yytext ); return( DECIMALNUMBER ); }
"a"   |
"A"                   { yylval = yytext[0]; return( A   ); }
"b"   |
"B"                   { yylval = yytext[0]; return( B   ); }
"cc"  |
"CC"                  { yylval = yytext[0]; return( CC  ); }
"dp"  |
"DP"                  { yylval = yytext[0]; return( DP  ); }
"d"   |
"D"                   { yylval = yytext[0]; return( D   ); }
"pcr" |
"pc"  |
"PCR" |
"PC"                  { yylval = yytext[0]; return( PCR ); }
"s"   |
"S"                   { yylval = yytext[0]; return( S   ); }
"u"   |
"U"                   { yylval = yytext[0]; return( UR  ); }
"x"   |
"X"                   { yylval = yytext[0]; return( X   ); }
"y"   |
"Y"                   { yylval = yytext[0]; return( Y   ); }
"and" |
"AND"                 { return( AND ); }
"or"  |
"OR"                  { return( OR ); }
"not" |
"NOT"                 { return( NOT ); }
[A-Za-z][0-9A-Za-z]*  {yylval= (int) yytext; return( ID ); }
"++"                  { return( PP ); }
"+"                   { return( P ); }
"--"                  { return( MM ); }
"-"                   { return( M ); }
" "                   { ; /* Nothing */ }
.                     { return( yytext[0] ); }
%%
