summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-10-05 11:26:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2013-10-05 11:26:38 -0700
commite022ebd1f2b414837b60f434e6db26e2c999207a (patch)
tree69f4b0da06f9b44642bac62906cddcd1005e8924
parent33c2ad9765e7dc34b9c645b304cfd51524056d9e (diff)
downloadhc-e022ebd1f2b414837b60f434e6db26e2c999207a.tar.gz
hc-e022ebd1f2b414837b60f434e6db26e2c999207a.tar.bz2
hc-e022ebd1f2b414837b60f434e6db26e2c999207a.zip
Ground work for supporting attribute filtering.
-rw-r--r--Makefile5
-rw-r--r--hc.c100
-rw-r--r--hc.h6
-rw-r--r--wl89
-rw-r--r--wl.h768
-rw-r--r--wl.txr25
6 files changed, 896 insertions, 97 deletions
diff --git a/Makefile b/Makefile
index 0b9b82a..9a1cda8 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,13 @@ hc: lex.yy.o hc.o
lex.yy.o: lex.yy.c hc.h
-hc.o: hc.c hc.h
+hc.o: hc.c hc.h wl.h
lex.yy.c: hc.l hc.h
$(LEX) -i -8 hc.l
+wl.h: wl.txr wl
+ txr wl.txr > $@
+
clean:
-rm hc lex.yy.o lex.yy.c
diff --git a/hc.c b/hc.c
index 4c14e04..3efb28a 100644
--- a/hc.c
+++ b/hc.c
@@ -2,102 +2,10 @@
#include <stdlib.h>
#include <string.h>
#include "hc.h"
+#include "wl.h"
-static int allowed_el_spec[] = {
- tok_el_a,
- tok_el_abbr,
- tok_el_acronym,
- tok_el_address,
- /* tok_el_applet, */
- /* tok_el_area, */
- tok_el_b,
- /* tok_el_base, */
- tok_el_basefont,
- tok_el_bdo,
- tok_el_big,
- tok_el_blockquote,
- /* tok_el_body, */
- tok_el_br,
- /* tok_el_button, */
- tok_el_caption,
- tok_el_center,
- tok_el_cite,
- tok_el_code,
- tok_el_col,
- tok_el_colgroup,
- tok_el_dd,
- tok_el_del,
- tok_el_dfn,
- tok_el_dir,
- tok_el_div,
- tok_el_dl,
- tok_el_dt,
- tok_el_em,
- /* tok_el_fieldset, */
- tok_el_font,
- tok_el_form,
- /* tok_el_frame, */
- /* tok_el_frameset, */
- tok_el_h1,
- tok_el_h2,
- tok_el_h3,
- tok_el_h4,
- tok_el_h5,
- tok_el_h6,
- /* tok_el_head, */
- tok_el_hr,
- /* tok_el_html, */
- tok_el_i,
- /* tok_el_iframe, */
- tok_el_img,
- /* tok_el_input, */
- tok_el_ins,
- tok_el_kbd,
- /* tok_el_label, */
- /* tok_el_legend, */
- tok_el_li,
- /* tok_el_link, */
- /* tok_el_map, */
- /* tok_el_menu, */
- /* tok_el_meta, */
- /* tok_el_noframes, */
- /* tok_el_noscript, */
- /* tok_el_object, */
- tok_el_ol,
- tok_el_optgroup,
- /* tok_el_option, */
- tok_el_p,
- /* tok_el_param, */
- tok_el_pre,
- tok_el_q,
- tok_el_samp,
- /* tok_el_script,*/
- /* tok_el_select, */
- tok_el_small,
- tok_el_span,
- tok_el_strike,
- tok_el_strong,
- tok_el_style,
- tok_el_sub,
- tok_el_sup,
- tok_el_table,
- tok_el_tbody,
- tok_el_td,
- /* tok_el_textarea, */
- tok_el_tfoot,
- tok_el_th,
- tok_el_thead,
- /* tok_el_title, */
- tok_el_tr,
- tok_el_tt,
- tok_el_u,
- tok_el_ul,
- /* tok_el_var, */
- tok_eof,
-};
-
-static int allowed_el[tok_max];
+static allowed_el_t *allowed_el[tok_max];
static const token_t blank;
static token_t pushback;
@@ -253,8 +161,8 @@ static void init(void)
{
int i;
- for (i = 0; allowed_el_spec[i] != tok_eof; i++)
- allowed_el[allowed_el_spec[i]] = 1;
+ for (i = 0; allowed_el_spec[i].type != tok_eof; i++)
+ allowed_el[allowed_el_spec[i].type] = &allowed_el_spec[i];
}
int main(void)
diff --git a/hc.h b/hc.h
index 05bedfb..60e9dea 100644
--- a/hc.h
+++ b/hc.h
@@ -94,6 +94,7 @@ typedef enum {
tok_el_ul,
tok_el_var,
tok_at_unknown,
+ tok_at_abbr,
tok_at_accept,
tok_at_accept_charset,
tok_at_accesskey,
@@ -223,5 +224,10 @@ typedef struct {
char *lexeme;
} token_t;
+typedef struct {
+ int type;
+ int *attr;
+} allowed_el_t;
+
extern int yylex(void);
extern char *yytext;
diff --git a/wl b/wl
new file mode 100644
index 0000000..6051b6d
--- /dev/null
+++ b/wl
@@ -0,0 +1,89 @@
+a: charset class coords dir href hreflang id lang name style title type
+abbr: class dir id lang style title
+acronym: class dir id lang style title
+address: class dir id lang style title
+!applet:
+!area:
+b: class dir id lang style title
+!base:
+basefont: color face id size
+bdo: class dir id lang style title
+big: class dir id lang style title
+blockquote: cite class dir id lang style title
+!body:
+br: class clear id style title
+!button:
+caption: align class dir id lang style title
+center: class dir id lang style title
+cite: class dir id lang style title
+code: class dir id lang style title
+col: align char charoff class dir id lang span style title valign width
+colgroup: align char charoff class dir id lang span style title valign width
+dd: class dir id lang style title
+del: class datetime dir id lang style title
+dfn: class dir id lang style title
+dir: class compact dir id lang style title
+div: align class dir id lang style title
+dl: class compact dir id lang style title
+dt: class dir id lang style title
+em: class dir id lang style title
+!fieldset:
+font: class color dir face id lang size style title
+!form:
+!frame:
+!frameset:
+h1: align class dir id lang style title
+h2: align class dir id lang style title
+h3: align class dir id lang style title
+h4: align class dir id lang style title
+h5: align class dir id lang style title
+h6: align class dir id lang style title
+!head:
+hr: align class dir id lang size style title width
+!html:
+i: class dir id lang style title
+!iframe:
+img: align alt border class dir height id lang longdesc name src style title vspace width
+!input:
+ins: class datetime dir id lang style title
+kbd: class dir id lang style title
+!label:
+!legend:
+li: class dir id lang style title type value
+!link:
+!map:
+!menu:
+!meta:
+!noframes:
+!noscript:
+!object:
+ol: class compact dir id lang start style title type
+optgroup: class dir id lang style title
+!option:
+p: align class dir id lang style title
+!param:
+pre: class dir id lang style title width
+q: cite class dir id lang style title
+samp: class dir id lang style title
+!script:
+!select:
+small: class dir id lang style title
+span: class dir id lang style title
+strike: class dir id lang style title
+strong: class dir id lang style title
+style: dir lang media style title type title
+sub: class dir id lang style title
+sup: class dir id lang style title
+table: align bgcolor cellpadding cellspacing class dir frame id lang rules style summary title width
+tbody: align border char charoff class dir id lang style title valign
+td: abbr align axis bgcolor char charoff class colspan dir headers height id lang rowspan scope style title valign width
+!textarea:
+tfoot: align char charoff class dir id lang style title valign
+th: abbr align axis bgcolor char charoff class colspan dir headers height id lang rowspan scope style title valign width
+thead: char charoff class dir id lang style title valign
+!title:
+tr: abbr bgcolor char charoff class dir id lang style title valign
+tt: class dir id lang style title
+u: class dir id lang style title
+ul: class compact dir id lang style title type
+!var:
diff --git a/wl.h b/wl.h
new file mode 100644
index 0000000..89feb95
--- /dev/null
+++ b/wl.h
@@ -0,0 +1,768 @@
+static int allowed_at_a_spec[] = {
+ tok_at_charset,
+ tok_at_class,
+ tok_at_coords,
+ tok_at_dir,
+ tok_at_href,
+ tok_at_hreflang,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_name,
+ tok_at_style,
+ tok_at_title,
+ tok_at_type,
+ tok_eof
+};
+
+static int allowed_at_abbr_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_acronym_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_address_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_b_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_basefont_spec[] = {
+ tok_at_color,
+ tok_at_face,
+ tok_at_id,
+ tok_at_size,
+ tok_eof
+};
+
+static int allowed_at_bdo_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_big_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_blockquote_spec[] = {
+ tok_at_cite,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_br_spec[] = {
+ tok_at_class,
+ tok_at_clear,
+ tok_at_id,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_caption_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_center_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_cite_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_code_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_col_spec[] = {
+ tok_at_align,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_span,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_colgroup_spec[] = {
+ tok_at_align,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_span,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_dd_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_del_spec[] = {
+ tok_at_class,
+ tok_at_datetime,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_dfn_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_dir_spec[] = {
+ tok_at_class,
+ tok_at_compact,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_div_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_dl_spec[] = {
+ tok_at_class,
+ tok_at_compact,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_dt_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_em_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_font_spec[] = {
+ tok_at_class,
+ tok_at_color,
+ tok_at_dir,
+ tok_at_face,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_size,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h1_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h2_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h3_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h4_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h5_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_h6_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_hr_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_size,
+ tok_at_style,
+ tok_at_title,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_i_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_img_spec[] = {
+ tok_at_align,
+ tok_at_alt,
+ tok_at_border,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_height,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_longdesc,
+ tok_at_name,
+ tok_at_src,
+ tok_at_style,
+ tok_at_title,
+ tok_at_vspace,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_ins_spec[] = {
+ tok_at_class,
+ tok_at_datetime,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_kbd_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_li_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_type,
+ tok_at_value,
+ tok_eof
+};
+
+static int allowed_at_ol_spec[] = {
+ tok_at_class,
+ tok_at_compact,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_start,
+ tok_at_style,
+ tok_at_title,
+ tok_at_type,
+ tok_eof
+};
+
+static int allowed_at_optgroup_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_p_spec[] = {
+ tok_at_align,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_pre_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_q_spec[] = {
+ tok_at_cite,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_samp_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_small_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_span_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_strike_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_strong_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_style_spec[] = {
+ tok_at_dir,
+ tok_at_lang,
+ tok_at_media,
+ tok_at_style,
+ tok_at_title,
+ tok_at_type,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_sub_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_sup_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_table_spec[] = {
+ tok_at_align,
+ tok_at_bgcolor,
+ tok_at_cellpadding,
+ tok_at_cellspacing,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_frame,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_rules,
+ tok_at_style,
+ tok_at_summary,
+ tok_at_title,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_tbody_spec[] = {
+ tok_at_align,
+ tok_at_border,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_eof
+};
+
+static int allowed_at_td_spec[] = {
+ tok_at_abbr,
+ tok_at_align,
+ tok_at_axis,
+ tok_at_bgcolor,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_colspan,
+ tok_at_dir,
+ tok_at_headers,
+ tok_at_height,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_rowspan,
+ tok_at_scope,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_tfoot_spec[] = {
+ tok_at_align,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_eof
+};
+
+static int allowed_at_th_spec[] = {
+ tok_at_abbr,
+ tok_at_align,
+ tok_at_axis,
+ tok_at_bgcolor,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_colspan,
+ tok_at_dir,
+ tok_at_headers,
+ tok_at_height,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_rowspan,
+ tok_at_scope,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_at_width,
+ tok_eof
+};
+
+static int allowed_at_thead_spec[] = {
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_eof
+};
+
+static int allowed_at_tr_spec[] = {
+ tok_at_abbr,
+ tok_at_bgcolor,
+ tok_at_char,
+ tok_at_charoff,
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_valign,
+ tok_eof
+};
+
+static int allowed_at_tt_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_u_spec[] = {
+ tok_at_class,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_eof
+};
+
+static int allowed_at_ul_spec[] = {
+ tok_at_class,
+ tok_at_compact,
+ tok_at_dir,
+ tok_at_id,
+ tok_at_lang,
+ tok_at_style,
+ tok_at_title,
+ tok_at_type,
+ tok_eof
+};
+
+allowed_el_t allowed_el_spec[] = {
+ { tok_el_a, allowed_at_a_spec },
+ { tok_el_abbr, allowed_at_abbr_spec },
+ { tok_el_acronym, allowed_at_acronym_spec },
+ { tok_el_address, allowed_at_address_spec },
+ { tok_el_b, allowed_at_b_spec },
+ { tok_el_basefont, allowed_at_basefont_spec },
+ { tok_el_bdo, allowed_at_bdo_spec },
+ { tok_el_big, allowed_at_big_spec },
+ { tok_el_blockquote, allowed_at_blockquote_spec },
+ { tok_el_br, allowed_at_br_spec },
+ { tok_el_caption, allowed_at_caption_spec },
+ { tok_el_center, allowed_at_center_spec },
+ { tok_el_cite, allowed_at_cite_spec },
+ { tok_el_code, allowed_at_code_spec },
+ { tok_el_col, allowed_at_col_spec },
+ { tok_el_colgroup, allowed_at_colgroup_spec },
+ { tok_el_dd, allowed_at_dd_spec },
+ { tok_el_del, allowed_at_del_spec },
+ { tok_el_dfn, allowed_at_dfn_spec },
+ { tok_el_dir, allowed_at_dir_spec },
+ { tok_el_div, allowed_at_div_spec },
+ { tok_el_dl, allowed_at_dl_spec },
+ { tok_el_dt, allowed_at_dt_spec },
+ { tok_el_em, allowed_at_em_spec },
+ { tok_el_font, allowed_at_font_spec },
+ { tok_el_h1, allowed_at_h1_spec },
+ { tok_el_h2, allowed_at_h2_spec },
+ { tok_el_h3, allowed_at_h3_spec },
+ { tok_el_h4, allowed_at_h4_spec },
+ { tok_el_h5, allowed_at_h5_spec },
+ { tok_el_h6, allowed_at_h6_spec },
+ { tok_el_hr, allowed_at_hr_spec },
+ { tok_el_i, allowed_at_i_spec },
+ { tok_el_img, allowed_at_img_spec },
+ { tok_el_ins, allowed_at_ins_spec },
+ { tok_el_kbd, allowed_at_kbd_spec },
+ { tok_el_li, allowed_at_li_spec },
+ { tok_el_ol, allowed_at_ol_spec },
+ { tok_el_optgroup, allowed_at_optgroup_spec },
+ { tok_el_p, allowed_at_p_spec },
+ { tok_el_pre, allowed_at_pre_spec },
+ { tok_el_q, allowed_at_q_spec },
+ { tok_el_samp, allowed_at_samp_spec },
+ { tok_el_small, allowed_at_small_spec },
+ { tok_el_span, allowed_at_span_spec },
+ { tok_el_strike, allowed_at_strike_spec },
+ { tok_el_strong, allowed_at_strong_spec },
+ { tok_el_style, allowed_at_style_spec },
+ { tok_el_sub, allowed_at_sub_spec },
+ { tok_el_sup, allowed_at_sup_spec },
+ { tok_el_table, allowed_at_table_spec },
+ { tok_el_tbody, allowed_at_tbody_spec },
+ { tok_el_td, allowed_at_td_spec },
+ { tok_el_tfoot, allowed_at_tfoot_spec },
+ { tok_el_th, allowed_at_th_spec },
+ { tok_el_thead, allowed_at_thead_spec },
+ { tok_el_tr, allowed_at_tr_spec },
+ { tok_el_tt, allowed_at_tt_spec },
+ { tok_el_u, allowed_at_u_spec },
+ { tok_el_ul, allowed_at_ul_spec },
+ { tok_eof, 0 }
+};
diff --git a/wl.txr b/wl.txr
new file mode 100644
index 0000000..ad6a8a0
--- /dev/null
+++ b/wl.txr
@@ -0,0 +1,25 @@
+@(next "wl")
+@(collect)
+@ (cases)
+!@/.*/
+@ (or)
+@elem:@(coll) @{attr /[^ ]+/}@(end)
+@ (end)
+@(end)
+@(output)
+@ (repeat)
+static int allowed_at_@{elem}_spec[] = {
+@ (repeat)
+ tok_at_@attr,
+@ (end)
+ tok_eof
+};
+
+@ (end)
+allowed_el_t allowed_el_spec[] = {
+@ (repeat)
+ { tok_el_@elem, allowed_at_@{elem}_spec },
+@ (end)
+ { tok_eof, 0 }
+};
+@(end)