Merge git://factorcode.org/git/factor

db4
Doug Coleman 2008-01-18 06:43:09 -10:00
commit 1a2bec9875
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 find a mode file which depends on this flaw, please fix it and submit
the changes to the jEdit project. 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 If you wish to contribute a new or improved mode file, please contact
the jEdit project. Updated mode files in jEdit will be periodically the jEdit project. Updated mode files in jEdit will be periodically
imported into the Factor source tree. imported into the Factor source tree.

View File

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

View File

@ -10,6 +10,7 @@ end
; ;
: <line-context> ( ruleset parent -- line-context ) : <line-context> ( ruleset parent -- line-context )
over [ "no context" throw ] unless
{ set-line-context-in-rule-set set-line-context-parent } { set-line-context-in-rule-set set-line-context-parent }
line-context construct ; 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 f "font:75%/1.6em \"Lucida Grande\", \"Lucida Sans Unicode\", verdana, geneva, sans-serif;" "css" load-mode tokenize-line 2drop
] unit-test ] 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> <SEQ TYPE="COMMENT1">/**/</SEQ>
<!-- Javadoc comment --> <!-- Javadoc comment -->
<SPAN TYPE="COMMENT3" DELEGATE="JAVADOC"> <SPAN TYPE="COMMENT3">
<BEGIN>/**</BEGIN> <BEGIN>/**</BEGIN>
<END>*/</END> <END>*/</END>
</SPAN> </SPAN>

View File

@ -33,7 +33,7 @@
</SPAN> </SPAN>
<!-- List literals --> <!-- List literals -->
<SPAN TYPE="LITERAL2" NO_LINE_BREAK="TRUE" DELEGATE="LIST"> <SPAN TYPE="LITERAL2" NO_LINE_BREAK="TRUE">
<BEGIN>[</BEGIN> <BEGIN>[</BEGIN>
<END>]</END> <END>]</END>
</SPAN> </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="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> <EOL_SPAN_REGEXP HASH_CHAR="if" TYPE="MARKUP" DELEGATE="c::CONDITION">if\b</EOL_SPAN_REGEXP>
<IMPORT DELEGATE="LEX"/> <IMPORT DELEGATE="c::LEX"/>
<!-- Directives --> <!-- Directives -->
<KEYWORDS> <KEYWORDS>

View File

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

View File

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

View File

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