home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 4.ddi / COM.ZIP / COMLEX.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-02  |  25.1 KB  |  1,048 lines

  1. #define YY_DEFAULT_ACTION ECHO;
  2. #define FLEX_USE_ECS
  3. #define FLEX_USE_MECS
  4. #define FLEX_INTERACTIVE_SCANNER
  5. /* A lexical scanner generated by flex */
  6.  
  7. #ifdef MSDOS
  8.  #include "\LIB\fskeldef.h"
  9. #else
  10.  #include "\LIB\flexskeldef.h"
  11. #endif
  12.  
  13. # line 1 "com.l"
  14. #define INITIAL 0
  15. # line 2 "com.l"
  16.  
  17. /***************/
  18. /* Gloal stuff */
  19. /***************/
  20.  
  21. extern "C" {
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <stdlib.h>
  25. #include <ctype.h>
  26. #include <io.h>
  27. }
  28.  
  29. #define STRMAX 255                    /* Max length of strings            */
  30.  
  31. #include "comgram.h"                /* Get YACC token equates            */
  32.  
  33. extern YYSTYPE yylval;
  34. extern FILE * comIn;
  35. extern FILE * comOut;
  36.  
  37. /* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  38.  * is returned in "result".
  39.  *
  40.  * We redefine Flex's routine so we can supply the text from a file.
  41.  */
  42. #undef YY_INPUT
  43. #define YY_INPUT(buf,result,max_size) \
  44.         if ( (result = read( fileno(comIn), buf, max_size )) < 0 ) \
  45.             YY_FATAL_ERROR( "read() in flex scanner failed" );
  46.  
  47. /* We don't want the default action to ECHO, so define it as nothing */
  48. #undef YY_DEFAULT_ACTION
  49. #define YY_DEFAULT_ACTION printf("Default action: %i\n",*yytext)
  50.  
  51. /*
  52.  *    Local variables
  53.  */
  54.  
  55. char *ptr;                            /* String pointer                      */
  56. char *cp;                            /* Roving string pointer            */
  57. int scount;                            /* String length                    */
  58. extern YYSTYPE yylval;                /* For returning token values        */
  59. extern int lineCount;                /* Our line counter                    */
  60. int q;                                /* Work variable                     */
  61.  
  62. #define BYTEMASK     0x7F
  63.  
  64. /***********************/
  65. /* Function prototypes */
  66. /***********************/
  67.  
  68. int otoi(char *);
  69. int htoi(char *);
  70. char myesc(char *);
  71.  
  72. #define QUOTE 2
  73. #define C_COMMENT 4
  74. #define RECOVER 6
  75. # line 79 "com.l"
  76. #define YY_JAM 163
  77. #define YY_JAM_BASE 271
  78. #define YY_TEMPLATE 164
  79. static char l[164] =
  80.     {   0,
  81.        -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   65,   62,
  82.        63,   64,   49,   27,   58,   52,   65,   45,   46,   56,
  83.        55,   44,   47,   57,   26,   26,   60,   59,   54,   61,
  84.        53,   50,   65,   65,   65,   65,   65,   65,   65,   65,
  85.        65,   65,   42,   51,   43,   48,   29,   31,   30,   29,
  86.         3,    5,    4,    0,   66,   62,   36,   35,    0,    0,
  87.         1,    0,   26,    0,   32,   40,   41,   37,   39,   38,
  88.        33,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  89.         0,   16,    0,    0,    0,    0,    0,   34,   28,   28,
  90.         0,    2,   23,    0,    0,    6,   25,    0,    0,    0,
  91.  
  92.         0,   15,   12,    0,   11,    0,   17,    0,    0,    0,
  93.         0,    0,   28,    0,    0,    0,    0,    0,   14,    0,
  94.         0,    8,    9,   10,    0,    0,   28,    0,    0,    0,
  95.        19,    0,    0,    0,    0,    0,   28,   24,    0,    0,
  96.         0,   18,   20,    7,    0,    0,    0,   13,    0,    0,
  97.         0,    0,    0,    0,    0,    0,    0,    0,    0,   22,
  98.         0,   21,    0
  99.     } ;
  100.  
  101. static char e[128] =
  102.     {   0,
  103.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  104.         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
  105.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  106.         1,    5,    6,    7,    1,    1,    8,    9,   10,   11,
  107.        12,   13,   14,   15,   16,    1,   17,   18,   19,   19,
  108.        19,   19,   19,   19,   19,   19,   19,   20,   21,   22,
  109.        23,   24,    1,    1,   27,   28,   29,   30,   31,   32,
  110.        33,   34,   35,   36,   36,   37,   38,   39,   40,   41,
  111.        36,   42,   43,   44,   45,   36,   46,   47,   48,   36,
  112.         1,   25,    1,   26,    1,    1,   27,   28,   29,   30,
  113.  
  114.        31,   32,   33,   34,   35,   36,   36,   37,   38,   39,
  115.        40,   41,   36,   42,   43,   44,   45,   36,   46,   47,
  116.        48,   36,   49,   50,   51,   52,    1
  117.     } ;
  118.  
  119. static char m[53] =
  120.     {   0,
  121.         1,    1,    2,    1,    1,    1,    1,    1,    1,    3,
  122.         1,    1,    1,    1,    1,    1,    1,    4,    4,    1,
  123.         1,    1,    1,    1,    1,    1,    5,    5,    5,    5,
  124.         5,    5,    6,    6,    6,    6,    6,    6,    6,    6,
  125.         6,    6,    6,    6,    6,    6,    6,    6,    1,    1,
  126.         1,    1
  127.     } ;
  128.  
  129. static short int b[175] =
  130.     {   0,
  131.         0,    0,   50,   51,   52,   53,  268,  267,  271,   57,
  132.       271,  271,  246,  271,  271,  259,   76,  271,  271,  271,
  133.       271,  271,  271,   47,  111,   49,  271,  271,   47,   49,
  134.       108,  271,  228,  229,  230,   96,  224,  223,  102,  106,
  135.       112,  232,  271,  211,  271,  271,  271,  271,  271,  122,
  136.       139,  271,  243,  256,  271,  144,  271,  271,  248,  247,
  137.       271,  253,  126,    0,  271,  271,  271,  271,  271,  271,
  138.       271,  207,  214,  210,  209,  221,  213,  222,  206,  203,
  139.       214,  271,  206,  204,  208,  203,  210,  271,  271,  132,
  140.         0,  271,  271,    0,  237,  271,    0,  195,  195,  196,
  141.  
  142.       205,  271,  271,  192,  271,  199,  271,  203,  186,  187,
  143.       200,  201,  135,    0,    0,  194,  196,  189,  271,  194,
  144.       192,  271,  271,  271,  165,  154,  137,    0,  168,  142,
  145.       271,  149,  170,  126,  127,  139,  271,  271,  132,  122,
  146.       140,  271,  271,  271,  135,  162,  126,  271,  136,  126,
  147.       123,  124,  123,  129,  121,  118,   48,   30,   24,  271,
  148.        17,  271,  271,  179,  185,  191,  197,  201,  207,  210,
  149.       211,  214,  215,  218
  150.     } ;
  151.  
  152. static short int d[175] =
  153.     {   0,
  154.       163,    1,  164,  164,  165,  165,  166,  166,  163,  163,
  155.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  156.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  157.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  158.       163,  163,  163,  163,  163,  163,  163,  163,  163,  167,
  159.       165,  163,  163,  166,  163,  163,  163,  163,  163,  168,
  160.       163,  169,  163,  170,  163,  163,  163,  163,  163,  163,
  161.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  162.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  163.       167,  163,  163,  171,  169,  163,  170,  163,  163,  163,
  164.  
  165.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  166.       163,  163,  163,  172,  173,  163,  163,  163,  163,  163,
  167.       163,  163,  163,  163,  163,  163,  163,  174,  163,  163,
  168.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  169.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  170.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  171.       163,  163,-32767,  163,  163,  163,  163,  163,  163,  163,
  172.       163,  163,  163,  163
  173.     } ;
  174.  
  175. static short int n[324] =
  176.     {   0,
  177.         9,   10,   11,   12,   10,   13,   14,   15,   16,   17,
  178.        18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
  179.        28,   29,   30,   31,    9,   32,   33,    9,   34,   35,
  180.        36,   37,    9,    9,    9,    9,    9,    9,   38,   39,
  181.         9,    9,   40,    9,    9,   41,    9,   42,   43,   44,
  182.        45,   46,   48,   48,   52,   52,   49,   49,   56,   61,
  183.       162,   56,  161,   62,   53,   53,   63,   63,   65,   66,
  184.        67,   68,   69,  160,   50,   50,   59,   59,  159,   59,
  185.        59,   59,   59,   59,   59,   59,   59,   59,   59,   59,
  186.        59,   59,   59,   59,   59,   59,   59,   59,   59,   59,
  187.  
  188.        59,   59,   60,   60,   60,   60,   60,   60,   60,   60,
  189.        60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
  190.        60,   60,   60,   60,   59,   59,   59,   59,   63,   63,
  191.        70,   71,   75,   81,   76,   77,   83,   78,   85,   90,
  192.        82,  163,   84,   63,   63,   56,   86,   91,   56,  113,
  193.       113,  163,  127,  127,  137,  137,  158,   64,  157,  156,
  194.       155,  154,  153,  152,  151,  150,  149,  148,  147,  146,
  195.       145,  144,  143,  142,  141,  140,  139,  138,  114,   47,
  196.        47,   47,   47,   47,   47,   51,   51,   51,   51,   51,
  197.        51,   54,   54,   54,   54,   54,   54,   89,  136,   89,
  198.  
  199.        89,   89,   89,   94,  135,   94,   94,   95,   95,   95,
  200.        95,   95,   95,   97,   97,  115,  115,  128,  128,  129,
  201.       129,   89,   89,  134,  133,  132,  131,  130,  126,  125,
  202.       124,  123,  122,  121,  120,  119,  118,  117,  116,   96,
  203.       112,  111,  110,  109,  108,  107,  106,  105,  104,  103,
  204.       102,  101,  100,   99,   98,   96,   93,   93,   55,   92,
  205.        88,   87,   80,   79,   74,   73,   72,   58,   57,   55,
  206.        55,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  207.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  208.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  209.  
  210.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  211.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  212.       163,  163,  163
  213.     } ;
  214.  
  215. static short int c[324] =
  216.     {   0,
  217.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  218.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  219.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  220.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  221.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  222.         1,    1,    3,    4,    5,    6,    3,    4,   10,   24,
  223.       161,   10,  159,   24,    5,    6,   26,   26,   29,   29,
  224.        30,   30,   30,  158,    3,    4,   17,   17,  157,   17,
  225.        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  226.        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  227.  
  228.        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  229.        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
  230.        17,   17,   17,   17,   17,   17,   17,   17,   25,   25,
  231.        31,   31,   36,   39,   36,   36,   40,   36,   41,   50,
  232.        39,   51,   40,   63,   63,   56,   41,   50,   56,   90,
  233.        90,   51,  113,  113,  127,  127,  156,   25,  155,  154,
  234.       153,  152,  151,  150,  149,  147,  146,  145,  141,  140,
  235.       139,  136,  135,  134,  133,  132,  130,  129,   90,  164,
  236.       164,  164,  164,  164,  164,  165,  165,  165,  165,  165,
  237.       165,  166,  166,  166,  166,  166,  166,  167,  126,  167,
  238.  
  239.       167,  167,  167,  168,  125,  168,  168,  169,  169,  169,
  240.       169,  169,  169,  170,  170,  171,  171,  172,  172,  173,
  241.       173,  174,  174,  121,  120,  118,  117,  116,  112,  111,
  242.       110,  109,  108,  106,  104,  101,  100,   99,   98,   95,
  243.        87,   86,   85,   84,   83,   81,   80,   79,   78,   77,
  244.        76,   75,   74,   73,   72,   62,   60,   59,   54,   53,
  245.        44,   42,   38,   37,   35,   34,   33,   16,   13,    8,
  246.         7,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  247.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  248.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  249.  
  250.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  251.       163,  163,  163,  163,  163,  163,  163,  163,  163,  163,
  252.       163,  163,  163
  253.     } ;
  254.  
  255.  
  256. /* these declarations have to come after the section 1 code or lint gets
  257.  * confused about whether the variables are used
  258.  */
  259. FILE *yyin = stdin, *yyout = stdout;
  260.  
  261. /* these variables are all declared out here so that section 3 code can
  262.  * manipulate them
  263.  */
  264. static int yy_start, yy_b_buf_p, yy_c_buf_p, yy_e_buf_p;
  265. static int yy_saw_eof, yy_init = 1;
  266.  
  267. /* yy_ch_buf has to be 1 character longer than YY_BUF_SIZE, since when
  268.  * setting up yytext we can try to put a '\0' just past the end of the
  269.  * matched text
  270.  */
  271. static char yy_ch_buf[YY_BUF_SIZE + 1];
  272. static int yy_st_buf[YY_BUF_SIZE];
  273. static char yy_hold_char;
  274. char *yytext;
  275. static int yyleng;
  276.  
  277. YY_DECL
  278.     {
  279.     int yy_n_chars, yy_lp, yy_iii, yy_buf_pos, yy_act;
  280.  
  281.  
  282.  
  283.  
  284.     if ( yy_init )
  285.     {
  286.     YY_INIT;
  287.     yy_start = 1;
  288.     yy_init = 0;
  289.     }
  290.  
  291.     goto get_next_token;
  292.  
  293. do_action:
  294.     for ( ; ; )
  295.     {
  296.     YY_DO_BEFORE_ACTION
  297.  
  298. #ifdef FLEX_DEBUG
  299.     fprintf( stderr, "--accepting rule #%d\n", yy_act );
  300. #endif
  301.     switch ( yy_act )
  302.         {
  303. /************/
  304. /* Comments */
  305. /************/
  306. case 1:
  307. # line 85 "com.l"
  308. BEGIN(C_COMMENT);        /* Old style comments.              */
  309.     YY_BREAK
  310. case 2:
  311. # line 87 "com.l"
  312. BEGIN(0);            /* Sub-scanner to handle comments.    */
  313.     YY_BREAK
  314. case 3:
  315. # line 88 "com.l"
  316. ;
  317.     YY_BREAK
  318. case 4:
  319. # line 89 "com.l"
  320. ;
  321.     YY_BREAK
  322. case 5:
  323. # line 90 "com.l"
  324. {
  325.                         lineCount++;
  326.                     }
  327.     YY_BREAK
  328. case 6:
  329. # line 94 "com.l"
  330. {                        /* New style comments */
  331.                         lineCount++;
  332.                     }
  333.     YY_BREAK
  334. /************/
  335. /* Commands */
  336. /************/
  337. case 7:
  338. # line 102 "com.l"
  339. return(YDEBUG);
  340.     YY_BREAK
  341. case 8:
  342. # line 104 "com.l"
  343. return(SEND);
  344.     YY_BREAK
  345. case 9:
  346. # line 106 "com.l"
  347. return(SLOW);
  348.     YY_BREAK
  349. case 10:
  350. # line 108 "com.l"
  351. return(WAIT);
  352.     YY_BREAK
  353. case 11:
  354. # line 110 "com.l"
  355. return(FOR);
  356.     YY_BREAK
  357. case 12:
  358. # line 112 "com.l"
  359. return(EOL);
  360.     YY_BREAK
  361. case 13:
  362. # line 114 "com.l"
  363. return(ANYTHING);
  364.     YY_BREAK
  365. case 14:
  366. # line 116 "com.l"
  367. return(ELSE);
  368.     YY_BREAK
  369. case 15:
  370. # line 118 "com.l"
  371. return(END); 
  372.     YY_BREAK
  373. case 16:
  374. # line 120 "com.l"
  375. return(ON);
  376.     YY_BREAK
  377. case 17:
  378. # line 122 "com.l"
  379. return(OFF);
  380.     YY_BREAK
  381. case 18:
  382. # line 124 "com.l"
  383. return(NOTIFY);
  384.     YY_BREAK
  385. case 19:
  386. # line 126 "com.l"
  387. return(CLOSE);
  388.     YY_BREAK
  389. case 20:
  390. # line 128 "com.l"
  391. return(WINDOW);
  392.     YY_BREAK
  393. case 21:
  394. # line 130 "com.l"
  395. return(DISPLAYCOMMENT);
  396.     YY_BREAK
  397. case 22:
  398. # line 132 "com.l"
  399. return(ERASECOMMENT);
  400.     YY_BREAK
  401. /* Byte Literal constant */
  402. case 23:
  403. # line 135 "com.l"
  404. {
  405.                     yylval.ival= *(yytext+1);
  406.                     return(BYTE_LITCONST);
  407.                 }
  408.     YY_BREAK
  409. /* Long Literal constant */
  410. case 24:
  411. # line 141 "com.l"
  412. {
  413.                     ptr=yytext+1;
  414.                     yylval.lval=(*ptr);
  415.                     yylval.lval<<=8;
  416.                     yylval.lval+=(*(ptr+1));
  417.                     yylval.lval<<=8;
  418.                     yylval.lval+=(*(ptr+2));
  419.                     yylval.lval<<=8;
  420.                     yylval.lval+=(*(ptr+3));
  421.                     return(LITCONST);
  422.                 }
  423.     YY_BREAK
  424. /* Hex constant */
  425. case 25:
  426. # line 155 "com.l"
  427. {
  428.                     yylval.ival=0;
  429.                     for (q=2; q<yyleng; q++) {
  430.                         if (yytext[q]<'A') {
  431.                             yylval.ival=(yylval.ival*16) + (yytext[q]-'0');
  432.                         } else {
  433.                             if (yytext[q]<'a')
  434.                               yylval.ival=(yylval.ival*16)+(yytext[q]-'A'+10);
  435.                             else
  436.                               yylval.ival=(yylval.ival*16)+(yytext[q]-'a'+10);
  437.                         }
  438.                     }
  439.                     return(CONSTANT);
  440.                 }
  441.     YY_BREAK
  442. /* Integer constant */
  443. case 26:
  444. # line 171 "com.l"
  445. {
  446.                 yylval.ival=0;
  447.                 for (q=0; q<yyleng; q++) {
  448.                     yylval.ival=(yylval.ival*10) + (yytext[q]-'0');
  449.                 }
  450.                 return(CONSTANT);
  451.             }
  452.     YY_BREAK
  453. /* String */
  454. case 27:
  455. # line 180 "com.l"
  456. {
  457.                 /* We need to accumulate all characters in the string     */
  458.                 /* To do this, we use a sub-analyzer.  Let's get set!    */
  459.                 ptr=(char*)calloc(1,STRMAX+1); /* Get memory for the string    */
  460.                 cp=ptr;                    /* Make a roving pointer        */
  461.                 scount=0;
  462.                 BEGIN(QUOTE);            /* Start the analyzer             */
  463.             }
  464.     YY_BREAK
  465. /* Sub-analyzer to accumulate the contents of a string */
  466. case 28:
  467. # line 190 "com.l"
  468. {
  469.                 *cp++=(myesc(yytext) & BYTEMASK);
  470.                 scount++;
  471.                 if (scount>=STRMAX-1) {
  472.                     printf("String too long!\n");
  473.                     free(ptr);                /* Give back our memory */
  474.                     BEGIN(0);
  475.                 }
  476.             }
  477.     YY_BREAK
  478. case 29:
  479. # line 200 "com.l"
  480. {
  481.                 *cp++=(yytext[0] & BYTEMASK); /* Still in string */
  482.                 scount++;
  483.                 if (scount>=STRMAX-1) {
  484.                     printf("String too long!\n");
  485.                     free(ptr);                /* Give back our memory */
  486.                     BEGIN(0);
  487.                 }
  488.             }
  489.     YY_BREAK
  490. case 30:
  491. # line 210 "com.l"
  492. {
  493.                 /* End of the string */
  494.                 *cp=0;                    /* Terminate the string            */
  495.                 scount++;
  496.                 cp=(char*)realloc(ptr,scount); /* Give a bit of memory back */
  497.                 if (cp)
  498.                     yylval.ptr=cp;        /* Pass pointer to string        */
  499.                 else
  500.                     yylval.ptr=ptr;        /* Realloc failed! (impossible) */
  501.                 BEGIN(0);                /* Turn off string processing    */
  502.                 return(STRING);            /* Return our string token        */
  503.             }
  504.     YY_BREAK
  505. case 31:
  506. # line 223 "com.l"
  507. {
  508.                 printf( "Missing quote\n" );
  509.                 free(ptr);                /* Give back our memory */
  510.                 BEGIN(0);
  511.             }
  512.     YY_BREAK
  513. /* Operators */
  514. case 32:
  515. # line 232 "com.l"
  516. return(SHIFT_LEFT);
  517.     YY_BREAK
  518. case 33:
  519. # line 233 "com.l"
  520. return(SHIFT_RIGHT);
  521.     YY_BREAK
  522. case 34:
  523. # line 234 "com.l"
  524. return(LOGICAL_OR);
  525.     YY_BREAK
  526. case 35:
  527. # line 235 "com.l"
  528. return(LOGICAL_AND);
  529.     YY_BREAK
  530. case 36:
  531. # line 236 "com.l"
  532. return(NOT_EQ);
  533.     YY_BREAK
  534. case 37:
  535. # line 237 "com.l"
  536. return(EQ);
  537.     YY_BREAK
  538. case 38:
  539. # line 238 "com.l"
  540. return(GT_EQ);
  541.     YY_BREAK
  542. case 39:
  543. # line 239 "com.l"
  544. return(GT_EQ);
  545.     YY_BREAK
  546. case 40:
  547. # line 240 "com.l"
  548. return(LT_EQ);
  549.     YY_BREAK
  550. case 41:
  551. # line 241 "com.l"
  552. return(LT_EQ);
  553.     YY_BREAK
  554. /* Single character stuff */
  555. case 42:
  556. # line 245 "com.l"
  557. return('{');
  558.     YY_BREAK
  559. case 43:
  560. # line 246 "com.l"
  561. return('}');
  562.     YY_BREAK
  563. case 44:
  564. # line 247 "com.l"
  565. return(',');
  566.     YY_BREAK
  567. case 45:
  568. # line 248 "com.l"
  569. return('(');
  570.     YY_BREAK
  571. case 46:
  572. # line 249 "com.l"
  573. return(')');
  574.     YY_BREAK
  575. case 47:
  576. # line 250 "com.l"
  577. return('-');
  578.     YY_BREAK
  579. case 48:
  580. # line 251 "com.l"
  581. return('~');
  582.     YY_BREAK
  583. case 49:
  584. # line 252 "com.l"
  585. return('!');
  586.     YY_BREAK
  587. case 50:
  588. # line 253 "com.l"
  589. return('^');
  590.     YY_BREAK
  591. case 51:
  592. # line 254 "com.l"
  593. return('|');
  594.     YY_BREAK
  595. case 52:
  596. # line 255 "com.l"
  597. return('&');
  598.     YY_BREAK
  599. case 53:
  600. # line 256 "com.l"
  601. return('>');
  602.     YY_BREAK
  603. case 54:
  604. # line 257 "com.l"
  605. return('<');
  606.     YY_BREAK
  607. case 55:
  608. # line 258 "com.l"
  609. return('+');
  610.     YY_BREAK
  611. case 56:
  612. # line 259 "com.l"
  613. return('*');
  614.     YY_BREAK
  615. case 57:
  616. # line 260 "com.l"
  617. return('/');
  618.     YY_BREAK
  619. case 58:
  620. # line 261 "com.l"
  621. return('%');
  622.     YY_BREAK
  623. case 59:
  624. # line 262 "com.l"
  625. return(';');
  626.     YY_BREAK
  627. case 60:
  628. # line 263 "com.l"
  629. return(':');
  630.     YY_BREAK
  631. case 61:
  632. # line 264 "com.l"
  633. return('=');
  634.     YY_BREAK
  635. case 62:
  636. # line 266 "com.l"
  637. ;                    /* We don't care about whitespace, eat it. */
  638.     YY_BREAK
  639. case 63:
  640. # line 268 "com.l"
  641. ;                    /* Ignore CR */
  642.     YY_BREAK
  643. case 64:
  644. # line 269 "com.l"
  645. {
  646.                 lineCount++;
  647.             }
  648.     YY_BREAK
  649. case 65:
  650. # line 273 "com.l"
  651. {
  652.                 printf( "Illegal character '%c' (%i)\n", yytext[0],yytext[0]);
  653.                 BEGIN(RECOVER);
  654.             }
  655.     YY_BREAK
  656. case 66:
  657. # line 278 "com.l"
  658. {
  659.                 lineCount++;
  660.                  BEGIN(0);
  661.               }
  662.     YY_BREAK
  663.  
  664. case YY_NEW_FILE:
  665. break; /* begin reading from new file */
  666.  
  667. case YY_DO_DEFAULT:
  668. YY_DEFAULT_ACTION;
  669. break;
  670.  
  671. case YY_END_TOK:
  672. return ( YY_END_TOK );
  673.  
  674. default:
  675. YY_FATAL_ERROR( "fatal flex scanner internal error" );
  676.         }
  677.  
  678. get_next_token:
  679.     {
  680.     register int yy_curst;
  681.     register char yy_sym;
  682.  
  683.     YY_DO_BEFORE_SCAN
  684.  
  685.     /* set up to begin running DFA */
  686.  
  687.     yy_curst = yy_start;
  688.  
  689.     if ( yy_ch_buf[yy_c_buf_p] == '\n' )
  690.         ++yy_curst;
  691.  
  692.     /* yy_b_buf_p points to the position in yy_ch_buf
  693.      * of the start of the current run.
  694.      */
  695.  
  696.     yy_b_buf_p = yy_c_buf_p + 1;
  697.  
  698.     do /* until the machine jams */
  699.         {
  700.         if ( yy_c_buf_p == yy_e_buf_p )
  701.         { /* need more input */
  702.         if ( yy_e_buf_p >= YY_BUF_LIM )
  703.             { /* not enough room to do another read */
  704.             /* see if we can make some room for more chars */
  705.  
  706.             yy_n_chars = yy_e_buf_p - yy_b_buf_p;
  707.  
  708.             if ( yy_n_chars >= 0 )
  709.             /* shift down buffer to make room */
  710.             for ( yy_iii = 0; yy_iii <= yy_n_chars; ++yy_iii )
  711.                 {
  712.                 yy_buf_pos = yy_b_buf_p + yy_iii;
  713.                 yy_ch_buf[yy_iii] = yy_ch_buf[yy_buf_pos];
  714.                 yy_st_buf[yy_iii] = yy_st_buf[yy_buf_pos];
  715.                 }
  716.  
  717.             yy_b_buf_p = 0;
  718.             yy_e_buf_p = yy_n_chars;
  719.  
  720.             if ( yy_e_buf_p >= YY_BUF_LIM )
  721.             YY_FATAL_ERROR( "flex input buffer overflowed" );
  722.  
  723.             yy_c_buf_p = yy_e_buf_p;
  724.             }
  725.  
  726.         else if ( yy_saw_eof )
  727.             {
  728. saweof:            if ( yy_b_buf_p > yy_e_buf_p )
  729.             {
  730.             if ( yywrap() )
  731.                 {
  732.                 yy_act = YY_END_TOK;
  733.                 goto do_action;
  734.                 }
  735.             
  736.             else
  737.                 {
  738.                 YY_INIT;
  739.                 yy_act = YY_NEW_FILE;
  740.                 goto do_action;
  741.                 }
  742.             }
  743.  
  744.             else /* do a jam to eat up more input */
  745.             {
  746. #ifndef FLEX_INTERACTIVE_SCANNER
  747.             /* we're going to decrement yy_c_buf_p upon doing
  748.              * the jam.  In this case, that's wrong, since
  749.              * it points to the last non-jam character.  So
  750.              * we increment it now to counter the decrement.
  751.              */
  752.             ++yy_c_buf_p;
  753. #endif
  754.             break;
  755.             }
  756.             }
  757.  
  758.         YY_INPUT( (yy_ch_buf + yy_c_buf_p + 1), yy_n_chars,
  759.               YY_MAX_LINE );
  760.  
  761.         if ( yy_n_chars == YY_NULL )
  762.             {
  763.             if ( yy_saw_eof )
  764.     YY_FATAL_ERROR( "flex scanner saw EOF twice - shouldn't happen" );
  765.             yy_saw_eof = 1;
  766.             goto saweof;
  767.             }
  768.  
  769.         yy_e_buf_p += yy_n_chars;
  770.         }
  771.  
  772.         ++yy_c_buf_p;
  773.  
  774. #ifdef FLEX_USE_ECS
  775.         yy_sym = e[yy_ch_buf[yy_c_buf_p]];
  776. #else
  777.         yy_sym = yy_ch_buf[yy_c_buf_p];
  778. #endif
  779.  
  780. #ifdef FLEX_FULL_TABLE
  781.         yy_curst = n[yy_curst][yy_sym];
  782.  
  783. #else /* get next state from compressed table */
  784.  
  785.         while ( c[b[yy_curst] + yy_sym] != yy_curst )
  786.         {
  787.         yy_curst = d[yy_curst];
  788.  
  789. #ifdef FLEX_USE_MECS
  790.         /* we've arrange it so that templates are never chained
  791.          * to one another.  This means we can afford make a
  792.          * very simple test to see if we need to convert to
  793.          * yy_sym's meta-equivalence class without worrying
  794.          * about erroneously looking up the meta-equivalence
  795.          * class twice
  796.          */
  797.  
  798.         if ( yy_curst >= YY_TEMPLATE )
  799.             yy_sym = m[yy_sym];
  800. #endif
  801.         }
  802.  
  803.         yy_curst = n[b[yy_curst] + yy_sym];
  804.  
  805. #endif
  806.  
  807.         yy_st_buf[yy_c_buf_p] = yy_curst;
  808.  
  809.         }
  810. #ifdef FLEX_INTERACTIVE_SCANNER
  811.     while ( b[yy_curst] != YY_JAM_BASE );
  812. #else
  813.     while ( yy_curst != YY_JAM );
  814.     --yy_c_buf_p; /* put back character we jammed on */
  815.  
  816. #endif
  817.  
  818.     if ( yy_c_buf_p >= yy_b_buf_p )
  819.         { /* we matched some text */
  820.         yy_curst = yy_st_buf[yy_c_buf_p];
  821.         yy_lp = l[yy_curst];
  822.  
  823. #ifdef FLEX_REJECT_ENABLED
  824. find_rule: /* we branch to this label when doing a REJECT */
  825. #endif
  826.  
  827.         for ( ; ; ) /* until we find what rule we matched */
  828.         {
  829. #ifdef FLEX_REJECT_ENABLED
  830.         if ( yy_lp && yy_lp < l[yy_curst + 1] )
  831.             {
  832.             yy_act = a[yy_lp];
  833.             goto do_action; /* "continue 2" */
  834.             }
  835. #else
  836.         if ( yy_lp )
  837.             {
  838.             yy_act = yy_lp;
  839.             goto do_action; /* "continue 2" */
  840.             }
  841. #endif
  842.  
  843.         if ( --yy_c_buf_p < yy_b_buf_p )
  844.             break;
  845.  
  846.         yy_curst = yy_st_buf[yy_c_buf_p];
  847.         yy_lp = l[yy_curst];
  848.         }
  849.         }
  850.  
  851.     /* if we got this far, then we didn't find any accepting
  852.      * states
  853.      */
  854.  
  855.     /* so that the default applies to the first char read */
  856.     ++yy_c_buf_p;
  857.  
  858.     yy_act = YY_DO_DEFAULT;
  859.     }
  860.     }
  861.  
  862.     /*NOTREACHED*/
  863.     }
  864.  
  865.  
  866. /* static int unput( c ) */
  867. void unput( c )                        /* This seems more correct - Tim Capps */
  868. char c;
  869.  
  870.     {
  871.     YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */
  872.  
  873.     if ( yy_c_buf_p == 0 )
  874.     {
  875.     register int i;
  876.     register int yy_buf_pos = YY_BUF_MAX;
  877.  
  878.     for ( i = yy_e_buf_p; i >= yy_c_buf_p; --i )
  879.         {
  880.         yy_ch_buf[yy_buf_pos] = yy_ch_buf[i];
  881.         yy_st_buf[yy_buf_pos] = yy_st_buf[i];
  882.         --yy_buf_pos;
  883.         }
  884.  
  885.     yy_c_buf_p = YY_BUF_MAX - yy_e_buf_p;
  886.     yy_e_buf_p = YY_BUF_MAX;
  887.     }
  888.  
  889.     if ( yy_c_buf_p <= 0 )
  890.     YY_FATAL_ERROR( "flex scanner push-back overflow" );
  891.  
  892.     if ( yy_c_buf_p >= yy_b_buf_p && yy_ch_buf[yy_c_buf_p] == '\n' )
  893.     yy_ch_buf[yy_c_buf_p - 1] = '\n';
  894.  
  895.     yy_ch_buf[yy_c_buf_p--] = c;
  896.  
  897.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  898.     }
  899.  
  900.  
  901. static int input()
  902.  
  903.     {
  904.     int c;
  905.  
  906.     YY_DO_BEFORE_SCAN
  907.  
  908.     if ( yy_c_buf_p == yy_e_buf_p )
  909.     { /* need more input */
  910.     int yy_n_chars;
  911.  
  912.     /* we can throw away the entire current buffer */
  913.     if ( yy_saw_eof )
  914.         {
  915.         if ( yywrap() )
  916.         return ( EOF );
  917.  
  918.         YY_INIT;
  919.         }
  920.  
  921.     yy_b_buf_p = 0;
  922.     YY_INPUT( yy_ch_buf, yy_n_chars, YY_MAX_LINE );
  923.  
  924.     if ( yy_n_chars == YY_NULL )
  925.         {
  926.         yy_saw_eof = 1;
  927.  
  928.         if ( yywrap() )
  929.         return ( EOF );
  930.  
  931.         YY_INIT;
  932.  
  933.         return ( input() );
  934.         }
  935.  
  936.     yy_c_buf_p = -1;
  937.     yy_e_buf_p = yy_n_chars - 1;
  938.     }
  939.  
  940.     c = yy_ch_buf[++yy_c_buf_p];
  941.  
  942.     YY_DO_BEFORE_ACTION;
  943.  
  944.     return ( c );
  945.     }
  946. # line 282 "com.l"
  947.  
  948.  
  949. /* myesc - return character corresponding to escape sequence
  950.  *
  951.  * synopsis
  952.  *    char array[], c, myesc();
  953.  *    c = myesc( array );
  954.  *
  955.  */
  956.  
  957. char
  958. myesc(array)
  959. char *array;
  960. {
  961.     char c, esc_char;
  962.     register int sptr = 2;
  963.  
  964.     switch (array[1]) {
  965.         case 'n': return ('\n');
  966.         case 't': return ('\t');
  967.         case 'f': return ('\f');
  968.         case 'r': return ('\r');
  969.         case 'b': return ('\b');
  970.     
  971.         case '0':
  972.             if(isdigit(array[2])) { /* \0<octal> */
  973.         
  974.                 /* don't increment inside loop control because the
  975.                  * macro will expand it to two increments!  (Not a
  976.                  * problem with the C version of the macro)
  977.                  */
  978.                 while(isdigit(array[sptr]))
  979.                     ++sptr;
  980.         
  981.                 c = array[sptr];
  982.                 array[sptr] = '\0';
  983.         
  984.                 esc_char = otoi(array + 2);
  985.                 array[sptr] = c;
  986.         
  987.                 return(esc_char);
  988.  
  989.             } else if((array[2] == 'x') || (array[2] == 'X')) { /* hex */
  990.                 /* do hex stuff. Format is ALWAYS 0x## */
  991.                 sptr+=3;
  992.         
  993.                 c = array[sptr];
  994.                 array[sptr] = '\0';
  995.         
  996.                 esc_char = htoi(array + 3);
  997.                 array[sptr] = c;
  998.         
  999.                 return(esc_char);
  1000.  
  1001.             } else {
  1002.                 return (0);
  1003.             }
  1004.             break;
  1005.  
  1006.         case '^':
  1007.             if (array[2]>='a')
  1008.                 return (array[2]-'a'+1);
  1009.             else
  1010.                 return (array[2]-'A'+1);
  1011.  
  1012.             break;
  1013.     }
  1014.     return(array[1]);
  1015. }
  1016.  
  1017. int
  1018. otoi(char *a)
  1019. {
  1020.  
  1021.     int        x=0;
  1022.  
  1023.     while(*a) {
  1024.         x <<= 3;
  1025.         x += *a++ - '0';
  1026.     }
  1027.     return(x);
  1028. }
  1029.  
  1030. int
  1031. htoi(char *a)
  1032. {
  1033.     int        x=0;
  1034.  
  1035.     while (*a) {
  1036.         if (*a<'A') {
  1037.             x=(x<<4) + (*a-'0');
  1038.         } else {
  1039.             if (*a<'a')
  1040.               x=(x<<4)+(*a-'A'+10);
  1041.             else
  1042.               x=(x<<4)+(*a-'a'+10);
  1043.         }
  1044.         a++;
  1045.     }
  1046.     return(x);
  1047. }
  1048.