home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / syntax.h < prev    next >
C/C++ Source or Header  |  1999-01-02  |  4KB  |  103 lines

  1. /* -*-C-*-
  2.  
  3. $Id: syntax.h,v 1.10 1999/01/02 06:11:34 cph Exp $
  4.  
  5. Copyright (c) 1987-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /* Definitions for Edwin syntax tables. */
  23.  
  24. /* NOTE: This program was created by translation from the syntax table
  25. code of GNU Emacs; it was translated from the original C to 68000
  26. assembly language (in 1986), and then translated back from 68000
  27. assembly language to C (in 1987).  Users should be aware that the GNU
  28. GENERAL PUBLIC LICENSE may apply to this code.  A copy of that license
  29. should have been included along with this file. */
  30.  
  31. /* CODE is the syntax code for the character. */
  32. #define SYNTAX_ENTRY_CODE(entry) ((enum syntaxcode) ((entry) & 0xF))
  33.  
  34. /* MATCH is a matching delimiter, if the character is a delimiter type.
  35.    For example, if the character is '(', then MATCH is usually ')'. */
  36. #define SYNTAX_ENTRY_MATCH(entry) (((entry) >> 4) & 0xFF)
  37.  
  38. /* Bits indicating whether this character is part of a two-character
  39.    comment delimiter sequence. */
  40. #define SYNTAX_ENTRY_COMMENT_BITS(entry) (((entry) >> 12) & 0xFF)
  41.  
  42. #define COMSTART_FIRST_A    0x80
  43. #define COMSTART_FIRST_B    0x40
  44. #define COMSTART_SECOND_A    0x20
  45. #define COMSTART_SECOND_B    0x10
  46. #define COMEND_FIRST_A        0x08
  47. #define COMEND_FIRST_B        0x04
  48. #define COMEND_SECOND_A        0x02
  49. #define COMEND_SECOND_B        0x01
  50.  
  51. #define COMMENT_STYLE_A        0xAA
  52. #define COMMENT_STYLE_B        0x55
  53. #define COMSTART_FIRST        0xC0
  54. #define COMSTART_SECOND        0x30
  55. #define COMEND_FIRST        0x0C
  56. #define COMEND_SECOND        0x03
  57.  
  58. #define SYNTAX_ENTRY_COMMENT_STYLE(sentry, m)                \
  59.   ((((SYNTAX_ENTRY_COMMENT_BITS (sentry)) & (m) & COMMENT_STYLE_A)    \
  60.     ? COMMENT_STYLE_A                            \
  61.     : 0)                                \
  62.    | (((SYNTAX_ENTRY_COMMENT_BITS (sentry)) & (m) & COMMENT_STYLE_B)    \
  63.       ? COMMENT_STYLE_B                            \
  64.       : 0))
  65.  
  66. /* PREFIX says to skip over this character if it precedes an s-expression.  */
  67. #define SYNTAX_ENTRY_PREFIX(entry) (((entry) >> 20) & 1)
  68.  
  69. enum syntaxcode            /* The possible syntax codes. */
  70.   {
  71.     syntaxcode_whitespace,    /* whitespace char */
  72.     syntaxcode_punct,        /* random punctuation char */
  73.     syntaxcode_word,        /* word constituent */
  74.     syntaxcode_symbol,        /* symbol constituent other than word */
  75.     syntaxcode_open,        /* beginning delimiter */
  76.     syntaxcode_close,        /* ending delimiter */
  77.     syntaxcode_quote,        /* prefix char like Lisp ' */
  78.     syntaxcode_string,        /* string-grouping char like Lisp " */
  79.     syntaxcode_math,        /* delimiters like $ in Tex. */
  80.     syntaxcode_escape,        /* char that begins a C-style escape */
  81.     syntaxcode_charquote,    /* char that quotes the following char */
  82.     syntaxcode_comment,        /* a comment-starting char */
  83.     syntaxcode_endcomment,    /* a comment-ending char */
  84.     syntaxcode_max        /* Upper bound on codes that are meaningful */
  85.   };
  86.  
  87. #define SYNTAX_ENTRY_QUOTE(entry)                    \
  88.   (((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_escape) ||        \
  89.    ((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_charquote))
  90.  
  91. /* This array, indexed by a character, contains the syntax code which that
  92.    character signifies (as a char).  For example,
  93.    ((enum syntaxcode) syntax_spec_code['w']) is syntaxcode_word. */
  94. extern char syntax_spec_code[0200];
  95.  
  96. #define SYNTAX_TABLE_P(argument)                    \
  97.   ((VECTOR_P (argument)) && ((VECTOR_LENGTH (argument)) == 0x100))
  98.  
  99. #define SYNTAX_TABLE_TYPE SCHEME_OBJECT
  100.  
  101. #define SYNTAX_TABLE_REF(table, index)                    \
  102.   (VECTOR_REF ((table), ((index) & 0xFF)))
  103.