diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-08 22:21:52 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-05-08 22:21:52 +0000 |
commit | 2f253cfc85ffd55a8acb988e91f0bc5ab348124c (patch) | |
tree | 4734ccd522c71dd455879162006742002f8c1565 /mkpfunc | |
download | HTML-Parser-tarball-master.tar.gz |
HTML-Parser-3.71HEADHTML-Parser-3.71master
Diffstat (limited to 'mkpfunc')
-rwxr-xr-x | mkpfunc | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#!/usr/bin/perl + +($progname = $0) =~ s,.*/,,; + +print "/* This file is autogenerated by $progname */\n"; + +print "typedef char*(*PFUNC)(PSTATE*, char *beg, char *end, U32 utf8, SV* self);\n"; +print "static PFUNC parsefunc[] = {\n"; + +for my $c (0..255) { + local $_ = chr($c); + my $func = "null"; + if (/^[A-Za-z]$/) { + $func = "start"; + } + elsif ($_ eq "/") { + $func = "end"; + } + elsif ($_ eq "!") { + $func = "decl"; + } + elsif ($_ eq "?") { + $func = "process"; + } + printf " %-15s /* %3d */\n", "parse_$func,", $c; +} + +print "};\n"; |