Mercurial > hg > xemacs-beta
comparison src/font-lock.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 859a2309aef8 |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
412 | 412 |
413 static void | 413 static void |
414 find_context (struct buffer *buf, Bufpos pt) | 414 find_context (struct buffer *buf, Bufpos pt) |
415 { | 415 { |
416 /* This function can GC */ | 416 /* This function can GC */ |
417 struct Lisp_Char_Table *mirrortab = | |
418 XCHAR_TABLE (buf->mirror_syntax_table); | |
417 Lisp_Object syntaxtab = buf->syntax_table; | 419 Lisp_Object syntaxtab = buf->syntax_table; |
418 Emchar prev_c, c; | 420 Emchar prev_c, c; |
419 Bufpos target = pt; | 421 Bufpos target = pt; |
420 setup_context_cache (buf, pt); | 422 setup_context_cache (buf, pt); |
421 pt = context_cache.cur_point; | 423 pt = context_cache.cur_point; |
468 { | 470 { |
469 context_cache.backslash_p = 0; | 471 context_cache.backslash_p = 0; |
470 continue; | 472 continue; |
471 } | 473 } |
472 | 474 |
473 switch (SYNTAX (syntaxtab, c)) | 475 switch (SYNTAX (mirrortab, c)) |
474 { | 476 { |
475 case Sescape: | 477 case Sescape: |
476 context_cache.backslash_p = 1; | 478 context_cache.backslash_p = 1; |
477 break; | 479 break; |
478 | 480 |
489 case Scomment: | 491 case Scomment: |
490 if (context_cache.context == context_none) | 492 if (context_cache.context == context_none) |
491 { | 493 { |
492 context_cache.context = context_comment; | 494 context_cache.context = context_comment; |
493 context_cache.ccontext = ccontext_none; | 495 context_cache.ccontext = ccontext_none; |
494 context_cache.style = SINGLE_SYNTAX_STYLE (syntaxtab, c); | 496 context_cache.style = SINGLE_SYNTAX_STYLE (mirrortab, c); |
495 if (context_cache.style == comment_style_none) abort (); | 497 if (context_cache.style == comment_style_none) abort (); |
496 } | 498 } |
497 break; | 499 break; |
498 | 500 |
499 case Sendcomment: | 501 case Sendcomment: |
500 if (context_cache.style != SINGLE_SYNTAX_STYLE (syntaxtab, c)) | 502 if (context_cache.style != SINGLE_SYNTAX_STYLE (mirrortab, c)) |
501 ; | 503 ; |
502 else if (context_cache.context == context_comment) | 504 else if (context_cache.context == context_comment) |
503 { | 505 { |
504 context_cache.context = context_none; | 506 context_cache.context = context_none; |
505 context_cache.style = comment_style_none; | 507 context_cache.style = comment_style_none; |
543 | 545 |
544 /* That takes care of the characters with manifest syntax. | 546 /* That takes care of the characters with manifest syntax. |
545 Now we've got to hack multi-char sequences that start | 547 Now we've got to hack multi-char sequences that start |
546 and end block comments. | 548 and end block comments. |
547 */ | 549 */ |
548 if ((SYNTAX_COMMENT_BITS (syntaxtab, c) & | 550 if ((SYNTAX_COMMENT_BITS (mirrortab, c) & |
549 SYNTAX_SECOND_CHAR_START) && | 551 SYNTAX_SECOND_CHAR_START) && |
550 context_cache.context == context_none && | 552 context_cache.context == context_none && |
551 context_cache.ccontext == ccontext_start1 && | 553 context_cache.ccontext == ccontext_start1 && |
552 SYNTAX_START_P (syntaxtab, prev_c, c) /* the two chars match */ | 554 SYNTAX_START_P (mirrortab, prev_c, c) /* the two chars match */ |
553 ) | 555 ) |
554 { | 556 { |
555 context_cache.ccontext = ccontext_start2; | 557 context_cache.ccontext = ccontext_start2; |
556 context_cache.style = SYNTAX_START_STYLE (syntaxtab, prev_c, c); | 558 context_cache.style = SYNTAX_START_STYLE (mirrortab, prev_c, c); |
557 if (context_cache.style == comment_style_none) abort (); | 559 if (context_cache.style == comment_style_none) abort (); |
558 } | 560 } |
559 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) & | 561 else if ((SYNTAX_COMMENT_BITS (mirrortab, c) & |
560 SYNTAX_FIRST_CHAR_START) && | 562 SYNTAX_FIRST_CHAR_START) && |
561 context_cache.context == context_none && | 563 context_cache.context == context_none && |
562 (context_cache.ccontext == ccontext_none || | 564 (context_cache.ccontext == ccontext_none || |
563 context_cache.ccontext == ccontext_start1)) | 565 context_cache.ccontext == ccontext_start1)) |
564 { | 566 { |
565 context_cache.ccontext = ccontext_start1; | 567 context_cache.ccontext = ccontext_start1; |
566 context_cache.style = comment_style_none; /* should be this already*/ | 568 context_cache.style = comment_style_none; /* should be this already*/ |
567 } | 569 } |
568 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) & | 570 else if ((SYNTAX_COMMENT_BITS (mirrortab, c) & |
569 SYNTAX_SECOND_CHAR_END) && | 571 SYNTAX_SECOND_CHAR_END) && |
570 context_cache.context == context_block_comment && | 572 context_cache.context == context_block_comment && |
571 context_cache.ccontext == ccontext_end1 && | 573 context_cache.ccontext == ccontext_end1 && |
572 SYNTAX_END_P (syntaxtab, prev_c, c) && | 574 SYNTAX_END_P (mirrortab, prev_c, c) && |
573 /* the two chars match */ | 575 /* the two chars match */ |
574 context_cache.style == | 576 context_cache.style == |
575 SYNTAX_END_STYLE (syntaxtab, prev_c, c) | 577 SYNTAX_END_STYLE (mirrortab, prev_c, c) |
576 ) | 578 ) |
577 { | 579 { |
578 context_cache.context = context_none; | 580 context_cache.context = context_none; |
579 context_cache.ccontext = ccontext_none; | 581 context_cache.ccontext = ccontext_none; |
580 context_cache.style = comment_style_none; | 582 context_cache.style = comment_style_none; |
581 } | 583 } |
582 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) & | 584 else if ((SYNTAX_COMMENT_BITS (mirrortab, c) & |
583 SYNTAX_FIRST_CHAR_END) && | 585 SYNTAX_FIRST_CHAR_END) && |
584 context_cache.context == context_block_comment && | 586 context_cache.context == context_block_comment && |
585 (context_cache.style == | 587 (context_cache.style == |
586 SYNTAX_END_STYLE (syntaxtab, c, | 588 SYNTAX_END_STYLE (mirrortab, c, |
587 BUF_FETCH_CHAR (buf, pt+1))) && | 589 BUF_FETCH_CHAR (buf, pt+1))) && |
588 (context_cache.ccontext == ccontext_start2 || | 590 (context_cache.ccontext == ccontext_start2 || |
589 context_cache.ccontext == ccontext_end1)) | 591 context_cache.ccontext == ccontext_end1)) |
590 /* #### is it right to check for end1 here?? */ | 592 /* #### is it right to check for end1 here?? */ |
591 { | 593 { |