diff options
author | Adrian Thurston <thurston@complang.org> | 2010-03-27 15:10:35 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2010-03-27 15:10:35 +0000 |
commit | d65c110f9c59d7aa0f472f5c215a29117f13863c (patch) | |
tree | 8f939abf9d51fb97483ac3254e7bd316ede9292d | |
parent | e750bd1ca853e8c86ca6c971826fd5f6f798e4c0 (diff) | |
download | colm-d65c110f9c59d7aa0f472f5c215a29117f13863c.tar.gz |
Added the html grammar to the suite.
-rw-r--r-- | test/TESTS | 1 | ||||
-rw-r--r-- | test/html/Makefile | 65 | ||||
-rw-r--r-- | test/html/TESTS | 6 | ||||
-rw-r--r-- | test/html/html.lm | 7 | ||||
-rw-r--r-- | test/html/html01.exp | 85 | ||||
-rw-r--r-- | test/html/html01.in (renamed from test/html/input01.html) | 0 |
6 files changed, 126 insertions, 38 deletions
@@ -3,6 +3,7 @@ SUBDIRS=" python + html " TESTS=" diff --git a/test/html/Makefile b/test/html/Makefile index d647261a..c71cc138 100644 --- a/test/html/Makefile +++ b/test/html/Makefile @@ -1,34 +1,31 @@ -# -# Copyright 2002-2006 Adrian Thurston <thurston@complang.org> -# - -# This file is part of Colm. -# -# Colm is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Colm is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Colm; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -SRC = $(wildcard *.lm) -BIN = $(SRC:%.lm=%.bin) -COLM = ../../colm/colm - -all: $(BIN) - -$(BIN): $(COLM) - -$(BIN): %.bin: %.lm - $(COLM) $< - -clean: - rm -f *.cpp *.bin +SUBDIRS = + +TESTS = \ + html.lm + +DIFFS = \ + html01.diff + +all: Makefile $(DIFFS) $(SUBDIRS) + +.PHONY: clean $(SUBDIRS:%=%-clean) +clean: $(SUBDIRS:%=%-clean) + rm -f *.bin +$(SUBDIRS:%=%-clean): + cd $(@:%-clean=%) && $(MAKE) clean + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + cd $@ && $(MAKE) + +Makefile: ../genmf TESTS + ../genmf > Makefile + +html01.diff: html01.out html01.exp + @diff -u html01.exp html01.out > html01.diff || ( cat html01.diff; rm html01.diff ) + +html01.out: html.bin + ./html.bin < html01.in > html01.out + +html.bin: html.lm ../../colm/colm + ../../colm/colm html.lm diff --git a/test/html/TESTS b/test/html/TESTS new file mode 100644 index 00000000..c949bd38 --- /dev/null +++ b/test/html/TESTS @@ -0,0 +1,6 @@ +#!/bin/bash +# + +TESTS=" + html.lm +" diff --git a/test/html/html.lm b/test/html/html.lm index 98573f2e..cf9e4217 100644 --- a/test/html/html.lm +++ b/test/html/html.lm @@ -73,7 +73,7 @@ lex close_id } } - send( make_token( send_id, pull(stdin, match_length) ) ) + input.push( make_token( send_id, input.pull(match_length) ) ) } } @@ -287,8 +287,7 @@ int close( ref start Start ) if should_close( TagId ) { - close_id CloseId = construct close_id - [TagId.data] + close_id CloseId = parse close_id (TagId.data) opt_close_tag CloseTag = construct opt_close_tag ['</' CloseId '>'] @@ -302,6 +301,6 @@ int close( ref start Start ) start HTML = parse start( stdin ) flatten( HTML ) -#print_xml( HTML ) +print_xml( HTML ) printLinks( HTML ) diff --git a/test/html/html01.exp b/test/html/html01.exp new file mode 100644 index 00000000..fd98ccca --- /dev/null +++ b/test/html/html01.exp @@ -0,0 +1,85 @@ +<start> + <_repeat_item> + <item> + <tag> + <open_tag> + <'<'/> + <tag_id>t1</tag_id> + <_repeat_attr/> + <'>'/> + </open_tag> + <_repeat_item> + <item> + <tag> + <open_tag> + <'<'/> + <tag_id>t2</tag_id> + <_repeat_attr/> + <'>'/> + </open_tag> + <_repeat_item/> + <opt_close_tag/> + </tag> + </item> + <item> + <tag> + <open_tag> + <'<'/> + <tag_id>a</tag_id> + <_repeat_attr> + <attr> + <attr_name>href</attr_name> + <_opt_eql_attr_val> + <eql_attr_val> + <'='/> + <attr_val> + <dquote_val>"foo"</dquote_val> + </attr_val> + </eql_attr_val> + </_opt_eql_attr_val> + </attr> + </_repeat_attr> + <'>'/> + </open_tag> + <_repeat_item> + <item> + <doc_data>FOO</doc_data> + </item> + </_repeat_item> + <opt_close_tag> + <'</'/> + <close_id>a</close_id> + <'>'/> + </opt_close_tag> + </tag> + </item> + <item> + <tag> + <open_tag> + <'<'/> + <tag_id>t3</tag_id> + <_repeat_attr/> + <'>'/> + </open_tag> + <_repeat_item/> + <opt_close_tag> + <'</'/> + <close_id>t3</close_id> + <'>'/> + </opt_close_tag> + </tag> + </item> + </_repeat_item> + <opt_close_tag> + <'</'/> + <close_id>t1</close_id> + <'>'/> + </opt_close_tag> + </tag> + </item> + </_repeat_item> + <trailing> </trailing> +</start> +link: FOO +target: "foo" + diff --git a/test/html/input01.html b/test/html/html01.in index cf783d63..cf783d63 100644 --- a/test/html/input01.html +++ b/test/html/html01.in |