%%
%{
#include "propery.h"
extern int yylval;

#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
   { \
   extern char *ptr; \
   int c = *ptr++; \
   result = (c == EOF) ? YY_NULL : (buf[0] = c, 1 ); \
   }

/* Assembler Directives */
%}
"DB"      { return DB;      }
"DS"      { return DS;      }
"DW"      { return DW;      }
"END"     { return END;     }
"EQU"     { return EQU;     }
"INCLUDE" { return INCLUDE; }
"ORG"     { return ORG;     }
%{
/* Microprocessor Instructions */
%}
"ADD"    { return( ADD  ); }
"ADDC"   { return( ADDC ); }
"ANL"    { return( ANL  ); }
"ANLD"   { return( ANLD ); }
"CALL"   { return( CALL ); }
"CLR"    { return( CLR  ); }
"CPL"    { return( CPL  ); }
"DA"     { return( DA   ); }
"DEC"    { return( DEC  ); }
"DIS"    { return( DIS  ); }
"DJNZ"   { return( DJNZ ); }
"EN"     { return( EN   ); }
"ENT0"   { return( ENT0 ); }
"IF"     { return( IF   ); }
"IN"     { return( IN   ); }
"INC"    { return( INC  ); }
"INS"    { return( INS  ); }
"JB0"    { return( JB0  ); }
"JB1"    { return( JB1  ); }
"JB2"    { return( JB2  ); }
"JB3"    { return( JB3  ); }
"JB4"    { return( JB4  ); }
"JB5"    { return( JB5  ); }
"JB6"    { return( JB6  ); }
"JB7"    { return( JB7  ); }
"JC"     { return( JC   ); }
"JF0"    { return( JF0  ); }
"JF1"    { return( JF1  ); }
"JMP"    { return( JMP  ); }
"JMPP"   { return( JMPP ); }
"JNC"    { return ( JNC  ); }
"JNI"    { return ( JNI  ); }
"JNT0"   { return ( JNT0 ); }
"JNT1"   { return ( JNT1 ); }
"JNZ"    { return ( JNZ  ); }
"JT0"    { return ( JT0  ); }
"JT1"    { return ( JT1  ); }
"JTF"    { return ( JTF  ); }
"JZ"     { return ( JZ   ); }
"MOV"    { return ( MOV  ); }
"MOVD"   { return ( MOVD ); }
"MOVP"   { return ( MOVP ); }
"MOVP3"  { return ( MOVP3 ); }
"MOVX"   { return ( MOVX ); }
"NOP"    { return ( NOP  ); }
"ORL"    { return ( ORL  ); }
"ORLD"   { return ( ORLD ); }
"OUTL"   { return ( OUTL ); }
"RET"    { return ( RET  ); }
"RETR"   { return ( RETR ); }
"RL"     { return ( RL   ); }
"RLC"    { return ( RLC  ); }
"RR"     { return ( RR   ); }
"RRC"    { return ( RRC  ); }
"SEL"    { return ( SEL  ); }
"STOP"   { return ( STOP ); }
"STRT"   { return ( STRT ); }
"SWAP"   { return ( SWAP ); }
"XCH"    { return ( XCH  ); }
"XCHD"   { return ( XCHD ); }
"XRL"    { return ( XRL  ); }
"'"[^\']+"'"           {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 ); }
%{
/* Operators */
%}
"AND"|"and"	      { return AND; }
"HIGH"|"high"	      { return HIGH;}
"LOW"|"low"	      { return LOW; }
"NOT"|"not"	      { return NOT; }
"OR"|"or"	      { return OR;  }
"SHL"|"shl"	      { return SHL; }
"SHR"|"shr"	      { return SHR; }
%{
/* Registers, etc. */
%}
"A"|"a"               { return A;   }
"BUS"|"bus"           { return BUS; }
"C"|"c"               { return C;   }
"CLK"|"clk"           { return CLK; }
"CNT"|"cnt"           { return CNT; }
"F1"|"f1"             { return F1;  }
"F0"|"f0"             { return F0;  }
"I"|"i"               { return I;   }
"MB0"|"mb0"           { return MB0; }
"MB1"|"mb1"           { return MB1; }
"P1"|"p1"             { return P1;  }
"P2"|"p2"             { return P2;  }
"P4"|"p4"             { return P4;  }
"P5"|"p5"             { return P5;  }
"P6"|"p6"             { return P6;  }
"P7"|"p7"             { return P7;  }
"PSW"|"psw"           { return PSW; }
"R0"|"r0"             { return R0;  }
"R1"|"r1"             { return R1;  }
"R2"|"r2"             { return R2;  }
"R3"|"r3"             { return R3;  }
"R4"|"r4"             { return R4;  }
"R5"|"r5"             { return R5;  }
"R6"|"r6"             { return R6;  }
"R7"|"r7"             { return R7;  }
"RB0"|"rb0"           { return RB0; }
"RB1"|"rb1"           { return RB1; }
"T"|"t"               { return T;   }
"TCNT"|"tcnt"         { return TCNT;}
"TCNTI"|"tcnti"       { return( TCNTI ); }
[A-Za-z][0-9A-Za-z]*  {yylval= (int) yytext; return( ID ); }
"\t" |
" "                   { ; /* Ignore tabs & spaces */ }
.                     { return( yytext[0] ); }
%%

static char *RcsId = "$Id$";
extern char *ptr;
extern debug;
