%{
/*
 * Lexer for XML->GMIIM_SCHEMA
 */
#include "y.tab.h"
#include <string.h>

%}

%s INTAG

%%

(<[Ss][Uu][Pp][Pp][Ll][Ii][Ee][Rr]_[Ll][Ii][Bb][Rr][Aa][Rr][Yy][\t ]+[Bb][Ss][Uu][\t ]*=) {return SUPPLIER_LIB_START;} 
(<\/[Ss][Uu][Pp][Pp][Ll][Ii][Ee][Rr]_[Ll][Ii][Bb][Rr][Aa][Rr][Yy]>)   {return SUPPLIER_LIB_END;}

(<[Cc][Ll][Aa][Ss][Ss][\t ]+[Bb][Ss][Uu][\t ]*=)  {return CLASS_START;} 
(<\/[Cc][Ll][Aa][Ss][Ss]>)   {return CLASS_END;}


(<[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy][\t ]+[Bb][Ss][Uu][\t ]*=)  {return PROPERTY_START;} 
(<\/[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy]>)   {return PROPERTY_END;}


(<[Tt][Aa][Bb][Ll][Ee][\t ]+[Bb][Ss][Uu][\t ]*=)  {return TABLE_START;} 
(<\/[Tt][Aa][Bb][Ll][Ee]>)   {return TABLE_END;}

                                     

["'][^"\n]*["'\n]   { 
                     yylval.val = strdup(yytext);
                     return QUOTED_STRING;
                    }

>      {return GREATER_THAN;}

(<[Cc][Oo][Ll][Uu][Mm][Nn]>)  {BEGIN INTAG; return COLUMN_START;}
(<\/[Cc][Oo][Ll][Uu][Mm][Nn]>) {return COLUMN_END;}

(<[Cc][Nn][Aa][Mm][Ee]>)      {BEGIN INTAG; return CNAME_START;}
(<[Pp][Nn][Aa][Mm][Ee]>)      {BEGIN INTAG; return PNAME_START;}
(<[Pp][Tt][Yy][Pp][Ee]>)      {BEGIN INTAG; return PTYPE_START;}
(<[Tt][Dd]>)                  {BEGIN INTAG; return TD_START;}
<INTAG>(<\/[Cc][Nn][Aa][Mm][Ee]>)     {BEGIN 0; return CNAME_END;}
<INTAG>(<\/[Pp][Nn][Aa][Mm][Ee]>)     {BEGIN 0; return PNAME_END;}
<INTAG>(<\/[Pp][Tt][Yy][Pp][Ee]>)     {BEGIN 0; return PTYPE_END;}
<INTAG>(<\/[Tt][Dd]>)                 {BEGIN 0; return TD_END;}

<INTAG>[^<]+   {
                yylval.val= strdup(yytext);
                        return TAGGED_TEXT;
               }

(<\?.+\?>) /* {printf("skipping <? ?> tag\n");}*/
(<!.+>)   /* {printf("skipping <!  > tag\n");}*/
(]>)     /*                                  */
[\t ]+     /* ignore white space */
\n  |
.     /* skip singles */
%%

