--- parse.l	2008/04/02 18:57:29	1.51
+++ parse.l	2008/04/27 15:55:53
@@ -14,6 +14,8 @@
 %x CPP_INCLUDE CPP_INC_FILE CPP_INC_FLAGS
 %x CPP_DEFINE CPP_DEFINE_ARGP CPP_DEFINE_BODY CPP_DEFINE_ARGS
 %x GNU_LABEL GNU_VA_ARG GNU_ATTRIBUTE GNU_TYPEOF GNU_OFFSETOF
+%x SDCC_EXTENSION1 SDCC_EXTENSION2
+%x C51_EXTENSION1 C51_EXTENSION3 C51_EXTENSION4 C51_EXTENSION5 C51_PRAGMAASM
 
 %{
 /***************************************
@@ -194,6 +196,13 @@
 <CPP_START>[a-z]+               { BEGIN(CPP); }
 <CPP_START>.|\n                 { BEGIN(INITIAL); /* Ignore bad pre-processor output */ }
 
+ /* C51 compiler - contributed by Claudio Montecucco */
+
+<CPP_START>pragma{W}+asm               { BEGIN(C51_PRAGMAASM); }
+<C51_PRAGMAASM>#{W}*pragma{W}+endasm   { BEGIN(INITIAL); }
+<C51_PRAGMAASM>{N}                     { }
+<C51_PRAGMAASM>.                       { }
+
  /* Preprocessor directives not #define or #include. */
 
 <CPP>.                          { }
@@ -311,6 +320,43 @@
 "_Complex"              {  }
 "_Bool"                 { yylval="_Bool";    return(BOOL);     }
 
+ /* SDCC - contributed by Claudio Montecucco with modifications from me */
+
+"__xdata"                          { }
+"__code"                           { }
+"__interrupt"                      { BEGIN(SDCC_EXTENSION1); }
+"__using"                          { BEGIN(SDCC_EXTENSION1); }
+<SDCC_EXTENSION1>"("               { }
+<SDCC_EXTENSION1>[^()]+            { }
+<SDCC_EXTENSION1>")"               { BEGIN(INITIAL); }
+
+"__sfr"                            { BEGIN(SDCC_EXTENSION2); }
+"__sbit"                           { BEGIN(SDCC_EXTENSION2); }
+"__at"                             { BEGIN(SDCC_EXTENSION2); }
+<SDCC_EXTENSION2>[^;]+             { }
+<SDCC_EXTENSION2>";"               { BEGIN(INITIAL); }
+
+"using"                            { BEGIN(C51_EXTENSION1); }
+<C51_EXTENSION1>"("                { }
+<C51_EXTENSION1>[^()]+             { }
+<C51_EXTENSION1>")"                { BEGIN(INITIAL); }
+
+"xdata"                            { }
+"code"                             { }
+
+"sfr"                              { BEGIN(C51_EXTENSION3); }
+"sbit"                             { BEGIN(C51_EXTENSION3); }
+<C51_EXTENSION3>[^;]+              { }
+<C51_EXTENSION3>";"                { BEGIN(INITIAL); }
+
+"interrupt"                        { BEGIN(C51_EXTENSION4); }
+<C51_EXTENSION4>[^{]+              { }
+<C51_EXTENSION4>"{"                { unput('{'); BEGIN(INITIAL); }
+
+"_at_"                             { BEGIN(C51_EXTENSION5); }
+<C51_EXTENSION5>[^;]+              { }
+<C51_EXTENSION5>";"                { unput(';'); BEGIN(INITIAL); }
+
  /* C language keywords. */
 
 "auto"                  { yylval="auto"    ; return(AUTO);     }
