Commit e0b8ff93 authored by Karl Heuer's avatar Karl Heuer
Browse files

(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte

characters.
(SYNTAX_ENTRY_FOLLOW_PARENT): New macro.
(SYNTAX_ENTRY): Handle syntax of multibyte characters.
(SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH): Don't signal error even
if a syntax entry is not cons.
parent 93da5fff
......@@ -51,95 +51,91 @@ enum syntaxcode
Smax /* Upper bound on codes that are meaningful */
};
/* Fetch the syntax entry for char C from table TABLE.
This returns the whole entry (normally a cons cell)
and does not do any kind of inheritance. */
#if 1
#define RAW_SYNTAX_ENTRY(table, c) \
(XCHAR_TABLE (table)->contents[(unsigned char) (c)])
/* Set the syntax entry VAL for char C in table TABLE. */
#define SET_RAW_SYNTAX_ENTRY(table, c, val) \
(XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val))
((unsigned)(c) < 128 \
? (XCHAR_TABLE (table)->contents[(unsigned) (c)] = (val)) \
: Faset ((table), (unsigned) (c), (val)))
/* Fetch the syntax entry for char C in syntax table TABLE.
This macro is called only when C is less than CHAR_TABLE_ORDINARY_SLOTS.
Do inheritance. */
#ifdef __GNUC__
#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
({ Lisp_Object tbl = table; \
Lisp_Object temp = XCHAR_TABLE (tbl)->contents[(c)]; \
while (NILP (temp)) \
{ \
tbl = XCHAR_TABLE (tbl)->parent; \
if (NILP (tbl)) \
break; \
temp = XCHAR_TABLE (tbl)->contents[(c)]; \
} \
temp; })
#else
#define RAW_SYNTAX_ENTRY(table, c) \
((c) >= 128 \
? raw_syntax_table_lookup (table, c) \
: XCHAR_TABLE (table)->contents[(unsigned char) (c)])
extern Lisp_Object syntax_temp;
extern Lisp_Object syntax_parent_lookup ();
#define SET_RAW_SYNTAX_ENTRY(table, c, val) \
((c) >= 128 \
? set_raw_syntax_table_lookup (table, c, (val)) \
: XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val))
#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
(syntax_temp = XCHAR_TABLE (table)->contents[(c)], \
(NILP (syntax_temp) \
? syntax_parent_lookup (table, (c)) \
: syntax_temp))
#endif
/* Fetch the syntax entry for char C in the current syntax table.
This returns the whole entry (normally a cons cell).
Do Inheritance. */
#define SYNTAX_ENTRY(c) \
((unsigned) (c) < CHAR_TABLE_ORDINARY_SLOTS \
? SYNTAX_ENTRY_FOLLOW_PARENT (current_buffer->syntax_table, (unsigned) (c))\
: Faref (current_buffer->syntax_table, make_number (c)))
/* Extract the information from the entry for character C
in syntax table TABLE. Do inheritance. */
in the current syntax table. */
#ifdef __GNUC__
#define SYNTAX_ENTRY(c) \
({ Lisp_Object temp, table; \
unsigned char cc = (c); \
table = current_buffer->syntax_table; \
while (!NILP (table)) \
{ \
temp = RAW_SYNTAX_ENTRY (table, cc); \
if (!NILP (temp)) \
break; \
table = XCHAR_TABLE (table)->parent; \
} \
temp; })
#define SYNTAX(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? (enum syntaxcode) (XINT (XCONS (temp)->car) & 0xff) \
: wrong_type_argument (Qconsp, temp)); })
: Swhitespace); })
#define SYNTAX_WITH_FLAGS(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? XINT (XCONS (temp)->car) \
: wrong_type_argument (Qconsp, temp)); })
: (int) Swhitespace); })
#define SYNTAX_MATCH(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? XINT (XCONS (temp)->cdr) \
: wrong_type_argument (Qconsp, temp)); })
: Qnil); })
#else
extern Lisp_Object syntax_temp;
extern Lisp_Object syntax_parent_lookup ();
#define SYNTAX_ENTRY(c) \
(syntax_temp \
= RAW_SYNTAX_ENTRY (current_buffer->syntax_table, (c)), \
(NILP (syntax_temp) \
? (syntax_temp \
= syntax_parent_lookup (current_buffer->syntax_table, \
(unsigned char) (c))) \
: syntax_temp))
#define SYNTAX(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? (enum syntaxcode) (XINT (XCONS (syntax_temp)->car) & 0xff) \
: wrong_type_argument (Qconsp, syntax_temp)))
: Swhitespace))
#define SYNTAX_WITH_FLAGS(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCONS (syntax_temp)->car) \
: wrong_type_argument (Qconsp, syntax_temp)))
: (int) Swhitespace))
#define SYNTAX_MATCH(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCONS (syntax_temp)->cdr) \
: wrong_type_argument (Qconsp, syntax_temp)))
: Qnil))
#endif
/* Then there are six single-bit flags that have the following meanings:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment