home *** CD-ROM | disk | FTP | other *** search
/ cs.rhul.ac.uk / www.cs.rhul.ac.uk.zip / www.cs.rhul.ac.uk / pub / rdp / rdp_cs3470.tar / rdp_supp / scan.h < prev    next >
C/C++ Source or Header  |  1998-05-07  |  2KB  |  72 lines

  1. /*******************************************************************************
  2. *
  3. * RDP release 1.50 by Adrian Johnstone (A.Johnstone@rhbnc.ac.uk) 20 December 1997
  4. *
  5. * scan.h - a programmable scanner
  6. *
  7. * This file may be freely distributed. Please mail improvements to the author.
  8. *
  9. *******************************************************************************/
  10. #ifndef SCAN_H
  11. #define SCAN_H
  12.  
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include "set.h"
  16. #include "symbol.h"
  17.  
  18. #define SCAN_DATA   \
  19. char * id; \
  20. int token; \
  21. int extended; \
  22. union{ \
  23.   long unsigned u; \
  24.   long int i; \
  25.   double r; \
  26.   void * p; \
  27. }data; 
  28.  
  29. #define SCAN_CAST ((scan_data*) text_scan_data)
  30.  
  31. typedef long int integer; 
  32.  
  33. extern char * scan_token_names; 
  34. extern void * scan_table; 
  35.  
  36. typedef struct
  37. {
  38.   SCAN_DATA
  39. }scan_data; 
  40.  
  41. extern int scan_case_insensitive;  /* this will dissapear at V2.00 */
  42. extern int scan_show_skips; 
  43. extern int scan_newline_visible;  /* this will dissapear at V2.00 */
  44. extern int scan_symbol_echo; 
  45. extern long unsigned scan_derivation_step; 
  46.  
  47. /* Warning: if you change this list, the routine rdp_make_token_string in
  48.    rdp_prnt.c must also be updated to match in two places! */
  49. enum scan_primitive_type
  50. {
  51.   SCAN_P_IGNORE, SCAN_P_ID, SCAN_P_INTEGER, SCAN_P_REAL, 
  52.   SCAN_P_CHAR, SCAN_P_CHAR_ESC, 
  53.   SCAN_P_STRING, SCAN_P_STRING_ESC, 
  54.   SCAN_P_COMMENT, SCAN_P_COMMENT_VISIBLE, 
  55.   SCAN_P_COMMENT_NEST, SCAN_P_COMMENT_NEST_VISIBLE, 
  56.   SCAN_P_COMMENT_LINE, SCAN_P_COMMENT_LINE_VISIBLE, 
  57.   SCAN_P_EOF, SCAN_P_EOLN, SCAN_P_TOP
  58. }; 
  59.  
  60. void scan_(void); 
  61. unsigned long scan_column_number(void); 
  62. void scan_init(const int case_insensitive, const int newline_visible, const int show_skips, const int symbol_echo, char * token_names); 
  63. unsigned long scan_line_number(void); 
  64. void scan_load_keyword(char * id1, const char * id2, const int token, const int extended); 
  65. void scan_prune_tree(scan_data * rdp_tree); 
  66. int scan_test(const char * production, const int valid, set_ * stop); 
  67. int scan_test_set(const char * production, set_ * valid, set_ * stop); 
  68. void scan_vcg_print_node(const void * node); 
  69. #endif
  70.  
  71. /* End of scan.h */
  72.