home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 11 / AUCD11B.iso / LANGUAGES / WraithSet / AwkStuff / MawkSrc / h / scan < prev    next >
Text File  |  1995-06-18  |  3KB  |  104 lines

  1.  
  2. /********************************************
  3. scan.h
  4. copyright 1991, Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13.  
  14. /* $Log: scan.h,v $
  15.  * Revision 1.3  1995/06/18  19:42:26  mike
  16.  * Remove some redundant declarations and add some prototypes
  17.  *
  18.  * Revision 1.2  1994/09/23  00:20:06  mike
  19.  * minor bug fix: handle \ in eat_nl()
  20.  *
  21.  * Revision 1.1.1.1  1993/07/03  18:58:20  mike
  22.  * move source to cvs
  23.  *
  24.  * Revision 5.1  1991/12/05  07:59:33  brennan
  25.  * 1.1 pre-release
  26.  *
  27. */
  28.  
  29.  
  30. /* scan.h  */
  31.  
  32. #ifndef  SCAN_H_INCLUDED
  33. #define  SCAN_H_INCLUDED   1
  34.  
  35. #include <stdio.h>
  36.  
  37. #ifndef   MAKESCAN
  38. #include  "symtype.h"
  39. #include  "parse.h"
  40. #endif
  41.  
  42.  
  43. extern  char scan_code[256] ;
  44.  
  45. /*  the scan codes to compactify the main switch */
  46.  
  47. #define  SC_SPACE               1
  48. #define  SC_NL                  2
  49. #define  SC_SEMI_COLON          3
  50. #define  SC_FAKE_SEMI_COLON     4
  51. #define  SC_LBRACE              5
  52. #define  SC_RBRACE              6
  53. #define  SC_QMARK               7
  54. #define  SC_COLON               8
  55. #define  SC_OR                  9
  56. #define  SC_AND                10
  57. #define  SC_PLUS               11
  58. #define  SC_MINUS              12
  59. #define  SC_MUL                13
  60. #define  SC_DIV                14
  61. #define  SC_MOD                15
  62. #define  SC_POW                16
  63. #define  SC_LPAREN             17
  64. #define  SC_RPAREN             18
  65. #define  SC_LBOX               19
  66. #define  SC_RBOX               20
  67. #define  SC_IDCHAR             21
  68. #define  SC_DIGIT              22
  69. #define  SC_DQUOTE             23
  70. #define  SC_ESCAPE             24
  71. #define  SC_COMMENT            25
  72. #define  SC_EQUAL              26
  73. #define  SC_NOT                27
  74. #define  SC_LT                 28
  75. #define  SC_GT                 29
  76. #define  SC_COMMA              30
  77. #define  SC_DOT                31
  78. #define  SC_MATCH              32
  79. #define  SC_DOLLAR             33
  80. #define  SC_UNEXPECTED         34
  81.  
  82. #ifndef  MAKESCAN
  83.  
  84. void  PROTO(eat_nl, (void) ) ;
  85.  
  86. /* in error.c */
  87. void  PROTO( unexpected_char, (void) ) ;
  88.  
  89. #define  ct_ret(x)  return current_token = (x)
  90.  
  91. #define  next() (*buffp ? *buffp++ : slow_next())
  92. #define  un_next()  buffp--
  93.  
  94. #define  test1_ret(c,x,d)  if ( next() == (c) ) ct_ret(x) ;\
  95.                            else { un_next() ; ct_ret(d) ; }
  96.  
  97. #define  test2_ret(c1,x1,c2,x2,d)   switch( next() )\
  98.                                    { case c1: ct_ret(x1) ;\
  99.                                      case c2: ct_ret(x2) ;\
  100.                                      default: un_next() ;\
  101.                                               ct_ret(d) ; }
  102. #endif  /* ! MAKESCAN  */
  103. #endif
  104.