home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / dsc.l < prev    next >
Text File  |  1993-11-05  |  3KB  |  147 lines

  1. %{
  2. /**************************************************************************
  3.  * Source Id :
  4.  *
  5.  * $Id: dsc.l,v 1.13 1993/11/03 10:04:46 kevinl Exp $
  6.  *-------------------------------------------------------------------------
  7.  * Project Notes :
  8.  *
  9.  *  Diamond Base
  10.  *  ============
  11.  *      A solid database implementation, spurred on by the continuing
  12.  *  Metal (Lead) Base saga.
  13.  *
  14.  *  Project Team :
  15.  *        A. Davison
  16.  *        K. Lentin
  17.  *        D. Platt
  18.  *
  19.  *    Project Commenced : 05-02-1993
  20.  *
  21.  *-------------------------------------------------------------------------
  22.  *  Module Notes :
  23.  *
  24.  *
  25.  *    Lexical Analyser for Relation Compiler.
  26.  *
  27.  *
  28.  *  Original Author : Andy
  29.  *
  30.  *-------------------------------------------------------------------------
  31.  * Revision History:
  32.  *
  33.  * $Log: dsc.l,v $
  34.  * Revision 1.13  1993/11/03  10:04:46  kevinl
  35.  * Added ichar and utils.{h,cc}
  36.  *
  37.  * Revision 1.12  1993/10/19  14:27:37  kevinl
  38.  * Fixed constructors/retrievers
  39.  *
  40.  * Revision 1.11  1993/10/19  11:50:27  kevinl
  41.  * Assignment/default values/constructors
  42.  *
  43.  * Revision 1.10  1993/10/19  08:27:13  davison
  44.  * Added assign token
  45.  *
  46.  * Revision 1.9  1993/10/18  08:01:41  kevinl
  47.  * Added constructors and fixed some probs
  48.  *
  49.  * Revision 1.8  1993/10/10  03:05:23  davison
  50.  * Added grammar prototypes for relational links
  51.  *
  52.  * Revision 1.7  1993/09/26  06:40:32  kevinl
  53.  * Added dbData support
  54.  *
  55.  * Revision 1.6  1993/07/11  09:42:05  kevinl
  56.  * Changed String to dbString
  57.  *
  58.  * Revision 1.5  1993/06/20  13:43:40  kevinl
  59.  * Added STRING
  60.  *
  61.  * Revision 1.4  1993/04/06  06:57:42  davison
  62.  * Fixed - underscored allowed in ident names.
  63.  *
  64.  * Revision 1.3  1993/04/02  02:17:00  davison
  65.  * Removed a few keywords.
  66.  *
  67.  * Revision 1.2  1993/03/15  18:59:15  davison
  68.  * Implemented a few nice things, like more than 2 index fields, line number
  69.  * reporting on syntax errors, and usage reporting.
  70.  *
  71.  * Just for you, Daz :-)
  72.  *
  73.  * Revision 1.1  1993/03/15  18:55:09  davison
  74.  * Initial revision
  75.  *
  76.  **************************************************************************/
  77. #ifdef __BORLANDC__
  78. #include <io.h>
  79. #endif
  80. %}
  81.  
  82.  
  83. newline [\n]
  84. delim   [ \t\r] 
  85. ws      {delim}+                      
  86. alpha   [A-Za-z_]                      
  87. digit   [0-9]                         
  88. alnum   [a-zA-Z0-9_]
  89. id        {alpha}{alnum}*                      
  90. num        [0-9]+                                      
  91. dot        [.]
  92. tcomment "//"[^\n]*"\n"
  93. hcomment "#"[^\n]*"\n"
  94. comma    ","
  95.  
  96. %%                                    
  97. {ws}        {/*No action, no return*/}    
  98. {newline}    { linenum++; }
  99. relation    {return(RELATION);}
  100. ";"        {return(SEMI);}
  101. "{"        {return(LCBRACE);}
  102. "}"        {return(RCBRACE);}
  103. "["        {return(LSBRACE);}
  104. "]"        {return(RSBRACE);}
  105. "="        {return(ASSIGN);}
  106.  
  107. short    {return(SHORT);}
  108. ushort    {return(USHORT);}
  109. long    {return(LONG);}
  110. ulong    {return(ULONG);}
  111. double    {return(DOUBLE);}
  112. float    {return(FLOAT);}
  113. money    {return(MONEY);}
  114. date    {return(DATE);}
  115. char    {return(CHAR);}
  116. ichar    {return(ICHAR);}
  117. dbString    {return(STRING);}
  118. dbData    {return(DATA);}
  119. index    {return(INDEX);}
  120. on        {return(ON);}
  121. unique    {return(UNIQUE);}
  122. is        {return(IS);}
  123. called  {return(CALLED);}
  124. ordered {return(ORDER);}
  125. using    {return(USING);}
  126. construct { return(CONSTRUCT);}
  127.  
  128. {tcomment} {linenum++;}
  129. {hcomment} {linenum++;}
  130. {id}    {return(IDENT);} 
  131. {num}    {return(NUM);}
  132. {comma} {return(COMMA);}
  133. {dot}   {return(DOT);}
  134. %%
  135.  
  136. void yyGetToSemi(void)
  137. {
  138.     long len = 0;
  139.     char c;
  140.  
  141.     while ((c=yyinput()) != ';')
  142.         yytext[len++] = c;
  143.     
  144.     yytext[len] = 0;
  145.     unput(c);
  146. }
  147.