- Subject: tool to create define_keywords
- From: "Klaus Schmid" <klaus.schmid@xxxxxx>
- Date: Thu, 7 Nov 2002 22:41:05 +0100
To ease writing define_keywords lines, I wrote
the following tool. (see also home.wtal.de/klaus/jed/)
%-*- mode: slang; mode: fold; -*-
% klaus.schmid 2002-11-07
define makedks_read() % %{{{
{
variable i, s= String_Type[3];
bob();
while (andelse{ bol_fsearch( "#iffalse")}{ down(1)})
if (i= looking_at( "keywords"), i) break;
if (not i) error("flag not found");
for (i=0;i<3;i++)
{
s[i]= "";
while ( down(1))
{
skip_white(); if ( eolp()) break;
push_mark(); skip_chars( "^ \t");
if ( s[i] != "") s[i]+= " ";
s[i]+= bufsubstr();
}
}
return s;
}
%}}}
define makedks_cmp( a, b) % %{{{
{
if ( strlen(a) < strlen(b)) return -1;
if ( strlen(a) > strlen(b)) return +1;
if ( a < b) return -1;
if ( a > b) return +1;
return 0;
}
%}}}
define makedks_a( a) % %{{{
{
variable i, s;
if (not length(a)) return a;
a= a[array_sort(a,&makedks_cmp)];
s= "";
for (i=0;i<length(a);i++)
{
if (orelse{not i}{strlen(a[i])!=strlen(a[i-1])})
{
if (i) s+= " ";
s+= string(strlen(a[i]))+";";
}
s+= a[i];
}
return strchop( s, ' ', 0);
}
%}}}
define makedks() % %{{{
{
variable i, t, v, s, a,;
s= makedks_read();
bob();
()= fsearch( "create_syntax_table");
()= ffind( "("); push_mark(); ()= ffind( ")");
v= "()=define_keywords_n"+bufsubstr()+",\"";
()= down(1);
if ( fsearch( "define_keywords"))
{
bol(); push_mark();
while (andelse{ down(1)}{ ffind( "define_keywords")});
del_region();
}
for (i=0;i<length(s);i++)
{
a= strchop( s[i], ' ', 0);
a= makedks_a( a);
foreach( a)
{
% t= ();
t= strchop( (), ';', 0);
insert( v+t[1]+"\","+t[0]+","+string(i)+");\n");
}
}
}
%}}}
example
-------------------------------------------------------------------
private variable m= "CSS";
create_syntax_table(m);
define_syntax( "/*", "*/", '%',m); % comment
......................
% define keywords for pre-preprocessing with makedks
()=define_keywords_n(m,"abipq",1,0);
()=define_keywords_n(m,"brdlemh1h2h3h4h5h6hroltdthtrttul",2,0);
()=define_keywords_n(m,"coldeldfndivimginskbdmapprevar",3,0);
.......................
()=define_keywords_n(m,"blockquote",10,0);
()=define_keywords_n(m,"clipfont",4,1);
......
()=define_keywords_n(m,"dashed",6,2);
#iffalse
keywords -- 0, 1 and 2, each delimited by a blank line
body
p
hr
br
span
......................
fieldset
padding
.......................
display
font
solid
dashed
none
left
right
#endif
-------------------------------------------------------------------
Has anyone fortunately a complete list of (supported) css2 keywords?
(for syntax highlighting and maybe context-sensitive tab completion)
Klaus
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]