]> code.delx.au - gnu-emacs/blobdiff - src/syntax.h
Merge from emacs-23
[gnu-emacs] / src / syntax.h
index 03aad0a08dd9c524cbc8bdf2a6f3fe778cc92db1..77902a041430d8c96ce4628a284a4fbd63c824af 100644 (file)
@@ -19,7 +19,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 extern Lisp_Object Qsyntax_table_p;
-extern void update_syntax_table P_ ((int, int, int, Lisp_Object));
+extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object);
 
 /* The standard syntax table is stored where it will automatically
    be used in all new buffers.  */
@@ -128,56 +128,9 @@ extern Lisp_Object syntax_temp;
     : Qnil))
 #endif
 
-/* Then there are seven single-bit flags that have the following meanings:
-  1. This character is the first of a two-character comment-start sequence.
-  2. This character is the second of a two-character comment-start sequence.
-  3. This character is the first of a two-character comment-end sequence.
-  4. This character is the second of a two-character comment-end sequence.
-  5. This character is a prefix, for backward-prefix-chars.
-  6. see below
-  7. This character is part of a nestable comment sequence.
-  Note that any two-character sequence whose first character has flag 1
-  and whose second character has flag 2 will be interpreted as a comment start.
 
-  bit 6 is used to discriminate between two different comment styles.
-  Languages such as C++ allow two orthogonal syntax start/end pairs
-  and bit 6 is used to determine whether a comment-end or Scommentend
-  ends style a or b.  Comment start sequences can start style a or b.
-  Style a is always the default.
-  */
-
-/* These macros extract a particular flag for a given character.  */
-
-#define SYNTAX_COMSTART_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 16) & 1)
-
-#define SYNTAX_COMSTART_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 17) & 1)
-
-#define SYNTAX_COMEND_FIRST(c) ((SYNTAX_WITH_FLAGS (c) >> 18) & 1)
-
-#define SYNTAX_COMEND_SECOND(c) ((SYNTAX_WITH_FLAGS (c) >> 19) & 1)
-
-#define SYNTAX_PREFIX(c) ((SYNTAX_WITH_FLAGS (c) >> 20) & 1)
-
-#define SYNTAX_COMMENT_STYLE(c) ((SYNTAX_WITH_FLAGS (c) >> 21) & 1)
-
-#define SYNTAX_COMMENT_NESTED(c) ((SYNTAX_WITH_FLAGS (c) >> 22) & 1)
-
-/* These macros extract specific flags from an integer
-   that holds the syntax code and the flags.  */
-
-#define SYNTAX_FLAGS_COMSTART_FIRST(flags) (((flags) >> 16) & 1)
-
-#define SYNTAX_FLAGS_COMSTART_SECOND(flags) (((flags) >> 17) & 1)
-
-#define SYNTAX_FLAGS_COMEND_FIRST(flags) (((flags) >> 18) & 1)
-
-#define SYNTAX_FLAGS_COMEND_SECOND(flags) (((flags) >> 19) & 1)
-
-#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_STYLE(flags) (((flags) >> 21) & 1)
-
-#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
+/* Whether the syntax of the character C has the prefix flag set.  */
+extern int syntax_prefix_flag_p (int c);
 
 /* This array, indexed by a character, contains the syntax code which that
  character signifies (as a char).  For example,
@@ -245,6 +198,14 @@ extern char syntax_code_spec[16];
         1)                                                     \
       : 0))
 
+/* This macro sets up the buffer-global syntax table.  */
+#define SETUP_BUFFER_SYNTAX_TABLE()                                    \
+do                                                                     \
+  {                                                                    \
+    gl_state.use_global = 0;                                           \
+    gl_state.current_syntax_table = current_buffer->syntax_table;      \
+  } while (0)
+
 /* This macro should be called with FROM at the start of forward
    search, or after the last position of the backward search.  It
    makes sure that the first char is picked up with correct table, so
@@ -256,12 +217,11 @@ extern char syntax_code_spec[16];
 #define SETUP_SYNTAX_TABLE(FROM, COUNT)                                        \
 do                                                                     \
   {                                                                    \
+    SETUP_BUFFER_SYNTAX_TABLE ();                                      \
     gl_state.b_property = BEGV;                                                \
     gl_state.e_property = ZV + 1;                                      \
     gl_state.object = Qnil;                                            \
-    gl_state.use_global = 0;                                           \
     gl_state.offset = 0;                                               \
-    gl_state.current_syntax_table = current_buffer->syntax_table;      \
     if (parse_sexp_lookup_properties)                                  \
       if ((COUNT) > 0 || (FROM) > BEGV)                                        \
         update_syntax_table ((COUNT) > 0 ? (FROM) : (FROM) - 1, (COUNT),\
@@ -279,6 +239,7 @@ while (0)
 #define SETUP_SYNTAX_TABLE_FOR_OBJECT(OBJECT, FROM, COUNT)             \
 do                                                                     \
   {                                                                    \
+    SETUP_BUFFER_SYNTAX_TABLE ();                                      \
     gl_state.object = (OBJECT);                                                \
     if (BUFFERP (gl_state.object))                                     \
       {                                                                        \
@@ -305,8 +266,6 @@ do                                                                  \
        gl_state.e_property = 1 + SCHARS (gl_state.object);             \
        gl_state.offset = 0;                                            \
       }                                                                        \
-    gl_state.use_global = 0;                                           \
-    gl_state.current_syntax_table = current_buffer->syntax_table;      \
     if (parse_sexp_lookup_properties)                                  \
       update_syntax_table (((FROM) + gl_state.offset                   \
                            + (COUNT > 0 ? 0 :  -1)),                   \
@@ -340,9 +299,8 @@ struct gl_state_s
 
 extern struct gl_state_s gl_state;
 extern int parse_sexp_lookup_properties;
-extern INTERVAL interval_of P_ ((int, Lisp_Object));
 
-extern int scan_words P_ ((int, int));
+extern EMACS_INT scan_words (EMACS_INT, EMACS_INT);
 
 /* arch-tag: 28833cca-cd73-4741-8c85-a3111166a0e0
    (do not change this comment) */