XMode fixes

db4
Slava Pestov 2008-01-18 02:39:09 -05:00
parent 1e265b001c
commit 08e9503f84
10 changed files with 36 additions and 24 deletions

View File

@ -36,6 +36,9 @@ to depend on:
find a mode file which depends on this flaw, please fix it and submit
the changes to the jEdit project.
- References to non-existent rule sets in IMPORT tags and DELEGATE
attributes were ignored in jEdit. They raise an error in Factor.
If you wish to contribute a new or improved mode file, please contact
the jEdit project. Updated mode files in jEdit will be periodically
imported into the Factor source tree.

View File

@ -42,9 +42,12 @@ MEMO: (load-mode) ( name -- rule-sets )
SYMBOL: rule-sets
: no-such-rule-set ( name -- * )
"No such rule set: " swap append throw ;
: get-rule-set ( name -- rule-sets rules )
"::" split1 [ swap (load-mode) ] [ rule-sets get ] if*
tuck at ;
dup "::" split1 [ swap (load-mode) ] [ rule-sets get ] if*
dup -roll at* [ nip ] [ drop no-such-rule-set ] if ;
: resolve-delegate ( rule -- )
dup rule-delegate dup string?
@ -68,14 +71,11 @@ SYMBOL: rule-sets
: resolve-imports ( ruleset -- )
dup rule-set-imports [
get-rule-set dup [
swap rule-sets [
2dup import-keywords
import-rules
] with-variable
] [
3drop
] if
get-rule-set swap rule-sets [
dup resolve-delegates
2dup import-keywords
import-rules
] with-variable
] with each ;
: finalize-rule-set ( ruleset -- )
@ -99,7 +99,7 @@ SYMBOL: rule-sets
(load-mode) dup finalize-mode ;
: reset-modes ( -- )
\ load-mode "memoize" word-prop clear-assoc ;
\ (load-mode) "memoize" word-prop clear-assoc ;
: ?glob-matches ( string glob/f -- ? )
dup [ glob-matches? ] [ 2drop f ] if ;

View File

@ -10,6 +10,7 @@ end
;
: <line-context> ( ruleset parent -- line-context )
over [ "no context" throw ] unless
{ set-line-context-in-rule-set set-line-context-parent }
line-context construct ;

View File

@ -133,3 +133,11 @@ IN: temporary
] [
f "font:75%/1.6em \"Lucida Grande\", \"Lucida Sans Unicode\", verdana, geneva, sans-serif;" "css" load-mode tokenize-line 2drop
] unit-test
[
{
T{ token f "<" MARKUP }
T{ token f "aaa" MARKUP }
T{ token f ">" MARKUP }
}
] [ f "<aaa>" "html" load-mode tokenize-line nip ] unit-test

View File

@ -19,7 +19,7 @@
<SEQ TYPE="COMMENT1">/**/</SEQ>
<!-- Javadoc comment -->
<SPAN TYPE="COMMENT3" DELEGATE="JAVADOC">
<SPAN TYPE="COMMENT3">
<BEGIN>/**</BEGIN>
<END>*/</END>
</SPAN>

View File

@ -33,7 +33,7 @@
</SPAN>
<!-- List literals -->
<SPAN TYPE="LITERAL2" NO_LINE_BREAK="TRUE" DELEGATE="LIST">
<SPAN TYPE="LITERAL2" NO_LINE_BREAK="TRUE">
<BEGIN>[</BEGIN>
<END>]</END>
</SPAN>

View File

@ -89,7 +89,7 @@
<EOL_SPAN_REGEXP HASH_CHAR="elif" TYPE="MARKUP" DELEGATE="c::CONDITION">elif\b</EOL_SPAN_REGEXP>
<EOL_SPAN_REGEXP HASH_CHAR="if" TYPE="MARKUP" DELEGATE="c::CONDITION">if\b</EOL_SPAN_REGEXP>
<IMPORT DELEGATE="LEX"/>
<IMPORT DELEGATE="c::LEX"/>
<!-- Directives -->
<KEYWORDS>

View File

@ -200,11 +200,11 @@ for the other tags (data, document, etc). more support planned for future.
<END>*/</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>
@ -413,11 +413,11 @@ for the other tags (data, document, etc). more support planned for future.
</RULES>
<RULES IGNORE_CASE="TRUE" SET="powerdynamo-tag-general">
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>
@ -428,11 +428,11 @@ for the other tags (data, document, etc). more support planned for future.
</RULES>
<RULES IGNORE_CASE="TRUE" SET="powerdynamo-tag-data">
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>
@ -444,11 +444,11 @@ for the other tags (data, document, etc). more support planned for future.
</RULES>
<RULES IGNORE_CASE="TRUE" SET="powerdynamo-tag-document">
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>"</BEGIN>
<END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" DELEGATE="powerdynamo_LITERAL">
<SPAN TYPE="LITERAL1">
<BEGIN>'</BEGIN>
<END>'</END>
</SPAN>

View File

@ -23,7 +23,7 @@
<SEQ TYPE="COMMENT1">/**/</SEQ>
<!-- Javadoc comment -->
<SPAN TYPE="COMMENT2" DELEGATE="JAVADOC">
<SPAN TYPE="COMMENT2">
<BEGIN>/**</BEGIN>
<END>*/</END>
</SPAN>

View File

@ -101,7 +101,7 @@
HIGHLIGHT_DIGITS="TRUE"
DIGIT_RE="(0x[\p{XDigit}]+[lL]?|[\p{Digit}]+(e[\p{Digit}]*)?[lLdDfF]?)">
<SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE" DELEGATE="VARIABLE">
<SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE">
<BEGIN>${</BEGIN>
<END>}</END>
</SPAN>