comparison src/font-lock.c @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents ac2d302a0011
children 859a2309aef8
comparison
equal deleted inserted replaced
15:ad457d5f7d04 16:0293115a14e9
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 Lisp_Object syntax_table = buf->syntax_table; 417 Lisp_Object syntaxtab = buf->syntax_table;
418 Emchar prev_c, c; 418 Emchar prev_c, c;
419 Bufpos target = pt; 419 Bufpos target = pt;
420 setup_context_cache (buf, pt); 420 setup_context_cache (buf, pt);
421 pt = context_cache.cur_point; 421 pt = context_cache.cur_point;
422 422
468 { 468 {
469 context_cache.backslash_p = 0; 469 context_cache.backslash_p = 0;
470 continue; 470 continue;
471 } 471 }
472 472
473 switch (SYNTAX (syntax_table, c)) 473 switch (SYNTAX (syntaxtab, c))
474 { 474 {
475 case Sescape: 475 case Sescape:
476 context_cache.backslash_p = 1; 476 context_cache.backslash_p = 1;
477 break; 477 break;
478 478
489 case Scomment: 489 case Scomment:
490 if (context_cache.context == context_none) 490 if (context_cache.context == context_none)
491 { 491 {
492 context_cache.context = context_comment; 492 context_cache.context = context_comment;
493 context_cache.ccontext = ccontext_none; 493 context_cache.ccontext = ccontext_none;
494 context_cache.style = SINGLE_SYNTAX_STYLE (syntax_table, c); 494 context_cache.style = SINGLE_SYNTAX_STYLE (syntaxtab, c);
495 if (context_cache.style == comment_style_none) abort (); 495 if (context_cache.style == comment_style_none) abort ();
496 } 496 }
497 break; 497 break;
498 498
499 case Sendcomment: 499 case Sendcomment:
500 if (context_cache.style != SINGLE_SYNTAX_STYLE (syntax_table, c)) 500 if (context_cache.style != SINGLE_SYNTAX_STYLE (syntaxtab, c))
501 ; 501 ;
502 else if (context_cache.context == context_comment) 502 else if (context_cache.context == context_comment)
503 { 503 {
504 context_cache.context = context_none; 504 context_cache.context = context_none;
505 context_cache.style = comment_style_none; 505 context_cache.style = comment_style_none;
522 context_cache.context = context_none; 522 context_cache.context = context_none;
523 context_cache.scontext = '\000'; 523 context_cache.scontext = '\000';
524 } 524 }
525 else if (context_cache.context == context_none) 525 else if (context_cache.context == context_none)
526 { 526 {
527 Lisp_Object stringtermobj = syntax_match (syntax_table, c); 527 Lisp_Object stringtermobj = syntax_match (syntaxtab, c);
528 Emchar stringterm; 528 Emchar stringterm;
529 529
530 if (CHARP (stringtermobj)) 530 if (CHARP (stringtermobj))
531 stringterm = XCHAR (stringtermobj); 531 stringterm = XCHAR (stringtermobj);
532 else 532 else
543 543
544 /* That takes care of the characters with manifest syntax. 544 /* That takes care of the characters with manifest syntax.
545 Now we've got to hack multi-char sequences that start 545 Now we've got to hack multi-char sequences that start
546 and end block comments. 546 and end block comments.
547 */ 547 */
548 if ((SYNTAX_COMMENT_BITS (syntax_table, c) & 548 if ((SYNTAX_COMMENT_BITS (syntaxtab, c) &
549 SYNTAX_SECOND_CHAR_START) && 549 SYNTAX_SECOND_CHAR_START) &&
550 context_cache.context == context_none && 550 context_cache.context == context_none &&
551 context_cache.ccontext == ccontext_start1 && 551 context_cache.ccontext == ccontext_start1 &&
552 SYNTAX_START_P (syntax_table, prev_c, c) /* the two chars match */ 552 SYNTAX_START_P (syntaxtab, prev_c, c) /* the two chars match */
553 ) 553 )
554 { 554 {
555 context_cache.ccontext = ccontext_start2; 555 context_cache.ccontext = ccontext_start2;
556 context_cache.style = SYNTAX_START_STYLE (syntax_table, prev_c, c); 556 context_cache.style = SYNTAX_START_STYLE (syntaxtab, prev_c, c);
557 if (context_cache.style == comment_style_none) abort (); 557 if (context_cache.style == comment_style_none) abort ();
558 } 558 }
559 else if ((SYNTAX_COMMENT_BITS (syntax_table, c) & 559 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) &
560 SYNTAX_FIRST_CHAR_START) && 560 SYNTAX_FIRST_CHAR_START) &&
561 context_cache.context == context_none && 561 context_cache.context == context_none &&
562 (context_cache.ccontext == ccontext_none || 562 (context_cache.ccontext == ccontext_none ||
563 context_cache.ccontext == ccontext_start1)) 563 context_cache.ccontext == ccontext_start1))
564 { 564 {
565 context_cache.ccontext = ccontext_start1; 565 context_cache.ccontext = ccontext_start1;
566 context_cache.style = comment_style_none; /* should be this already*/ 566 context_cache.style = comment_style_none; /* should be this already*/
567 } 567 }
568 else if ((SYNTAX_COMMENT_BITS (syntax_table, c) & 568 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) &
569 SYNTAX_SECOND_CHAR_END) && 569 SYNTAX_SECOND_CHAR_END) &&
570 context_cache.context == context_block_comment && 570 context_cache.context == context_block_comment &&
571 context_cache.ccontext == ccontext_end1 && 571 context_cache.ccontext == ccontext_end1 &&
572 SYNTAX_END_P (syntax_table, prev_c, c) && 572 SYNTAX_END_P (syntaxtab, prev_c, c) &&
573 /* the two chars match */ 573 /* the two chars match */
574 context_cache.style == 574 context_cache.style ==
575 SYNTAX_END_STYLE (syntax_table, prev_c, c) 575 SYNTAX_END_STYLE (syntaxtab, prev_c, c)
576 ) 576 )
577 { 577 {
578 context_cache.context = context_none; 578 context_cache.context = context_none;
579 context_cache.ccontext = ccontext_none; 579 context_cache.ccontext = ccontext_none;
580 context_cache.style = comment_style_none; 580 context_cache.style = comment_style_none;
581 } 581 }
582 else if ((SYNTAX_COMMENT_BITS (syntax_table, c) & 582 else if ((SYNTAX_COMMENT_BITS (syntaxtab, c) &
583 SYNTAX_FIRST_CHAR_END) && 583 SYNTAX_FIRST_CHAR_END) &&
584 context_cache.context == context_block_comment && 584 context_cache.context == context_block_comment &&
585 (context_cache.style == 585 (context_cache.style ==
586 SYNTAX_END_STYLE (syntax_table, c, 586 SYNTAX_END_STYLE (syntaxtab, c,
587 BUF_FETCH_CHAR (buf, pt+1))) && 587 BUF_FETCH_CHAR (buf, pt+1))) &&
588 (context_cache.ccontext == ccontext_start2 || 588 (context_cache.ccontext == ccontext_start2 ||
589 context_cache.ccontext == ccontext_end1)) 589 context_cache.ccontext == ccontext_end1))
590 /* #### is it right to check for end1 here?? */ 590 /* #### is it right to check for end1 here?? */
591 { 591 {