diff options
author | Tom Lane | 2007-08-21 01:11:32 +0000 |
---|---|---|
committer | Tom Lane | 2007-08-21 01:11:32 +0000 |
commit | 140d4ebcb46e17cdb1be43892ed797e5e060c8ef (patch) | |
tree | f99d209dbe5e40dcb434c3841e0c8b4ff383f453 | |
parent | 4e94d1f952c3ce5670ceae3c12b55e344503a701 (diff) |
Tsearch2 functionality migrates to core. The bulk of this work is by
Oleg Bartunov and Teodor Sigaev, but I did a lot of editorializing,
so anything that's broken is probably my fault.
Documentation is nonexistent as yet, but let's land the patch so we can
get some portability testing done.
200 files changed, 54388 insertions, 147 deletions
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 99cc22958f2..f1d882a11e4 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.206 2007/08/04 01:26:53 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.207 2007/08/21 01:11:11 tgl Exp $ --> <chapter id="datatype"> <title id="datatype-title">Data Types</title> @@ -3485,6 +3485,14 @@ SET xmloption TO { DOCUMENT | CONTENT }; </indexterm> <indexterm zone="datatype-oid"> + <primary>regconfig</primary> + </indexterm> + + <indexterm zone="datatype-oid"> + <primary>regdictionary</primary> + </indexterm> + + <indexterm zone="datatype-oid"> <primary>xid</primary> </indexterm> @@ -3505,9 +3513,9 @@ SET xmloption TO { DOCUMENT | CONTENT }; configuration variable is enabled. Type <type>oid</> represents an object identifier. There are also several alias types for <type>oid</>: <type>regproc</>, <type>regprocedure</>, - <type>regoper</>, <type>regoperator</>, <type>regclass</>, and - <type>regtype</>. <xref linkend="datatype-oid-table"> shows an - overview. + <type>regoper</>, <type>regoperator</>, <type>regclass</>, + <type>regtype</>, <type>regconfig</>, and <type>regdictionary</>. + <xref linkend="datatype-oid-table"> shows an overview. </para> <para> @@ -3614,6 +3622,20 @@ SELECT * FROM pg_attribute <entry>data type name</entry> <entry><literal>integer</></entry> </row> + + <row> + <entry><type>regconfig</></entry> + <entry><structname>pg_ts_config</></entry> + <entry>text search configuration</entry> + <entry><literal>english</></entry> + </row> + + <row> + <entry><type>regdictionary</></entry> + <entry><structname>pg_ts_dict</></entry> + <entry>text search dictionary</entry> + <entry><literal>simple</></entry> + </row> </tbody> </tgroup> </table> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 2bb1ff1d757..bc9abc689cb 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.387 2007/08/19 03:23:30 adunstan Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.388 2007/08/21 01:11:11 tgl Exp $ --> <chapter id="functions"> <title>Functions and Operators</title> @@ -10794,7 +10794,9 @@ SELECT relname FROM pg_class WHERE pg_table_is_visible(oid); All these functions require object OIDs to identify the object to be checked. If you want to test an object by name, it is convenient to use the OID alias types (<type>regclass</>, <type>regtype</>, - <type>regprocedure</>, or <type>regoperator</>), for example: + <type>regprocedure</>, <type>regoperator</>, <type>regconfig</>, + or <type>regdictionary</>), + for example: <programlisting> SELECT pg_type_is_visible('myschema.widget'::regtype); </programlisting> @@ -11255,8 +11257,8 @@ SELECT set_config('log_statement_stats', 'off', false); <para> <function>pg_rotate_logfile</> signals the log-file manager to switch to a new output file immediately. This works only when the built-in - log collector is running, since otherwise there is no log-file manager - subprocess. + log collector is running, since otherwise there is no log-file manager + subprocess. </para> <indexterm zone="functions-admin"> diff --git a/src/Makefile b/src/Makefile index 3539ff1de16..8d66bf62cac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/Makefile,v 1.41 2007/01/20 17:16:09 petere Exp $ +# $PostgreSQL: pgsql/src/Makefile,v 1.42 2007/08/21 01:11:12 tgl Exp $ # #------------------------------------------------------------------------- @@ -18,6 +18,7 @@ all install installdirs uninstall distprep: $(MAKE) -C timezone $@ $(MAKE) -C backend $@ $(MAKE) -C backend/utils/mb/conversion_procs $@ + $(MAKE) -C backend/snowball $@ $(MAKE) -C include $@ $(MAKE) -C interfaces $@ $(MAKE) -C bin $@ @@ -47,6 +48,7 @@ clean: $(MAKE) -C port $@ $(MAKE) -C timezone $@ $(MAKE) -C backend $@ + $(MAKE) -C backend/snowball $@ $(MAKE) -C include $@ $(MAKE) -C interfaces $@ $(MAKE) -C bin $@ @@ -60,6 +62,7 @@ distclean maintainer-clean: -$(MAKE) -C port $@ -$(MAKE) -C timezone $@ -$(MAKE) -C backend $@ + -$(MAKE) -C backend/snowball $@ -$(MAKE) -C include $@ -$(MAKE) -C interfaces $@ -$(MAKE) -C bin $@ diff --git a/src/backend/Makefile b/src/backend/Makefile index d2caa7036ce..9d2dbe62fa5 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -2,9 +2,10 @@ # # Makefile for the postgres backend # -# Copyright (c) 1994, Regents of the University of California +# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group +# Portions Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/backend/Makefile,v 1.123 2007/07/24 09:00:27 mha Exp $ +# $PostgreSQL: pgsql/src/backend/Makefile,v 1.124 2007/08/21 01:11:12 tgl Exp $ # #------------------------------------------------------------------------- @@ -15,7 +16,7 @@ include $(top_builddir)/src/Makefile.global DIRS = access bootstrap catalog parser commands executor lib libpq \ main nodes optimizer port postmaster regex rewrite \ - storage tcop utils $(top_builddir)/src/timezone + storage tcop tsearch utils $(top_builddir)/src/timezone SUBSYSOBJS = $(DIRS:%=%/SUBSYS.o) @@ -166,6 +167,7 @@ ifeq ($(MAKE_DLL), true) endif endif $(MAKE) -C catalog install-data + $(MAKE) -C tsearch install-data $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' @@ -220,6 +222,7 @@ ifeq ($(MAKE_DLL), true) endif endif $(MAKE) -C catalog uninstall-data + $(MAKE) -C tsearch uninstall-data rm -f '$(DESTDIR)$(datadir)/pg_hba.conf.sample' \ '$(DESTDIR)$(datadir)/pg_ident.conf.sample' \ '$(DESTDIR)$(datadir)/postgresql.conf.sample' \ diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c index a46def63c50..d608bedb605 100644 --- a/src/backend/access/gin/ginarrayproc.c +++ b/src/backend/access/gin/ginarrayproc.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.9 2007/01/31 15:09:45 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.10 2007/08/21 01:11:12 tgl Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -62,7 +62,7 @@ ginarrayextract(PG_FUNCTION_ARGS) if ( *nentries == 0 && PG_NARGS() == 3 ) { - switch( PG_GETARG_UINT16(2) ) + switch( PG_GETARG_UINT16(2) ) /* StrategyNumber */ { case GinOverlapStrategy: *nentries = -1; /* nobody can be found */ @@ -80,6 +80,15 @@ ginarrayextract(PG_FUNCTION_ARGS) } Datum +ginqueryarrayextract(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall3(ginarrayextract, + PG_GETARG_DATUM(0), + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(2))); +} + +Datum ginarrayconsistent(PG_FUNCTION_ARGS) { bool *check = (bool *) PG_GETARG_POINTER(0); diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index 3503385c2ac..6e87b2f6010 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -2,7 +2,7 @@ # # Makefile for backend/catalog # -# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.64 2007/04/02 03:49:37 tgl Exp $ +# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.65 2007/08/21 01:11:13 tgl Exp $ # #------------------------------------------------------------------------- @@ -35,6 +35,8 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\ pg_enum.h pg_namespace.h pg_conversion.h pg_depend.h \ pg_database.h pg_tablespace.h pg_pltemplate.h \ pg_authid.h pg_auth_members.h pg_shdepend.h pg_shdescription.h \ + pg_ts_config.h pg_ts_config_map.h pg_ts_dict.h \ + pg_ts_parser.h pg_ts_template.h \ toasting.h indexing.h \ ) diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 292a737099e..96d238c7242 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.139 2007/04/20 02:37:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.140 2007/08/21 01:11:13 tgl Exp $ * * NOTES * See acl.h. @@ -34,6 +34,8 @@ #include "catalog/pg_proc.h" #include "catalog/pg_tablespace.h" #include "catalog/pg_type.h" +#include "catalog/pg_ts_config.h" +#include "catalog/pg_ts_dict.h" #include "commands/dbcommands.h" #include "miscadmin.h" #include "parser/parse_func.h" @@ -1416,7 +1418,11 @@ static const char *const no_priv_msg[MAX_ACL_KIND] = /* ACL_KIND_CONVERSION */ gettext_noop("permission denied for conversion %s"), /* ACL_KIND_TABLESPACE */ - gettext_noop("permission denied for tablespace %s") + gettext_noop("permission denied for tablespace %s"), + /* ACL_KIND_TSDICTIONARY */ + gettext_noop("permission denied for text search dictionary %s"), + /* ACL_KIND_TSCONFIGURATION */ + gettext_noop("permission denied for text search configuration %s") }; static const char *const not_owner_msg[MAX_ACL_KIND] = @@ -1444,7 +1450,11 @@ static const char *const not_owner_msg[MAX_ACL_KIND] = /* ACL_KIND_CONVERSION */ gettext_noop("must be owner of conversion %s"), /* ACL_KIND_TABLESPACE */ - gettext_noop("must be owner of tablespace %s") + gettext_noop("must be owner of tablespace %s"), + /* ACL_KIND_TSDICTIONARY */ + gettext_noop("must be owner of text search dictionary %s"), + /* ACL_KIND_TSCONFIGURATION */ + gettext_noop("must be owner of text search configuration %s") }; @@ -2298,6 +2308,65 @@ pg_opfamily_ownercheck(Oid opf_oid, Oid roleid) } /* + * Ownership check for a text search dictionary (specified by OID). + */ +bool +pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid) +{ + HeapTuple tuple; + Oid ownerId; + + /* Superusers bypass all permission checking. */ + if (superuser_arg(roleid)) + return true; + + tuple = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(dict_oid), + 0, 0, 0); + if (!HeapTupleIsValid(tuple)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search dictionary with OID %u does not exist", + dict_oid))); + + ownerId = ((Form_pg_ts_dict) GETSTRUCT(tuple))->dictowner; + + ReleaseSysCache(tuple); + + return has_privs_of_role(roleid, ownerId); +} + +/* + * Ownership check for a text search configuration (specified by OID). + */ +bool +pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid) +{ + HeapTuple tuple; + Oid ownerId; + + /* Superusers bypass all permission checking. */ + if (superuser_arg(roleid)) + return true; + + tuple = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(cfg_oid), + 0, 0, 0); + if (!HeapTupleIsValid(tuple)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search configuration with OID %u does not exist", + cfg_oid))); + + ownerId = ((Form_pg_ts_config) GETSTRUCT(tuple))->cfgowner; + + ReleaseSysCache(tuple); + + return has_privs_of_role(roleid, ownerId); +} + + +/* * Ownership check for a database (specified by OID). */ bool diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 6b58af65228..51bb4ba17f4 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.66 2007/06/05 21:31:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.67 2007/08/21 01:11:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -40,6 +40,10 @@ #include "catalog/pg_rewrite.h" #include "catalog/pg_tablespace.h" #include "catalog/pg_trigger.h" +#include "catalog/pg_ts_config.h" +#include "catalog/pg_ts_dict.h" +#include "catalog/pg_ts_parser.h" +#include "catalog/pg_ts_template.h" #include "catalog/pg_type.h" #include "commands/comment.h" #include "commands/dbcommands.h" @@ -97,6 +101,10 @@ static const Oid object_classes[MAX_OCLASS] = { RewriteRelationId, /* OCLASS_REWRITE */ TriggerRelationId, /* OCLASS_TRIGGER */ NamespaceRelationId, /* OCLASS_SCHEMA */ + TSParserRelationId, /* OCLASS_TSPARSER */ + TSDictionaryRelationId, /* OCLASS_TSDICT */ + TSTemplateRelationId, /* OCLASS_TSTEMPLATE */ + TSConfigRelationId, /* OCLASS_TSCONFIG */ AuthIdRelationId, /* OCLASS_ROLE */ DatabaseRelationId, /* OCLASS_DATABASE */ TableSpaceRelationId /* OCLASS_TBLSPACE */ @@ -988,6 +996,22 @@ doDeletion(const ObjectAddress *object) RemoveSchemaById(object->objectId); break; + case OCLASS_TSPARSER: + RemoveTSParserById(object->objectId); + break; + + case OCLASS_TSDICT: + RemoveTSDictionaryById(object->objectId); + break; + + case OCLASS_TSTEMPLATE: + RemoveTSTemplateById(object->objectId); + break; + + case OCLASS_TSCONFIG: + RemoveTSConfigurationById(object->objectId); + break; + /* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE not handled */ default: @@ -1201,8 +1225,8 @@ find_expr_references_walker(Node *node, /* * If it's a regclass or similar literal referring to an existing * object, add a reference to that object. (Currently, only the - * regclass case has any likely use, but we may as well handle all the - * OID-alias datatypes consistently.) + * regclass and regconfig cases have any likely use, but we may as + * well handle all the OID-alias datatypes consistently.) */ if (!con->constisnull) { @@ -1242,6 +1266,22 @@ find_expr_references_walker(Node *node, add_object_address(OCLASS_TYPE, objoid, 0, context->addrs); break; + case REGCONFIGOID: + objoid = DatumGetObjectId(con->constvalue); + if (SearchSysCacheExists(TSCONFIGOID, + ObjectIdGetDatum(objoid), + 0, 0, 0)) + add_object_address(OCLASS_TSCONFIG, objoid, 0, + context->addrs); + break; + case REGDICTIONARYOID: + objoid = DatumGetObjectId(con->constvalue); + if (SearchSysCacheExists(TSDICTOID, + ObjectIdGetDatum(objoid), + 0, 0, 0)) + add_object_address(OCLASS_TSDICT, objoid, 0, + context->addrs); + break; } } return false; @@ -1606,6 +1646,21 @@ object_address_present(const ObjectAddress *object, } /* + * Record multiple dependencies from an ObjectAddresses array, after first + * removing any duplicates. + */ +void +record_object_address_dependencies(const ObjectAddress *depender, + ObjectAddresses *referenced, + DependencyType behavior) +{ + eliminate_duplicate_dependencies(referenced); + recordMultipleDependencies(depender, + referenced->refs, referenced->numrefs, + behavior); +} + +/* * Clean up when done with an ObjectAddresses array. */ void @@ -1690,6 +1745,22 @@ getObjectClass(const ObjectAddress *object) Assert(object->objectSubId == 0); return OCLASS_SCHEMA; + case TSParserRelationId: + Assert(object->objectSubId == 0); + return OCLASS_TSPARSER; + + case TSDictionaryRelationId: + Assert(object->objectSubId == 0); + return OCLASS_TSDICT; + + case TSTemplateRelationId: + Assert(object->objectSubId == 0); + return OCLASS_TSTEMPLATE; + + case TSConfigRelationId: + Assert(object->objectSubId == 0); + return OCLASS_TSCONFIG; + case AuthIdRelationId: Assert(object->objectSubId == 0); return OCLASS_ROLE; @@ -2080,6 +2151,70 @@ getObjectDescription(const ObjectAddress *object) break; } + case OCLASS_TSPARSER: + { + HeapTuple tup; + + tup = SearchSysCache(TSPARSEROID, + ObjectIdGetDatum(object->objectId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search parser %u", + object->objectId); + appendStringInfo(&buffer, _("text search parser %s"), + NameStr(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname)); + ReleaseSysCache(tup); + break; + } + + case OCLASS_TSDICT: + { + HeapTuple tup; + + tup = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(object->objectId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search dictionary %u", + object->objectId); + appendStringInfo(&buffer, _("text search dictionary %s"), + NameStr(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname)); + ReleaseSysCache(tup); + break; + } + + case OCLASS_TSTEMPLATE: + { + HeapTuple tup; + + tup = SearchSysCache(TSTEMPLATEOID, + ObjectIdGetDatum(object->objectId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search template %u", + object->objectId); + appendStringInfo(&buffer, _("text search template %s"), + NameStr(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname)); + ReleaseSysCache(tup); + break; + } + + case OCLASS_TSCONFIG: + { + HeapTuple tup; + + tup = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(object->objectId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search configuration %u", + object->objectId); + appendStringInfo(&buffer, _("text search configuration %s"), + NameStr(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname)); + ReleaseSysCache(tup); + break; + } + case OCLASS_ROLE: { appendStringInfo(&buffer, _("role %s"), diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 2f8753bd2e0..84220bd4ce0 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.97 2007/07/25 22:16:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.98 2007/08/21 01:11:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,10 @@ #include "catalog/pg_operator.h" #include "catalog/pg_opfamily.h" #include "catalog/pg_proc.h" +#include "catalog/pg_ts_config.h" +#include "catalog/pg_ts_dict.h" +#include "catalog/pg_ts_parser.h" +#include "catalog/pg_ts_template.h" #include "catalog/pg_type.h" #include "commands/dbcommands.h" #include "miscadmin.h" @@ -189,6 +193,10 @@ Datum pg_function_is_visible(PG_FUNCTION_ARGS); Datum pg_operator_is_visible(PG_FUNCTION_ARGS); Datum pg_opclass_is_visible(PG_FUNCTION_ARGS); Datum pg_conversion_is_visible(PG_FUNCTION_ARGS); +Datum pg_ts_parser_is_visible(PG_FUNCTION_ARGS); +Datum pg_ts_dict_is_visible(PG_FUNCTION_ARGS); +Datum pg_ts_template_is_visible(PG_FUNCTION_ARGS); +Datum pg_ts_config_is_visible(PG_FUNCTION_ARGS); Datum pg_my_temp_schema(PG_FUNCTION_ARGS); Datum pg_is_other_temp_schema(PG_FUNCTION_ARGS); @@ -1315,6 +1323,521 @@ ConversionIsVisible(Oid conid) } /* + * TSParserGetPrsid - find a TS parser by possibly qualified name + * + * If not found, returns InvalidOid if failOK, else throws error + */ +Oid +TSParserGetPrsid(List *names, bool failOK) +{ + char *schemaname; + char *parser_name; + Oid namespaceId; + Oid prsoid = InvalidOid; + ListCell *l; + + /* deconstruct the name list */ + DeconstructQualifiedName(names, &schemaname, &parser_name); + + if (schemaname) + { + /* use exact schema given */ + namespaceId = LookupExplicitNamespace(schemaname); + prsoid = GetSysCacheOid(TSPARSERNAMENSP, + PointerGetDatum(parser_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + } + else + { + /* search for it in search path */ + recomputeNamespacePath(); + + foreach(l, activeSearchPath) + { + namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + prsoid = GetSysCacheOid(TSPARSERNAMENSP, + PointerGetDatum(parser_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + if (OidIsValid(prsoid)) + break; + } + } + + if (!OidIsValid(prsoid) && !failOK) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search parser \"%s\" does not exist", + NameListToString(names)))); + + return prsoid; +} + +/* + * TSParserIsVisible + * Determine whether a parser (identified by OID) is visible in the + * current search path. Visible means "would be found by searching + * for the unqualified parser name". + */ +bool +TSParserIsVisible(Oid prsId) +{ + HeapTuple tup; + Form_pg_ts_parser form; + Oid namespace; + bool visible; + + tup = SearchSysCache(TSPARSEROID, + ObjectIdGetDatum(prsId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search parser %u", prsId); + form = (Form_pg_ts_parser) GETSTRUCT(tup); + + recomputeNamespacePath(); + + /* + * Quick check: if it ain't in the path at all, it ain't visible. Items in + * the system namespace are surely in the path and so we needn't even do + * list_member_oid() for them. + */ + namespace = form->prsnamespace; + if (namespace != PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, namespace)) + visible = false; + else + { + /* + * If it is in the path, it might still not be visible; it could be + * hidden by another parser of the same name earlier in the path. So we + * must do a slow check for conflicting parsers. + */ + char *name = NameStr(form->prsname); + ListCell *l; + + visible = false; + foreach(l, activeSearchPath) + { + Oid namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + if (namespaceId == namespace) + { + /* Found it first in path */ + visible = true; + break; + } + if (SearchSysCacheExists(TSPARSERNAMENSP, + PointerGetDatum(name), + ObjectIdGetDatum(namespaceId), + 0, 0)) + { + /* Found something else first in path */ + break; + } + } + } + + ReleaseSysCache(tup); + + return visible; +} + +/* + * TSDictionaryGetDictid - find a TS dictionary by possibly qualified name + * + * If not found, returns InvalidOid if failOK, else throws error + */ +Oid +TSDictionaryGetDictid(List *names, bool failOK) +{ + char *schemaname; + char *dict_name; + Oid namespaceId; + Oid dictoid = InvalidOid; + ListCell *l; + + /* deconstruct the name list */ + DeconstructQualifiedName(names, &schemaname, &dict_name); + + if (schemaname) + { + /* use exact schema given */ + namespaceId = LookupExplicitNamespace(schemaname); + dictoid = GetSysCacheOid(TSDICTNAMENSP, + PointerGetDatum(dict_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + } + else + { + /* search for it in search path */ + recomputeNamespacePath(); + + foreach(l, activeSearchPath) + { + namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + dictoid = GetSysCacheOid(TSDICTNAMENSP, + PointerGetDatum(dict_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + if (OidIsValid(dictoid)) + break; + } + } + + if (!OidIsValid(dictoid) && !failOK) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search dictionary \"%s\" does not exist", + NameListToString(names)))); + + return dictoid; +} + +/* + * TSDictionaryIsVisible + * Determine whether a dictionary (identified by OID) is visible in the + * current search path. Visible means "would be found by searching + * for the unqualified dictionary name". + */ +bool +TSDictionaryIsVisible(Oid dictId) +{ + HeapTuple tup; + Form_pg_ts_dict form; + Oid namespace; + bool visible; + + tup = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(dictId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictId); + form = (Form_pg_ts_dict) GETSTRUCT(tup); + + recomputeNamespacePath(); + + /* + * Quick check: if it ain't in the path at all, it ain't visible. Items in + * the system namespace are surely in the path and so we needn't even do + * list_member_oid() for them. + */ + namespace = form->dictnamespace; + if (namespace != PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, namespace)) + visible = false; + else + { + /* + * If it is in the path, it might still not be visible; it could be + * hidden by another dictionary of the same name earlier in the + * path. So we must do a slow check for conflicting dictionaries. + */ + char *name = NameStr(form->dictname); + ListCell *l; + + visible = false; + foreach(l, activeSearchPath) + { + Oid namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + if (namespaceId == namespace) + { + /* Found it first in path */ + visible = true; + break; + } + if (SearchSysCacheExists(TSDICTNAMENSP, + PointerGetDatum(name), + ObjectIdGetDatum(namespaceId), + 0, 0)) + { + /* Found something else first in path */ + break; + } + } + } + + ReleaseSysCache(tup); + + return visible; +} + +/* + * TSTemplateGetTmplid - find a TS template by possibly qualified name + * + * If not found, returns InvalidOid if failOK, else throws error + */ +Oid +TSTemplateGetTmplid(List *names, bool failOK) +{ + char *schemaname; + char *template_name; + Oid namespaceId; + Oid tmploid = InvalidOid; + ListCell *l; + + /* deconstruct the name list */ + DeconstructQualifiedName(names, &schemaname, &template_name); + + if (schemaname) + { + /* use exact schema given */ + namespaceId = LookupExplicitNamespace(schemaname); + tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, + PointerGetDatum(template_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + } + else + { + /* search for it in search path */ + recomputeNamespacePath(); + + foreach(l, activeSearchPath) + { + namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + tmploid = GetSysCacheOid(TSTEMPLATENAMENSP, + PointerGetDatum(template_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + if (OidIsValid(tmploid)) + break; + } + } + + if (!OidIsValid(tmploid) && !failOK) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search template \"%s\" does not exist", + NameListToString(names)))); + + return tmploid; +} + +/* + * TSTemplateIsVisible + * Determine whether a template (identified by OID) is visible in the + * current search path. Visible means "would be found by searching + * for the unqualified template name". + */ +bool +TSTemplateIsVisible(Oid tmplId) +{ + HeapTuple tup; + Form_pg_ts_template form; + Oid namespace; + bool visible; + + tup = SearchSysCache(TSTEMPLATEOID, + ObjectIdGetDatum(tmplId), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search template %u", tmplId); + form = (Form_pg_ts_template) GETSTRUCT(tup); + + recomputeNamespacePath(); + + /* + * Quick check: if it ain't in the path at all, it ain't visible. Items in + * the system namespace are surely in the path and so we needn't even do + * list_member_oid() for them. + */ + namespace = form->tmplnamespace; + if (namespace != PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, namespace)) + visible = false; + else + { + /* + * If it is in the path, it might still not be visible; it could be + * hidden by another template of the same name earlier in the path. + * So we must do a slow check for conflicting templates. + */ + char *name = NameStr(form->tmplname); + ListCell *l; + + visible = false; + foreach(l, activeSearchPath) + { + Oid namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + if (namespaceId == namespace) + { + /* Found it first in path */ + visible = true; + break; + } + if (SearchSysCacheExists(TSTEMPLATENAMENSP, + PointerGetDatum(name), + ObjectIdGetDatum(namespaceId), + 0, 0)) + { + /* Found something else first in path */ + break; + } + } + } + + ReleaseSysCache(tup); + + return visible; +} + +/* + * TSConfigGetCfgid - find a TS config by possibly qualified name + * + * If not found, returns InvalidOid if failOK, else throws error + */ +Oid +TSConfigGetCfgid(List *names, bool failOK) +{ + char *schemaname; + char *config_name; + Oid namespaceId; + Oid cfgoid = InvalidOid; + ListCell *l; + + /* deconstruct the name list */ + DeconstructQualifiedName(names, &schemaname, &config_name); + + if (schemaname) + { + /* use exact schema given */ + namespaceId = LookupExplicitNamespace(schemaname); + cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, + PointerGetDatum(config_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + } + else + { + /* search for it in search path */ + recomputeNamespacePath(); + + foreach(l, activeSearchPath) + { + namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + cfgoid = GetSysCacheOid(TSCONFIGNAMENSP, + PointerGetDatum(config_name), + ObjectIdGetDatum(namespaceId), + 0, 0); + if (OidIsValid(cfgoid)) + break; + } + } + + if (!OidIsValid(cfgoid) && !failOK) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search configuration \"%s\" does not exist", + NameListToString(names)))); + + return cfgoid; +} + +/* + * TSConfigIsVisible + * Determine whether a text search configuration (identified by OID) + * is visible in the current search path. Visible means "would be found + * by searching for the unqualified text search configuration name". + */ +bool +TSConfigIsVisible(Oid cfgid) +{ + HeapTuple tup; + Form_pg_ts_config form; + Oid namespace; + bool visible; + + tup = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(cfgid), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search configuration %u", + cfgid); + form = (Form_pg_ts_config) GETSTRUCT(tup); + + recomputeNamespacePath(); + + /* + * Quick check: if it ain't in the path at all, it ain't visible. Items in + * the system namespace are surely in the path and so we needn't even do + * list_member_oid() for them. + */ + namespace = form->cfgnamespace; + if (namespace != PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, namespace)) + visible = false; + else + { + /* + * If it is in the path, it might still not be visible; it could be + * hidden by another configuration of the same name earlier in the + * path. So we must do a slow check for conflicting configurations. + */ + char *name = NameStr(form->cfgname); + ListCell *l; + + visible = false; + foreach(l, activeSearchPath) + { + Oid namespaceId = lfirst_oid(l); + + if (namespaceId == myTempNamespace) + continue; /* do not look in temp namespace */ + + if (namespaceId == namespace) + { + /* Found it first in path */ + visible = true; + break; + } + if (SearchSysCacheExists(TSCONFIGNAMENSP, + PointerGetDatum(name), + ObjectIdGetDatum(namespaceId), + 0, 0)) + { + /* Found something else first in path */ + break; + } + } + } + + ReleaseSysCache(tup); + + return visible; +} + + +/* * DeconstructQualifiedName * Given a possibly-qualified name expressed as a list of String nodes, * extract the schema name and object name. @@ -2516,6 +3039,38 @@ pg_conversion_is_visible(PG_FUNCTION_ARGS) } Datum +pg_ts_parser_is_visible(PG_FUNCTION_ARGS) +{ + Oid oid = PG_GETARG_OID(0); + + PG_RETURN_BOOL(TSParserIsVisible(oid)); +} + +Datum +pg_ts_dict_is_visible(PG_FUNCTION_ARGS) +{ + Oid oid = PG_GETARG_OID(0); + + PG_RETURN_BOOL(TSDictionaryIsVisible(oid)); +} + +Datum +pg_ts_template_is_visible(PG_FUNCTION_ARGS) +{ + Oid oid = PG_GETARG_OID(0); + + PG_RETURN_BOOL(TSTemplateIsVisible(oid)); +} + +Datum +pg_ts_config_is_visible(PG_FUNCTION_ARGS) +{ + Oid oid = PG_GETARG_OID(0); + + PG_RETURN_BOOL(TSConfigIsVisible(oid)); +} + +Datum pg_my_temp_schema(PG_FUNCTION_ARGS) { PG_RETURN_OID(myTempNamespace); diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index c091c855708..756809b8aef 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -3,7 +3,7 @@ * * Copyright (c) 1996-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.39 2007/07/25 22:16:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.40 2007/08/21 01:11:13 tgl Exp $ */ CREATE VIEW pg_roles AS @@ -382,3 +382,74 @@ CREATE VIEW pg_stat_bgwriter AS pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint, pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean, pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean; + +-- Tsearch debug function. Defined here because it'd be pretty unwieldy +-- to put it into pg_proc.h + +CREATE TYPE ts_debug AS ( + "Alias" text, + "Description" text, + "Token" text, + "Dictionaries" regdictionary[], + "Lexized token" text +); + +COMMENT ON TYPE ts_debug IS 'returned type from ts_debug() function'; + +CREATE FUNCTION ts_debug(regconfig, text) +RETURNS SETOF ts_debug AS +$$ +SELECT + ( + SELECT + tt.alias + FROM + pg_catalog.ts_token_type( + (SELECT cfgparser FROM pg_catalog.pg_ts_config WHERE oid = $1 ) + ) AS tt + WHERE + tt.tokid = parse.tokid + ) AS "Alias", + ( + SELECT + tt.description + FROM + pg_catalog.ts_token_type( + (SELECT cfgparser FROM pg_catalog.pg_ts_config WHERE oid = $1 ) + ) AS tt + WHERE + tt.tokid = parse.tokid + ) AS "Description", + parse.token AS "Token", + ARRAY ( SELECT m.mapdict::pg_catalog.regdictionary + FROM pg_catalog.pg_ts_config_map AS m + WHERE m.mapcfg = $1 AND m.maptokentype = parse.tokid + ORDER BY m.mapcfg, m.maptokentype, m.mapseqno ) + AS "Dictionaries", + ( + SELECT + dl.mapdict::pg_catalog.regdictionary || ': ' || dl.lex::pg_catalog.text + FROM + ( SELECT mapdict, pg_catalog.ts_lexize(mapdict, parse.token) AS lex + FROM pg_catalog.pg_ts_config_map AS m + WHERE m.mapcfg = $1 AND m.maptokentype = parse.tokid + ORDER BY m.mapcfg, m.maptokentype, m.mapseqno ) dl + WHERE dl.lex IS NOT NULL + LIMIT 1 + ) AS "Lexized token" +FROM pg_catalog.ts_parse( + (SELECT cfgparser FROM pg_catalog.pg_ts_config WHERE oid = $1 ), $2 + ) AS parse; +$$ +LANGUAGE SQL RETURNS NULL ON NULL INPUT; + +COMMENT ON FUNCTION ts_debug(regconfig,text) IS 'debug function for text search configuration'; + +CREATE FUNCTION ts_debug(text) +RETURNS SETOF ts_debug AS +$$ + SELECT * FROM pg_catalog.ts_debug( pg_catalog.get_current_ts_config(), $1 ); +$$ +LANGUAGE SQL RETURNS NULL ON NULL INPUT; + +COMMENT ON FUNCTION ts_debug(text) IS 'debug function for current text search configuration'; diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile index 4b25ae6489e..e47b8f91fac 100644 --- a/src/backend/commands/Makefile +++ b/src/backend/commands/Makefile @@ -4,7 +4,7 @@ # Makefile for backend/commands # # IDENTIFICATION -# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.36 2007/04/26 16:13:09 neilc Exp $ +# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.37 2007/08/21 01:11:14 tgl Exp $ # #------------------------------------------------------------------------- @@ -18,7 +18,8 @@ OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \ indexcmds.o lockcmds.o operatorcmds.o opclasscmds.o \ portalcmds.o prepare.o proclang.o \ schemacmds.o sequence.o tablecmds.o tablespace.o trigger.o \ - typecmds.o user.o vacuum.o vacuumlazy.o variable.o view.o + tsearchcmds.o typecmds.o user.o vacuum.o vacuumlazy.o \ + variable.o view.o all: SUBSYS.o diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index 7cd347b69f9..65c2bbdb0f2 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.24 2007/07/03 01:30:36 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.25 2007/08/21 01:11:14 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -138,6 +138,22 @@ ExecRenameStmt(RenameStmt *stmt) break; } + case OBJECT_TSPARSER: + RenameTSParser(stmt->object, stmt->newname); + break; + + case OBJECT_TSDICTIONARY: + RenameTSDictionary(stmt->object, stmt->newname); + break; + + case OBJECT_TSTEMPLATE: + RenameTSTemplate(stmt->object, stmt->newname); + break; + + case OBJECT_TSCONFIGURATION: + RenameTSConfiguration(stmt->object, stmt->newname); + break; + default: elog(ERROR, "unrecognized rename stmt type: %d", (int) stmt->renameType); @@ -240,6 +256,14 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) AlterTypeOwner(stmt->object, newowner); break; + case OBJECT_TSDICTIONARY: + AlterTSDictionaryOwner(stmt->object, newowner); + break; + + case OBJECT_TSCONFIGURATION: + AlterTSConfigurationOwner(stmt->object, newowner); + break; + default: elog(ERROR, "unrecognized AlterOwnerStmt type: %d", (int) stmt->objectType); diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 344099ebdf6..89158251aa4 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -7,7 +7,7 @@ * Copyright (c) 1996-2007, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.96 2007/02/01 19:10:25 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.97 2007/08/21 01:11:14 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,6 +34,10 @@ #include "catalog/pg_shdescription.h" #include "catalog/pg_tablespace.h" #include "catalog/pg_trigger.h" +#include "catalog/pg_ts_config.h" +#include "catalog/pg_ts_dict.h" +#include "catalog/pg_ts_parser.h" +#include "catalog/pg_ts_template.h" #include "catalog/pg_type.h" #include "commands/comment.h" #include "commands/dbcommands.h" @@ -78,6 +82,10 @@ static void CommentLargeObject(List *qualname, char *comment); static void CommentCast(List *qualname, List *arguments, char *comment); static void CommentTablespace(List *qualname, char *comment); static void CommentRole(List *qualname, char *comment); +static void CommentTSParser(List *qualname, char *comment); +static void CommentTSDictionary(List *qualname, char *comment); +static void CommentTSTemplate(List *qualname, char *comment); +static void CommentTSConfiguration(List *qualname, char *comment); /* @@ -151,6 +159,18 @@ CommentObject(CommentStmt *stmt) case OBJECT_ROLE: CommentRole(stmt->objname, stmt->comment); break; + case OBJECT_TSPARSER: + CommentTSParser(stmt->objname, stmt->comment); + break; + case OBJECT_TSDICTIONARY: + CommentTSDictionary(stmt->objname, stmt->comment); + break; + case OBJECT_TSTEMPLATE: + CommentTSTemplate(stmt->objname, stmt->comment); + break; + case OBJECT_TSCONFIGURATION: + CommentTSConfiguration(stmt->objname, stmt->comment); + break; default: elog(ERROR, "unrecognized object type: %d", (int) stmt->objtype); @@ -1462,3 +1482,61 @@ CommentCast(List *qualname, List *arguments, char *comment) /* Call CreateComments() to create/drop the comments */ CreateComments(castOid, CastRelationId, 0, comment); } + +static void +CommentTSParser(List *qualname, char *comment) +{ + Oid prsId; + + prsId = TSParserGetPrsid(qualname, false); + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to comment on text search parser"))); + + CreateComments(prsId, TSParserRelationId, 0, comment); +} + +static void +CommentTSDictionary(List *qualname, char *comment) +{ + Oid dictId; + + dictId = TSDictionaryGetDictid(qualname, false); + + if (!pg_ts_dict_ownercheck(dictId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, + NameListToString(qualname)); + + CreateComments(dictId, TSDictionaryRelationId, 0, comment); +} + +static void +CommentTSTemplate(List *qualname, char *comment) +{ + Oid tmplId; + + tmplId = TSTemplateGetTmplid(qualname, false); + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to comment on text search template"))); + + CreateComments(tmplId, TSTemplateRelationId, 0, comment); +} + +static void +CommentTSConfiguration(List *qualname, char *comment) +{ + Oid cfgId; + + cfgId = TSConfigGetCfgid(qualname, false); + + if (!pg_ts_config_ownercheck(cfgId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, + NameListToString(qualname)); + + CreateComments(cfgId, TSConfigRelationId, 0, comment); +} diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 07e56620428..006076b01f4 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.230 2007/07/17 05:02:00 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.231 2007/08/21 01:11:14 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -5079,8 +5079,13 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, case OCLASS_LANGUAGE: case OCLASS_OPERATOR: case OCLASS_OPCLASS: + case OCLASS_OPFAMILY: case OCLASS_TRIGGER: case OCLASS_SCHEMA: + case OCLASS_TSPARSER: + case OCLASS_TSDICT: + case OCLASS_TSTEMPLATE: + case OCLASS_TSCONFIG: /* * We don't expect any of these sorts of objects to depend on diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c new file mode 100644 index 00000000000..7092da132d8 --- /dev/null +++ b/src/backend/commands/tsearchcmds.c @@ -0,0 +1,1948 @@ +/*------------------------------------------------------------------------- + * + * tsearchcmds.c + * + * Routines for tsearch manipulation commands + * + * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.1 2007/08/21 01:11:15 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#include "postgres.h" +#include "miscadmin.h" + +#include "access/heapam.h" +#include "access/genam.h" +#include "access/xact.h" +#include "catalog/dependency.h" +#include "catalog/indexing.h" +#include "catalog/namespace.h" +#include "catalog/pg_namespace.h" +#include "catalog/pg_proc.h" +#include "catalog/pg_ts_config.h" +#include "catalog/pg_ts_config_map.h" +#include "catalog/pg_ts_dict.h" +#include "catalog/pg_ts_parser.h" +#include "catalog/pg_ts_template.h" +#include "catalog/pg_type.h" +#include "commands/defrem.h" +#include "parser/parse_func.h" +#include "tsearch/ts_cache.h" +#include "tsearch/ts_public.h" +#include "tsearch/ts_utils.h" +#include "utils/acl.h" +#include "utils/builtins.h" +#include "utils/catcache.h" +#include "utils/fmgroids.h" +#include "utils/lsyscache.h" +#include "utils/syscache.h" + + +static HeapTuple UpdateTSConfiguration(AlterTSConfigurationStmt *stmt, + HeapTuple tup); +static void MakeConfigurationMapping(AlterTSConfigurationStmt *stmt, + HeapTuple tup); +static void DropConfigurationMapping(AlterTSConfigurationStmt *stmt, + HeapTuple tup); + + +/* --------------------- TS Parser commands ------------------------ */ + +/* + * lookup a parser support function and return its OID (as a Datum) + * + * attnum is the pg_ts_parser column the function will go into + */ +static Datum +get_ts_parser_func(DefElem *defel, int attnum) +{ + List *funcName = defGetQualifiedName(defel); + Oid typeId[3]; + Oid retTypeId; + int nargs; + Oid procOid; + + retTypeId = INTERNALOID; /* correct for most */ + typeId[0] = INTERNALOID; + switch (attnum) + { + case Anum_pg_ts_parser_prsstart: + nargs = 2; + typeId[1] = INT4OID; + break; + case Anum_pg_ts_parser_prstoken: + nargs = 3; + typeId[1] = INTERNALOID; + typeId[2] = INTERNALOID; + break; + case Anum_pg_ts_parser_prsend: + nargs = 1; + retTypeId = VOIDOID; + break; + case Anum_pg_ts_parser_prsheadline: + nargs = 3; + typeId[1] = TEXTOID; + typeId[2] = TSQUERYOID; + break; + case Anum_pg_ts_parser_prslextype: + nargs = 1; + break; + default: + /* should not be here */ + elog(ERROR, "unknown attribute for text search parser: %d", attnum); + nargs = 0; /* keep compiler quiet */ + } + + procOid = LookupFuncName(funcName, nargs, typeId, false); + if (get_func_rettype(procOid) != retTypeId) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("function %s should return type %s", + func_signature_string(funcName, nargs, typeId), + format_type_be(retTypeId)))); + + return ObjectIdGetDatum(procOid); +} + +/* + * make pg_depend entries for a new pg_ts_parser entry + */ +static void +makeParserDependencies(HeapTuple tuple) +{ + Form_pg_ts_parser prs = (Form_pg_ts_parser) GETSTRUCT(tuple); + ObjectAddress myself, + referenced; + + myself.classId = TSParserRelationId; + myself.objectId = HeapTupleGetOid(tuple); + myself.objectSubId = 0; + + /* dependency on namespace */ + referenced.classId = NamespaceRelationId; + referenced.objectId = prs->prsnamespace; + referenced.objectSubId = 0; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + /* dependencies on functions */ + referenced.classId = ProcedureRelationId; + referenced.objectSubId = 0; + + referenced.objectId = prs->prsstart; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + referenced.objectId = prs->prstoken; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + referenced.objectId = prs->prsend; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + referenced.objectId = prs->prslextype; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + if (OidIsValid(prs->prsheadline)) + { + referenced.objectId = prs->prsheadline; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + } +} + +/* + * CREATE TEXT SEARCH PARSER + */ +void +DefineTSParser(List *names, List *parameters) +{ + char *prsname; + ListCell *pl; + Relation prsRel; + HeapTuple tup; + Datum values[Natts_pg_ts_parser]; + char nulls[Natts_pg_ts_parser]; + NameData pname; + Oid prsOid; + Oid namespaceoid; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to create text search parsers"))); + + /* Convert list of names to a name and namespace */ + namespaceoid = QualifiedNameGetCreationNamespace(names, &prsname); + + /* initialize tuple fields with name/namespace */ + memset(values, 0, sizeof(values)); + memset(nulls, ' ', sizeof(nulls)); + + namestrcpy(&pname, prsname); + values[Anum_pg_ts_parser_prsname - 1] = NameGetDatum(&pname); + values[Anum_pg_ts_parser_prsnamespace - 1] = ObjectIdGetDatum(namespaceoid); + + /* + * loop over the definition list and extract the information we need. + */ + foreach(pl, parameters) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "start") == 0) + { + values[Anum_pg_ts_parser_prsstart - 1] = + get_ts_parser_func(defel, Anum_pg_ts_parser_prsstart); + } + else if (pg_strcasecmp(defel->defname, "gettoken") == 0) + { + values[Anum_pg_ts_parser_prstoken - 1] = + get_ts_parser_func(defel, Anum_pg_ts_parser_prstoken); + } + else if (pg_strcasecmp(defel->defname, "end") == 0) + { + values[Anum_pg_ts_parser_prsend - 1] = + get_ts_parser_func(defel, Anum_pg_ts_parser_prsend); + } + else if (pg_strcasecmp(defel->defname, "headline") == 0) + { + values[Anum_pg_ts_parser_prsheadline - 1] = + get_ts_parser_func(defel, Anum_pg_ts_parser_prsheadline); + } + else if (pg_strcasecmp(defel->defname, "lextypes") == 0) + { + values[Anum_pg_ts_parser_prslextype - 1] = + get_ts_parser_func(defel, Anum_pg_ts_parser_prslextype); + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search parser parameter \"%s\" not recognized", + defel->defname))); + } + + /* + * Validation + */ + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_parser_prsstart - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search parser start method is required"))); + + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_parser_prstoken - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search parser gettoken method is required"))); + + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_parser_prsend - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search parser end method is required"))); + + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_parser_prslextype - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search parser lextypes method is required"))); + + /* + * Looks good, insert + */ + prsRel = heap_open(TSParserRelationId, RowExclusiveLock); + + tup = heap_formtuple(prsRel->rd_att, values, nulls); + + prsOid = simple_heap_insert(prsRel, tup); + + CatalogUpdateIndexes(prsRel, tup); + + makeParserDependencies(tup); + + heap_freetuple(tup); + + heap_close(prsRel, RowExclusiveLock); +} + +/* + * DROP TEXT SEARCH PARSER + */ +void +RemoveTSParser(List *names, DropBehavior behavior, bool missing_ok) +{ + Oid prsOid; + ObjectAddress object; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to drop text search parsers"))); + + prsOid = TSParserGetPrsid(names, true); + if (!OidIsValid(prsOid)) + { + if (!missing_ok) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search parser \"%s\" does not exist", + NameListToString(names)))); + } + else + { + ereport(NOTICE, + (errmsg("text search parser \"%s\" does not exist, skipping", + NameListToString(names)))); + } + return; + } + + object.classId = TSParserRelationId; + object.objectId = prsOid; + object.objectSubId = 0; + + performDeletion(&object, behavior); +} + +/* + * Guts of TS parser deletion. + */ +void +RemoveTSParserById(Oid prsId) +{ + Relation relation; + HeapTuple tup; + + relation = heap_open(TSParserRelationId, RowExclusiveLock); + + tup = SearchSysCache(TSPARSEROID, + ObjectIdGetDatum(prsId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search parser %u", prsId); + + simple_heap_delete(relation, &tup->t_self); + + ReleaseSysCache(tup); + + heap_close(relation, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH PARSER RENAME + */ +void +RenameTSParser(List *oldname, const char *newname) +{ + HeapTuple tup; + Relation rel; + Oid prsId; + Oid namespaceOid; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to rename text search parsers"))); + + rel = heap_open(TSParserRelationId, RowExclusiveLock); + + prsId = TSParserGetPrsid(oldname, false); + + tup = SearchSysCacheCopy(TSPARSEROID, + ObjectIdGetDatum(prsId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search parser %u", prsId); + + namespaceOid = ((Form_pg_ts_parser) GETSTRUCT(tup))->prsnamespace; + + if (SearchSysCacheExists(TSPARSERNAMENSP, + PointerGetDatum(newname), + ObjectIdGetDatum(namespaceOid), + 0, 0)) + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("text search parser \"%s\" already exists", + newname))); + + namestrcpy(&(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname), newname); + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* ---------------------- TS Dictionary commands -----------------------*/ + +/* + * make pg_depend entries for a new pg_ts_dict entry + */ +static void +makeDictionaryDependencies(HeapTuple tuple) +{ + Form_pg_ts_dict dict = (Form_pg_ts_dict) GETSTRUCT(tuple); + ObjectAddress myself, + referenced; + + myself.classId = TSDictionaryRelationId; + myself.objectId = HeapTupleGetOid(tuple); + myself.objectSubId = 0; + + /* dependency on namespace */ + referenced.classId = NamespaceRelationId; + referenced.objectId = dict->dictnamespace; + referenced.objectSubId = 0; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + /* dependency on owner */ + recordDependencyOnOwner(myself.classId, myself.objectId, dict->dictowner); + + /* dependency on template */ + referenced.classId = TSTemplateRelationId; + referenced.objectId = dict->dicttemplate; + referenced.objectSubId = 0; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); +} + +/* + * CREATE TEXT SEARCH DICTIONARY + */ +void +DefineTSDictionary(List *names, List *parameters) +{ + ListCell *pl; + Relation dictRel; + HeapTuple tup; + Datum values[Natts_pg_ts_dict]; + char nulls[Natts_pg_ts_dict]; + NameData dname; + int i; + Oid dictOid; + Oid namespaceoid; + AclResult aclresult; + char *dictname; + + /* Convert list of names to a name and namespace */ + namespaceoid = QualifiedNameGetCreationNamespace(names, &dictname); + + /* Check we have creation rights in target namespace */ + aclresult = pg_namespace_aclcheck(namespaceoid, GetUserId(), ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceoid)); + + for (i = 0; i < Natts_pg_ts_dict; i++) + { + nulls[i] = ' '; + values[i] = ObjectIdGetDatum(InvalidOid); + } + + namestrcpy(&dname, dictname); + values[Anum_pg_ts_dict_dictname - 1] = NameGetDatum(&dname); + values[Anum_pg_ts_dict_dictnamespace - 1] = ObjectIdGetDatum(namespaceoid); + values[Anum_pg_ts_dict_dictowner - 1] = ObjectIdGetDatum(GetUserId()); + nulls[Anum_pg_ts_dict_dictinitoption - 1] = 'n'; + + /* + * loop over the definition list and extract the information we need. + */ + foreach(pl, parameters) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "template") == 0) + { + Oid templId; + + templId = TSTemplateGetTmplid(defGetQualifiedName(defel), false); + + values[Anum_pg_ts_dict_dicttemplate - 1] = ObjectIdGetDatum(templId); + nulls[Anum_pg_ts_dict_dicttemplate - 1] = ' '; + } + else if (pg_strcasecmp(defel->defname, "option") == 0) + { + char *opt = defGetString(defel); + + if (pg_strcasecmp(opt, "null") != 0) + { + values[Anum_pg_ts_dict_dictinitoption - 1] = + DirectFunctionCall1(textin, CStringGetDatum(opt)); + nulls[Anum_pg_ts_dict_dictinitoption - 1] = ' '; + } + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search dictionary parameter \"%s\" not recognized", + defel->defname))); + } + + /* + * Validation + */ + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_dict_dicttemplate - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search template is required"))); + + /* + * Looks good, insert + */ + + dictRel = heap_open(TSDictionaryRelationId, RowExclusiveLock); + + tup = heap_formtuple(dictRel->rd_att, values, nulls); + + dictOid = simple_heap_insert(dictRel, tup); + + CatalogUpdateIndexes(dictRel, tup); + + makeDictionaryDependencies(tup); + + heap_freetuple(tup); + + heap_close(dictRel, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH DICTIONARY RENAME + */ +void +RenameTSDictionary(List *oldname, const char *newname) +{ + HeapTuple tup; + Relation rel; + Oid dictId; + Oid namespaceOid; + AclResult aclresult; + + rel = heap_open(TSDictionaryRelationId, RowExclusiveLock); + + dictId = TSDictionaryGetDictid(oldname, false); + + tup = SearchSysCacheCopy(TSDICTOID, + ObjectIdGetDatum(dictId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictId); + + namespaceOid = ((Form_pg_ts_dict) GETSTRUCT(tup))->dictnamespace; + + if (SearchSysCacheExists(TSDICTNAMENSP, + PointerGetDatum(newname), + ObjectIdGetDatum(namespaceOid), + 0, 0)) + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("text search dictionary \"%s\" already exists", + newname))); + + /* must be owner */ + if (!pg_ts_dict_ownercheck(dictId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, + NameListToString(oldname)); + + /* must have CREATE privilege on namespace */ + aclresult = pg_namespace_aclcheck(namespaceOid, GetUserId(), ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceOid)); + + namestrcpy(&(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname), newname); + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* + * DROP TEXT SEARCH DICTIONARY + */ +void +RemoveTSDictionary(List *names, DropBehavior behavior, bool missing_ok) +{ + Oid dictOid; + ObjectAddress object; + HeapTuple tup; + Oid namespaceId; + + dictOid = TSDictionaryGetDictid(names, true); + if (!OidIsValid(dictOid)) + { + if (!missing_ok) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search dictionary \"%s\" does not exist", + NameListToString(names)))); + } + else + { + ereport(NOTICE, + (errmsg("text search dictionary \"%s\" does not exist, skipping", + NameListToString(names)))); + } + return; + } + + tup = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(dictOid), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictOid); + + /* Permission check: must own dictionary or its namespace */ + namespaceId = ((Form_pg_ts_dict) GETSTRUCT(tup))->dictnamespace; + if (!pg_ts_dict_ownercheck(dictOid, GetUserId()) && + !pg_namespace_ownercheck(namespaceId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, + NameListToString(names)); + + ReleaseSysCache(tup); + + object.classId = TSDictionaryRelationId; + object.objectId = dictOid; + object.objectSubId = 0; + + performDeletion(&object, behavior); +} + +/* + * Guts of TS dictionary deletion. + */ +void +RemoveTSDictionaryById(Oid dictId) +{ + Relation relation; + HeapTuple tup; + + relation = heap_open(TSDictionaryRelationId, RowExclusiveLock); + + tup = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(dictId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictId); + + simple_heap_delete(relation, &tup->t_self); + + ReleaseSysCache(tup); + + heap_close(relation, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH DICTIONARY + */ +void +AlterTSDictionary(AlterTSDictionaryStmt * stmt) +{ + HeapTuple tup, + newtup; + Relation rel; + Oid dictId; + ListCell *pl; + Datum repl_val[Natts_pg_ts_dict]; + char repl_null[Natts_pg_ts_dict]; + char repl_repl[Natts_pg_ts_dict]; + + dictId = TSDictionaryGetDictid(stmt->dictname, false); + + rel = heap_open(TSDictionaryRelationId, RowExclusiveLock); + + tup = SearchSysCache(TSDICTOID, + ObjectIdGetDatum(dictId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictId); + + /* must be owner */ + if (!pg_ts_dict_ownercheck(dictId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, + NameListToString(stmt->dictname)); + + memset(repl_val, 0, sizeof(repl_val)); + memset(repl_null, ' ', sizeof(repl_null)); + memset(repl_repl, ' ', sizeof(repl_repl)); + + /* + * NOTE: because we only support altering the option, not the template, + * there is no need to update dependencies. + */ + foreach(pl, stmt->options) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "option") == 0) + { + char *opt = defGetString(defel); + + if (pg_strcasecmp(opt, "null") == 0) + { + repl_null[Anum_pg_ts_dict_dictinitoption - 1] = 'n'; + } + else + { + repl_val[Anum_pg_ts_dict_dictinitoption - 1] = + DirectFunctionCall1(textin, CStringGetDatum(opt)); + repl_null[Anum_pg_ts_dict_dictinitoption - 1] = ' '; + } + repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = 'r'; + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search dictionary parameter \"%s\" not recognized", + defel->defname))); + } + + newtup = heap_modifytuple(tup, RelationGetDescr(rel), + repl_val, repl_null, repl_repl); + + simple_heap_update(rel, &newtup->t_self, newtup); + + CatalogUpdateIndexes(rel, newtup); + + heap_freetuple(newtup); + ReleaseSysCache(tup); + + heap_close(rel, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH DICTIONARY OWNER + */ +void +AlterTSDictionaryOwner(List *name, Oid newOwnerId) +{ + HeapTuple tup; + Relation rel; + Oid dictId; + Oid namespaceOid; + AclResult aclresult; + Form_pg_ts_dict form; + + rel = heap_open(TSDictionaryRelationId, RowExclusiveLock); + + dictId = TSDictionaryGetDictid(name, false); + + tup = SearchSysCacheCopy(TSDICTOID, + ObjectIdGetDatum(dictId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search dictionary %u", + dictId); + + form = (Form_pg_ts_dict) GETSTRUCT(tup); + namespaceOid = form->dictnamespace; + + if (form->dictowner != newOwnerId) + { + /* Superusers can always do it */ + if (!superuser()) + { + /* must be owner */ + if (!pg_ts_dict_ownercheck(dictId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, + NameListToString(name)); + + /* Must be able to become new owner */ + check_is_member_of_role(GetUserId(), newOwnerId); + + /* New owner must have CREATE privilege on namespace */ + aclresult = pg_namespace_aclcheck(namespaceOid, newOwnerId, ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceOid)); + } + + form->dictowner = newOwnerId; + + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + /* Update owner dependency reference */ + changeDependencyOnOwner(TSDictionaryRelationId, HeapTupleGetOid(tup), + newOwnerId); + } + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* ---------------------- TS Template commands -----------------------*/ + +/* + * lookup a template support function and return its OID (as a Datum) + * + * attnum is the pg_ts_template column the function will go into + */ +static Datum +get_ts_template_func(DefElem *defel, int attnum) +{ + List *funcName = defGetQualifiedName(defel); + Oid typeId[4]; + Oid retTypeId; + int nargs; + Oid procOid; + + retTypeId = INTERNALOID; + typeId[0] = INTERNALOID; + typeId[1] = INTERNALOID; + typeId[2] = INTERNALOID; + typeId[3] = INTERNALOID; + switch (attnum) + { + case Anum_pg_ts_template_tmplinit: + nargs = 1; + break; + case Anum_pg_ts_template_tmpllexize: + nargs = 4; + break; + default: + /* should not be here */ + elog(ERROR, "unknown attribute for text search template: %d", + attnum); + nargs = 0; /* keep compiler quiet */ + } + + procOid = LookupFuncName(funcName, nargs, typeId, false); + if (get_func_rettype(procOid) != retTypeId) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("function %s should return type %s", + func_signature_string(funcName, nargs, typeId), + format_type_be(retTypeId)))); + + return ObjectIdGetDatum(procOid); +} + +/* + * make pg_depend entries for a new pg_ts_template entry + */ +static void +makeTSTemplateDependencies(HeapTuple tuple) +{ + Form_pg_ts_template tmpl = (Form_pg_ts_template) GETSTRUCT(tuple); + ObjectAddress myself, + referenced; + + myself.classId = TSTemplateRelationId; + myself.objectId = HeapTupleGetOid(tuple); + myself.objectSubId = 0; + + /* dependency on namespace */ + referenced.classId = NamespaceRelationId; + referenced.objectId = tmpl->tmplnamespace; + referenced.objectSubId = 0; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + /* dependencies on functions */ + referenced.classId = ProcedureRelationId; + referenced.objectSubId = 0; + + referenced.objectId = tmpl->tmpllexize; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + + if (OidIsValid(tmpl->tmplinit)) + { + referenced.objectId = tmpl->tmplinit; + recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); + } +} + +/* + * CREATE TEXT SEARCH TEMPLATE + */ +void +DefineTSTemplate(List *names, List *parameters) +{ + ListCell *pl; + Relation tmplRel; + HeapTuple tup; + Datum values[Natts_pg_ts_template]; + char nulls[Natts_pg_ts_template]; + NameData dname; + int i; + Oid dictOid; + Oid namespaceoid; + char *tmplname; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to create text search templates"))); + + /* Convert list of names to a name and namespace */ + namespaceoid = QualifiedNameGetCreationNamespace(names, &tmplname); + + for (i = 0; i < Natts_pg_ts_template; i++) + { + nulls[i] = ' '; + values[i] = ObjectIdGetDatum(InvalidOid); + } + + namestrcpy(&dname, tmplname); + values[Anum_pg_ts_template_tmplname - 1] = NameGetDatum(&dname); + values[Anum_pg_ts_template_tmplnamespace - 1] = ObjectIdGetDatum(namespaceoid); + + /* + * loop over the definition list and extract the information we need. + */ + foreach(pl, parameters) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "init") == 0) + { + values[Anum_pg_ts_template_tmplinit - 1] = + get_ts_template_func(defel, Anum_pg_ts_template_tmplinit); + nulls[Anum_pg_ts_template_tmplinit - 1] = ' '; + } + else if (pg_strcasecmp(defel->defname, "lexize") == 0) + { + values[Anum_pg_ts_template_tmpllexize - 1] = + get_ts_template_func(defel, Anum_pg_ts_template_tmpllexize); + nulls[Anum_pg_ts_template_tmpllexize - 1] = ' '; + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search template parameter \"%s\" not recognized", + defel->defname))); + } + + /* + * Validation + */ + if (!OidIsValid(DatumGetObjectId(values[Anum_pg_ts_template_tmpllexize - 1]))) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search template lexize method is required"))); + + /* + * Looks good, insert + */ + + tmplRel = heap_open(TSTemplateRelationId, RowExclusiveLock); + + tup = heap_formtuple(tmplRel->rd_att, values, nulls); + + dictOid = simple_heap_insert(tmplRel, tup); + + CatalogUpdateIndexes(tmplRel, tup); + + makeTSTemplateDependencies(tup); + + heap_freetuple(tup); + + heap_close(tmplRel, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH TEMPLATE RENAME + */ +void +RenameTSTemplate(List *oldname, const char *newname) +{ + HeapTuple tup; + Relation rel; + Oid tmplId; + Oid namespaceOid; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to rename text search templates"))); + + rel = heap_open(TSTemplateRelationId, RowExclusiveLock); + + tmplId = TSTemplateGetTmplid(oldname, false); + + tup = SearchSysCacheCopy(TSTEMPLATEOID, + ObjectIdGetDatum(tmplId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search template %u", + tmplId); + + namespaceOid = ((Form_pg_ts_template) GETSTRUCT(tup))->tmplnamespace; + + if (SearchSysCacheExists(TSTEMPLATENAMENSP, + PointerGetDatum(newname), + ObjectIdGetDatum(namespaceOid), + 0, 0)) + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("text search template \"%s\" already exists", + newname))); + + namestrcpy(&(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname), newname); + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* + * DROP TEXT SEARCH TEMPLATE + */ +void +RemoveTSTemplate(List *names, DropBehavior behavior, bool missing_ok) +{ + Oid tmplOid; + ObjectAddress object; + + if (!superuser()) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("must be superuser to drop text search templates"))); + + tmplOid = TSTemplateGetTmplid(names, true); + if (!OidIsValid(tmplOid)) + { + if (!missing_ok) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search template \"%s\" does not exist", + NameListToString(names)))); + } + else + { + ereport(NOTICE, + (errmsg("text search template \"%s\" does not exist, skipping", + NameListToString(names)))); + } + return; + } + + object.classId = TSTemplateRelationId; + object.objectId = tmplOid; + object.objectSubId = 0; + + performDeletion(&object, behavior); +} + +/* + * Guts of TS template deletion. + */ +void +RemoveTSTemplateById(Oid tmplId) +{ + Relation relation; + HeapTuple tup; + + relation = heap_open(TSTemplateRelationId, RowExclusiveLock); + + tup = SearchSysCache(TSTEMPLATEOID, + ObjectIdGetDatum(tmplId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search template %u", + tmplId); + + simple_heap_delete(relation, &tup->t_self); + + ReleaseSysCache(tup); + + heap_close(relation, RowExclusiveLock); +} + +/* ---------------------- TS Configuration commands -----------------------*/ + +/* + * Finds syscache tuple of configuration. + * Returns NULL if no such cfg. + */ +static HeapTuple +GetTSConfigTuple(List *names) +{ + HeapTuple tup; + Oid cfgId; + + cfgId = TSConfigGetCfgid(names, true); + if (!OidIsValid(cfgId)) + return NULL; + + tup = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(cfgId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search configuration %u", + cfgId); + + return tup; +} + +/* + * make pg_depend entries for a new or updated pg_ts_config entry + * + * Pass opened pg_ts_config_map relation if there might be any config map + * entries for the config. + */ +static void +makeConfigurationDependencies(HeapTuple tuple, bool removeOld, + Relation mapRel) +{ + Form_pg_ts_config cfg = (Form_pg_ts_config) GETSTRUCT(tuple); + ObjectAddresses *addrs; + ObjectAddress myself, + referenced; + + myself.classId = TSConfigRelationId; + myself.objectId = HeapTupleGetOid(tuple); + myself.objectSubId = 0; + + /* for ALTER case, first flush old dependencies */ + if (removeOld) + { + deleteDependencyRecordsFor(myself.classId, myself.objectId); + deleteSharedDependencyRecordsFor(myself.classId, myself.objectId); + } + + /* + * We use an ObjectAddresses list to remove possible duplicate + * dependencies from the config map info. The pg_ts_config items + * shouldn't be duplicates, but might as well fold them all into one call. + */ + addrs = new_object_addresses(); + + /* dependency on namespace */ + referenced.classId = NamespaceRelationId; + referenced.objectId = cfg->cfgnamespace; + referenced.objectSubId = 0; + add_exact_object_address(&referenced, addrs); + + /* dependency on owner */ + recordDependencyOnOwner(myself.classId, myself.objectId, cfg->cfgowner); + + /* dependency on parser */ + referenced.classId = TSParserRelationId; + referenced.objectId = cfg->cfgparser; + referenced.objectSubId = 0; + add_exact_object_address(&referenced, addrs); + + /* dependencies on dictionaries listed in config map */ + if (mapRel) + { + ScanKeyData skey; + SysScanDesc scan; + HeapTuple maptup; + + /* CCI to ensure we can see effects of caller's changes */ + CommandCounterIncrement(); + + ScanKeyInit(&skey, + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(myself.objectId)); + + scan = systable_beginscan(mapRel, TSConfigMapIndexId, true, + SnapshotNow, 1, &skey); + + while (HeapTupleIsValid((maptup = systable_getnext(scan)))) + { + Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup); + + referenced.classId = TSDictionaryRelationId; + referenced.objectId = cfgmap->mapdict; + referenced.objectSubId = 0; + add_exact_object_address(&referenced, addrs); + } + + systable_endscan(scan); + } + + /* Record 'em (this includes duplicate elimination) */ + record_object_address_dependencies(&myself, addrs, DEPENDENCY_NORMAL); + + free_object_addresses(addrs); +} + +/* + * CREATE TEXT SEARCH CONFIGURATION + */ +void +DefineTSConfiguration(List *names, List *parameters) +{ + Relation cfgRel; + Relation mapRel = NULL; + HeapTuple tup; + Datum values[Natts_pg_ts_config]; + char nulls[Natts_pg_ts_config]; + AclResult aclresult; + Oid namespaceoid; + char *cfgname; + NameData cname; + List *templateName = NIL; + Oid templateOid = InvalidOid; + Oid prsOid = InvalidOid; + bool with_map = false; + Oid cfgOid; + ListCell *pl; + + /* Convert list of names to a name and namespace */ + namespaceoid = QualifiedNameGetCreationNamespace(names, &cfgname); + + /* Check we have creation rights in target namespace */ + aclresult = pg_namespace_aclcheck(namespaceoid, GetUserId(), ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceoid)); + + /* + * loop over the definition list and extract the information we need. + */ + foreach(pl, parameters) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "parser") == 0) + prsOid = TSParserGetPrsid(defGetQualifiedName(defel), false); + else if (pg_strcasecmp(defel->defname, "template") == 0) + templateName = defGetQualifiedName(defel); + else if (pg_strcasecmp(defel->defname, "map") == 0) + with_map = defGetBoolean(defel); + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search configuration parameter \"%s\" not recognized", + defel->defname))); + } + + /* + * Look up template if given. XXX the "template" is an existing config + * that we copy, not a pg_ts_template entry. This seems confusing. + * Maybe should use "source" or some other word? + */ + if (templateName) + { + Form_pg_ts_config cfg; + + templateOid = TSConfigGetCfgid(templateName, false); + + tup = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(templateOid), + 0, 0, 0); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search configuration %u", + templateOid); + + cfg = (Form_pg_ts_config) GETSTRUCT(tup); + + /* Use template's parser if no other was specified */ + if (!OidIsValid(prsOid)) + prsOid = cfg->cfgparser; + + ReleaseSysCache(tup); + } + + /* + * Validation + */ + if (!OidIsValid(prsOid)) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("text search parser is required"))); + + /* + * Looks good, build tuple and insert + */ + memset(values, 0, sizeof(values)); + memset(nulls, ' ', sizeof(nulls)); + + namestrcpy(&cname, cfgname); + values[Anum_pg_ts_config_cfgname - 1] = NameGetDatum(&cname); + values[Anum_pg_ts_config_cfgnamespace - 1] = ObjectIdGetDatum(namespaceoid); + values[Anum_pg_ts_config_cfgowner - 1] = ObjectIdGetDatum(GetUserId()); + values[Anum_pg_ts_config_cfgparser - 1] = ObjectIdGetDatum(prsOid); + + cfgRel = heap_open(TSConfigRelationId, RowExclusiveLock); + + tup = heap_formtuple(cfgRel->rd_att, values, nulls); + + cfgOid = simple_heap_insert(cfgRel, tup); + + CatalogUpdateIndexes(cfgRel, tup); + + if (OidIsValid(templateOid) && with_map) + { + /* + * Copy token-dicts map from template + */ + ScanKeyData skey; + SysScanDesc scan; + HeapTuple maptup; + + mapRel = heap_open(TSConfigMapRelationId, RowExclusiveLock); + + ScanKeyInit(&skey, + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(templateOid)); + + scan = systable_beginscan(mapRel, TSConfigMapIndexId, true, + SnapshotNow, 1, &skey); + + while (HeapTupleIsValid((maptup = systable_getnext(scan)))) + { + Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup); + HeapTuple newmaptup; + Datum mapvalues[Natts_pg_ts_config_map]; + char mapnulls[Natts_pg_ts_config_map]; + + memset(mapvalues, 0, sizeof(mapvalues)); + memset(mapnulls, ' ', sizeof(mapnulls)); + + mapvalues[Anum_pg_ts_config_map_mapcfg - 1] = cfgOid; + mapvalues[Anum_pg_ts_config_map_maptokentype - 1] = cfgmap->maptokentype; + mapvalues[Anum_pg_ts_config_map_mapseqno - 1] = cfgmap->mapseqno; + mapvalues[Anum_pg_ts_config_map_mapdict - 1] = cfgmap->mapdict; + + newmaptup = heap_formtuple(mapRel->rd_att, mapvalues, mapnulls); + + simple_heap_insert(mapRel, newmaptup); + + CatalogUpdateIndexes(mapRel, newmaptup); + + heap_freetuple(newmaptup); + } + + systable_endscan(scan); + } + + makeConfigurationDependencies(tup, false, mapRel); + + heap_freetuple(tup); + + if (mapRel) + heap_close(mapRel, RowExclusiveLock); + heap_close(cfgRel, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH CONFIGURATION RENAME + */ +void +RenameTSConfiguration(List *oldname, const char *newname) +{ + HeapTuple tup; + Relation rel; + Oid cfgId; + AclResult aclresult; + Oid namespaceOid; + + rel = heap_open(TSConfigRelationId, RowExclusiveLock); + + cfgId = TSConfigGetCfgid(oldname, false); + + tup = SearchSysCacheCopy(TSCONFIGOID, + ObjectIdGetDatum(cfgId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search configuration %u", + cfgId); + + namespaceOid = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgnamespace; + + if (SearchSysCacheExists(TSCONFIGNAMENSP, + PointerGetDatum(newname), + ObjectIdGetDatum(namespaceOid), + 0, 0)) + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("text search configuration \"%s\" already exists", + newname))); + + /* must be owner */ + if (!pg_ts_config_ownercheck(cfgId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, + NameListToString(oldname)); + + /* must have CREATE privilege on namespace */ + aclresult = pg_namespace_aclcheck(namespaceOid, GetUserId(), ACL_CREATE); + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceOid)); + + namestrcpy(&(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname), newname); + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* + * DROP TEXT SEARCH CONFIGURATION + */ +void +RemoveTSConfiguration(List *names, DropBehavior behavior, bool missing_ok) +{ + Oid cfgOid; + Oid namespaceId; + ObjectAddress object; + HeapTuple tup; + + tup = GetTSConfigTuple(names); + + if (!HeapTupleIsValid(tup)) + { + if (!missing_ok) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search configuration \"%s\" does not exist", + NameListToString(names)))); + } + else + { + ereport(NOTICE, + (errmsg("text search configuration \"%s\" does not exist, skipping", + NameListToString(names)))); + } + return; + } + + /* Permission check: must own configuration or its namespace */ + cfgOid = HeapTupleGetOid(tup); + namespaceId = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgnamespace; + if (!pg_ts_config_ownercheck(cfgOid, GetUserId()) && + !pg_namespace_ownercheck(namespaceId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, + NameListToString(names)); + + ReleaseSysCache(tup); + + object.classId = TSConfigRelationId; + object.objectId = cfgOid; + object.objectSubId = 0; + + performDeletion(&object, behavior); +} + +/* + * Guts of TS configuration deletion. + */ +void +RemoveTSConfigurationById(Oid cfgId) +{ + Relation relCfg, + relMap; + HeapTuple tup; + ScanKeyData skey; + SysScanDesc scan; + + /* Remove the pg_ts_config entry */ + relCfg = heap_open(TSConfigRelationId, RowExclusiveLock); + + tup = SearchSysCache(TSCONFIGOID, + ObjectIdGetDatum(cfgId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for text search dictionary %u", + cfgId); + + simple_heap_delete(relCfg, &tup->t_self); + + ReleaseSysCache(tup); + + heap_close(relCfg, RowExclusiveLock); + + /* Remove any pg_ts_config_map entries */ + relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock); + + ScanKeyInit(&skey, + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(cfgId)); + + scan = systable_beginscan(relMap, TSConfigMapIndexId, true, + SnapshotNow, 1, &skey); + + while (HeapTupleIsValid((tup = systable_getnext(scan)))) + { + simple_heap_delete(relMap, &tup->t_self); + } + + systable_endscan(scan); + + heap_close(relMap, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH CONFIGURATION OWNER + */ +void +AlterTSConfigurationOwner(List *name, Oid newOwnerId) +{ + HeapTuple tup; + Relation rel; + Oid cfgId; + AclResult aclresult; + Oid namespaceOid; + Form_pg_ts_config form; + + rel = heap_open(TSConfigRelationId, RowExclusiveLock); + + cfgId = TSConfigGetCfgid(name, false); + + tup = SearchSysCacheCopy(TSCONFIGOID, + ObjectIdGetDatum(cfgId), + 0, 0, 0); + + if (!HeapTupleIsValid(tup)) /* should not happen */ + elog(ERROR, "cache lookup failed for text search configuration %u", + cfgId); + + form = (Form_pg_ts_config) GETSTRUCT(tup); + namespaceOid = form->cfgnamespace; + + if (form->cfgowner != newOwnerId) + { + /* Superusers can always do it */ + if (!superuser()) + { + /* must be owner */ + if (!pg_ts_config_ownercheck(cfgId, GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, + NameListToString(name)); + + /* Must be able to become new owner */ + check_is_member_of_role(GetUserId(), newOwnerId); + + /* New owner must have CREATE privilege on namespace */ + aclresult = pg_namespace_aclcheck(namespaceOid, newOwnerId, ACL_CREATE); + if (aclresult != ACLCHECK_OK) + aclcheck_error(aclresult, ACL_KIND_NAMESPACE, + get_namespace_name(namespaceOid)); + } + + form->cfgowner = newOwnerId; + + simple_heap_update(rel, &tup->t_self, tup); + CatalogUpdateIndexes(rel, tup); + + /* Update owner dependency reference */ + changeDependencyOnOwner(TSConfigRelationId, HeapTupleGetOid(tup), + newOwnerId); + } + + heap_close(rel, NoLock); + heap_freetuple(tup); +} + +/* + * ALTER TEXT SEARCH CONFIGURATION - main entry point + */ +void +AlterTSConfiguration(AlterTSConfigurationStmt *stmt) +{ + HeapTuple tup; + HeapTuple newtup; + Relation mapRel; + + /* Find the configuration */ + tup = GetTSConfigTuple(stmt->cfgname); + if (!HeapTupleIsValid(tup)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("text search configuration \"%s\" does not exist", + NameListToString(stmt->cfgname)))); + + /* must be owner */ + if (!pg_ts_config_ownercheck(HeapTupleGetOid(tup), GetUserId())) + aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, + NameListToString(stmt->cfgname)); + + /* Update fields of config tuple? */ + if (stmt->options) + newtup = UpdateTSConfiguration(stmt, tup); + else + newtup = tup; + + /* Add or drop mappings? */ + if (stmt->dicts) + MakeConfigurationMapping(stmt, newtup); + else if (stmt->tokentype) + DropConfigurationMapping(stmt, newtup); + + /* + * Even if we aren't changing mappings, there could already be some, + * so makeConfigurationDependencies always has to look. + */ + mapRel = heap_open(TSConfigMapRelationId, AccessShareLock); + + /* Update dependencies */ + makeConfigurationDependencies(newtup, true, mapRel); + + heap_close(mapRel, AccessShareLock); + + ReleaseSysCache(tup); +} + +/* + * ALTER TEXT SEARCH CONFIGURATION - update fields of pg_ts_config tuple + */ +static HeapTuple +UpdateTSConfiguration(AlterTSConfigurationStmt *stmt, HeapTuple tup) +{ + Relation cfgRel; + ListCell *pl; + Datum repl_val[Natts_pg_ts_config]; + char repl_null[Natts_pg_ts_config]; + char repl_repl[Natts_pg_ts_config]; + HeapTuple newtup; + + memset(repl_val, 0, sizeof(repl_val)); + memset(repl_null, ' ', sizeof(repl_null)); + memset(repl_repl, ' ', sizeof(repl_repl)); + + cfgRel = heap_open(TSConfigRelationId, RowExclusiveLock); + + foreach(pl, stmt->options) + { + DefElem *defel = (DefElem *) lfirst(pl); + + if (pg_strcasecmp(defel->defname, "parser") == 0) + { + Oid newPrs; + + newPrs = TSParserGetPrsid(defGetQualifiedName(defel), false); + repl_val[Anum_pg_ts_config_cfgparser - 1] = ObjectIdGetDatum(newPrs); + repl_repl[Anum_pg_ts_config_cfgparser - 1] = 'r'; + } + else + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("text search configuration parameter \"%s\" not recognized", + defel->defname))); + } + + newtup = heap_modifytuple(tup, RelationGetDescr(cfgRel), + repl_val, repl_null, repl_repl); + + simple_heap_update(cfgRel, &newtup->t_self, newtup); + + CatalogUpdateIndexes(cfgRel, newtup); + + heap_close(cfgRel, RowExclusiveLock); + + return newtup; +} + +/*------------------- TS Configuration mapping stuff ----------------*/ + +/* + * Translate a list of token type names to an array of token type numbers + */ +static int * +getTokenTypes(Oid prsId, List *tokennames) +{ + TSParserCacheEntry *prs = lookup_ts_parser_cache(prsId); + LexDescr *list; + int *res, + i, + ntoken; + ListCell *tn; + + ntoken = list_length(tokennames); + if (ntoken == 0) + return NULL; + res = (int *) palloc(sizeof(int) * ntoken); + + if (!OidIsValid(prs->lextypeOid)) + elog(ERROR, "method lextype isn't defined for text search parser %u", + prsId); + + /* OidFunctionCall0 is absent */ + list = (LexDescr *) DatumGetPointer(OidFunctionCall1(prs->lextypeOid, + (Datum) 0)); + + i = 0; + foreach(tn, tokennames) + { + Value *val = (Value *) lfirst(tn); + bool found = false; + int j; + + j = 0; + while (list && list[j].lexid) + { + /* XXX should we use pg_strcasecmp here? */ + if (strcmp(strVal(val), list[j].alias) == 0) + { + res[i] = list[j].lexid; + found = true; + break; + } + j++; + } + if (!found) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("token type \"%s\" does not exist", + strVal(val)))); + i++; + } + + return res; +} + +/* + * ALTER TEXT SEARCH CONFIGURATION ADD/ALTER MAPPING + */ +static void +MakeConfigurationMapping(AlterTSConfigurationStmt *stmt, HeapTuple tup) +{ + Oid cfgId = HeapTupleGetOid(tup); + Relation relMap; + ScanKeyData skey[2]; + SysScanDesc scan; + HeapTuple maptup; + int i; + int j; + Oid prsId; + int *tokens, + ntoken; + Oid *dictIds; + int ndict; + ListCell *c; + + prsId = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgparser; + + tokens = getTokenTypes(prsId, stmt->tokentype); + ntoken = list_length(stmt->tokentype); + + relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock); + + if (stmt->override) + { + /* + * delete maps for tokens if they exist and command was ALTER + */ + for (i = 0; i < ntoken; i++) + { + ScanKeyInit(&skey[0], + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(cfgId)); + ScanKeyInit(&skey[1], + Anum_pg_ts_config_map_maptokentype, + BTEqualStrategyNumber, F_INT4EQ, + Int32GetDatum(tokens[i])); + + scan = systable_beginscan(relMap, TSConfigMapIndexId, true, + SnapshotNow, 2, skey); + + while (HeapTupleIsValid((maptup = systable_getnext(scan)))) + { + simple_heap_delete(relMap, &maptup->t_self); + } + + systable_endscan(scan); + } + } + + /* + * Convert list of dictionary names to array of dict OIDs + */ + ndict = list_length(stmt->dicts); + dictIds = (Oid *) palloc(sizeof(Oid) * ndict); + i = 0; + foreach(c, stmt->dicts) + { + List *names = (List *) lfirst(c); + + dictIds[i] = TSDictionaryGetDictid(names, false); + i++; + } + + if (stmt->replace) + { + /* + * Replace a specific dictionary in existing entries + */ + Oid dictOld = dictIds[0], + dictNew = dictIds[1]; + + ScanKeyInit(&skey[0], + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(cfgId)); + + scan = systable_beginscan(relMap, TSConfigMapIndexId, true, + SnapshotNow, 1, skey); + + while (HeapTupleIsValid((maptup = systable_getnext(scan)))) + { + Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup); + + /* + * check if it's one of target token types + */ + if (tokens) + { + bool tokmatch = false; + + for (j = 0; j < ntoken; j++) + { + if (cfgmap->maptokentype == tokens[j]) + { + tokmatch = true; + break; + } + } + if (!tokmatch) + continue; + } + + /* + * replace dictionary if match + */ + if (cfgmap->mapdict == dictOld) + { + Datum repl_val[Natts_pg_ts_config_map]; + char repl_null[Natts_pg_ts_config_map]; + char repl_repl[Natts_pg_ts_config_map]; + HeapTuple newtup; + + memset(repl_val, 0, sizeof(repl_val)); + memset(repl_null, ' ', sizeof(repl_null)); + memset(repl_repl, ' ', sizeof(repl_repl)); + + repl_val[Anum_pg_ts_config_map_mapdict - 1] = ObjectIdGetDatum(dictNew); + repl_repl[Anum_pg_ts_config_map_mapdict - 1] = 'r'; + + newtup = heap_modifytuple(maptup, + RelationGetDescr(relMap), + repl_val, repl_null, repl_repl); + simple_heap_update(relMap, &newtup->t_self, newtup); + + CatalogUpdateIndexes(relMap, newtup); + } + } + + systable_endscan(scan); + } + else + { + /* + * Insertion of new entries + */ + for (i = 0; i < ntoken; i++) + { + for (j = 0; j < ndict; j++) + { + Datum values[Natts_pg_ts_config_map]; + char nulls[Natts_pg_ts_config_map]; + + memset(nulls, ' ', sizeof(nulls)); + values[Anum_pg_ts_config_map_mapcfg - 1] = ObjectIdGetDatum(cfgId); + values[Anum_pg_ts_config_map_maptokentype - 1] = Int32GetDatum(tokens[i]); + values[Anum_pg_ts_config_map_mapseqno - 1] = Int32GetDatum(j + 1); + values[Anum_pg_ts_config_map_mapdict - 1] = ObjectIdGetDatum(dictIds[j]); + + tup = heap_formtuple(relMap->rd_att, values, nulls); + simple_heap_insert(relMap, tup); + CatalogUpdateIndexes(relMap, tup); + + heap_freetuple(tup); + } + } + } + + heap_close(relMap, RowExclusiveLock); +} + +/* + * ALTER TEXT SEARCH CONFIGURATION DROP MAPPING + */ +static void +DropConfigurationMapping(AlterTSConfigurationStmt *stmt, HeapTuple tup) +{ + Oid cfgId = HeapTupleGetOid(tup); + Relation relMap; + ScanKeyData skey[2]; + SysScanDesc scan; + HeapTuple maptup; + int i; + Oid prsId; + int *tokens, + ntoken; + ListCell *c; + + prsId = ((Form_pg_ts_config) GETSTRUCT(tup))->cfgparser; + + tokens = getTokenTypes(prsId, stmt->tokentype); + ntoken = list_length(stmt->tokentype); + + relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock); + + i = 0; + foreach(c, stmt->tokentype) + { + Value *val = (Value *) lfirst(c); + bool found = false; + + ScanKeyInit(&skey[0], + Anum_pg_ts_config_map_mapcfg, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(cfgId)); + ScanKeyInit(&skey[1], + Anum_pg_ts_config_map_maptokentype, + BTEqualStrategyNumber, F_INT4EQ, + Int32GetDatum(tokens[i])); + + scan = systable_beginscan(relMap, TSConfigMapIndexId, true, + SnapshotNow, 2, skey); + + while (HeapTupleIsValid((maptup = systable_getnext(scan)))) + { + simple_heap_delete(relMap, &maptup->t_self); + found = true; + } + + systable_endscan(scan); + + if (!found) + { + if (!stmt->missing_ok) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("mapping for token type \"%s\" does not exist", + strVal(val)))); + } + else + { + ereport(NOTICE, + (errmsg("mapping for token type \"%s\" does not exist, skipping", + strVal(val)))); + } + } + + i++; + } + + heap_close(relMap, RowExclusiveLock); +} diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 324f89a2566..ed3d55c9d7b 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.597 2007/07/03 01:30:36 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.598 2007/08/21 01:11:15 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -173,6 +173,7 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args) ViewStmt CheckPointStmt CreateConversionStmt DeallocateStmt PrepareStmt ExecuteStmt DropOwnedStmt ReassignOwnedStmt + AlterTSConfigurationStmt AlterTSDictionaryStmt %type <node> select_no_parens select_with_parens select_clause simple_select values_clause @@ -375,14 +376,14 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args) CACHE CALLED CASCADE CASCADED CASE CAST CHAIN CHAR_P CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT - COMMITTED CONCURRENTLY CONNECTION CONSTRAINT CONSTRAINTS + COMMITTED CONCURRENTLY CONFIGURATION CONNECTION CONSTRAINT CONSTRAINTS CONTENT_P CONVERSION_P CONVERT COPY COST CREATE CREATEDB CREATEROLE CREATEUSER CROSS CSV CURRENT_P CURRENT_DATE CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS - DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS - DESC DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP + DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS DESC + DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP EACH ELSE ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ESCAPE EXCEPT EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT @@ -407,7 +408,7 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args) LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION LOCK_P LOGIN_P - MATCH MAXVALUE MINUTE_P MINVALUE MODE MONTH_P MOVE + MAPPING MATCH MAXVALUE MINUTE_P MINVALUE MODE MONTH_P MOVE NAME_P NAMES NATIONAL NATURAL NCHAR NEW NEXT NO NOCREATEDB NOCREATEROLE NOCREATEUSER NOINHERIT NOLOGIN_P NONE NOSUPERUSER @@ -416,7 +417,7 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args) OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNED OWNER - PARTIAL PASSWORD PLACING PLANS POSITION + PARSER PARTIAL PASSWORD PLACING PLANS POSITION PRECISION PRESERVE PREPARE PREPARED PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE @@ -426,13 +427,13 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args) REPEATABLE REPLACE REPLICA RESET RESTART RESTRICT RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROW ROWS RULE - SAVEPOINT SCHEMA SCROLL SECOND_P SECURITY SELECT SEQUENCE + SAVEPOINT SCHEMA SCROLL SEARCH SECOND_P SECURITY SELECT SEQUENCE SERIALIZABLE SESSION SESSION_USER SET SETOF SHARE SHOW SIMILAR SIMPLE SMALLINT SOME STABLE STANDALONE_P START STATEMENT STATISTICS STDIN STDOUT STORAGE STRICT_P STRIP_P SUBSTRING SUPERUSER_P SYMMETRIC SYSID SYSTEM_P - TABLE TABLESPACE TEMP TEMPLATE TEMPORARY THEN TIME TIMESTAMP + TABLE TABLESPACE TEMP TEMPLATE TEMPORARY TEXT THEN TIME TIMESTAMP TO TRAILING TRANSACTION TREAT TRIGGER TRIM TRUE_P TRUNCATE TRUSTED TYPE_P @@ -537,6 +538,8 @@ stmt : | AlterTableStmt | AlterRoleSetStmt | AlterRoleStmt + | AlterTSConfigurationStmt + | AlterTSDictionaryStmt | AlterUserSetStmt | AlterUserStmt | AnalyzeStmt @@ -2972,6 +2975,42 @@ DefineStmt: n->vals = $7; $$ = (Node *)n; } + | CREATE TEXT SEARCH PARSER any_name definition + { + DefineStmt *n = makeNode(DefineStmt); + n->kind = OBJECT_TSPARSER; + n->args = NIL; + n->defnames = $5; + n->definition = $6; + $$ = (Node *)n; + } + | CREATE TEXT SEARCH DICTIONARY any_name definition + { + DefineStmt *n = makeNode(DefineStmt); + n->kind = OBJECT_TSDICTIONARY; + n->args = NIL; + n->defnames = $5; + n->definition = $6; + $$ = (Node *)n; + } + | CREATE TEXT SEARCH TEMPLATE any_name definition + { + DefineStmt *n = makeNode(DefineStmt); + n->kind = OBJECT_TSTEMPLATE; + n->args = NIL; + n->defnames = $5; + n->definition = $6; + $$ = (Node *)n; + } + | CREATE TEXT SEARCH CONFIGURATION any_name definition + { + DefineStmt *n = makeNode(DefineStmt); + n->kind = OBJECT_TSCONFIGURATION; + n->args = NIL; + n->defnames = $5; + n->definition = $6; + $$ = (Node *)n; + } ; definition: '(' def_list ')' { $$ = $2; } @@ -3281,6 +3320,10 @@ drop_type: TABLE { $$ = OBJECT_TABLE; } | DOMAIN_P { $$ = OBJECT_DOMAIN; } | CONVERSION_P { $$ = OBJECT_CONVERSION; } | SCHEMA { $$ = OBJECT_SCHEMA; } + | TEXT SEARCH PARSER { $$ = OBJECT_TSPARSER; } + | TEXT SEARCH DICTIONARY { $$ = OBJECT_TSDICTIONARY; } + | TEXT SEARCH TEMPLATE { $$ = OBJECT_TSTEMPLATE; } + | TEXT SEARCH CONFIGURATION { $$ = OBJECT_TSCONFIGURATION; } ; any_name_list: @@ -3323,7 +3366,10 @@ TruncateStmt: * * COMMENT ON [ [ DATABASE | DOMAIN | INDEX | SEQUENCE | TABLE | TYPE | VIEW | * CONVERSION | LANGUAGE | OPERATOR CLASS | LARGE OBJECT | - * CAST | COLUMN | SCHEMA | TABLESPACE | ROLE ] <objname> | + * CAST | COLUMN | SCHEMA | TABLESPACE | ROLE | + * TEXT SEARCH PARSER | TEXT SEARCH DICTIONARY | + * TEXT SEARCH TEMPLATE | + * TEXT SEARCH CONFIGURATION ] <objname> | * AGGREGATE <aggname> (arg1, ...) | * FUNCTION <funcname> (arg1, arg2, ...) | * OPERATOR <op> (leftoperand_typ, rightoperand_typ) | @@ -3454,6 +3500,38 @@ CommentStmt: n->comment = $7; $$ = (Node *) n; } + | COMMENT ON TEXT SEARCH PARSER any_name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_TSPARSER; + n->objname = $6; + n->comment = $8; + $$ = (Node *) n; + } + | COMMENT ON TEXT SEARCH DICTIONARY any_name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_TSDICTIONARY; + n->objname = $6; + n->comment = $8; + $$ = (Node *) n; + } + | COMMENT ON TEXT SEARCH TEMPLATE any_name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_TSTEMPLATE; + n->objname = $6; + n->comment = $8; + $$ = (Node *) n; + } + | COMMENT ON TEXT SEARCH CONFIGURATION any_name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_TSCONFIGURATION; + n->objname = $6; + n->comment = $8; + $$ = (Node *) n; + } ; comment_type: @@ -4615,6 +4693,38 @@ RenameStmt: ALTER AGGREGATE func_name aggr_args RENAME TO name n->newname = $6; $$ = (Node *)n; } + | ALTER TEXT SEARCH PARSER any_name RENAME TO name + { + RenameStmt *n = makeNode(RenameStmt); + n->renameType = OBJECT_TSPARSER; + n->object = $5; + n->newname = $8; + $$ = (Node *)n; + } + | ALTER TEXT SEARCH DICTIONARY any_name RENAME TO name + { + RenameStmt *n = makeNode(RenameStmt); + n->renameType = OBJECT_TSDICTIONARY; + n->object = $5; + n->newname = $8; + $$ = (Node *)n; + } + | ALTER TEXT SEARCH TEMPLATE any_name RENAME TO name + { + RenameStmt *n = makeNode(RenameStmt); + n->renameType = OBJECT_TSTEMPLATE; + n->object = $5; + n->newname = $8; + $$ = (Node *)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name RENAME TO name + { + RenameStmt *n = makeNode(RenameStmt); + n->renameType = OBJECT_TSCONFIGURATION; + n->object = $5; + n->newname = $8; + $$ = (Node *)n; + } ; opt_column: COLUMN { $$ = COLUMN; } @@ -4787,6 +4897,22 @@ AlterOwnerStmt: ALTER AGGREGATE func_name aggr_args OWNER TO RoleId n->newowner = $6; $$ = (Node *)n; } + | ALTER TEXT SEARCH DICTIONARY any_name OWNER TO RoleId + { + AlterOwnerStmt *n = makeNode(AlterOwnerStmt); + n->objectType = OBJECT_TSDICTIONARY; + n->object = $5; + n->newowner = $8; + $$ = (Node *)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name OWNER TO RoleId + { + AlterOwnerStmt *n = makeNode(AlterOwnerStmt); + n->objectType = OBJECT_TSCONFIGURATION; + n->object = $5; + n->newowner = $8; + $$ = (Node *)n; + } ; @@ -5382,6 +5508,89 @@ opt_as: AS {} /***************************************************************************** * + * Manipulate a text search dictionary or configuration + * + *****************************************************************************/ + +AlterTSDictionaryStmt: + ALTER TEXT SEARCH DICTIONARY any_name definition + { + AlterTSDictionaryStmt *n = makeNode(AlterTSDictionaryStmt); + n->dictname = $5; + n->options = $6; + $$ = (Node *)n; + } + ; + +AlterTSConfigurationStmt: + ALTER TEXT SEARCH CONFIGURATION any_name definition + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->options = $6; + $$ = (Node *)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name ADD_P MAPPING FOR name_list WITH any_name_list + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = $9; + n->dicts = $11; + n->override = false; + n->replace = false; + $$ = (Node*)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list WITH any_name_list + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = $9; + n->dicts = $11; + n->override = true; + n->replace = false; + $$ = (Node*)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name ALTER MAPPING REPLACE any_name WITH any_name + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = NIL; + n->dicts = list_make2($9,$11); + n->override = false; + n->replace = true; + $$ = (Node*)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list REPLACE any_name WITH any_name + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = $9; + n->dicts = list_make2($11,$13); + n->override = false; + n->replace = true; + $$ = (Node*)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name DROP MAPPING FOR name_list + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = $9; + n->missing_ok = false; + $$ = (Node*)n; + } + | ALTER TEXT SEARCH CONFIGURATION any_name DROP MAPPING IF_P EXISTS FOR name_list + { + AlterTSConfigurationStmt *n = makeNode(AlterTSConfigurationStmt); + n->cfgname = $5; + n->tokentype = $11; + n->missing_ok = true; + $$ = (Node*)n; + } + ; + + +/***************************************************************************** + * * Manipulate a conversion * * CREATE [DEFAULT] CONVERSION <conversion_name> @@ -8853,6 +9062,7 @@ unreserved_keyword: | COMMIT | COMMITTED | CONCURRENTLY + | CONFIGURATION | CONNECTION | CONSTRAINTS | CONTENT_P @@ -8876,6 +9086,7 @@ unreserved_keyword: | DELETE_P | DELIMITER | DELIMITERS + | DICTIONARY | DISABLE_P | DISCARD | DOCUMENT_P @@ -8933,6 +9144,7 @@ unreserved_keyword: | LOCATION | LOCK_P | LOGIN_P + | MAPPING | MATCH | MAXVALUE | MINUTE_P @@ -8961,6 +9173,7 @@ unreserved_keyword: | OPTION | OWNED | OWNER + | PARSER | PARTIAL | PASSWORD | PLANS @@ -8994,6 +9207,7 @@ unreserved_keyword: | SAVEPOINT | SCHEMA | SCROLL + | SEARCH | SECOND_P | SECURITY | SEQUENCE @@ -9020,6 +9234,7 @@ unreserved_keyword: | TEMP | TEMPLATE | TEMPORARY + | TEXT | TRANSACTION | TRIGGER | TRUNCATE diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c index 5b62a9c7c98..1e97d854465 100644 --- a/src/backend/parser/keywords.c +++ b/src/backend/parser/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.189 2007/06/18 21:40:58 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.190 2007/08/21 01:11:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -87,6 +87,7 @@ static const ScanKeyword ScanKeywords[] = { {"commit", COMMIT, UNRESERVED_KEYWORD}, {"committed", COMMITTED, UNRESERVED_KEYWORD}, {"concurrently", CONCURRENTLY, UNRESERVED_KEYWORD}, + {"configuration", CONFIGURATION, UNRESERVED_KEYWORD}, {"connection", CONNECTION, UNRESERVED_KEYWORD}, {"constraint", CONSTRAINT, RESERVED_KEYWORD}, {"constraints", CONSTRAINTS, UNRESERVED_KEYWORD}, @@ -124,6 +125,7 @@ static const ScanKeyword ScanKeywords[] = { {"delimiter", DELIMITER, UNRESERVED_KEYWORD}, {"delimiters", DELIMITERS, UNRESERVED_KEYWORD}, {"desc", DESC, RESERVED_KEYWORD}, + {"dictionary", DICTIONARY, UNRESERVED_KEYWORD}, {"disable", DISABLE_P, UNRESERVED_KEYWORD}, {"discard", DISCARD, UNRESERVED_KEYWORD}, {"distinct", DISTINCT, RESERVED_KEYWORD}, @@ -219,6 +221,7 @@ static const ScanKeyword ScanKeywords[] = { {"location", LOCATION, UNRESERVED_KEYWORD}, {"lock", LOCK_P, UNRESERVED_KEYWORD}, {"login", LOGIN_P, UNRESERVED_KEYWORD}, + {"mapping", MAPPING, UNRESERVED_KEYWORD}, {"match", MATCH, UNRESERVED_KEYWORD}, {"maxvalue", MAXVALUE, UNRESERVED_KEYWORD}, {"minute", MINUTE_P, UNRESERVED_KEYWORD}, @@ -268,6 +271,7 @@ static const ScanKeyword ScanKeywords[] = { {"overlay", OVERLAY, COL_NAME_KEYWORD}, {"owned", OWNED, UNRESERVED_KEYWORD}, {"owner", OWNER, UNRESERVED_KEYWORD}, + {"parser", PARSER, UNRESERVED_KEYWORD}, {"partial", PARTIAL, UNRESERVED_KEYWORD}, {"password", PASSWORD, UNRESERVED_KEYWORD}, {"placing", PLACING, RESERVED_KEYWORD}, @@ -310,6 +314,7 @@ static const ScanKeyword ScanKeywords[] = { {"savepoint", SAVEPOINT, UNRESERVED_KEYWORD}, {"schema", SCHEMA, UNRESERVED_KEYWORD}, {"scroll", SCROLL, UNRESERVED_KEYWORD}, + {"search", SEARCH, UNRESERVED_KEYWORD}, {"second", SECOND_P, UNRESERVED_KEYWORD}, {"security", SECURITY, UNRESERVED_KEYWORD}, {"select", SELECT, RESERVED_KEYWORD}, @@ -345,6 +350,7 @@ static const ScanKeyword ScanKeywords[] = { {"temp", TEMP, UNRESERVED_KEYWORD}, {"template", TEMPLATE, UNRESERVED_KEYWORD}, {"temporary", TEMPORARY, UNRESERVED_KEYWORD}, + {"text", TEXT, UNRESERVED_KEYWORD}, {"then", THEN, RESERVED_KEYWORD}, {"time", TIME, COL_NAME_KEYWORD}, {"timestamp", TIMESTAMP, COL_NAME_KEYWORD}, diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index abc05685811..6fb7bd9b59f 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.155 2007/06/06 23:00:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.156 2007/08/21 01:11:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1554,6 +1554,8 @@ TypeCategory(Oid inType) case (REGOPERATOROID): case (REGCLASSOID): case (REGTYPEOID): + case (REGCONFIGOID): + case (REGDICTIONARYOID): case (INT2OID): case (INT4OID): case (INT8OID): @@ -1672,7 +1674,9 @@ IsPreferredType(CATEGORY category, Oid type) type == REGOPEROID || type == REGOPERATOROID || type == REGCLASSOID || - type == REGTYPEOID) + type == REGTYPEOID || + type == REGCONFIGOID || + type == REGDICTIONARYOID) preftype = OIDOID; else preftype = FLOAT8OID; diff --git a/src/backend/snowball/Makefile b/src/backend/snowball/Makefile new file mode 100644 index 00000000000..f1d54eb0998 --- /dev/null +++ b/src/backend/snowball/Makefile @@ -0,0 +1,144 @@ +#------------------------------------------------------------------------- +# +# Makefile for src/backend/snowball +# +# $PostgreSQL: pgsql/src/backend/snowball/Makefile,v 1.1 2007/08/21 01:11:15 tgl Exp $ +# +#------------------------------------------------------------------------- + +subdir = src/backend/snowball +top_builddir = ../../.. +include $(top_builddir)/src/Makefile.global + +override CPPFLAGS := -I$(top_srcdir)/src/include/snowball \ + -I$(top_srcdir)/src/include/snowball/libstemmer $(CPPFLAGS) + +OBJS= dict_snowball.o api.o utilities.o \ + stem_ISO_8859_1_danish.o \ + stem_ISO_8859_1_dutch.o \ + stem_ISO_8859_1_english.o \ + stem_ISO_8859_1_finnish.o \ + stem_ISO_8859_1_french.o \ + stem_ISO_8859_1_german.o \ + stem_ISO_8859_1_hungarian.o \ + stem_ISO_8859_1_italian.o \ + stem_ISO_8859_1_norwegian.o \ + stem_ISO_8859_1_porter.o \ + stem_ISO_8859_1_portuguese.o \ + stem_ISO_8859_1_spanish.o \ + stem_ISO_8859_1_swedish.o \ + stem_ISO_8859_2_romanian.o \ + stem_KOI8_R_russian.o \ + stem_UTF_8_danish.o \ + stem_UTF_8_dutch.o \ + stem_UTF_8_english.o \ + stem_UTF_8_finnish.o \ + stem_UTF_8_french.o \ + stem_UTF_8_german.o \ + stem_UTF_8_hungarian.o \ + stem_UTF_8_italian.o \ + stem_UTF_8_norwegian.o \ + stem_UTF_8_porter.o \ + stem_UTF_8_portuguese.o \ + stem_UTF_8_romanian.o \ + stem_UTF_8_russian.o \ + stem_UTF_8_spanish.o \ + stem_UTF_8_swedish.o \ + stem_UTF_8_turkish.o + +# second column is name of latin dictionary, if different +LANGUAGES= \ + danish danish \ + dutch dutch \ + english english \ + finnish finnish \ + french french \ + german german \ + hungarian hungarian \ + italian italian \ + norwegian norwegian \ + portuguese portuguese \ + romanian romanian \ + russian english \ + spanish spanish \ + swedish swedish \ + turkish turkish \ + + +SQLSCRIPT= snowball_create.sql +DICTDIR=tsearch_data + +ifdef VPATH +override VPATH := $(srcdir)/libstemmer:$(VPATH) +else +VPATH = $(srcdir)/libstemmer +endif + +SHLIB_LINK := $(BE_DLLLIBS) + +NAME := dict_snowball +SO_MAJOR_VERSION := 0 +SO_MINOR_VERSION := 0 +rpath = + +all: all-shared-lib $(SQLSCRIPT) + +include $(top_srcdir)/src/Makefile.shlib + +$(SQLSCRIPT): Makefile snowball_func.sql.in snowball.sql.in +ifeq ($(enable_shared), yes) + echo '-- Language-specific snowball dictionaries' > $@ + cat $(srcdir)/snowball_func.sql.in >> $@ + @set $(LANGUAGES) ; \ + while [ "$$#" -gt 0 ] ; \ + do \ + lang=$$1; shift; \ + if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \ + stop=", StopWords=$${lang}" ; \ + else \ + stop=""; \ + fi; \ + nonlatdictname=$$lang; \ + latdictname=$$1; shift; \ + cat $(srcdir)/snowball.sql.in | \ + sed -e "s#_DICTNAME_#$$lang#g" | \ + sed -e "s#_CFGNAME_#$$lang#g" | \ + sed -e "s#_LATDICTNAME_#$$latdictname#g" | \ + sed -e "s#_NONLATDICTNAME_#$$nonlatdictname#g" | \ + sed -e "s#_STOPWORDS_#$$stop#g" ; \ + done >> $@ +else + echo "-- No language-specific snowball dictionaries, for lack of shared library support" > $@ +endif + +install: all installdirs +ifeq ($(enable_shared), yes) + $(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)' +endif + $(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)' + @set $(LANGUAGES) ; \ + while [ "$$#" -gt 0 ] ; \ + do \ + lang=$$1; shift; shift; \ + if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \ + $(INSTALL_DATA) $(srcdir)/stopwords/$${lang}.stop '$(DESTDIR)$(datadir)/$(DICTDIR)' ; \ + fi \ + done + +installdirs: + $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' '$(DESTDIR)$(datadir)' '$(DESTDIR)$(datadir)/$(DICTDIR)' + +uninstall: + rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)' + rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)' + @set $(LANGUAGES) ; \ + while [ "$$#" -gt 0 ] ; \ + do \ + lang=$$1; shift; shift; \ + if [ -s $(srcdir)/stopwords/$${lang}.stop ] ; then \ + rm -f '$(DESTDIR)$(datadir)/$(DICTDIR)/'$${lang}.stop ; \ + fi \ + done + +clean distclean maintainer-clean: clean-lib + rm -f $(OBJS) $(SQLSCRIPT) diff --git a/src/backend/snowball/README b/src/backend/snowball/README new file mode 100644 index 00000000000..099925ad8f0 --- /dev/null +++ b/src/backend/snowball/README @@ -0,0 +1,47 @@ +Snowball-based stemming +----------------------- + +This module uses the word stemming code developed by the Snowball project, +http://snowball.tartarus.org/ +which is released by them under a BSD-style license. + +The files under src/backend/snowball/libstemmer/ and +src/include/snowball/libstemmer/ are taken directly from their libstemmer_c +distribution, with only some minor adjustments of file inclusions. Note +that most of these files are in fact derived files, not master source. +The master sources are in the Snowball language, and are available along +with the Snowball-to-C compiler from the Snowball project. We choose to +include the derived files in the PostgreSQL distribution because most +installations will not have the Snowball compiler available. + +To update the PostgreSQL sources from a new Snowball libstemmer_c +distribution: + +1. Copy the *.c files in libstemmer_c/src_c/ to src/backend/snowball/libstemmer +with replacement of "../runtime/header.h" by "header.h", for example + +for f in libstemmer_c/src_c/*.c +do + sed 's|\.\./runtime/header\.h|header.h|' $f >libstemmer/`basename $f` +done + +(Alternatively, if you rebuild the stemmer files from the master Snowball +sources, just omit "-r ../runtime" from the Snowball compiler switches.) + +2. Copy the *.c files in libstemmer_c/runtime/ to +src/backend/snowball/libstemmer, and edit them to remove direct inclusions +of system headers such as <stdio.h> --- they should only include "header.h". +(This removal avoids portability problems on some platforms where <stdio.h> +is sensitive to largefile compilation options.) + +3. Copy the *.h files in libstemmer_c/src_c/ and libstemmer_c/runtime/ +to src/include/snowball/libstemmer. At this writing the header files +do not require any changes. + +4. Check whether any stemmer modules have been added or removed. If so, edit +the OBJS list in Makefile, the list of #include's in dict_snowball.c, and the +stemmer_modules[] table in dict_snowball.c. + +5. The various stopword files in stopwords/ must be downloaded +individually from pages on the snowball.tartarus.org website. +Be careful that these files must be stored in UTF-8 encoding. diff --git a/src/backend/snowball/dict_snowball.c b/src/backend/snowball/dict_snowball.c new file mode 100644 index 00000000000..f0bc2feedec --- /dev/null +++ b/src/backend/snowball/dict_snowball.c @@ -0,0 +1,326 @@ +/*------------------------------------------------------------------------- + * + * dict_snowball.c + * Snowball dictionary + * + * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/backend/snowball/dict_snowball.c,v 1.1 2007/08/21 01:11:16 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#include "postgres.h" + +#include "fmgr.h" +#include "tsearch/ts_locale.h" +#include "tsearch/ts_public.h" +#include "tsearch/ts_utils.h" +#include "utils/builtins.h" + +/* Some platforms define MAXINT and/or MININT, causing conflicts */ +#ifdef MAXINT +#undef MAXINT +#endif +#ifdef MININT +#undef MININT +#endif + +/* Now we can include the original Snowball header.h */ +#include "snowball/libstemmer/header.h" +#include "snowball/libstemmer/stem_ISO_8859_1_danish.h" +#include "snowball/libstemmer/stem_ISO_8859_1_dutch.h" +#include "snowball/libstemmer/stem_ISO_8859_1_english.h" +#include "snowball/libstemmer/stem_ISO_8859_1_finnish.h" +#include "snowball/libstemmer/stem_ISO_8859_1_french.h" +#include "snowball/libstemmer/stem_ISO_8859_1_german.h" +#include "snowball/libstemmer/stem_ISO_8859_1_hungarian.h" +#include "snowball/libstemmer/stem_ISO_8859_1_italian.h" +#include "snowball/libstemmer/stem_ISO_8859_1_norwegian.h" +#include "snowball/libstemmer/stem_ISO_8859_1_porter.h" +#include "snowball/libstemmer/stem_ISO_8859_1_portuguese.h" +#include "snowball/libstemmer/stem_ISO_8859_1_spanish.h" +#include "snowball/libstemmer/stem_ISO_8859_1_swedish.h" +#include "snowball/libstemmer/stem_ISO_8859_2_romanian.h" +#include "snowball/libstemmer/stem_KOI8_R_russian.h" +#include "snowball/libstemmer/stem_UTF_8_danish.h" +#include "snowball/libstemmer/stem_UTF_8_dutch.h" +#include "snowball/libstemmer/stem_UTF_8_english.h" +#include "snowball/libstemmer/stem_UTF_8_finnish.h" +#include "snowball/libstemmer/stem_UTF_8_french.h" +#include "snowball/libstemmer/stem_UTF_8_german.h" +#include "snowball/libstemmer/stem_UTF_8_hungarian.h" +#include "snowball/libstemmer/stem_UTF_8_italian.h" +#include "snowball/libstemmer/stem_UTF_8_norwegian.h" +#include "snowball/libstemmer/stem_UTF_8_porter.h" +#include "snowball/libstemmer/stem_UTF_8_portuguese.h" +#include "snowball/libstemmer/stem_UTF_8_romanian.h" +#include "snowball/libstemmer/stem_UTF_8_russian.h" +#include "snowball/libstemmer/stem_UTF_8_spanish.h" +#include "snowball/libstemmer/stem_UTF_8_swedish.h" +#include "snowball/libstemmer/stem_UTF_8_turkish.h" + + +PG_MODULE_MAGIC; + +PG_FUNCTION_INFO_V1(dsnowball_init); +Datum dsnowball_init(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(dsnowball_lexize); +Datum dsnowball_lexize(PG_FUNCTION_ARGS); + +/* List of supported modules */ +typedef struct stemmer_module +{ + const char *name; + pg_enc enc; + struct SN_env *(*create) (void); + void (*close) (struct SN_env *); + int (*stem) (struct SN_env *); +} stemmer_module; + +static const stemmer_module stemmer_modules[] = +{ + /* + * Stemmers list from Snowball distribution + */ + {"danish", PG_LATIN1, danish_ISO_8859_1_create_env, danish_ISO_8859_1_close_env, danish_ISO_8859_1_stem}, + {"dutch", PG_LATIN1, dutch_ISO_8859_1_create_env, dutch_ISO_8859_1_close_env, dutch_ISO_8859_1_stem}, + {"english", PG_LATIN1, english_ISO_8859_1_create_env, english_ISO_8859_1_close_env, english_ISO_8859_1_stem}, + {"finnish", PG_LATIN1, finnish_ISO_8859_1_create_env, finnish_ISO_8859_1_close_env, finnish_ISO_8859_1_stem}, + {"french", PG_LATIN1, french_ISO_8859_1_create_env, french_ISO_8859_1_close_env, french_ISO_8859_1_stem}, + {"german", PG_LATIN1, german_ISO_8859_1_create_env, german_ISO_8859_1_close_env, german_ISO_8859_1_stem}, + {"hungarian", PG_LATIN1, hungarian_ISO_8859_1_create_env, hungarian_ISO_8859_1_close_env, hungarian_ISO_8859_1_stem}, + {"italian", PG_LATIN1, italian_ISO_8859_1_create_env, italian_ISO_8859_1_close_env, italian_ISO_8859_1_stem}, + {"norwegian", PG_LATIN1, norwegian_ISO_8859_1_create_env, norwegian_ISO_8859_1_close_env, norwegian_ISO_8859_1_stem}, + {"porter", PG_LATIN1, porter_ISO_8859_1_create_env, porter_ISO_8859_1_close_env, porter_ISO_8859_1_stem}, + {"portuguese", PG_LATIN1, portuguese_ISO_8859_1_create_env, portuguese_ISO_8859_1_close_env, portuguese_ISO_8859_1_stem}, + {"spanish", PG_LATIN1, spanish_ISO_8859_1_create_env, spanish_ISO_8859_1_close_env, spanish_ISO_8859_1_stem}, + {"swedish", PG_LATIN1, swedish_ISO_8859_1_create_env, swedish_ISO_8859_1_close_env, swedish_ISO_8859_1_stem}, + {"romanian", PG_LATIN2, romanian_ISO_8859_2_create_env, romanian_ISO_8859_2_close_env, romanian_ISO_8859_2_stem}, + {"russian", PG_KOI8R, russian_KOI8_R_create_env, russian_KOI8_R_close_env, russian_KOI8_R_stem}, + {"danish", PG_UTF8, danish_UTF_8_create_env, danish_UTF_8_close_env, danish_UTF_8_stem}, + {"dutch", PG_UTF8, dutch_UTF_8_create_env, dutch_UTF_8_close_env, dutch_UTF_8_stem}, + {"english", PG_UTF8, english_UTF_8_create_env, english_UTF_8_close_env, english_UTF_8_stem}, + {"finnish", PG_UTF8, finnish_UTF_8_create_env, finnish_UTF_8_close_env, finnish_UTF_8_stem}, + {"french", PG_UTF8, french_UTF_8_create_env, french_UTF_8_close_env, french_UTF_8_stem}, + {"german", PG_UTF8, german_UTF_8_create_env, german_UTF_8_close_env, german_UTF_8_stem}, + {"hungarian", PG_UTF8, hungarian_UTF_8_create_env, hungarian_UTF_8_close_env, hungarian_UTF_8_stem}, + {"italian", PG_UTF8, italian_UTF_8_create_env, italian_UTF_8_close_env, italian_UTF_8_stem}, + {"norwegian", PG_UTF8, norwegian_UTF_8_create_env, norwegian_UTF_8_close_env, norwegian_UTF_8_stem}, + {"porter", PG_UTF8, porter_UTF_8_create_env, porter_UTF_8_close_env, porter_UTF_8_stem}, + {"portuguese", PG_UTF8, portuguese_UTF_8_create_env, portuguese_UTF_8_close_env, portuguese_UTF_8_stem}, + {"romanian", PG_UTF8, romanian_UTF_8_create_env, romanian_UTF_8_close_env, romanian_UTF_8_stem}, + {"russian", PG_UTF8, russian_UTF_8_create_env, russian_UTF_8_close_env, russian_UTF_8_stem}, + {"spanish", PG_UTF8, spanish_UTF_8_create_env, spanish_UTF_8_close_env, spanish_UTF_8_stem}, + {"swedish", PG_UTF8, swedish_UTF_8_create_env, swedish_UTF_8_close_env, swedish_UTF_8_stem}, + {"turkish", PG_UTF8, turkish_UTF_8_create_env, turkish_UTF_8_close_env, turkish_UTF_8_stem}, + + /* + * Stemmer with PG_SQL_ASCII encoding should be valid for any server + * encoding + */ + {"english", PG_SQL_ASCII, english_ISO_8859_1_create_env, english_ISO_8859_1_close_env, english_ISO_8859_1_stem}, + + {NULL, 0, NULL, NULL, NULL} /* list end marker */ +}; + + +typedef struct DictSnowball +{ + struct SN_env *z; + StopList stoplist; + bool needrecode; /* needs recoding before/after call stem */ + int (*stem) (struct SN_env * z); + + /* + * snowball saves alloced memory between calls, so we should run it in our + * private memory context. Note, init function is executed in long lived + * context, so we just remember CurrentMemoryContext + */ + MemoryContext dictCtx; +} DictSnowball; + + +static void +locate_stem_module(DictSnowball * d, char *lang) +{ + const stemmer_module *m; + + /* + * First, try to find exact match of stemmer module. Stemmer with + * PG_SQL_ASCII encoding is treated as working with any server encoding + */ + for (m = stemmer_modules; m->name; m++) + { + if ((m->enc == PG_SQL_ASCII || m->enc == GetDatabaseEncoding()) && + pg_strcasecmp(m->name, lang) == 0) + { + d->stem = m->stem; + d->z = m->create(); + d->needrecode = false; + return; + } + } + + /* + * Second, try to find stemmer for needed language for UTF8 encoding. + */ + for (m = stemmer_modules; m->name; m++) + { + if (m->enc == PG_UTF8 && pg_strcasecmp(m->name, lang) == 0) + { + d->stem = m->stem; + d->z = m->create(); + d->needrecode = true; + return; + } + } + + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("no Snowball stemmer available for language \"%s\" and encoding \"%s\"", + lang, GetDatabaseEncodingName()))); +} + +Datum +dsnowball_init(PG_FUNCTION_ARGS) +{ + text *in; + DictSnowball *d; + Map *cfg, + *pcfg; + bool stoploaded = false; + + /* init functions must defend against NULLs for themselves */ + if (PG_ARGISNULL(0) || PG_GETARG_POINTER(0) == NULL) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("NULL config not allowed for Snowball"))); + in = PG_GETARG_TEXT_P(0); + + d = (DictSnowball *) palloc0(sizeof(DictSnowball)); + d->stoplist.wordop = recode_and_lowerstr; + + parse_keyvalpairs(in, &cfg); + pcfg = cfg; + PG_FREE_IF_COPY(in, 0); + + while (pcfg && pcfg->key) + { + if (pg_strcasecmp("StopWords", pcfg->key) == 0) + { + if (stoploaded) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("multiple StopWords parameters"))); + readstoplist(pcfg->value, &d->stoplist); + sortstoplist(&d->stoplist); + stoploaded = true; + } + else if (pg_strcasecmp("Language", pcfg->key) == 0) + { + if (d->stem) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("multiple Language parameters"))); + locate_stem_module(d, pcfg->value); + } + else + { + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("unrecognized Snowball parameter: \"%s\"", + pcfg->key))); + } + + pfree(pcfg->key); + pfree(pcfg->value); + pcfg++; + } + pfree(cfg); + + if (!d->stem) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("missing Language parameter"))); + + d->dictCtx = CurrentMemoryContext; + + PG_RETURN_POINTER(d); +} + +Datum +dsnowball_lexize(PG_FUNCTION_ARGS) +{ + DictSnowball *d = (DictSnowball *) PG_GETARG_POINTER(0); + char *in = (char *) PG_GETARG_POINTER(1); + int32 len = PG_GETARG_INT32(2); + char *txt = lowerstr_with_len(in, len); + TSLexeme *res = palloc0(sizeof(TSLexeme) * 2); + + if (*txt == '\0' || searchstoplist(&(d->stoplist), txt)) + { + pfree(txt); + } + else + { + MemoryContext saveCtx; + + /* + * recode to utf8 if stemmer is utf8 and doesn't match server encoding + */ + if (d->needrecode) + { + char *recoded; + + recoded = (char *) pg_do_encoding_conversion((unsigned char *) txt, + strlen(txt), + GetDatabaseEncoding(), + PG_UTF8); + if (recoded == NULL) + elog(ERROR, "encoding conversion failed"); + + if (recoded != txt) + { + pfree(txt); + txt = recoded; + } + } + + /* see comment about d->dictCtx */ + saveCtx = MemoryContextSwitchTo(d->dictCtx); + SN_set_current(d->z, strlen(txt), (symbol *) txt); + d->stem(d->z); + MemoryContextSwitchTo(saveCtx); + + if (d->z->p && d->z->l) + { + txt = repalloc(txt, d->z->l + 1); + memcpy(txt, d->z->p, d->z->l); + txt[d->z->l] = '\0'; + } + + /* back recode if needed */ + if (d->needrecode) + { + char *recoded; + + recoded = (char *) pg_do_encoding_conversion((unsigned char *) txt, + strlen(txt), + PG_UTF8, + GetDatabaseEncoding()); + if (recoded == NULL) + elog(ERROR, "encoding conversion failed"); + + if (recoded != txt) + { + pfree(txt); + txt = recoded; + } + } + + res->lexeme = txt; + } + + PG_RETURN_POINTER(res); +} diff --git a/src/backend/snowball/libstemmer/api.c b/src/backend/snowball/libstemmer/api.c new file mode 100644 index 00000000000..530b427a466 --- /dev/null +++ b/src/backend/snowball/libstemmer/api.c @@ -0,0 +1,64 @@ +#include "header.h" + +extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size) +{ + struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env)); + if (z == NULL) return NULL; + z->p = create_s(); + if (z->p == NULL) goto error; + if (S_size) + { + int i; + z->S = (symbol * *) calloc(S_size, sizeof(symbol *)); + if (z->S == NULL) goto error; + + for (i = 0; i < S_size; i++) + { + z->S[i] = create_s(); + if (z->S[i] == NULL) goto error; + } + } + + if (I_size) + { + z->I = (int *) calloc(I_size, sizeof(int)); + if (z->I == NULL) goto error; + } + + if (B_size) + { + z->B = (unsigned char *) calloc(B_size, sizeof(unsigned char)); + if (z->B == NULL) goto error; + } + + return z; +error: + SN_close_env(z, S_size); + return NULL; +} + +extern void SN_close_env(struct SN_env * z, int S_size) +{ + if (z == NULL) return; + if (S_size) + { + int i; + for (i = 0; i < S_size; i++) + { + lose_s(z->S[i]); + } + free(z->S); + } + free(z->I); + free(z->B); + if (z->p) lose_s(z->p); + free(z); +} + +extern int SN_set_current(struct SN_env * z, int size, const symbol * s) +{ + int err = replace_s(z, 0, z->l, size, s, NULL); + z->c = 0; + return err; +} + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c new file mode 100644 index 00000000000..36a9f99276f --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c @@ -0,0 +1,337 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int danish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_undouble(struct SN_env * z); +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * danish_ISO_8859_1_create_env(void); +extern void danish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'h', 'e', 'd' }; +static const symbol s_0_1[5] = { 'e', 't', 'h', 'e', 'd' }; +static const symbol s_0_2[4] = { 'e', 'r', 'e', 'd' }; +static const symbol s_0_3[1] = { 'e' }; +static const symbol s_0_4[5] = { 'e', 'r', 'e', 'd', 'e' }; +static const symbol s_0_5[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_0_6[6] = { 'e', 'r', 'e', 'n', 'd', 'e' }; +static const symbol s_0_7[3] = { 'e', 'n', 'e' }; +static const symbol s_0_8[4] = { 'e', 'r', 'n', 'e' }; +static const symbol s_0_9[3] = { 'e', 'r', 'e' }; +static const symbol s_0_10[2] = { 'e', 'n' }; +static const symbol s_0_11[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_0_12[4] = { 'e', 'r', 'e', 'n' }; +static const symbol s_0_13[2] = { 'e', 'r' }; +static const symbol s_0_14[5] = { 'h', 'e', 'd', 'e', 'r' }; +static const symbol s_0_15[4] = { 'e', 'r', 'e', 'r' }; +static const symbol s_0_16[1] = { 's' }; +static const symbol s_0_17[4] = { 'h', 'e', 'd', 's' }; +static const symbol s_0_18[2] = { 'e', 's' }; +static const symbol s_0_19[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_20[7] = { 'e', 'r', 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_21[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_0_22[5] = { 'e', 'r', 'n', 'e', 's' }; +static const symbol s_0_23[4] = { 'e', 'r', 'e', 's' }; +static const symbol s_0_24[3] = { 'e', 'n', 's' }; +static const symbol s_0_25[6] = { 'h', 'e', 'd', 'e', 'n', 's' }; +static const symbol s_0_26[5] = { 'e', 'r', 'e', 'n', 's' }; +static const symbol s_0_27[3] = { 'e', 'r', 's' }; +static const symbol s_0_28[3] = { 'e', 't', 's' }; +static const symbol s_0_29[5] = { 'e', 'r', 'e', 't', 's' }; +static const symbol s_0_30[2] = { 'e', 't' }; +static const symbol s_0_31[4] = { 'e', 'r', 'e', 't' }; + +static const struct among a_0[32] = +{ +/* 0 */ { 3, s_0_0, -1, 1, 0}, +/* 1 */ { 5, s_0_1, 0, 1, 0}, +/* 2 */ { 4, s_0_2, -1, 1, 0}, +/* 3 */ { 1, s_0_3, -1, 1, 0}, +/* 4 */ { 5, s_0_4, 3, 1, 0}, +/* 5 */ { 4, s_0_5, 3, 1, 0}, +/* 6 */ { 6, s_0_6, 5, 1, 0}, +/* 7 */ { 3, s_0_7, 3, 1, 0}, +/* 8 */ { 4, s_0_8, 3, 1, 0}, +/* 9 */ { 3, s_0_9, 3, 1, 0}, +/* 10 */ { 2, s_0_10, -1, 1, 0}, +/* 11 */ { 5, s_0_11, 10, 1, 0}, +/* 12 */ { 4, s_0_12, 10, 1, 0}, +/* 13 */ { 2, s_0_13, -1, 1, 0}, +/* 14 */ { 5, s_0_14, 13, 1, 0}, +/* 15 */ { 4, s_0_15, 13, 1, 0}, +/* 16 */ { 1, s_0_16, -1, 2, 0}, +/* 17 */ { 4, s_0_17, 16, 1, 0}, +/* 18 */ { 2, s_0_18, 16, 1, 0}, +/* 19 */ { 5, s_0_19, 18, 1, 0}, +/* 20 */ { 7, s_0_20, 19, 1, 0}, +/* 21 */ { 4, s_0_21, 18, 1, 0}, +/* 22 */ { 5, s_0_22, 18, 1, 0}, +/* 23 */ { 4, s_0_23, 18, 1, 0}, +/* 24 */ { 3, s_0_24, 16, 1, 0}, +/* 25 */ { 6, s_0_25, 24, 1, 0}, +/* 26 */ { 5, s_0_26, 24, 1, 0}, +/* 27 */ { 3, s_0_27, 16, 1, 0}, +/* 28 */ { 3, s_0_28, 16, 1, 0}, +/* 29 */ { 5, s_0_29, 28, 1, 0}, +/* 30 */ { 2, s_0_30, -1, 1, 0}, +/* 31 */ { 4, s_0_31, 30, 1, 0} +}; + +static const symbol s_1_0[2] = { 'g', 'd' }; +static const symbol s_1_1[2] = { 'd', 't' }; +static const symbol s_1_2[2] = { 'g', 't' }; +static const symbol s_1_3[2] = { 'k', 't' }; + +static const struct among a_1[4] = +{ +/* 0 */ { 2, s_1_0, -1, -1, 0}, +/* 1 */ { 2, s_1_1, -1, -1, 0}, +/* 2 */ { 2, s_1_2, -1, -1, 0}, +/* 3 */ { 2, s_1_3, -1, -1, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'g' }; +static const symbol s_2_1[3] = { 'l', 'i', 'g' }; +static const symbol s_2_2[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_2_3[3] = { 'e', 'l', 's' }; +static const symbol s_2_4[4] = { 'l', 0xF8, 's', 't' }; + +static const struct among a_2[5] = +{ +/* 0 */ { 2, s_2_0, -1, 1, 0}, +/* 1 */ { 3, s_2_1, 0, 1, 0}, +/* 2 */ { 4, s_2_2, 1, 1, 0}, +/* 3 */ { 3, s_2_3, -1, 1, 0}, +/* 4 */ { 4, s_2_4, -1, 2, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; + +static const unsigned char g_s_ending[] = { 239, 254, 42, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }; + +static const symbol s_0[] = { 's', 't' }; +static const symbol s_1[] = { 'i', 'g' }; +static const symbol s_2[] = { 'l', 0xF8, 's' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { int c_test = z->c; /* test, line 33 */ + { int ret = z->c + 3; + if (0 > ret || ret > z->l) return 0; + z->c = ret; /* hop, line 33 */ + } + z->I[1] = z->c; /* setmark x, line 33 */ + z->c = c_test; + } + if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 34 */ + { /* gopast */ /* non v, line 34 */ + int ret = in_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 34 */ + /* try, line 35 */ + if (!(z->I[0] < z->I[1])) goto lab0; + z->I[0] = z->I[1]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 41 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 41 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 41 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851440 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_0, 32); /* substring, line 41 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 41 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 48 */ + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_s_ending, 97, 229, 0)) return 0; + { int ret = slice_del(z); /* delete, line 50 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { int m_test = z->l - z->c; /* test, line 55 */ + { int mlimit; /* setlimit, line 56 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 56 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 56 */ + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 116)) { z->lb = mlimit; return 0; } + if (!(find_among_b(z, a_1, 4))) { z->lb = mlimit; return 0; } /* substring, line 56 */ + z->bra = z->c; /* ], line 56 */ + z->lb = mlimit; + } + z->c = z->l - m_test; + } + if (z->c <= z->lb) return 0; + z->c--; /* next, line 62 */ + z->bra = z->c; /* ], line 62 */ + { int ret = slice_del(z); /* delete, line 62 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + { int m1 = z->l - z->c; (void)m1; /* do, line 66 */ + z->ket = z->c; /* [, line 66 */ + if (!(eq_s_b(z, 2, s_0))) goto lab0; + z->bra = z->c; /* ], line 66 */ + if (!(eq_s_b(z, 2, s_1))) goto lab0; + { int ret = slice_del(z); /* delete, line 66 */ + if (ret < 0) return ret; + } + lab0: + z->c = z->l - m1; + } + { int mlimit; /* setlimit, line 67 */ + int m2 = z->l - z->c; (void)m2; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 67 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m2; + z->ket = z->c; /* [, line 67 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1572992 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_2, 5); /* substring, line 67 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 67 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 70 */ + if (ret < 0) return ret; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 70 */ + { int ret = r_consonant_pair(z); + if (ret == 0) goto lab1; /* call consonant_pair, line 70 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m3; + } + break; + case 2: + { int ret = slice_from_s(z, 3, s_2); /* <-, line 72 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + { int mlimit; /* setlimit, line 76 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 76 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 76 */ + if (out_grouping_b(z, g_v, 97, 248, 0)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 76 */ + z->S[0] = slice_to(z, z->S[0]); /* -> ch, line 76 */ + if (z->S[0] == 0) return -1; /* -> ch, line 76 */ + z->lb = mlimit; + } + if (!(eq_v_b(z, z->S[0]))) return 0; /* name ch, line 77 */ + { int ret = slice_del(z); /* delete, line 78 */ + if (ret < 0) return ret; + } + return 1; +} + +extern int danish_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 84 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab0; /* call mark_regions, line 84 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + z->lb = z->c; z->c = z->l; /* backwards, line 85 */ + + { int m2 = z->l - z->c; (void)m2; /* do, line 86 */ + { int ret = r_main_suffix(z); + if (ret == 0) goto lab1; /* call main_suffix, line 86 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 87 */ + { int ret = r_consonant_pair(z); + if (ret == 0) goto lab2; /* call consonant_pair, line 87 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 88 */ + { int ret = r_other_suffix(z); + if (ret == 0) goto lab3; /* call other_suffix, line 88 */ + if (ret < 0) return ret; + } + lab3: + z->c = z->l - m4; + } + { int m5 = z->l - z->c; (void)m5; /* do, line 89 */ + { int ret = r_undouble(z); + if (ret == 0) goto lab4; /* call undouble, line 89 */ + if (ret < 0) return ret; + } + lab4: + z->c = z->l - m5; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * danish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2, 0); } + +extern void danish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c new file mode 100644 index 00000000000..e5ba288b1f5 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c @@ -0,0 +1,624 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int dutch_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_en_ending(struct SN_env * z); +static int r_e_ending(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * dutch_ISO_8859_1_create_env(void); +extern void dutch_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xE1 }; +static const symbol s_0_2[1] = { 0xE4 }; +static const symbol s_0_3[1] = { 0xE9 }; +static const symbol s_0_4[1] = { 0xEB }; +static const symbol s_0_5[1] = { 0xED }; +static const symbol s_0_6[1] = { 0xEF }; +static const symbol s_0_7[1] = { 0xF3 }; +static const symbol s_0_8[1] = { 0xF6 }; +static const symbol s_0_9[1] = { 0xFA }; +static const symbol s_0_10[1] = { 0xFC }; + +static const struct among a_0[11] = +{ +/* 0 */ { 0, 0, -1, 6, 0}, +/* 1 */ { 1, s_0_1, 0, 1, 0}, +/* 2 */ { 1, s_0_2, 0, 1, 0}, +/* 3 */ { 1, s_0_3, 0, 2, 0}, +/* 4 */ { 1, s_0_4, 0, 2, 0}, +/* 5 */ { 1, s_0_5, 0, 3, 0}, +/* 6 */ { 1, s_0_6, 0, 3, 0}, +/* 7 */ { 1, s_0_7, 0, 4, 0}, +/* 8 */ { 1, s_0_8, 0, 4, 0}, +/* 9 */ { 1, s_0_9, 0, 5, 0}, +/* 10 */ { 1, s_0_10, 0, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'Y' }; + +static const struct among a_1[3] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 1, s_1_1, 0, 2, 0}, +/* 2 */ { 1, s_1_2, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'd', 'd' }; +static const symbol s_2_1[2] = { 'k', 'k' }; +static const symbol s_2_2[2] = { 't', 't' }; + +static const struct among a_2[3] = +{ +/* 0 */ { 2, s_2_0, -1, -1, 0}, +/* 1 */ { 2, s_2_1, -1, -1, 0}, +/* 2 */ { 2, s_2_2, -1, -1, 0} +}; + +static const symbol s_3_0[3] = { 'e', 'n', 'e' }; +static const symbol s_3_1[2] = { 's', 'e' }; +static const symbol s_3_2[2] = { 'e', 'n' }; +static const symbol s_3_3[5] = { 'h', 'e', 'd', 'e', 'n' }; +static const symbol s_3_4[1] = { 's' }; + +static const struct among a_3[5] = +{ +/* 0 */ { 3, s_3_0, -1, 2, 0}, +/* 1 */ { 2, s_3_1, -1, 3, 0}, +/* 2 */ { 2, s_3_2, -1, 2, 0}, +/* 3 */ { 5, s_3_3, 2, 1, 0}, +/* 4 */ { 1, s_3_4, -1, 3, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[2] = { 'i', 'g' }; +static const symbol s_4_2[3] = { 'i', 'n', 'g' }; +static const symbol s_4_3[4] = { 'l', 'i', 'j', 'k' }; +static const symbol s_4_4[4] = { 'b', 'a', 'a', 'r' }; +static const symbol s_4_5[3] = { 'b', 'a', 'r' }; + +static const struct among a_4[6] = +{ +/* 0 */ { 3, s_4_0, -1, 1, 0}, +/* 1 */ { 2, s_4_1, -1, 2, 0}, +/* 2 */ { 3, s_4_2, -1, 1, 0}, +/* 3 */ { 4, s_4_3, -1, 3, 0}, +/* 4 */ { 4, s_4_4, -1, 4, 0}, +/* 5 */ { 3, s_4_5, -1, 5, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'o', 'o' }; +static const symbol s_5_3[2] = { 'u', 'u' }; + +static const struct among a_5[4] = +{ +/* 0 */ { 2, s_5_0, -1, -1, 0}, +/* 1 */ { 2, s_5_1, -1, -1, 0}, +/* 2 */ { 2, s_5_2, -1, -1, 0}, +/* 3 */ { 2, s_5_3, -1, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_I[] = { 1, 0, 0, 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const unsigned char g_v_j[] = { 17, 67, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'o' }; +static const symbol s_4[] = { 'u' }; +static const symbol s_5[] = { 'y' }; +static const symbol s_6[] = { 'Y' }; +static const symbol s_7[] = { 'i' }; +static const symbol s_8[] = { 'I' }; +static const symbol s_9[] = { 'y' }; +static const symbol s_10[] = { 'Y' }; +static const symbol s_11[] = { 'y' }; +static const symbol s_12[] = { 'i' }; +static const symbol s_13[] = { 'e' }; +static const symbol s_14[] = { 'g', 'e', 'm' }; +static const symbol s_15[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_16[] = { 'h', 'e', 'i', 'd' }; +static const symbol s_17[] = { 'c' }; +static const symbol s_18[] = { 'e', 'n' }; +static const symbol s_19[] = { 'i', 'g' }; +static const symbol s_20[] = { 'e' }; +static const symbol s_21[] = { 'e' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { int c_test = z->c; /* test, line 42 */ + while(1) { /* repeat, line 42 */ + int c1 = z->c; + z->bra = z->c; /* [, line 43 */ + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 7 || !((340306450 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 6; else + among_var = find_among(z, a_0, 11); /* substring, line 43 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 43 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_0); /* <-, line 45 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_1); /* <-, line 47 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_2); /* <-, line 49 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 1, s_3); /* <-, line 51 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 1, s_4); /* <-, line 53 */ + if (ret < 0) return ret; + } + break; + case 6: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 54 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + z->c = c_test; + } + { int c_keep = z->c; /* try, line 57 */ + z->bra = z->c; /* [, line 57 */ + if (!(eq_s(z, 1, s_5))) { z->c = c_keep; goto lab1; } + z->ket = z->c; /* ], line 57 */ + { int ret = slice_from_s(z, 1, s_6); /* <-, line 57 */ + if (ret < 0) return ret; + } + lab1: + ; + } + while(1) { /* repeat, line 58 */ + int c2 = z->c; + while(1) { /* goto, line 58 */ + int c3 = z->c; + if (in_grouping(z, g_v, 97, 232, 0)) goto lab3; + z->bra = z->c; /* [, line 59 */ + { int c4 = z->c; /* or, line 59 */ + if (!(eq_s(z, 1, s_7))) goto lab5; + z->ket = z->c; /* ], line 59 */ + if (in_grouping(z, g_v, 97, 232, 0)) goto lab5; + { int ret = slice_from_s(z, 1, s_8); /* <-, line 59 */ + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = c4; + if (!(eq_s(z, 1, s_9))) goto lab3; + z->ket = z->c; /* ], line 60 */ + { int ret = slice_from_s(z, 1, s_10); /* <-, line 60 */ + if (ret < 0) return ret; + } + } + lab4: + z->c = c3; + break; + lab3: + z->c = c3; + if (z->c >= z->l) goto lab2; + z->c++; /* goto, line 58 */ + } + continue; + lab2: + z->c = c2; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + { /* gopast */ /* grouping v, line 69 */ + int ret = out_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { /* gopast */ /* non v, line 69 */ + int ret = in_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 69 */ + /* try, line 70 */ + if (!(z->I[0] < 3)) goto lab0; + z->I[0] = 3; +lab0: + { /* gopast */ /* grouping v, line 71 */ + int ret = out_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + { /* gopast */ /* non v, line 71 */ + int ret = in_grouping(z, g_v, 97, 232, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; /* setmark p2, line 71 */ + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while(1) { /* repeat, line 75 */ + int c1 = z->c; + z->bra = z->c; /* [, line 77 */ + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 89)) among_var = 3; else + among_var = find_among(z, a_1, 3); /* substring, line 77 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 77 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_11); /* <-, line 78 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_12); /* <-, line 79 */ + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 80 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_undouble(struct SN_env * z) { + { int m_test = z->l - z->c; /* test, line 91 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1050640 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!(find_among_b(z, a_2, 3))) return 0; /* among, line 91 */ + z->c = z->l - m_test; + } + z->ket = z->c; /* [, line 91 */ + if (z->c <= z->lb) return 0; + z->c--; /* next, line 91 */ + z->bra = z->c; /* ], line 91 */ + { int ret = slice_del(z); /* delete, line 91 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_e_ending(struct SN_env * z) { + z->B[0] = 0; /* unset e_found, line 95 */ + z->ket = z->c; /* [, line 96 */ + if (!(eq_s_b(z, 1, s_13))) return 0; + z->bra = z->c; /* ], line 96 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 96 */ + if (ret < 0) return ret; + } + { int m_test = z->l - z->c; /* test, line 96 */ + if (out_grouping_b(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 96 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set e_found, line 97 */ + { int ret = r_undouble(z); + if (ret == 0) return 0; /* call undouble, line 98 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_en_ending(struct SN_env * z) { + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 102 */ + if (ret < 0) return ret; + } + { int m1 = z->l - z->c; (void)m1; /* and, line 102 */ + if (out_grouping_b(z, g_v, 97, 232, 0)) return 0; + z->c = z->l - m1; + { int m2 = z->l - z->c; (void)m2; /* not, line 102 */ + if (!(eq_s_b(z, 3, s_14))) goto lab0; + return 0; + lab0: + z->c = z->l - m2; + } + } + { int ret = slice_del(z); /* delete, line 102 */ + if (ret < 0) return ret; + } + { int ret = r_undouble(z); + if (ret == 0) return 0; /* call undouble, line 103 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { int m1 = z->l - z->c; (void)m1; /* do, line 107 */ + z->ket = z->c; /* [, line 108 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((540704 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_3, 5); /* substring, line 108 */ + if (!(among_var)) goto lab0; + z->bra = z->c; /* ], line 108 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = r_R1(z); + if (ret == 0) goto lab0; /* call R1, line 110 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 4, s_15); /* <-, line 110 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_en_ending(z); + if (ret == 0) goto lab0; /* call en_ending, line 113 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = r_R1(z); + if (ret == 0) goto lab0; /* call R1, line 116 */ + if (ret < 0) return ret; + } + if (out_grouping_b(z, g_v_j, 97, 232, 0)) goto lab0; + { int ret = slice_del(z); /* delete, line 116 */ + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - m1; + } + { int m2 = z->l - z->c; (void)m2; /* do, line 120 */ + { int ret = r_e_ending(z); + if (ret == 0) goto lab1; /* call e_ending, line 120 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 122 */ + z->ket = z->c; /* [, line 122 */ + if (!(eq_s_b(z, 4, s_16))) goto lab2; + z->bra = z->c; /* ], line 122 */ + { int ret = r_R2(z); + if (ret == 0) goto lab2; /* call R2, line 122 */ + if (ret < 0) return ret; + } + { int m4 = z->l - z->c; (void)m4; /* not, line 122 */ + if (!(eq_s_b(z, 1, s_17))) goto lab3; + goto lab2; + lab3: + z->c = z->l - m4; + } + { int ret = slice_del(z); /* delete, line 122 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 123 */ + if (!(eq_s_b(z, 2, s_18))) goto lab2; + z->bra = z->c; /* ], line 123 */ + { int ret = r_en_ending(z); + if (ret == 0) goto lab2; /* call en_ending, line 123 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m5 = z->l - z->c; (void)m5; /* do, line 126 */ + z->ket = z->c; /* [, line 127 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((264336 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab4; + among_var = find_among_b(z, a_4, 6); /* substring, line 127 */ + if (!(among_var)) goto lab4; + z->bra = z->c; /* ], line 127 */ + switch(among_var) { + case 0: goto lab4; + case 1: + { int ret = r_R2(z); + if (ret == 0) goto lab4; /* call R2, line 129 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 129 */ + if (ret < 0) return ret; + } + { int m6 = z->l - z->c; (void)m6; /* or, line 130 */ + z->ket = z->c; /* [, line 130 */ + if (!(eq_s_b(z, 2, s_19))) goto lab6; + z->bra = z->c; /* ], line 130 */ + { int ret = r_R2(z); + if (ret == 0) goto lab6; /* call R2, line 130 */ + if (ret < 0) return ret; + } + { int m7 = z->l - z->c; (void)m7; /* not, line 130 */ + if (!(eq_s_b(z, 1, s_20))) goto lab7; + goto lab6; + lab7: + z->c = z->l - m7; + } + { int ret = slice_del(z); /* delete, line 130 */ + if (ret < 0) return ret; + } + goto lab5; + lab6: + z->c = z->l - m6; + { int ret = r_undouble(z); + if (ret == 0) goto lab4; /* call undouble, line 130 */ + if (ret < 0) return ret; + } + } + lab5: + break; + case 2: + { int ret = r_R2(z); + if (ret == 0) goto lab4; /* call R2, line 133 */ + if (ret < 0) return ret; + } + { int m8 = z->l - z->c; (void)m8; /* not, line 133 */ + if (!(eq_s_b(z, 1, s_21))) goto lab8; + goto lab4; + lab8: + z->c = z->l - m8; + } + { int ret = slice_del(z); /* delete, line 133 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = r_R2(z); + if (ret == 0) goto lab4; /* call R2, line 136 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 136 */ + if (ret < 0) return ret; + } + { int ret = r_e_ending(z); + if (ret == 0) goto lab4; /* call e_ending, line 136 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = r_R2(z); + if (ret == 0) goto lab4; /* call R2, line 139 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 139 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = r_R2(z); + if (ret == 0) goto lab4; /* call R2, line 142 */ + if (ret < 0) return ret; + } + if (!(z->B[0])) goto lab4; /* Boolean test e_found, line 142 */ + { int ret = slice_del(z); /* delete, line 142 */ + if (ret < 0) return ret; + } + break; + } + lab4: + z->c = z->l - m5; + } + { int m9 = z->l - z->c; (void)m9; /* do, line 146 */ + if (out_grouping_b(z, g_v_I, 73, 232, 0)) goto lab9; + { int m_test = z->l - z->c; /* test, line 148 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((2129954 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab9; + if (!(find_among_b(z, a_5, 4))) goto lab9; /* among, line 149 */ + if (out_grouping_b(z, g_v, 97, 232, 0)) goto lab9; + z->c = z->l - m_test; + } + z->ket = z->c; /* [, line 152 */ + if (z->c <= z->lb) goto lab9; + z->c--; /* next, line 152 */ + z->bra = z->c; /* ], line 152 */ + { int ret = slice_del(z); /* delete, line 152 */ + if (ret < 0) return ret; + } + lab9: + z->c = z->l - m9; + } + return 1; +} + +extern int dutch_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 159 */ + { int ret = r_prelude(z); + if (ret == 0) goto lab0; /* call prelude, line 159 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 160 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab1; /* call mark_regions, line 160 */ + if (ret < 0) return ret; + } + lab1: + z->c = c2; + } + z->lb = z->c; z->c = z->l; /* backwards, line 161 */ + + { int m3 = z->l - z->c; (void)m3; /* do, line 162 */ + { int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; /* call standard_suffix, line 162 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + z->c = z->lb; + { int c4 = z->c; /* do, line 163 */ + { int ret = r_postlude(z); + if (ret == 0) goto lab3; /* call postlude, line 163 */ + if (ret < 0) return ret; + } + lab3: + z->c = c4; + } + return 1; +} + +extern struct SN_env * dutch_ISO_8859_1_create_env(void) { return SN_create_env(0, 2, 1); } + +extern void dutch_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c new file mode 100644 index 00000000000..141c45dc275 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c @@ -0,0 +1,1117 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int english_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_exception2(struct SN_env * z); +static int r_exception1(struct SN_env * z); +static int r_Step_5(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * english_ISO_8859_1_create_env(void); +extern void english_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[5] = { 'a', 'r', 's', 'e', 'n' }; +static const symbol s_0_1[6] = { 'c', 'o', 'm', 'm', 'u', 'n' }; +static const symbol s_0_2[5] = { 'g', 'e', 'n', 'e', 'r' }; + +static const struct among a_0[3] = +{ +/* 0 */ { 5, s_0_0, -1, -1, 0}, +/* 1 */ { 6, s_0_1, -1, -1, 0}, +/* 2 */ { 5, s_0_2, -1, -1, 0} +}; + +static const symbol s_1_0[1] = { '\'' }; +static const symbol s_1_1[3] = { '\'', 's', '\'' }; +static const symbol s_1_2[2] = { '\'', 's' }; + +static const struct among a_1[3] = +{ +/* 0 */ { 1, s_1_0, -1, 1, 0}, +/* 1 */ { 3, s_1_1, 0, 1, 0}, +/* 2 */ { 2, s_1_2, -1, 1, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'e', 'd' }; +static const symbol s_2_1[1] = { 's' }; +static const symbol s_2_2[3] = { 'i', 'e', 's' }; +static const symbol s_2_3[4] = { 's', 's', 'e', 's' }; +static const symbol s_2_4[2] = { 's', 's' }; +static const symbol s_2_5[2] = { 'u', 's' }; + +static const struct among a_2[6] = +{ +/* 0 */ { 3, s_2_0, -1, 2, 0}, +/* 1 */ { 1, s_2_1, -1, 3, 0}, +/* 2 */ { 3, s_2_2, 1, 2, 0}, +/* 3 */ { 4, s_2_3, 1, 1, 0}, +/* 4 */ { 2, s_2_4, 1, -1, 0}, +/* 5 */ { 2, s_2_5, 1, -1, 0} +}; + +static const symbol s_3_1[2] = { 'b', 'b' }; +static const symbol s_3_2[2] = { 'd', 'd' }; +static const symbol s_3_3[2] = { 'f', 'f' }; +static const symbol s_3_4[2] = { 'g', 'g' }; +static const symbol s_3_5[2] = { 'b', 'l' }; +static const symbol s_3_6[2] = { 'm', 'm' }; +static const symbol s_3_7[2] = { 'n', 'n' }; +static const symbol s_3_8[2] = { 'p', 'p' }; +static const symbol s_3_9[2] = { 'r', 'r' }; +static const symbol s_3_10[2] = { 'a', 't' }; +static const symbol s_3_11[2] = { 't', 't' }; +static const symbol s_3_12[2] = { 'i', 'z' }; + +static const struct among a_3[13] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 2, s_3_1, 0, 2, 0}, +/* 2 */ { 2, s_3_2, 0, 2, 0}, +/* 3 */ { 2, s_3_3, 0, 2, 0}, +/* 4 */ { 2, s_3_4, 0, 2, 0}, +/* 5 */ { 2, s_3_5, 0, 1, 0}, +/* 6 */ { 2, s_3_6, 0, 2, 0}, +/* 7 */ { 2, s_3_7, 0, 2, 0}, +/* 8 */ { 2, s_3_8, 0, 2, 0}, +/* 9 */ { 2, s_3_9, 0, 2, 0}, +/* 10 */ { 2, s_3_10, 0, 1, 0}, +/* 11 */ { 2, s_3_11, 0, 2, 0}, +/* 12 */ { 2, s_3_12, 0, 1, 0} +}; + +static const symbol s_4_0[2] = { 'e', 'd' }; +static const symbol s_4_1[3] = { 'e', 'e', 'd' }; +static const symbol s_4_2[3] = { 'i', 'n', 'g' }; +static const symbol s_4_3[4] = { 'e', 'd', 'l', 'y' }; +static const symbol s_4_4[5] = { 'e', 'e', 'd', 'l', 'y' }; +static const symbol s_4_5[5] = { 'i', 'n', 'g', 'l', 'y' }; + +static const struct among a_4[6] = +{ +/* 0 */ { 2, s_4_0, -1, 2, 0}, +/* 1 */ { 3, s_4_1, 0, 1, 0}, +/* 2 */ { 3, s_4_2, -1, 2, 0}, +/* 3 */ { 4, s_4_3, -1, 2, 0}, +/* 4 */ { 5, s_4_4, 3, 1, 0}, +/* 5 */ { 5, s_4_5, -1, 2, 0} +}; + +static const symbol s_5_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_5_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_5_2[3] = { 'o', 'g', 'i' }; +static const symbol s_5_3[2] = { 'l', 'i' }; +static const symbol s_5_4[3] = { 'b', 'l', 'i' }; +static const symbol s_5_5[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_5_6[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_5_7[5] = { 'f', 'u', 'l', 'l', 'i' }; +static const symbol s_5_8[6] = { 'l', 'e', 's', 's', 'l', 'i' }; +static const symbol s_5_9[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_5_10[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_5_11[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_5_12[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_5_13[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_5_14[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_5_15[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_5_16[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_5_17[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_5_18[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_5_19[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_5_20[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_5_21[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_5_22[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_5_23[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; + +static const struct among a_5[24] = +{ +/* 0 */ { 4, s_5_0, -1, 3, 0}, +/* 1 */ { 4, s_5_1, -1, 2, 0}, +/* 2 */ { 3, s_5_2, -1, 13, 0}, +/* 3 */ { 2, s_5_3, -1, 16, 0}, +/* 4 */ { 3, s_5_4, 3, 12, 0}, +/* 5 */ { 4, s_5_5, 4, 4, 0}, +/* 6 */ { 4, s_5_6, 3, 8, 0}, +/* 7 */ { 5, s_5_7, 3, 14, 0}, +/* 8 */ { 6, s_5_8, 3, 15, 0}, +/* 9 */ { 5, s_5_9, 3, 10, 0}, +/* 10 */ { 5, s_5_10, 3, 5, 0}, +/* 11 */ { 5, s_5_11, -1, 8, 0}, +/* 12 */ { 6, s_5_12, -1, 12, 0}, +/* 13 */ { 5, s_5_13, -1, 11, 0}, +/* 14 */ { 6, s_5_14, -1, 1, 0}, +/* 15 */ { 7, s_5_15, 14, 7, 0}, +/* 16 */ { 5, s_5_16, -1, 8, 0}, +/* 17 */ { 5, s_5_17, -1, 7, 0}, +/* 18 */ { 7, s_5_18, 17, 6, 0}, +/* 19 */ { 4, s_5_19, -1, 6, 0}, +/* 20 */ { 4, s_5_20, -1, 7, 0}, +/* 21 */ { 7, s_5_21, -1, 11, 0}, +/* 22 */ { 7, s_5_22, -1, 9, 0}, +/* 23 */ { 7, s_5_23, -1, 10, 0} +}; + +static const symbol s_6_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_6_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_6_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_6_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_6_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_6_5[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_6_6[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_6_7[3] = { 'f', 'u', 'l' }; +static const symbol s_6_8[4] = { 'n', 'e', 's', 's' }; + +static const struct among a_6[9] = +{ +/* 0 */ { 5, s_6_0, -1, 4, 0}, +/* 1 */ { 5, s_6_1, -1, 6, 0}, +/* 2 */ { 5, s_6_2, -1, 3, 0}, +/* 3 */ { 5, s_6_3, -1, 4, 0}, +/* 4 */ { 4, s_6_4, -1, 4, 0}, +/* 5 */ { 6, s_6_5, -1, 1, 0}, +/* 6 */ { 7, s_6_6, 5, 2, 0}, +/* 7 */ { 3, s_6_7, -1, 5, 0}, +/* 8 */ { 4, s_6_8, -1, 5, 0} +}; + +static const symbol s_7_0[2] = { 'i', 'c' }; +static const symbol s_7_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_7_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_7_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_7_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_7_5[3] = { 'a', 't', 'e' }; +static const symbol s_7_6[3] = { 'i', 'v', 'e' }; +static const symbol s_7_7[3] = { 'i', 'z', 'e' }; +static const symbol s_7_8[3] = { 'i', 't', 'i' }; +static const symbol s_7_9[2] = { 'a', 'l' }; +static const symbol s_7_10[3] = { 'i', 's', 'm' }; +static const symbol s_7_11[3] = { 'i', 'o', 'n' }; +static const symbol s_7_12[2] = { 'e', 'r' }; +static const symbol s_7_13[3] = { 'o', 'u', 's' }; +static const symbol s_7_14[3] = { 'a', 'n', 't' }; +static const symbol s_7_15[3] = { 'e', 'n', 't' }; +static const symbol s_7_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_7_17[5] = { 'e', 'm', 'e', 'n', 't' }; + +static const struct among a_7[18] = +{ +/* 0 */ { 2, s_7_0, -1, 1, 0}, +/* 1 */ { 4, s_7_1, -1, 1, 0}, +/* 2 */ { 4, s_7_2, -1, 1, 0}, +/* 3 */ { 4, s_7_3, -1, 1, 0}, +/* 4 */ { 4, s_7_4, -1, 1, 0}, +/* 5 */ { 3, s_7_5, -1, 1, 0}, +/* 6 */ { 3, s_7_6, -1, 1, 0}, +/* 7 */ { 3, s_7_7, -1, 1, 0}, +/* 8 */ { 3, s_7_8, -1, 1, 0}, +/* 9 */ { 2, s_7_9, -1, 1, 0}, +/* 10 */ { 3, s_7_10, -1, 1, 0}, +/* 11 */ { 3, s_7_11, -1, 2, 0}, +/* 12 */ { 2, s_7_12, -1, 1, 0}, +/* 13 */ { 3, s_7_13, -1, 1, 0}, +/* 14 */ { 3, s_7_14, -1, 1, 0}, +/* 15 */ { 3, s_7_15, -1, 1, 0}, +/* 16 */ { 4, s_7_16, 15, 1, 0}, +/* 17 */ { 5, s_7_17, 16, 1, 0} +}; + +static const symbol s_8_0[1] = { 'e' }; +static const symbol s_8_1[1] = { 'l' }; + +static const struct among a_8[2] = +{ +/* 0 */ { 1, s_8_0, -1, 1, 0}, +/* 1 */ { 1, s_8_1, -1, 2, 0} +}; + +static const symbol s_9_0[7] = { 's', 'u', 'c', 'c', 'e', 'e', 'd' }; +static const symbol s_9_1[7] = { 'p', 'r', 'o', 'c', 'e', 'e', 'd' }; +static const symbol s_9_2[6] = { 'e', 'x', 'c', 'e', 'e', 'd' }; +static const symbol s_9_3[7] = { 'c', 'a', 'n', 'n', 'i', 'n', 'g' }; +static const symbol s_9_4[6] = { 'i', 'n', 'n', 'i', 'n', 'g' }; +static const symbol s_9_5[7] = { 'e', 'a', 'r', 'r', 'i', 'n', 'g' }; +static const symbol s_9_6[7] = { 'h', 'e', 'r', 'r', 'i', 'n', 'g' }; +static const symbol s_9_7[6] = { 'o', 'u', 't', 'i', 'n', 'g' }; + +static const struct among a_9[8] = +{ +/* 0 */ { 7, s_9_0, -1, -1, 0}, +/* 1 */ { 7, s_9_1, -1, -1, 0}, +/* 2 */ { 6, s_9_2, -1, -1, 0}, +/* 3 */ { 7, s_9_3, -1, -1, 0}, +/* 4 */ { 6, s_9_4, -1, -1, 0}, +/* 5 */ { 7, s_9_5, -1, -1, 0}, +/* 6 */ { 7, s_9_6, -1, -1, 0}, +/* 7 */ { 6, s_9_7, -1, -1, 0} +}; + +static const symbol s_10_0[5] = { 'a', 'n', 'd', 'e', 's' }; +static const symbol s_10_1[5] = { 'a', 't', 'l', 'a', 's' }; +static const symbol s_10_2[4] = { 'b', 'i', 'a', 's' }; +static const symbol s_10_3[6] = { 'c', 'o', 's', 'm', 'o', 's' }; +static const symbol s_10_4[5] = { 'd', 'y', 'i', 'n', 'g' }; +static const symbol s_10_5[5] = { 'e', 'a', 'r', 'l', 'y' }; +static const symbol s_10_6[6] = { 'g', 'e', 'n', 't', 'l', 'y' }; +static const symbol s_10_7[4] = { 'h', 'o', 'w', 'e' }; +static const symbol s_10_8[4] = { 'i', 'd', 'l', 'y' }; +static const symbol s_10_9[5] = { 'l', 'y', 'i', 'n', 'g' }; +static const symbol s_10_10[4] = { 'n', 'e', 'w', 's' }; +static const symbol s_10_11[4] = { 'o', 'n', 'l', 'y' }; +static const symbol s_10_12[6] = { 's', 'i', 'n', 'g', 'l', 'y' }; +static const symbol s_10_13[5] = { 's', 'k', 'i', 'e', 's' }; +static const symbol s_10_14[4] = { 's', 'k', 'i', 's' }; +static const symbol s_10_15[3] = { 's', 'k', 'y' }; +static const symbol s_10_16[5] = { 't', 'y', 'i', 'n', 'g' }; +static const symbol s_10_17[4] = { 'u', 'g', 'l', 'y' }; + +static const struct among a_10[18] = +{ +/* 0 */ { 5, s_10_0, -1, -1, 0}, +/* 1 */ { 5, s_10_1, -1, -1, 0}, +/* 2 */ { 4, s_10_2, -1, -1, 0}, +/* 3 */ { 6, s_10_3, -1, -1, 0}, +/* 4 */ { 5, s_10_4, -1, 3, 0}, +/* 5 */ { 5, s_10_5, -1, 9, 0}, +/* 6 */ { 6, s_10_6, -1, 7, 0}, +/* 7 */ { 4, s_10_7, -1, -1, 0}, +/* 8 */ { 4, s_10_8, -1, 6, 0}, +/* 9 */ { 5, s_10_9, -1, 4, 0}, +/* 10 */ { 4, s_10_10, -1, -1, 0}, +/* 11 */ { 4, s_10_11, -1, 10, 0}, +/* 12 */ { 6, s_10_12, -1, 11, 0}, +/* 13 */ { 5, s_10_13, -1, 2, 0}, +/* 14 */ { 4, s_10_14, -1, 1, 0}, +/* 15 */ { 3, s_10_15, -1, -1, 0}, +/* 16 */ { 5, s_10_16, -1, 5, 0}, +/* 17 */ { 4, s_10_17, -1, 8, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const unsigned char g_valid_LI[] = { 55, 141, 2 }; + +static const symbol s_0[] = { '\'' }; +static const symbol s_1[] = { 'y' }; +static const symbol s_2[] = { 'Y' }; +static const symbol s_3[] = { 'y' }; +static const symbol s_4[] = { 'Y' }; +static const symbol s_5[] = { 's', 's' }; +static const symbol s_6[] = { 'i' }; +static const symbol s_7[] = { 'i', 'e' }; +static const symbol s_8[] = { 'e', 'e' }; +static const symbol s_9[] = { 'e' }; +static const symbol s_10[] = { 'e' }; +static const symbol s_11[] = { 'y' }; +static const symbol s_12[] = { 'Y' }; +static const symbol s_13[] = { 'i' }; +static const symbol s_14[] = { 't', 'i', 'o', 'n' }; +static const symbol s_15[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_16[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_17[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_18[] = { 'e', 'n', 't' }; +static const symbol s_19[] = { 'i', 'z', 'e' }; +static const symbol s_20[] = { 'a', 't', 'e' }; +static const symbol s_21[] = { 'a', 'l' }; +static const symbol s_22[] = { 'f', 'u', 'l' }; +static const symbol s_23[] = { 'o', 'u', 's' }; +static const symbol s_24[] = { 'i', 'v', 'e' }; +static const symbol s_25[] = { 'b', 'l', 'e' }; +static const symbol s_26[] = { 'l' }; +static const symbol s_27[] = { 'o', 'g' }; +static const symbol s_28[] = { 'f', 'u', 'l' }; +static const symbol s_29[] = { 'l', 'e', 's', 's' }; +static const symbol s_30[] = { 't', 'i', 'o', 'n' }; +static const symbol s_31[] = { 'a', 't', 'e' }; +static const symbol s_32[] = { 'a', 'l' }; +static const symbol s_33[] = { 'i', 'c' }; +static const symbol s_34[] = { 's' }; +static const symbol s_35[] = { 't' }; +static const symbol s_36[] = { 'l' }; +static const symbol s_37[] = { 's', 'k', 'i' }; +static const symbol s_38[] = { 's', 'k', 'y' }; +static const symbol s_39[] = { 'd', 'i', 'e' }; +static const symbol s_40[] = { 'l', 'i', 'e' }; +static const symbol s_41[] = { 't', 'i', 'e' }; +static const symbol s_42[] = { 'i', 'd', 'l' }; +static const symbol s_43[] = { 'g', 'e', 'n', 't', 'l' }; +static const symbol s_44[] = { 'u', 'g', 'l', 'i' }; +static const symbol s_45[] = { 'e', 'a', 'r', 'l', 'i' }; +static const symbol s_46[] = { 'o', 'n', 'l', 'i' }; +static const symbol s_47[] = { 's', 'i', 'n', 'g', 'l' }; +static const symbol s_48[] = { 'Y' }; +static const symbol s_49[] = { 'y' }; + +static int r_prelude(struct SN_env * z) { + z->B[0] = 0; /* unset Y_found, line 26 */ + { int c1 = z->c; /* do, line 27 */ + z->bra = z->c; /* [, line 27 */ + if (!(eq_s(z, 1, s_0))) goto lab0; + z->ket = z->c; /* ], line 27 */ + { int ret = slice_del(z); /* delete, line 27 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 28 */ + z->bra = z->c; /* [, line 28 */ + if (!(eq_s(z, 1, s_1))) goto lab1; + z->ket = z->c; /* ], line 28 */ + { int ret = slice_from_s(z, 1, s_2); /* <-, line 28 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set Y_found, line 28 */ + lab1: + z->c = c2; + } + { int c3 = z->c; /* do, line 29 */ + while(1) { /* repeat, line 29 */ + int c4 = z->c; + while(1) { /* goto, line 29 */ + int c5 = z->c; + if (in_grouping(z, g_v, 97, 121, 0)) goto lab4; + z->bra = z->c; /* [, line 29 */ + if (!(eq_s(z, 1, s_3))) goto lab4; + z->ket = z->c; /* ], line 29 */ + z->c = c5; + break; + lab4: + z->c = c5; + if (z->c >= z->l) goto lab3; + z->c++; /* goto, line 29 */ + } + { int ret = slice_from_s(z, 1, s_4); /* <-, line 29 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set Y_found, line 29 */ + continue; + lab3: + z->c = c4; + break; + } + z->c = c3; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + { int c1 = z->c; /* do, line 35 */ + { int c2 = z->c; /* or, line 41 */ + if (z->c + 4 >= z->l || z->p[z->c + 4] >> 5 != 3 || !((2375680 >> (z->p[z->c + 4] & 0x1f)) & 1)) goto lab2; + if (!(find_among(z, a_0, 3))) goto lab2; /* among, line 36 */ + goto lab1; + lab2: + z->c = c2; + { /* gopast */ /* grouping v, line 41 */ + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { /* gopast */ /* non v, line 41 */ + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[0] = z->c; /* setmark p1, line 42 */ + { /* gopast */ /* grouping v, line 43 */ + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + { /* gopast */ /* non v, line 43 */ + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + z->I[1] = z->c; /* setmark p2, line 43 */ + lab0: + z->c = c1; + } + return 1; +} + +static int r_shortv(struct SN_env * z) { + { int m1 = z->l - z->c; (void)m1; /* or, line 51 */ + if (out_grouping_b(z, g_v_WXY, 89, 121, 0)) goto lab1; + if (in_grouping_b(z, g_v, 97, 121, 0)) goto lab1; + if (out_grouping_b(z, g_v, 97, 121, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - m1; + if (out_grouping_b(z, g_v, 97, 121, 0)) return 0; + if (in_grouping_b(z, g_v, 97, 121, 0)) return 0; + if (z->c > z->lb) return 0; /* atlimit, line 52 */ + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 59 */ + z->ket = z->c; /* [, line 60 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 39 && z->p[z->c - 1] != 115)) { z->c = z->l - m_keep; goto lab0; } + among_var = find_among_b(z, a_1, 3); /* substring, line 60 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 60 */ + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab0; } + case 1: + { int ret = slice_del(z); /* delete, line 62 */ + if (ret < 0) return ret; + } + break; + } + lab0: + ; + } + z->ket = z->c; /* [, line 65 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 115)) return 0; + among_var = find_among_b(z, a_2, 6); /* substring, line 65 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 65 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 2, s_5); /* <-, line 66 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m1 = z->l - z->c; (void)m1; /* or, line 68 */ + { int ret = z->c - 2; + if (z->lb > ret || ret > z->l) goto lab2; + z->c = ret; /* hop, line 68 */ + } + { int ret = slice_from_s(z, 1, s_6); /* <-, line 68 */ + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - m1; + { int ret = slice_from_s(z, 2, s_7); /* <-, line 68 */ + if (ret < 0) return ret; + } + } + lab1: + break; + case 3: + if (z->c <= z->lb) return 0; + z->c--; /* next, line 69 */ + { /* gopast */ /* grouping v, line 69 */ + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { int ret = slice_del(z); /* delete, line 69 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 75 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33554576 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_4, 6); /* substring, line 75 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 75 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 77 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 2, s_8); /* <-, line 77 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m_test = z->l - z->c; /* test, line 80 */ + { /* gopast */ /* grouping v, line 80 */ + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 80 */ + if (ret < 0) return ret; + } + { int m_test = z->l - z->c; /* test, line 81 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_3, 13); /* substring, line 81 */ + if (!(among_var)) return 0; + z->c = z->l - m_test; + } + switch(among_var) { + case 0: return 0; + case 1: + { int c_keep = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_9); /* <+, line 83 */ + z->c = c_keep; + if (ret < 0) return ret; + } + break; + case 2: + z->ket = z->c; /* [, line 86 */ + if (z->c <= z->lb) return 0; + z->c--; /* next, line 86 */ + z->bra = z->c; /* ], line 86 */ + { int ret = slice_del(z); /* delete, line 86 */ + if (ret < 0) return ret; + } + break; + case 3: + if (z->c != z->I[0]) return 0; /* atmark, line 87 */ + { int m_test = z->l - z->c; /* test, line 87 */ + { int ret = r_shortv(z); + if (ret == 0) return 0; /* call shortv, line 87 */ + if (ret < 0) return ret; + } + z->c = z->l - m_test; + } + { int c_keep = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_10); /* <+, line 87 */ + z->c = c_keep; + if (ret < 0) return ret; + } + break; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; /* [, line 94 */ + { int m1 = z->l - z->c; (void)m1; /* or, line 94 */ + if (!(eq_s_b(z, 1, s_11))) goto lab1; + goto lab0; + lab1: + z->c = z->l - m1; + if (!(eq_s_b(z, 1, s_12))) return 0; + } +lab0: + z->bra = z->c; /* ], line 94 */ + if (out_grouping_b(z, g_v, 97, 121, 0)) return 0; + { int m2 = z->l - z->c; (void)m2; /* not, line 95 */ + if (z->c > z->lb) goto lab2; /* atlimit, line 95 */ + return 0; + lab2: + z->c = z->l - m2; + } + { int ret = slice_from_s(z, 1, s_13); /* <-, line 96 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 100 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((815616 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 24); /* substring, line 100 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 100 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 100 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 4, s_14); /* <-, line 101 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 4, s_15); /* <-, line 102 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 4, s_16); /* <-, line 103 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 4, s_17); /* <-, line 104 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 3, s_18); /* <-, line 105 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 3, s_19); /* <-, line 107 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_from_s(z, 3, s_20); /* <-, line 109 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_from_s(z, 2, s_21); /* <-, line 111 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_from_s(z, 3, s_22); /* <-, line 112 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = slice_from_s(z, 3, s_23); /* <-, line 114 */ + if (ret < 0) return ret; + } + break; + case 11: + { int ret = slice_from_s(z, 3, s_24); /* <-, line 116 */ + if (ret < 0) return ret; + } + break; + case 12: + { int ret = slice_from_s(z, 3, s_25); /* <-, line 118 */ + if (ret < 0) return ret; + } + break; + case 13: + if (!(eq_s_b(z, 1, s_26))) return 0; + { int ret = slice_from_s(z, 2, s_27); /* <-, line 119 */ + if (ret < 0) return ret; + } + break; + case 14: + { int ret = slice_from_s(z, 3, s_28); /* <-, line 120 */ + if (ret < 0) return ret; + } + break; + case 15: + { int ret = slice_from_s(z, 4, s_29); /* <-, line 121 */ + if (ret < 0) return ret; + } + break; + case 16: + if (in_grouping_b(z, g_valid_LI, 99, 116, 0)) return 0; + { int ret = slice_del(z); /* delete, line 122 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 127 */ + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_6, 9); /* substring, line 127 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 127 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 127 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 4, s_30); /* <-, line 128 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 3, s_31); /* <-, line 129 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 2, s_32); /* <-, line 130 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 2, s_33); /* <-, line 132 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_del(z); /* delete, line 134 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 136 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 136 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 141 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1864232 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_7, 18); /* substring, line 141 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 141 */ + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 141 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 144 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m1 = z->l - z->c; (void)m1; /* or, line 145 */ + if (!(eq_s_b(z, 1, s_34))) goto lab1; + goto lab0; + lab1: + z->c = z->l - m1; + if (!(eq_s_b(z, 1, s_35))) return 0; + } + lab0: + { int ret = slice_del(z); /* delete, line 145 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 150 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 101 && z->p[z->c - 1] != 108)) return 0; + among_var = find_among_b(z, a_8, 2); /* substring, line 150 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 150 */ + switch(among_var) { + case 0: return 0; + case 1: + { int m1 = z->l - z->c; (void)m1; /* or, line 151 */ + { int ret = r_R2(z); + if (ret == 0) goto lab1; /* call R2, line 151 */ + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - m1; + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 151 */ + if (ret < 0) return ret; + } + { int m2 = z->l - z->c; (void)m2; /* not, line 151 */ + { int ret = r_shortv(z); + if (ret == 0) goto lab2; /* call shortv, line 151 */ + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - m2; + } + } + lab0: + { int ret = slice_del(z); /* delete, line 151 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 152 */ + if (ret < 0) return ret; + } + if (!(eq_s_b(z, 1, s_36))) return 0; + { int ret = slice_del(z); /* delete, line 152 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_exception2(struct SN_env * z) { + z->ket = z->c; /* [, line 158 */ + if (z->c - 5 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 103)) return 0; + if (!(find_among_b(z, a_9, 8))) return 0; /* substring, line 158 */ + z->bra = z->c; /* ], line 158 */ + if (z->c > z->lb) return 0; /* atlimit, line 158 */ + return 1; +} + +static int r_exception1(struct SN_env * z) { + int among_var; + z->bra = z->c; /* [, line 170 */ + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((42750482 >> (z->p[z->c + 2] & 0x1f)) & 1)) return 0; + among_var = find_among(z, a_10, 18); /* substring, line 170 */ + if (!(among_var)) return 0; + z->ket = z->c; /* ], line 170 */ + if (z->c < z->l) return 0; /* atlimit, line 170 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 3, s_37); /* <-, line 174 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 3, s_38); /* <-, line 175 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 3, s_39); /* <-, line 176 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 3, s_40); /* <-, line 177 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 3, s_41); /* <-, line 178 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 3, s_42); /* <-, line 182 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_from_s(z, 5, s_43); /* <-, line 183 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_from_s(z, 4, s_44); /* <-, line 184 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_from_s(z, 5, s_45); /* <-, line 185 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = slice_from_s(z, 4, s_46); /* <-, line 186 */ + if (ret < 0) return ret; + } + break; + case 11: + { int ret = slice_from_s(z, 5, s_47); /* <-, line 187 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + if (!(z->B[0])) return 0; /* Boolean test Y_found, line 203 */ + while(1) { /* repeat, line 203 */ + int c1 = z->c; + while(1) { /* goto, line 203 */ + int c2 = z->c; + z->bra = z->c; /* [, line 203 */ + if (!(eq_s(z, 1, s_48))) goto lab1; + z->ket = z->c; /* ], line 203 */ + z->c = c2; + break; + lab1: + z->c = c2; + if (z->c >= z->l) goto lab0; + z->c++; /* goto, line 203 */ + } + { int ret = slice_from_s(z, 1, s_49); /* <-, line 203 */ + if (ret < 0) return ret; + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +extern int english_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* or, line 207 */ + { int ret = r_exception1(z); + if (ret == 0) goto lab1; /* call exception1, line 207 */ + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = c1; + { int c2 = z->c; /* not, line 208 */ + { int ret = z->c + 3; + if (0 > ret || ret > z->l) goto lab3; + z->c = ret; /* hop, line 208 */ + } + goto lab2; + lab3: + z->c = c2; + } + goto lab0; + lab2: + z->c = c1; + { int c3 = z->c; /* do, line 209 */ + { int ret = r_prelude(z); + if (ret == 0) goto lab4; /* call prelude, line 209 */ + if (ret < 0) return ret; + } + lab4: + z->c = c3; + } + { int c4 = z->c; /* do, line 210 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab5; /* call mark_regions, line 210 */ + if (ret < 0) return ret; + } + lab5: + z->c = c4; + } + z->lb = z->c; z->c = z->l; /* backwards, line 211 */ + + { int m5 = z->l - z->c; (void)m5; /* do, line 213 */ + { int ret = r_Step_1a(z); + if (ret == 0) goto lab6; /* call Step_1a, line 213 */ + if (ret < 0) return ret; + } + lab6: + z->c = z->l - m5; + } + { int m6 = z->l - z->c; (void)m6; /* or, line 215 */ + { int ret = r_exception2(z); + if (ret == 0) goto lab8; /* call exception2, line 215 */ + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - m6; + { int m7 = z->l - z->c; (void)m7; /* do, line 217 */ + { int ret = r_Step_1b(z); + if (ret == 0) goto lab9; /* call Step_1b, line 217 */ + if (ret < 0) return ret; + } + lab9: + z->c = z->l - m7; + } + { int m8 = z->l - z->c; (void)m8; /* do, line 218 */ + { int ret = r_Step_1c(z); + if (ret == 0) goto lab10; /* call Step_1c, line 218 */ + if (ret < 0) return ret; + } + lab10: + z->c = z->l - m8; + } + { int m9 = z->l - z->c; (void)m9; /* do, line 220 */ + { int ret = r_Step_2(z); + if (ret == 0) goto lab11; /* call Step_2, line 220 */ + if (ret < 0) return ret; + } + lab11: + z->c = z->l - m9; + } + { int m10 = z->l - z->c; (void)m10; /* do, line 221 */ + { int ret = r_Step_3(z); + if (ret == 0) goto lab12; /* call Step_3, line 221 */ + if (ret < 0) return ret; + } + lab12: + z->c = z->l - m10; + } + { int m11 = z->l - z->c; (void)m11; /* do, line 222 */ + { int ret = r_Step_4(z); + if (ret == 0) goto lab13; /* call Step_4, line 222 */ + if (ret < 0) return ret; + } + lab13: + z->c = z->l - m11; + } + { int m12 = z->l - z->c; (void)m12; /* do, line 224 */ + { int ret = r_Step_5(z); + if (ret == 0) goto lab14; /* call Step_5, line 224 */ + if (ret < 0) return ret; + } + lab14: + z->c = z->l - m12; + } + } + lab7: + z->c = z->lb; + { int c13 = z->c; /* do, line 227 */ + { int ret = r_postlude(z); + if (ret == 0) goto lab15; /* call postlude, line 227 */ + if (ret < 0) return ret; + } + lab15: + z->c = c13; + } + } +lab0: + return 1; +} + +extern struct SN_env * english_ISO_8859_1_create_env(void) { return SN_create_env(0, 2, 1); } + +extern void english_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c new file mode 100644 index 00000000000..9621771d282 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c @@ -0,0 +1,762 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int finnish_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_tidy(struct SN_env * z); +static int r_other_endings(struct SN_env * z); +static int r_t_plural(struct SN_env * z); +static int r_i_plural(struct SN_env * z); +static int r_case_ending(struct SN_env * z); +static int r_VI(struct SN_env * z); +static int r_LONG(struct SN_env * z); +static int r_possessive(struct SN_env * z); +static int r_particle_etc(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * finnish_ISO_8859_1_create_env(void); +extern void finnish_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'p', 'a' }; +static const symbol s_0_1[3] = { 's', 't', 'i' }; +static const symbol s_0_2[4] = { 'k', 'a', 'a', 'n' }; +static const symbol s_0_3[3] = { 'h', 'a', 'n' }; +static const symbol s_0_4[3] = { 'k', 'i', 'n' }; +static const symbol s_0_5[3] = { 'h', 0xE4, 'n' }; +static const symbol s_0_6[4] = { 'k', 0xE4, 0xE4, 'n' }; +static const symbol s_0_7[2] = { 'k', 'o' }; +static const symbol s_0_8[2] = { 'p', 0xE4 }; +static const symbol s_0_9[2] = { 'k', 0xF6 }; + +static const struct among a_0[10] = +{ +/* 0 */ { 2, s_0_0, -1, 1, 0}, +/* 1 */ { 3, s_0_1, -1, 2, 0}, +/* 2 */ { 4, s_0_2, -1, 1, 0}, +/* 3 */ { 3, s_0_3, -1, 1, 0}, +/* 4 */ { 3, s_0_4, -1, 1, 0}, +/* 5 */ { 3, s_0_5, -1, 1, 0}, +/* 6 */ { 4, s_0_6, -1, 1, 0}, +/* 7 */ { 2, s_0_7, -1, 1, 0}, +/* 8 */ { 2, s_0_8, -1, 1, 0}, +/* 9 */ { 2, s_0_9, -1, 1, 0} +}; + +static const symbol s_1_0[3] = { 'l', 'l', 'a' }; +static const symbol s_1_1[2] = { 'n', 'a' }; +static const symbol s_1_2[3] = { 's', 's', 'a' }; +static const symbol s_1_3[2] = { 't', 'a' }; +static const symbol s_1_4[3] = { 'l', 't', 'a' }; +static const symbol s_1_5[3] = { 's', 't', 'a' }; + +static const struct among a_1[6] = +{ +/* 0 */ { 3, s_1_0, -1, -1, 0}, +/* 1 */ { 2, s_1_1, -1, -1, 0}, +/* 2 */ { 3, s_1_2, -1, -1, 0}, +/* 3 */ { 2, s_1_3, -1, -1, 0}, +/* 4 */ { 3, s_1_4, 3, -1, 0}, +/* 5 */ { 3, s_1_5, 3, -1, 0} +}; + +static const symbol s_2_0[3] = { 'l', 'l', 0xE4 }; +static const symbol s_2_1[2] = { 'n', 0xE4 }; +static const symbol s_2_2[3] = { 's', 's', 0xE4 }; +static const symbol s_2_3[2] = { 't', 0xE4 }; +static const symbol s_2_4[3] = { 'l', 't', 0xE4 }; +static const symbol s_2_5[3] = { 's', 't', 0xE4 }; + +static const struct among a_2[6] = +{ +/* 0 */ { 3, s_2_0, -1, -1, 0}, +/* 1 */ { 2, s_2_1, -1, -1, 0}, +/* 2 */ { 3, s_2_2, -1, -1, 0}, +/* 3 */ { 2, s_2_3, -1, -1, 0}, +/* 4 */ { 3, s_2_4, 3, -1, 0}, +/* 5 */ { 3, s_2_5, 3, -1, 0} +}; + +static const symbol s_3_0[3] = { 'l', 'l', 'e' }; +static const symbol s_3_1[3] = { 'i', 'n', 'e' }; + +static const struct among a_3[2] = +{ +/* 0 */ { 3, s_3_0, -1, -1, 0}, +/* 1 */ { 3, s_3_1, -1, -1, 0} +}; + +static const symbol s_4_0[3] = { 'n', 's', 'a' }; +static const symbol s_4_1[3] = { 'm', 'm', 'e' }; +static const symbol s_4_2[3] = { 'n', 'n', 'e' }; +static const symbol s_4_3[2] = { 'n', 'i' }; +static const symbol s_4_4[2] = { 's', 'i' }; +static const symbol s_4_5[2] = { 'a', 'n' }; +static const symbol s_4_6[2] = { 'e', 'n' }; +static const symbol s_4_7[2] = { 0xE4, 'n' }; +static const symbol s_4_8[3] = { 'n', 's', 0xE4 }; + +static const struct among a_4[9] = +{ +/* 0 */ { 3, s_4_0, -1, 3, 0}, +/* 1 */ { 3, s_4_1, -1, 3, 0}, +/* 2 */ { 3, s_4_2, -1, 3, 0}, +/* 3 */ { 2, s_4_3, -1, 2, 0}, +/* 4 */ { 2, s_4_4, -1, 1, 0}, +/* 5 */ { 2, s_4_5, -1, 4, 0}, +/* 6 */ { 2, s_4_6, -1, 6, 0}, +/* 7 */ { 2, s_4_7, -1, 5, 0}, +/* 8 */ { 3, s_4_8, -1, 3, 0} +}; + +static const symbol s_5_0[2] = { 'a', 'a' }; +static const symbol s_5_1[2] = { 'e', 'e' }; +static const symbol s_5_2[2] = { 'i', 'i' }; +static const symbol s_5_3[2] = { 'o', 'o' }; +static const symbol s_5_4[2] = { 'u', 'u' }; +static const symbol s_5_5[2] = { 0xE4, 0xE4 }; +static const symbol s_5_6[2] = { 0xF6, 0xF6 }; + +static const struct among a_5[7] = +{ +/* 0 */ { 2, s_5_0, -1, -1, 0}, +/* 1 */ { 2, s_5_1, -1, -1, 0}, +/* 2 */ { 2, s_5_2, -1, -1, 0}, +/* 3 */ { 2, s_5_3, -1, -1, 0}, +/* 4 */ { 2, s_5_4, -1, -1, 0}, +/* 5 */ { 2, s_5_5, -1, -1, 0}, +/* 6 */ { 2, s_5_6, -1, -1, 0} +}; + +static const symbol s_6_0[1] = { 'a' }; +static const symbol s_6_1[3] = { 'l', 'l', 'a' }; +static const symbol s_6_2[2] = { 'n', 'a' }; +static const symbol s_6_3[3] = { 's', 's', 'a' }; +static const symbol s_6_4[2] = { 't', 'a' }; +static const symbol s_6_5[3] = { 'l', 't', 'a' }; +static const symbol s_6_6[3] = { 's', 't', 'a' }; +static const symbol s_6_7[3] = { 't', 't', 'a' }; +static const symbol s_6_8[3] = { 'l', 'l', 'e' }; +static const symbol s_6_9[3] = { 'i', 'n', 'e' }; +static const symbol s_6_10[3] = { 'k', 's', 'i' }; +static const symbol s_6_11[1] = { 'n' }; +static const symbol s_6_12[3] = { 'h', 'a', 'n' }; +static const symbol s_6_13[3] = { 'd', 'e', 'n' }; +static const symbol s_6_14[4] = { 's', 'e', 'e', 'n' }; +static const symbol s_6_15[3] = { 'h', 'e', 'n' }; +static const symbol s_6_16[4] = { 't', 't', 'e', 'n' }; +static const symbol s_6_17[3] = { 'h', 'i', 'n' }; +static const symbol s_6_18[4] = { 's', 'i', 'i', 'n' }; +static const symbol s_6_19[3] = { 'h', 'o', 'n' }; +static const symbol s_6_20[3] = { 'h', 0xE4, 'n' }; +static const symbol s_6_21[3] = { 'h', 0xF6, 'n' }; +static const symbol s_6_22[1] = { 0xE4 }; +static const symbol s_6_23[3] = { 'l', 'l', 0xE4 }; +static const symbol s_6_24[2] = { 'n', 0xE4 }; +static const symbol s_6_25[3] = { 's', 's', 0xE4 }; +static const symbol s_6_26[2] = { 't', 0xE4 }; +static const symbol s_6_27[3] = { 'l', 't', 0xE4 }; +static const symbol s_6_28[3] = { 's', 't', 0xE4 }; +static const symbol s_6_29[3] = { 't', 't', 0xE4 }; + +static const struct among a_6[30] = +{ +/* 0 */ { 1, s_6_0, -1, 8, 0}, +/* 1 */ { 3, s_6_1, 0, -1, 0}, +/* 2 */ { 2, s_6_2, 0, -1, 0}, +/* 3 */ { 3, s_6_3, 0, -1, 0}, +/* 4 */ { 2, s_6_4, 0, -1, 0}, +/* 5 */ { 3, s_6_5, 4, -1, 0}, +/* 6 */ { 3, s_6_6, 4, -1, 0}, +/* 7 */ { 3, s_6_7, 4, 9, 0}, +/* 8 */ { 3, s_6_8, -1, -1, 0}, +/* 9 */ { 3, s_6_9, -1, -1, 0}, +/* 10 */ { 3, s_6_10, -1, -1, 0}, +/* 11 */ { 1, s_6_11, -1, 7, 0}, +/* 12 */ { 3, s_6_12, 11, 1, 0}, +/* 13 */ { 3, s_6_13, 11, -1, r_VI}, +/* 14 */ { 4, s_6_14, 11, -1, r_LONG}, +/* 15 */ { 3, s_6_15, 11, 2, 0}, +/* 16 */ { 4, s_6_16, 11, -1, r_VI}, +/* 17 */ { 3, s_6_17, 11, 3, 0}, +/* 18 */ { 4, s_6_18, 11, -1, r_VI}, +/* 19 */ { 3, s_6_19, 11, 4, 0}, +/* 20 */ { 3, s_6_20, 11, 5, 0}, +/* 21 */ { 3, s_6_21, 11, 6, 0}, +/* 22 */ { 1, s_6_22, -1, 8, 0}, +/* 23 */ { 3, s_6_23, 22, -1, 0}, +/* 24 */ { 2, s_6_24, 22, -1, 0}, +/* 25 */ { 3, s_6_25, 22, -1, 0}, +/* 26 */ { 2, s_6_26, 22, -1, 0}, +/* 27 */ { 3, s_6_27, 26, -1, 0}, +/* 28 */ { 3, s_6_28, 26, -1, 0}, +/* 29 */ { 3, s_6_29, 26, 9, 0} +}; + +static const symbol s_7_0[3] = { 'e', 'j', 'a' }; +static const symbol s_7_1[3] = { 'm', 'm', 'a' }; +static const symbol s_7_2[4] = { 'i', 'm', 'm', 'a' }; +static const symbol s_7_3[3] = { 'm', 'p', 'a' }; +static const symbol s_7_4[4] = { 'i', 'm', 'p', 'a' }; +static const symbol s_7_5[3] = { 'm', 'm', 'i' }; +static const symbol s_7_6[4] = { 'i', 'm', 'm', 'i' }; +static const symbol s_7_7[3] = { 'm', 'p', 'i' }; +static const symbol s_7_8[4] = { 'i', 'm', 'p', 'i' }; +static const symbol s_7_9[3] = { 'e', 'j', 0xE4 }; +static const symbol s_7_10[3] = { 'm', 'm', 0xE4 }; +static const symbol s_7_11[4] = { 'i', 'm', 'm', 0xE4 }; +static const symbol s_7_12[3] = { 'm', 'p', 0xE4 }; +static const symbol s_7_13[4] = { 'i', 'm', 'p', 0xE4 }; + +static const struct among a_7[14] = +{ +/* 0 */ { 3, s_7_0, -1, -1, 0}, +/* 1 */ { 3, s_7_1, -1, 1, 0}, +/* 2 */ { 4, s_7_2, 1, -1, 0}, +/* 3 */ { 3, s_7_3, -1, 1, 0}, +/* 4 */ { 4, s_7_4, 3, -1, 0}, +/* 5 */ { 3, s_7_5, -1, 1, 0}, +/* 6 */ { 4, s_7_6, 5, -1, 0}, +/* 7 */ { 3, s_7_7, -1, 1, 0}, +/* 8 */ { 4, s_7_8, 7, -1, 0}, +/* 9 */ { 3, s_7_9, -1, -1, 0}, +/* 10 */ { 3, s_7_10, -1, 1, 0}, +/* 11 */ { 4, s_7_11, 10, -1, 0}, +/* 12 */ { 3, s_7_12, -1, 1, 0}, +/* 13 */ { 4, s_7_13, 12, -1, 0} +}; + +static const symbol s_8_0[1] = { 'i' }; +static const symbol s_8_1[1] = { 'j' }; + +static const struct among a_8[2] = +{ +/* 0 */ { 1, s_8_0, -1, -1, 0}, +/* 1 */ { 1, s_8_1, -1, -1, 0} +}; + +static const symbol s_9_0[3] = { 'm', 'm', 'a' }; +static const symbol s_9_1[4] = { 'i', 'm', 'm', 'a' }; + +static const struct among a_9[2] = +{ +/* 0 */ { 3, s_9_0, -1, 1, 0}, +/* 1 */ { 4, s_9_1, 0, -1, 0} +}; + +static const unsigned char g_AEI[] = { 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 }; + +static const unsigned char g_V1[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_V2[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const unsigned char g_particle_end[] = { 17, 97, 24, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32 }; + +static const symbol s_0[] = { 'k' }; +static const symbol s_1[] = { 'k', 's', 'e' }; +static const symbol s_2[] = { 'k', 's', 'i' }; +static const symbol s_3[] = { 'i' }; +static const symbol s_4[] = { 'a' }; +static const symbol s_5[] = { 'e' }; +static const symbol s_6[] = { 'i' }; +static const symbol s_7[] = { 'o' }; +static const symbol s_8[] = { 0xE4 }; +static const symbol s_9[] = { 0xF6 }; +static const symbol s_10[] = { 'i', 'e' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'p', 'o' }; +static const symbol s_13[] = { 't' }; +static const symbol s_14[] = { 'p', 'o' }; +static const symbol s_15[] = { 'j' }; +static const symbol s_16[] = { 'o' }; +static const symbol s_17[] = { 'u' }; +static const symbol s_18[] = { 'o' }; +static const symbol s_19[] = { 'j' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + if (out_grouping(z, g_V1, 97, 246, 1) < 0) return 0; /* goto */ /* grouping V1, line 46 */ + { /* gopast */ /* non V1, line 46 */ + int ret = in_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 46 */ + if (out_grouping(z, g_V1, 97, 246, 1) < 0) return 0; /* goto */ /* grouping V1, line 47 */ + { /* gopast */ /* non V1, line 47 */ + int ret = in_grouping(z, g_V1, 97, 246, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; /* setmark p2, line 47 */ + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_particle_etc(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 55 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 55 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 55 */ + among_var = find_among_b(z, a_0, 10); /* substring, line 55 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 55 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + if (in_grouping_b(z, g_particle_end, 97, 246, 0)) return 0; + break; + case 2: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 64 */ + if (ret < 0) return ret; + } + break; + } + { int ret = slice_del(z); /* delete, line 66 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_possessive(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 69 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 69 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 69 */ + among_var = find_among_b(z, a_4, 9); /* substring, line 69 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 69 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int m2 = z->l - z->c; (void)m2; /* not, line 72 */ + if (!(eq_s_b(z, 1, s_0))) goto lab0; + return 0; + lab0: + z->c = z->l - m2; + } + { int ret = slice_del(z); /* delete, line 72 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_del(z); /* delete, line 74 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 74 */ + if (!(eq_s_b(z, 3, s_1))) return 0; + z->bra = z->c; /* ], line 74 */ + { int ret = slice_from_s(z, 3, s_2); /* <-, line 74 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 78 */ + if (ret < 0) return ret; + } + break; + case 4: + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 97) return 0; + if (!(find_among_b(z, a_1, 6))) return 0; /* among, line 81 */ + { int ret = slice_del(z); /* delete, line 81 */ + if (ret < 0) return ret; + } + break; + case 5: + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 228) return 0; + if (!(find_among_b(z, a_2, 6))) return 0; /* among, line 83 */ + { int ret = slice_del(z); /* delete, line 84 */ + if (ret < 0) return ret; + } + break; + case 6: + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 101) return 0; + if (!(find_among_b(z, a_3, 2))) return 0; /* among, line 86 */ + { int ret = slice_del(z); /* delete, line 86 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_LONG(struct SN_env * z) { + if (!(find_among_b(z, a_5, 7))) return 0; /* among, line 91 */ + return 1; +} + +static int r_VI(struct SN_env * z) { + if (!(eq_s_b(z, 1, s_3))) return 0; + if (in_grouping_b(z, g_V2, 97, 246, 0)) return 0; + return 1; +} + +static int r_case_ending(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 96 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 96 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 96 */ + among_var = find_among_b(z, a_6, 30); /* substring, line 96 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 96 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + if (!(eq_s_b(z, 1, s_4))) return 0; + break; + case 2: + if (!(eq_s_b(z, 1, s_5))) return 0; + break; + case 3: + if (!(eq_s_b(z, 1, s_6))) return 0; + break; + case 4: + if (!(eq_s_b(z, 1, s_7))) return 0; + break; + case 5: + if (!(eq_s_b(z, 1, s_8))) return 0; + break; + case 6: + if (!(eq_s_b(z, 1, s_9))) return 0; + break; + case 7: + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 111 */ + { int m2 = z->l - z->c; (void)m2; /* and, line 113 */ + { int m3 = z->l - z->c; (void)m3; /* or, line 112 */ + { int ret = r_LONG(z); + if (ret == 0) goto lab2; /* call LONG, line 111 */ + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - m3; + if (!(eq_s_b(z, 2, s_10))) { z->c = z->l - m_keep; goto lab0; } + } + lab1: + z->c = z->l - m2; + if (z->c <= z->lb) { z->c = z->l - m_keep; goto lab0; } + z->c--; /* next, line 113 */ + } + z->bra = z->c; /* ], line 113 */ + lab0: + ; + } + break; + case 8: + if (in_grouping_b(z, g_V1, 97, 246, 0)) return 0; + if (out_grouping_b(z, g_V1, 97, 246, 0)) return 0; + break; + case 9: + if (!(eq_s_b(z, 1, s_11))) return 0; + break; + } + { int ret = slice_del(z); /* delete, line 138 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set ending_removed, line 139 */ + return 1; +} + +static int r_other_endings(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 142 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[1]) return 0; + z->c = z->I[1]; /* tomark, line 142 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 142 */ + among_var = find_among_b(z, a_7, 14); /* substring, line 142 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 142 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int m2 = z->l - z->c; (void)m2; /* not, line 146 */ + if (!(eq_s_b(z, 2, s_12))) goto lab0; + return 0; + lab0: + z->c = z->l - m2; + } + break; + } + { int ret = slice_del(z); /* delete, line 151 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_i_plural(struct SN_env * z) { + { int mlimit; /* setlimit, line 154 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 154 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 154 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 106)) { z->lb = mlimit; return 0; } + if (!(find_among_b(z, a_8, 2))) { z->lb = mlimit; return 0; } /* substring, line 154 */ + z->bra = z->c; /* ], line 154 */ + z->lb = mlimit; + } + { int ret = slice_del(z); /* delete, line 158 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_t_plural(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 161 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 161 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 162 */ + if (!(eq_s_b(z, 1, s_13))) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 162 */ + { int m_test = z->l - z->c; /* test, line 162 */ + if (in_grouping_b(z, g_V1, 97, 246, 0)) { z->lb = mlimit; return 0; } + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 163 */ + if (ret < 0) return ret; + } + z->lb = mlimit; + } + { int mlimit; /* setlimit, line 165 */ + int m2 = z->l - z->c; (void)m2; + if (z->c < z->I[1]) return 0; + z->c = z->I[1]; /* tomark, line 165 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m2; + z->ket = z->c; /* [, line 165 */ + if (z->c - 2 <= z->lb || z->p[z->c - 1] != 97) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_9, 2); /* substring, line 165 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 165 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int m3 = z->l - z->c; (void)m3; /* not, line 167 */ + if (!(eq_s_b(z, 2, s_14))) goto lab0; + return 0; + lab0: + z->c = z->l - m3; + } + break; + } + { int ret = slice_del(z); /* delete, line 170 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_tidy(struct SN_env * z) { + { int mlimit; /* setlimit, line 173 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 173 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + { int m2 = z->l - z->c; (void)m2; /* do, line 174 */ + { int m3 = z->l - z->c; (void)m3; /* and, line 174 */ + { int ret = r_LONG(z); + if (ret == 0) goto lab0; /* call LONG, line 174 */ + if (ret < 0) return ret; + } + z->c = z->l - m3; + z->ket = z->c; /* [, line 174 */ + if (z->c <= z->lb) goto lab0; + z->c--; /* next, line 174 */ + z->bra = z->c; /* ], line 174 */ + { int ret = slice_del(z); /* delete, line 174 */ + if (ret < 0) return ret; + } + } + lab0: + z->c = z->l - m2; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 175 */ + z->ket = z->c; /* [, line 175 */ + if (in_grouping_b(z, g_AEI, 97, 228, 0)) goto lab1; + z->bra = z->c; /* ], line 175 */ + if (out_grouping_b(z, g_V1, 97, 246, 0)) goto lab1; + { int ret = slice_del(z); /* delete, line 175 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m4; + } + { int m5 = z->l - z->c; (void)m5; /* do, line 176 */ + z->ket = z->c; /* [, line 176 */ + if (!(eq_s_b(z, 1, s_15))) goto lab2; + z->bra = z->c; /* ], line 176 */ + { int m6 = z->l - z->c; (void)m6; /* or, line 176 */ + if (!(eq_s_b(z, 1, s_16))) goto lab4; + goto lab3; + lab4: + z->c = z->l - m6; + if (!(eq_s_b(z, 1, s_17))) goto lab2; + } + lab3: + { int ret = slice_del(z); /* delete, line 176 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m5; + } + { int m7 = z->l - z->c; (void)m7; /* do, line 177 */ + z->ket = z->c; /* [, line 177 */ + if (!(eq_s_b(z, 1, s_18))) goto lab5; + z->bra = z->c; /* ], line 177 */ + if (!(eq_s_b(z, 1, s_19))) goto lab5; + { int ret = slice_del(z); /* delete, line 177 */ + if (ret < 0) return ret; + } + lab5: + z->c = z->l - m7; + } + z->lb = mlimit; + } + if (in_grouping_b(z, g_V1, 97, 246, 1) < 0) return 0; /* goto */ /* non V1, line 179 */ + z->ket = z->c; /* [, line 179 */ + if (z->c <= z->lb) return 0; + z->c--; /* next, line 179 */ + z->bra = z->c; /* ], line 179 */ + z->S[0] = slice_to(z, z->S[0]); /* -> x, line 179 */ + if (z->S[0] == 0) return -1; /* -> x, line 179 */ + if (!(eq_v_b(z, z->S[0]))) return 0; /* name x, line 179 */ + { int ret = slice_del(z); /* delete, line 179 */ + if (ret < 0) return ret; + } + return 1; +} + +extern int finnish_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 185 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab0; /* call mark_regions, line 185 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + z->B[0] = 0; /* unset ending_removed, line 186 */ + z->lb = z->c; z->c = z->l; /* backwards, line 187 */ + + { int m2 = z->l - z->c; (void)m2; /* do, line 188 */ + { int ret = r_particle_etc(z); + if (ret == 0) goto lab1; /* call particle_etc, line 188 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 189 */ + { int ret = r_possessive(z); + if (ret == 0) goto lab2; /* call possessive, line 189 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 190 */ + { int ret = r_case_ending(z); + if (ret == 0) goto lab3; /* call case_ending, line 190 */ + if (ret < 0) return ret; + } + lab3: + z->c = z->l - m4; + } + { int m5 = z->l - z->c; (void)m5; /* do, line 191 */ + { int ret = r_other_endings(z); + if (ret == 0) goto lab4; /* call other_endings, line 191 */ + if (ret < 0) return ret; + } + lab4: + z->c = z->l - m5; + } + { int m6 = z->l - z->c; (void)m6; /* or, line 192 */ + if (!(z->B[0])) goto lab6; /* Boolean test ending_removed, line 192 */ + { int m7 = z->l - z->c; (void)m7; /* do, line 192 */ + { int ret = r_i_plural(z); + if (ret == 0) goto lab7; /* call i_plural, line 192 */ + if (ret < 0) return ret; + } + lab7: + z->c = z->l - m7; + } + goto lab5; + lab6: + z->c = z->l - m6; + { int m8 = z->l - z->c; (void)m8; /* do, line 192 */ + { int ret = r_t_plural(z); + if (ret == 0) goto lab8; /* call t_plural, line 192 */ + if (ret < 0) return ret; + } + lab8: + z->c = z->l - m8; + } + } +lab5: + { int m9 = z->l - z->c; (void)m9; /* do, line 193 */ + { int ret = r_tidy(z); + if (ret == 0) goto lab9; /* call tidy, line 193 */ + if (ret < 0) return ret; + } + lab9: + z->c = z->l - m9; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * finnish_ISO_8859_1_create_env(void) { return SN_create_env(1, 2, 1); } + +extern void finnish_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 1); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c new file mode 100644 index 00000000000..fc79c0a24dc --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c @@ -0,0 +1,1246 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int french_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_un_accent(struct SN_env * z); +static int r_un_double(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_i_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * french_ISO_8859_1_create_env(void); +extern void french_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[3] = { 'c', 'o', 'l' }; +static const symbol s_0_1[3] = { 'p', 'a', 'r' }; +static const symbol s_0_2[3] = { 't', 'a', 'p' }; + +static const struct among a_0[3] = +{ +/* 0 */ { 3, s_0_0, -1, -1, 0}, +/* 1 */ { 3, s_0_1, -1, -1, 0}, +/* 2 */ { 3, s_0_2, -1, -1, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'U' }; +static const symbol s_1_3[1] = { 'Y' }; + +static const struct among a_1[4] = +{ +/* 0 */ { 0, 0, -1, 4, 0}, +/* 1 */ { 1, s_1_1, 0, 1, 0}, +/* 2 */ { 1, s_1_2, 0, 2, 0}, +/* 3 */ { 1, s_1_3, 0, 3, 0} +}; + +static const symbol s_2_0[3] = { 'i', 'q', 'U' }; +static const symbol s_2_1[3] = { 'a', 'b', 'l' }; +static const symbol s_2_2[3] = { 'I', 0xE8, 'r' }; +static const symbol s_2_3[3] = { 'i', 0xE8, 'r' }; +static const symbol s_2_4[3] = { 'e', 'u', 's' }; +static const symbol s_2_5[2] = { 'i', 'v' }; + +static const struct among a_2[6] = +{ +/* 0 */ { 3, s_2_0, -1, 3, 0}, +/* 1 */ { 3, s_2_1, -1, 3, 0}, +/* 2 */ { 3, s_2_2, -1, 4, 0}, +/* 3 */ { 3, s_2_3, -1, 4, 0}, +/* 4 */ { 3, s_2_4, -1, 2, 0}, +/* 5 */ { 2, s_2_5, -1, 1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'c' }; +static const symbol s_3_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_3_2[2] = { 'i', 'v' }; + +static const struct among a_3[3] = +{ +/* 0 */ { 2, s_3_0, -1, 2, 0}, +/* 1 */ { 4, s_3_1, -1, 1, 0}, +/* 2 */ { 2, s_3_2, -1, 3, 0} +}; + +static const symbol s_4_0[4] = { 'i', 'q', 'U', 'e' }; +static const symbol s_4_1[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_4_2[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_4_3[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_4_4[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_4_5[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_4_6[4] = { 'i', 's', 'm', 'e' }; +static const symbol s_4_7[4] = { 'e', 'u', 's', 'e' }; +static const symbol s_4_8[4] = { 'i', 's', 't', 'e' }; +static const symbol s_4_9[3] = { 'i', 'v', 'e' }; +static const symbol s_4_10[2] = { 'i', 'f' }; +static const symbol s_4_11[5] = { 'u', 's', 'i', 'o', 'n' }; +static const symbol s_4_12[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_4_13[5] = { 'u', 't', 'i', 'o', 'n' }; +static const symbol s_4_14[5] = { 'a', 't', 'e', 'u', 'r' }; +static const symbol s_4_15[5] = { 'i', 'q', 'U', 'e', 's' }; +static const symbol s_4_16[7] = { 'a', 't', 'r', 'i', 'c', 'e', 's' }; +static const symbol s_4_17[5] = { 'a', 'n', 'c', 'e', 's' }; +static const symbol s_4_18[5] = { 'e', 'n', 'c', 'e', 's' }; +static const symbol s_4_19[6] = { 'l', 'o', 'g', 'i', 'e', 's' }; +static const symbol s_4_20[5] = { 'a', 'b', 'l', 'e', 's' }; +static const symbol s_4_21[5] = { 'i', 's', 'm', 'e', 's' }; +static const symbol s_4_22[5] = { 'e', 'u', 's', 'e', 's' }; +static const symbol s_4_23[5] = { 'i', 's', 't', 'e', 's' }; +static const symbol s_4_24[4] = { 'i', 'v', 'e', 's' }; +static const symbol s_4_25[3] = { 'i', 'f', 's' }; +static const symbol s_4_26[6] = { 'u', 's', 'i', 'o', 'n', 's' }; +static const symbol s_4_27[6] = { 'a', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_28[6] = { 'u', 't', 'i', 'o', 'n', 's' }; +static const symbol s_4_29[6] = { 'a', 't', 'e', 'u', 'r', 's' }; +static const symbol s_4_30[5] = { 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_31[6] = { 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_32[9] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't', 's' }; +static const symbol s_4_33[4] = { 'i', 't', 0xE9, 's' }; +static const symbol s_4_34[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_4_35[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_36[8] = { 'i', 's', 's', 'e', 'm', 'e', 'n', 't' }; +static const symbol s_4_37[6] = { 'a', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_38[6] = { 'e', 'm', 'm', 'e', 'n', 't' }; +static const symbol s_4_39[3] = { 'a', 'u', 'x' }; +static const symbol s_4_40[4] = { 'e', 'a', 'u', 'x' }; +static const symbol s_4_41[3] = { 'e', 'u', 'x' }; +static const symbol s_4_42[3] = { 'i', 't', 0xE9 }; + +static const struct among a_4[43] = +{ +/* 0 */ { 4, s_4_0, -1, 1, 0}, +/* 1 */ { 6, s_4_1, -1, 2, 0}, +/* 2 */ { 4, s_4_2, -1, 1, 0}, +/* 3 */ { 4, s_4_3, -1, 5, 0}, +/* 4 */ { 5, s_4_4, -1, 3, 0}, +/* 5 */ { 4, s_4_5, -1, 1, 0}, +/* 6 */ { 4, s_4_6, -1, 1, 0}, +/* 7 */ { 4, s_4_7, -1, 11, 0}, +/* 8 */ { 4, s_4_8, -1, 1, 0}, +/* 9 */ { 3, s_4_9, -1, 8, 0}, +/* 10 */ { 2, s_4_10, -1, 8, 0}, +/* 11 */ { 5, s_4_11, -1, 4, 0}, +/* 12 */ { 5, s_4_12, -1, 2, 0}, +/* 13 */ { 5, s_4_13, -1, 4, 0}, +/* 14 */ { 5, s_4_14, -1, 2, 0}, +/* 15 */ { 5, s_4_15, -1, 1, 0}, +/* 16 */ { 7, s_4_16, -1, 2, 0}, +/* 17 */ { 5, s_4_17, -1, 1, 0}, +/* 18 */ { 5, s_4_18, -1, 5, 0}, +/* 19 */ { 6, s_4_19, -1, 3, 0}, +/* 20 */ { 5, s_4_20, -1, 1, 0}, +/* 21 */ { 5, s_4_21, -1, 1, 0}, +/* 22 */ { 5, s_4_22, -1, 11, 0}, +/* 23 */ { 5, s_4_23, -1, 1, 0}, +/* 24 */ { 4, s_4_24, -1, 8, 0}, +/* 25 */ { 3, s_4_25, -1, 8, 0}, +/* 26 */ { 6, s_4_26, -1, 4, 0}, +/* 27 */ { 6, s_4_27, -1, 2, 0}, +/* 28 */ { 6, s_4_28, -1, 4, 0}, +/* 29 */ { 6, s_4_29, -1, 2, 0}, +/* 30 */ { 5, s_4_30, -1, 15, 0}, +/* 31 */ { 6, s_4_31, 30, 6, 0}, +/* 32 */ { 9, s_4_32, 31, 12, 0}, +/* 33 */ { 4, s_4_33, -1, 7, 0}, +/* 34 */ { 4, s_4_34, -1, 15, 0}, +/* 35 */ { 5, s_4_35, 34, 6, 0}, +/* 36 */ { 8, s_4_36, 35, 12, 0}, +/* 37 */ { 6, s_4_37, 34, 13, 0}, +/* 38 */ { 6, s_4_38, 34, 14, 0}, +/* 39 */ { 3, s_4_39, -1, 10, 0}, +/* 40 */ { 4, s_4_40, 39, 9, 0}, +/* 41 */ { 3, s_4_41, -1, 1, 0}, +/* 42 */ { 3, s_4_42, -1, 7, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'r', 'a' }; +static const symbol s_5_1[2] = { 'i', 'e' }; +static const symbol s_5_2[4] = { 'i', 's', 's', 'e' }; +static const symbol s_5_3[7] = { 'i', 's', 's', 'a', 'n', 't', 'e' }; +static const symbol s_5_4[1] = { 'i' }; +static const symbol s_5_5[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_5_6[2] = { 'i', 'r' }; +static const symbol s_5_7[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_8[3] = { 'i', 'e', 's' }; +static const symbol s_5_9[4] = { 0xEE, 'm', 'e', 's' }; +static const symbol s_5_10[5] = { 'i', 's', 's', 'e', 's' }; +static const symbol s_5_11[8] = { 'i', 's', 's', 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_12[4] = { 0xEE, 't', 'e', 's' }; +static const symbol s_5_13[2] = { 'i', 's' }; +static const symbol s_5_14[5] = { 'i', 'r', 'a', 'i', 's' }; +static const symbol s_5_15[6] = { 'i', 's', 's', 'a', 'i', 's' }; +static const symbol s_5_16[6] = { 'i', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_5_17[7] = { 'i', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_5_18[5] = { 'i', 'r', 'o', 'n', 's' }; +static const symbol s_5_19[6] = { 'i', 's', 's', 'o', 'n', 's' }; +static const symbol s_5_20[7] = { 'i', 's', 's', 'a', 'n', 't', 's' }; +static const symbol s_5_21[2] = { 'i', 't' }; +static const symbol s_5_22[5] = { 'i', 'r', 'a', 'i', 't' }; +static const symbol s_5_23[6] = { 'i', 's', 's', 'a', 'i', 't' }; +static const symbol s_5_24[6] = { 'i', 's', 's', 'a', 'n', 't' }; +static const symbol s_5_25[7] = { 'i', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_26[8] = { 'i', 's', 's', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_5_27[5] = { 'i', 'r', 'e', 'n', 't' }; +static const symbol s_5_28[6] = { 'i', 's', 's', 'e', 'n', 't' }; +static const symbol s_5_29[5] = { 'i', 'r', 'o', 'n', 't' }; +static const symbol s_5_30[2] = { 0xEE, 't' }; +static const symbol s_5_31[5] = { 'i', 'r', 'i', 'e', 'z' }; +static const symbol s_5_32[6] = { 'i', 's', 's', 'i', 'e', 'z' }; +static const symbol s_5_33[4] = { 'i', 'r', 'e', 'z' }; +static const symbol s_5_34[5] = { 'i', 's', 's', 'e', 'z' }; + +static const struct among a_5[35] = +{ +/* 0 */ { 3, s_5_0, -1, 1, 0}, +/* 1 */ { 2, s_5_1, -1, 1, 0}, +/* 2 */ { 4, s_5_2, -1, 1, 0}, +/* 3 */ { 7, s_5_3, -1, 1, 0}, +/* 4 */ { 1, s_5_4, -1, 1, 0}, +/* 5 */ { 4, s_5_5, 4, 1, 0}, +/* 6 */ { 2, s_5_6, -1, 1, 0}, +/* 7 */ { 4, s_5_7, -1, 1, 0}, +/* 8 */ { 3, s_5_8, -1, 1, 0}, +/* 9 */ { 4, s_5_9, -1, 1, 0}, +/* 10 */ { 5, s_5_10, -1, 1, 0}, +/* 11 */ { 8, s_5_11, -1, 1, 0}, +/* 12 */ { 4, s_5_12, -1, 1, 0}, +/* 13 */ { 2, s_5_13, -1, 1, 0}, +/* 14 */ { 5, s_5_14, 13, 1, 0}, +/* 15 */ { 6, s_5_15, 13, 1, 0}, +/* 16 */ { 6, s_5_16, -1, 1, 0}, +/* 17 */ { 7, s_5_17, -1, 1, 0}, +/* 18 */ { 5, s_5_18, -1, 1, 0}, +/* 19 */ { 6, s_5_19, -1, 1, 0}, +/* 20 */ { 7, s_5_20, -1, 1, 0}, +/* 21 */ { 2, s_5_21, -1, 1, 0}, +/* 22 */ { 5, s_5_22, 21, 1, 0}, +/* 23 */ { 6, s_5_23, 21, 1, 0}, +/* 24 */ { 6, s_5_24, -1, 1, 0}, +/* 25 */ { 7, s_5_25, -1, 1, 0}, +/* 26 */ { 8, s_5_26, -1, 1, 0}, +/* 27 */ { 5, s_5_27, -1, 1, 0}, +/* 28 */ { 6, s_5_28, -1, 1, 0}, +/* 29 */ { 5, s_5_29, -1, 1, 0}, +/* 30 */ { 2, s_5_30, -1, 1, 0}, +/* 31 */ { 5, s_5_31, -1, 1, 0}, +/* 32 */ { 6, s_5_32, -1, 1, 0}, +/* 33 */ { 4, s_5_33, -1, 1, 0}, +/* 34 */ { 5, s_5_34, -1, 1, 0} +}; + +static const symbol s_6_0[1] = { 'a' }; +static const symbol s_6_1[3] = { 'e', 'r', 'a' }; +static const symbol s_6_2[4] = { 'a', 's', 's', 'e' }; +static const symbol s_6_3[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_4[2] = { 0xE9, 'e' }; +static const symbol s_6_5[2] = { 'a', 'i' }; +static const symbol s_6_6[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_6_7[2] = { 'e', 'r' }; +static const symbol s_6_8[2] = { 'a', 's' }; +static const symbol s_6_9[4] = { 'e', 'r', 'a', 's' }; +static const symbol s_6_10[4] = { 0xE2, 'm', 'e', 's' }; +static const symbol s_6_11[5] = { 'a', 's', 's', 'e', 's' }; +static const symbol s_6_12[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_6_13[4] = { 0xE2, 't', 'e', 's' }; +static const symbol s_6_14[3] = { 0xE9, 'e', 's' }; +static const symbol s_6_15[3] = { 'a', 'i', 's' }; +static const symbol s_6_16[5] = { 'e', 'r', 'a', 'i', 's' }; +static const symbol s_6_17[4] = { 'i', 'o', 'n', 's' }; +static const symbol s_6_18[6] = { 'e', 'r', 'i', 'o', 'n', 's' }; +static const symbol s_6_19[7] = { 'a', 's', 's', 'i', 'o', 'n', 's' }; +static const symbol s_6_20[5] = { 'e', 'r', 'o', 'n', 's' }; +static const symbol s_6_21[4] = { 'a', 'n', 't', 's' }; +static const symbol s_6_22[2] = { 0xE9, 's' }; +static const symbol s_6_23[3] = { 'a', 'i', 't' }; +static const symbol s_6_24[5] = { 'e', 'r', 'a', 'i', 't' }; +static const symbol s_6_25[3] = { 'a', 'n', 't' }; +static const symbol s_6_26[5] = { 'a', 'I', 'e', 'n', 't' }; +static const symbol s_6_27[7] = { 'e', 'r', 'a', 'I', 'e', 'n', 't' }; +static const symbol s_6_28[5] = { 0xE8, 'r', 'e', 'n', 't' }; +static const symbol s_6_29[6] = { 'a', 's', 's', 'e', 'n', 't' }; +static const symbol s_6_30[5] = { 'e', 'r', 'o', 'n', 't' }; +static const symbol s_6_31[2] = { 0xE2, 't' }; +static const symbol s_6_32[2] = { 'e', 'z' }; +static const symbol s_6_33[3] = { 'i', 'e', 'z' }; +static const symbol s_6_34[5] = { 'e', 'r', 'i', 'e', 'z' }; +static const symbol s_6_35[6] = { 'a', 's', 's', 'i', 'e', 'z' }; +static const symbol s_6_36[4] = { 'e', 'r', 'e', 'z' }; +static const symbol s_6_37[1] = { 0xE9 }; + +static const struct among a_6[38] = +{ +/* 0 */ { 1, s_6_0, -1, 3, 0}, +/* 1 */ { 3, s_6_1, 0, 2, 0}, +/* 2 */ { 4, s_6_2, -1, 3, 0}, +/* 3 */ { 4, s_6_3, -1, 3, 0}, +/* 4 */ { 2, s_6_4, -1, 2, 0}, +/* 5 */ { 2, s_6_5, -1, 3, 0}, +/* 6 */ { 4, s_6_6, 5, 2, 0}, +/* 7 */ { 2, s_6_7, -1, 2, 0}, +/* 8 */ { 2, s_6_8, -1, 3, 0}, +/* 9 */ { 4, s_6_9, 8, 2, 0}, +/* 10 */ { 4, s_6_10, -1, 3, 0}, +/* 11 */ { 5, s_6_11, -1, 3, 0}, +/* 12 */ { 5, s_6_12, -1, 3, 0}, +/* 13 */ { 4, s_6_13, -1, 3, 0}, +/* 14 */ { 3, s_6_14, -1, 2, 0}, +/* 15 */ { 3, s_6_15, -1, 3, 0}, +/* 16 */ { 5, s_6_16, 15, 2, 0}, +/* 17 */ { 4, s_6_17, -1, 1, 0}, +/* 18 */ { 6, s_6_18, 17, 2, 0}, +/* 19 */ { 7, s_6_19, 17, 3, 0}, +/* 20 */ { 5, s_6_20, -1, 2, 0}, +/* 21 */ { 4, s_6_21, -1, 3, 0}, +/* 22 */ { 2, s_6_22, -1, 2, 0}, +/* 23 */ { 3, s_6_23, -1, 3, 0}, +/* 24 */ { 5, s_6_24, 23, 2, 0}, +/* 25 */ { 3, s_6_25, -1, 3, 0}, +/* 26 */ { 5, s_6_26, -1, 3, 0}, +/* 27 */ { 7, s_6_27, 26, 2, 0}, +/* 28 */ { 5, s_6_28, -1, 2, 0}, +/* 29 */ { 6, s_6_29, -1, 3, 0}, +/* 30 */ { 5, s_6_30, -1, 2, 0}, +/* 31 */ { 2, s_6_31, -1, 3, 0}, +/* 32 */ { 2, s_6_32, -1, 2, 0}, +/* 33 */ { 3, s_6_33, 32, 2, 0}, +/* 34 */ { 5, s_6_34, 33, 2, 0}, +/* 35 */ { 6, s_6_35, 33, 3, 0}, +/* 36 */ { 4, s_6_36, 32, 2, 0}, +/* 37 */ { 1, s_6_37, -1, 2, 0} +}; + +static const symbol s_7_0[1] = { 'e' }; +static const symbol s_7_1[4] = { 'I', 0xE8, 'r', 'e' }; +static const symbol s_7_2[4] = { 'i', 0xE8, 'r', 'e' }; +static const symbol s_7_3[3] = { 'i', 'o', 'n' }; +static const symbol s_7_4[3] = { 'I', 'e', 'r' }; +static const symbol s_7_5[3] = { 'i', 'e', 'r' }; +static const symbol s_7_6[1] = { 0xEB }; + +static const struct among a_7[7] = +{ +/* 0 */ { 1, s_7_0, -1, 3, 0}, +/* 1 */ { 4, s_7_1, 0, 2, 0}, +/* 2 */ { 4, s_7_2, 0, 2, 0}, +/* 3 */ { 3, s_7_3, -1, 1, 0}, +/* 4 */ { 3, s_7_4, -1, 2, 0}, +/* 5 */ { 3, s_7_5, -1, 2, 0}, +/* 6 */ { 1, s_7_6, -1, 4, 0} +}; + +static const symbol s_8_0[3] = { 'e', 'l', 'l' }; +static const symbol s_8_1[4] = { 'e', 'i', 'l', 'l' }; +static const symbol s_8_2[3] = { 'e', 'n', 'n' }; +static const symbol s_8_3[3] = { 'o', 'n', 'n' }; +static const symbol s_8_4[3] = { 'e', 't', 't' }; + +static const struct among a_8[5] = +{ +/* 0 */ { 3, s_8_0, -1, -1, 0}, +/* 1 */ { 4, s_8_1, -1, -1, 0}, +/* 2 */ { 3, s_8_2, -1, -1, 0}, +/* 3 */ { 3, s_8_3, -1, -1, 0}, +/* 4 */ { 3, s_8_4, -1, -1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 130, 103, 8, 5 }; + +static const unsigned char g_keep_with_s[] = { 1, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 }; + +static const symbol s_0[] = { 'u' }; +static const symbol s_1[] = { 'U' }; +static const symbol s_2[] = { 'i' }; +static const symbol s_3[] = { 'I' }; +static const symbol s_4[] = { 'y' }; +static const symbol s_5[] = { 'Y' }; +static const symbol s_6[] = { 'y' }; +static const symbol s_7[] = { 'Y' }; +static const symbol s_8[] = { 'q' }; +static const symbol s_9[] = { 'u' }; +static const symbol s_10[] = { 'U' }; +static const symbol s_11[] = { 'i' }; +static const symbol s_12[] = { 'u' }; +static const symbol s_13[] = { 'y' }; +static const symbol s_14[] = { 'i', 'c' }; +static const symbol s_15[] = { 'i', 'q', 'U' }; +static const symbol s_16[] = { 'l', 'o', 'g' }; +static const symbol s_17[] = { 'u' }; +static const symbol s_18[] = { 'e', 'n', 't' }; +static const symbol s_19[] = { 'a', 't' }; +static const symbol s_20[] = { 'e', 'u', 'x' }; +static const symbol s_21[] = { 'i' }; +static const symbol s_22[] = { 'a', 'b', 'l' }; +static const symbol s_23[] = { 'i', 'q', 'U' }; +static const symbol s_24[] = { 'a', 't' }; +static const symbol s_25[] = { 'i', 'c' }; +static const symbol s_26[] = { 'i', 'q', 'U' }; +static const symbol s_27[] = { 'e', 'a', 'u' }; +static const symbol s_28[] = { 'a', 'l' }; +static const symbol s_29[] = { 'e', 'u', 'x' }; +static const symbol s_30[] = { 'a', 'n', 't' }; +static const symbol s_31[] = { 'e', 'n', 't' }; +static const symbol s_32[] = { 'e' }; +static const symbol s_33[] = { 's' }; +static const symbol s_34[] = { 's' }; +static const symbol s_35[] = { 't' }; +static const symbol s_36[] = { 'i' }; +static const symbol s_37[] = { 'g', 'u' }; +static const symbol s_38[] = { 0xE9 }; +static const symbol s_39[] = { 0xE8 }; +static const symbol s_40[] = { 'e' }; +static const symbol s_41[] = { 'Y' }; +static const symbol s_42[] = { 'i' }; +static const symbol s_43[] = { 0xE7 }; +static const symbol s_44[] = { 'c' }; + +static int r_prelude(struct SN_env * z) { + while(1) { /* repeat, line 38 */ + int c1 = z->c; + while(1) { /* goto, line 38 */ + int c2 = z->c; + { int c3 = z->c; /* or, line 44 */ + if (in_grouping(z, g_v, 97, 251, 0)) goto lab3; + z->bra = z->c; /* [, line 40 */ + { int c4 = z->c; /* or, line 40 */ + if (!(eq_s(z, 1, s_0))) goto lab5; + z->ket = z->c; /* ], line 40 */ + if (in_grouping(z, g_v, 97, 251, 0)) goto lab5; + { int ret = slice_from_s(z, 1, s_1); /* <-, line 40 */ + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = c4; + if (!(eq_s(z, 1, s_2))) goto lab6; + z->ket = z->c; /* ], line 41 */ + if (in_grouping(z, g_v, 97, 251, 0)) goto lab6; + { int ret = slice_from_s(z, 1, s_3); /* <-, line 41 */ + if (ret < 0) return ret; + } + goto lab4; + lab6: + z->c = c4; + if (!(eq_s(z, 1, s_4))) goto lab3; + z->ket = z->c; /* ], line 42 */ + { int ret = slice_from_s(z, 1, s_5); /* <-, line 42 */ + if (ret < 0) return ret; + } + } + lab4: + goto lab2; + lab3: + z->c = c3; + z->bra = z->c; /* [, line 45 */ + if (!(eq_s(z, 1, s_6))) goto lab7; + z->ket = z->c; /* ], line 45 */ + if (in_grouping(z, g_v, 97, 251, 0)) goto lab7; + { int ret = slice_from_s(z, 1, s_7); /* <-, line 45 */ + if (ret < 0) return ret; + } + goto lab2; + lab7: + z->c = c3; + if (!(eq_s(z, 1, s_8))) goto lab1; + z->bra = z->c; /* [, line 47 */ + if (!(eq_s(z, 1, s_9))) goto lab1; + z->ket = z->c; /* ], line 47 */ + { int ret = slice_from_s(z, 1, s_10); /* <-, line 47 */ + if (ret < 0) return ret; + } + } + lab2: + z->c = c2; + break; + lab1: + z->c = c2; + if (z->c >= z->l) goto lab0; + z->c++; /* goto, line 38 */ + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + z->I[2] = z->l; + { int c1 = z->c; /* do, line 56 */ + { int c2 = z->c; /* or, line 58 */ + if (in_grouping(z, g_v, 97, 251, 0)) goto lab2; + if (in_grouping(z, g_v, 97, 251, 0)) goto lab2; + if (z->c >= z->l) goto lab2; + z->c++; /* next, line 57 */ + goto lab1; + lab2: + z->c = c2; + if (z->c + 2 >= z->l || z->p[z->c + 2] >> 5 != 3 || !((331776 >> (z->p[z->c + 2] & 0x1f)) & 1)) goto lab3; + if (!(find_among(z, a_0, 3))) goto lab3; /* among, line 59 */ + goto lab1; + lab3: + z->c = c2; + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 66 */ + { /* gopast */ /* grouping v, line 66 */ + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab0; + z->c += ret; + } + } + lab1: + z->I[0] = z->c; /* setmark pV, line 67 */ + lab0: + z->c = c1; + } + { int c3 = z->c; /* do, line 69 */ + { /* gopast */ /* grouping v, line 70 */ + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { /* gopast */ /* non v, line 70 */ + int ret = in_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; /* setmark p1, line 70 */ + { /* gopast */ /* grouping v, line 71 */ + int ret = out_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { /* gopast */ /* non v, line 71 */ + int ret = in_grouping(z, g_v, 97, 251, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[2] = z->c; /* setmark p2, line 71 */ + lab4: + z->c = c3; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while(1) { /* repeat, line 75 */ + int c1 = z->c; + z->bra = z->c; /* [, line 77 */ + if (z->c >= z->l || z->p[z->c + 0] >> 5 != 2 || !((35652096 >> (z->p[z->c + 0] & 0x1f)) & 1)) among_var = 4; else + among_var = find_among(z, a_1, 4); /* substring, line 77 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 77 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_11); /* <-, line 78 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_12); /* <-, line 79 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_13); /* <-, line 80 */ + if (ret < 0) return ret; + } + break; + case 4: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 81 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[2] <= z->c)) return 0; + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 92 */ + among_var = find_among_b(z, a_4, 43); /* substring, line 92 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 92 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 96 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 96 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 99 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 99 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 100 */ + z->ket = z->c; /* [, line 100 */ + if (!(eq_s_b(z, 2, s_14))) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 100 */ + { int m1 = z->l - z->c; (void)m1; /* or, line 100 */ + { int ret = r_R2(z); + if (ret == 0) goto lab2; /* call R2, line 100 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 100 */ + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = z->l - m1; + { int ret = slice_from_s(z, 3, s_15); /* <-, line 100 */ + if (ret < 0) return ret; + } + } + lab1: + lab0: + ; + } + break; + case 3: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 104 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_16); /* <-, line 104 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 107 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 1, s_17); /* <-, line 107 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 110 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_18); /* <-, line 110 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 114 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 114 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 115 */ + z->ket = z->c; /* [, line 116 */ + among_var = find_among_b(z, a_2, 6); /* substring, line 116 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab3; } + z->bra = z->c; /* ], line 116 */ + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab3; } + case 1: + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 117 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 117 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 117 */ + if (!(eq_s_b(z, 2, s_19))) { z->c = z->l - m_keep; goto lab3; } + z->bra = z->c; /* ], line 117 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 117 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 117 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m2 = z->l - z->c; (void)m2; /* or, line 118 */ + { int ret = r_R2(z); + if (ret == 0) goto lab5; /* call R2, line 118 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 118 */ + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - m2; + { int ret = r_R1(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R1, line 118 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_20); /* <-, line 118 */ + if (ret < 0) return ret; + } + } + lab4: + break; + case 3: + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 120 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 120 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = r_RV(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call RV, line 122 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 1, s_21); /* <-, line 122 */ + if (ret < 0) return ret; + } + break; + } + lab3: + ; + } + break; + case 7: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 129 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 129 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 130 */ + z->ket = z->c; /* [, line 131 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - m_keep; goto lab6; } + among_var = find_among_b(z, a_3, 3); /* substring, line 131 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab6; } + z->bra = z->c; /* ], line 131 */ + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab6; } + case 1: + { int m3 = z->l - z->c; (void)m3; /* or, line 132 */ + { int ret = r_R2(z); + if (ret == 0) goto lab8; /* call R2, line 132 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 132 */ + if (ret < 0) return ret; + } + goto lab7; + lab8: + z->c = z->l - m3; + { int ret = slice_from_s(z, 3, s_22); /* <-, line 132 */ + if (ret < 0) return ret; + } + } + lab7: + break; + case 2: + { int m4 = z->l - z->c; (void)m4; /* or, line 133 */ + { int ret = r_R2(z); + if (ret == 0) goto lab10; /* call R2, line 133 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 133 */ + if (ret < 0) return ret; + } + goto lab9; + lab10: + z->c = z->l - m4; + { int ret = slice_from_s(z, 3, s_23); /* <-, line 133 */ + if (ret < 0) return ret; + } + } + lab9: + break; + case 3: + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab6; } /* call R2, line 134 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 134 */ + if (ret < 0) return ret; + } + break; + } + lab6: + ; + } + break; + case 8: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 141 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 141 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 142 */ + z->ket = z->c; /* [, line 142 */ + if (!(eq_s_b(z, 2, s_24))) { z->c = z->l - m_keep; goto lab11; } + z->bra = z->c; /* ], line 142 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab11; } /* call R2, line 142 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 142 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 142 */ + if (!(eq_s_b(z, 2, s_25))) { z->c = z->l - m_keep; goto lab11; } + z->bra = z->c; /* ], line 142 */ + { int m5 = z->l - z->c; (void)m5; /* or, line 142 */ + { int ret = r_R2(z); + if (ret == 0) goto lab13; /* call R2, line 142 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 142 */ + if (ret < 0) return ret; + } + goto lab12; + lab13: + z->c = z->l - m5; + { int ret = slice_from_s(z, 3, s_26); /* <-, line 142 */ + if (ret < 0) return ret; + } + } + lab12: + lab11: + ; + } + break; + case 9: + { int ret = slice_from_s(z, 3, s_27); /* <-, line 144 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 145 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 2, s_28); /* <-, line 145 */ + if (ret < 0) return ret; + } + break; + case 11: + { int m6 = z->l - z->c; (void)m6; /* or, line 147 */ + { int ret = r_R2(z); + if (ret == 0) goto lab15; /* call R2, line 147 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 147 */ + if (ret < 0) return ret; + } + goto lab14; + lab15: + z->c = z->l - m6; + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 147 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_29); /* <-, line 147 */ + if (ret < 0) return ret; + } + } + lab14: + break; + case 12: + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 150 */ + if (ret < 0) return ret; + } + if (out_grouping_b(z, g_v, 97, 251, 0)) return 0; + { int ret = slice_del(z); /* delete, line 150 */ + if (ret < 0) return ret; + } + break; + case 13: + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 155 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_30); /* <-, line 155 */ + if (ret < 0) return ret; + } + return 0; /* fail, line 155 */ + break; + case 14: + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 156 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_31); /* <-, line 156 */ + if (ret < 0) return ret; + } + return 0; /* fail, line 156 */ + break; + case 15: + { int m_test = z->l - z->c; /* test, line 158 */ + if (in_grouping_b(z, g_v, 97, 251, 0)) return 0; + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 158 */ + if (ret < 0) return ret; + } + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 158 */ + if (ret < 0) return ret; + } + return 0; /* fail, line 158 */ + break; + } + return 1; +} + +static int r_i_verb_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 163 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 163 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 164 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68944418 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_5, 35); /* substring, line 164 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 164 */ + switch(among_var) { + case 0: { z->lb = mlimit; return 0; } + case 1: + if (out_grouping_b(z, g_v, 97, 251, 0)) { z->lb = mlimit; return 0; } + { int ret = slice_del(z); /* delete, line 170 */ + if (ret < 0) return ret; + } + break; + } + z->lb = mlimit; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 174 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 174 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 175 */ + among_var = find_among_b(z, a_6, 38); /* substring, line 175 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 175 */ + switch(among_var) { + case 0: { z->lb = mlimit; return 0; } + case 1: + { int ret = r_R2(z); + if (ret == 0) { z->lb = mlimit; return 0; } /* call R2, line 177 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 177 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_del(z); /* delete, line 185 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 190 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 191 */ + z->ket = z->c; /* [, line 191 */ + if (!(eq_s_b(z, 1, s_32))) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 191 */ + { int ret = slice_del(z); /* delete, line 191 */ + if (ret < 0) return ret; + } + lab0: + ; + } + break; + } + z->lb = mlimit; + } + return 1; +} + +static int r_residual_suffix(struct SN_env * z) { + int among_var; + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 199 */ + z->ket = z->c; /* [, line 199 */ + if (!(eq_s_b(z, 1, s_33))) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 199 */ + { int m_test = z->l - z->c; /* test, line 199 */ + if (out_grouping_b(z, g_keep_with_s, 97, 232, 0)) { z->c = z->l - m_keep; goto lab0; } + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 199 */ + if (ret < 0) return ret; + } + lab0: + ; + } + { int mlimit; /* setlimit, line 200 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 200 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 201 */ + among_var = find_among_b(z, a_7, 7); /* substring, line 201 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 201 */ + switch(among_var) { + case 0: { z->lb = mlimit; return 0; } + case 1: + { int ret = r_R2(z); + if (ret == 0) { z->lb = mlimit; return 0; } /* call R2, line 202 */ + if (ret < 0) return ret; + } + { int m2 = z->l - z->c; (void)m2; /* or, line 202 */ + if (!(eq_s_b(z, 1, s_34))) goto lab2; + goto lab1; + lab2: + z->c = z->l - m2; + if (!(eq_s_b(z, 1, s_35))) { z->lb = mlimit; return 0; } + } + lab1: + { int ret = slice_del(z); /* delete, line 202 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_36); /* <-, line 204 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 205 */ + if (ret < 0) return ret; + } + break; + case 4: + if (!(eq_s_b(z, 2, s_37))) { z->lb = mlimit; return 0; } + { int ret = slice_del(z); /* delete, line 206 */ + if (ret < 0) return ret; + } + break; + } + z->lb = mlimit; + } + return 1; +} + +static int r_un_double(struct SN_env * z) { + { int m_test = z->l - z->c; /* test, line 212 */ + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1069056 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!(find_among_b(z, a_8, 5))) return 0; /* among, line 212 */ + z->c = z->l - m_test; + } + z->ket = z->c; /* [, line 212 */ + if (z->c <= z->lb) return 0; + z->c--; /* next, line 212 */ + z->bra = z->c; /* ], line 212 */ + { int ret = slice_del(z); /* delete, line 212 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_un_accent(struct SN_env * z) { + { int i = 1; + while(1) { /* atleast, line 216 */ + if (out_grouping_b(z, g_v, 97, 251, 0)) goto lab0; + i--; + continue; + lab0: + break; + } + if (i > 0) return 0; + } + z->ket = z->c; /* [, line 217 */ + { int m1 = z->l - z->c; (void)m1; /* or, line 217 */ + if (!(eq_s_b(z, 1, s_38))) goto lab2; + goto lab1; + lab2: + z->c = z->l - m1; + if (!(eq_s_b(z, 1, s_39))) return 0; + } +lab1: + z->bra = z->c; /* ], line 217 */ + { int ret = slice_from_s(z, 1, s_40); /* <-, line 217 */ + if (ret < 0) return ret; + } + return 1; +} + +extern int french_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 223 */ + { int ret = r_prelude(z); + if (ret == 0) goto lab0; /* call prelude, line 223 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 224 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab1; /* call mark_regions, line 224 */ + if (ret < 0) return ret; + } + lab1: + z->c = c2; + } + z->lb = z->c; z->c = z->l; /* backwards, line 225 */ + + { int m3 = z->l - z->c; (void)m3; /* do, line 227 */ + { int m4 = z->l - z->c; (void)m4; /* or, line 237 */ + { int m5 = z->l - z->c; (void)m5; /* and, line 233 */ + { int m6 = z->l - z->c; (void)m6; /* or, line 229 */ + { int ret = r_standard_suffix(z); + if (ret == 0) goto lab6; /* call standard_suffix, line 229 */ + if (ret < 0) return ret; + } + goto lab5; + lab6: + z->c = z->l - m6; + { int ret = r_i_verb_suffix(z); + if (ret == 0) goto lab7; /* call i_verb_suffix, line 230 */ + if (ret < 0) return ret; + } + goto lab5; + lab7: + z->c = z->l - m6; + { int ret = r_verb_suffix(z); + if (ret == 0) goto lab4; /* call verb_suffix, line 231 */ + if (ret < 0) return ret; + } + } + lab5: + z->c = z->l - m5; + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 234 */ + z->ket = z->c; /* [, line 234 */ + { int m7 = z->l - z->c; (void)m7; /* or, line 234 */ + if (!(eq_s_b(z, 1, s_41))) goto lab10; + z->bra = z->c; /* ], line 234 */ + { int ret = slice_from_s(z, 1, s_42); /* <-, line 234 */ + if (ret < 0) return ret; + } + goto lab9; + lab10: + z->c = z->l - m7; + if (!(eq_s_b(z, 1, s_43))) { z->c = z->l - m_keep; goto lab8; } + z->bra = z->c; /* ], line 235 */ + { int ret = slice_from_s(z, 1, s_44); /* <-, line 235 */ + if (ret < 0) return ret; + } + } + lab9: + lab8: + ; + } + } + goto lab3; + lab4: + z->c = z->l - m4; + { int ret = r_residual_suffix(z); + if (ret == 0) goto lab2; /* call residual_suffix, line 238 */ + if (ret < 0) return ret; + } + } + lab3: + lab2: + z->c = z->l - m3; + } + { int m8 = z->l - z->c; (void)m8; /* do, line 243 */ + { int ret = r_un_double(z); + if (ret == 0) goto lab11; /* call un_double, line 243 */ + if (ret < 0) return ret; + } + lab11: + z->c = z->l - m8; + } + { int m9 = z->l - z->c; (void)m9; /* do, line 244 */ + { int ret = r_un_accent(z); + if (ret == 0) goto lab12; /* call un_accent, line 244 */ + if (ret < 0) return ret; + } + lab12: + z->c = z->l - m9; + } + z->c = z->lb; + { int c10 = z->c; /* do, line 246 */ + { int ret = r_postlude(z); + if (ret == 0) goto lab13; /* call postlude, line 246 */ + if (ret < 0) return ret; + } + lab13: + z->c = c10; + } + return 1; +} + +extern struct SN_env * french_ISO_8859_1_create_env(void) { return SN_create_env(0, 3, 0); } + +extern void french_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c new file mode 100644 index 00000000000..13c24230923 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c @@ -0,0 +1,503 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int german_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * german_ISO_8859_1_create_env(void); +extern void german_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 'U' }; +static const symbol s_0_2[1] = { 'Y' }; +static const symbol s_0_3[1] = { 0xE4 }; +static const symbol s_0_4[1] = { 0xF6 }; +static const symbol s_0_5[1] = { 0xFC }; + +static const struct among a_0[6] = +{ +/* 0 */ { 0, 0, -1, 6, 0}, +/* 1 */ { 1, s_0_1, 0, 2, 0}, +/* 2 */ { 1, s_0_2, 0, 1, 0}, +/* 3 */ { 1, s_0_3, 0, 3, 0}, +/* 4 */ { 1, s_0_4, 0, 4, 0}, +/* 5 */ { 1, s_0_5, 0, 5, 0} +}; + +static const symbol s_1_0[1] = { 'e' }; +static const symbol s_1_1[2] = { 'e', 'm' }; +static const symbol s_1_2[2] = { 'e', 'n' }; +static const symbol s_1_3[3] = { 'e', 'r', 'n' }; +static const symbol s_1_4[2] = { 'e', 'r' }; +static const symbol s_1_5[1] = { 's' }; +static const symbol s_1_6[2] = { 'e', 's' }; + +static const struct among a_1[7] = +{ +/* 0 */ { 1, s_1_0, -1, 1, 0}, +/* 1 */ { 2, s_1_1, -1, 1, 0}, +/* 2 */ { 2, s_1_2, -1, 1, 0}, +/* 3 */ { 3, s_1_3, -1, 1, 0}, +/* 4 */ { 2, s_1_4, -1, 1, 0}, +/* 5 */ { 1, s_1_5, -1, 2, 0}, +/* 6 */ { 2, s_1_6, 5, 1, 0} +}; + +static const symbol s_2_0[2] = { 'e', 'n' }; +static const symbol s_2_1[2] = { 'e', 'r' }; +static const symbol s_2_2[2] = { 's', 't' }; +static const symbol s_2_3[3] = { 'e', 's', 't' }; + +static const struct among a_2[4] = +{ +/* 0 */ { 2, s_2_0, -1, 1, 0}, +/* 1 */ { 2, s_2_1, -1, 1, 0}, +/* 2 */ { 2, s_2_2, -1, 2, 0}, +/* 3 */ { 3, s_2_3, 2, 1, 0} +}; + +static const symbol s_3_0[2] = { 'i', 'g' }; +static const symbol s_3_1[4] = { 'l', 'i', 'c', 'h' }; + +static const struct among a_3[2] = +{ +/* 0 */ { 2, s_3_0, -1, 1, 0}, +/* 1 */ { 4, s_3_1, -1, 1, 0} +}; + +static const symbol s_4_0[3] = { 'e', 'n', 'd' }; +static const symbol s_4_1[2] = { 'i', 'g' }; +static const symbol s_4_2[3] = { 'u', 'n', 'g' }; +static const symbol s_4_3[4] = { 'l', 'i', 'c', 'h' }; +static const symbol s_4_4[4] = { 'i', 's', 'c', 'h' }; +static const symbol s_4_5[2] = { 'i', 'k' }; +static const symbol s_4_6[4] = { 'h', 'e', 'i', 't' }; +static const symbol s_4_7[4] = { 'k', 'e', 'i', 't' }; + +static const struct among a_4[8] = +{ +/* 0 */ { 3, s_4_0, -1, 1, 0}, +/* 1 */ { 2, s_4_1, -1, 2, 0}, +/* 2 */ { 3, s_4_2, -1, 1, 0}, +/* 3 */ { 4, s_4_3, -1, 3, 0}, +/* 4 */ { 4, s_4_4, -1, 2, 0}, +/* 5 */ { 2, s_4_5, -1, 2, 0}, +/* 6 */ { 4, s_4_6, -1, 3, 0}, +/* 7 */ { 4, s_4_7, -1, 4, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 32, 8 }; + +static const unsigned char g_s_ending[] = { 117, 30, 5 }; + +static const unsigned char g_st_ending[] = { 117, 30, 4 }; + +static const symbol s_0[] = { 0xDF }; +static const symbol s_1[] = { 's', 's' }; +static const symbol s_2[] = { 'u' }; +static const symbol s_3[] = { 'U' }; +static const symbol s_4[] = { 'y' }; +static const symbol s_5[] = { 'Y' }; +static const symbol s_6[] = { 'y' }; +static const symbol s_7[] = { 'u' }; +static const symbol s_8[] = { 'a' }; +static const symbol s_9[] = { 'o' }; +static const symbol s_10[] = { 'u' }; +static const symbol s_11[] = { 'i', 'g' }; +static const symbol s_12[] = { 'e' }; +static const symbol s_13[] = { 'e' }; +static const symbol s_14[] = { 'e', 'r' }; +static const symbol s_15[] = { 'e', 'n' }; + +static int r_prelude(struct SN_env * z) { + { int c_test = z->c; /* test, line 30 */ + while(1) { /* repeat, line 30 */ + int c1 = z->c; + { int c2 = z->c; /* or, line 33 */ + z->bra = z->c; /* [, line 32 */ + if (!(eq_s(z, 1, s_0))) goto lab2; + z->ket = z->c; /* ], line 32 */ + { int ret = slice_from_s(z, 2, s_1); /* <-, line 32 */ + if (ret < 0) return ret; + } + goto lab1; + lab2: + z->c = c2; + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 33 */ + } + lab1: + continue; + lab0: + z->c = c1; + break; + } + z->c = c_test; + } + while(1) { /* repeat, line 36 */ + int c3 = z->c; + while(1) { /* goto, line 36 */ + int c4 = z->c; + if (in_grouping(z, g_v, 97, 252, 0)) goto lab4; + z->bra = z->c; /* [, line 37 */ + { int c5 = z->c; /* or, line 37 */ + if (!(eq_s(z, 1, s_2))) goto lab6; + z->ket = z->c; /* ], line 37 */ + if (in_grouping(z, g_v, 97, 252, 0)) goto lab6; + { int ret = slice_from_s(z, 1, s_3); /* <-, line 37 */ + if (ret < 0) return ret; + } + goto lab5; + lab6: + z->c = c5; + if (!(eq_s(z, 1, s_4))) goto lab4; + z->ket = z->c; /* ], line 38 */ + if (in_grouping(z, g_v, 97, 252, 0)) goto lab4; + { int ret = slice_from_s(z, 1, s_5); /* <-, line 38 */ + if (ret < 0) return ret; + } + } + lab5: + z->c = c4; + break; + lab4: + z->c = c4; + if (z->c >= z->l) goto lab3; + z->c++; /* goto, line 36 */ + } + continue; + lab3: + z->c = c3; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + { int c_test = z->c; /* test, line 47 */ + { int ret = z->c + 3; + if (0 > ret || ret > z->l) return 0; + z->c = ret; /* hop, line 47 */ + } + z->I[2] = z->c; /* setmark x, line 47 */ + z->c = c_test; + } + { /* gopast */ /* grouping v, line 49 */ + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { /* gopast */ /* non v, line 49 */ + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 49 */ + /* try, line 50 */ + if (!(z->I[0] < z->I[2])) goto lab0; + z->I[0] = z->I[2]; +lab0: + { /* gopast */ /* grouping v, line 51 */ + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + { /* gopast */ /* non v, line 51 */ + int ret = in_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[1] = z->c; /* setmark p2, line 51 */ + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while(1) { /* repeat, line 55 */ + int c1 = z->c; + z->bra = z->c; /* [, line 57 */ + among_var = find_among(z, a_0, 6); /* substring, line 57 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 57 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_6); /* <-, line 58 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_7); /* <-, line 59 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_8); /* <-, line 60 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 1, s_9); /* <-, line 61 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 1, s_10); /* <-, line 62 */ + if (ret < 0) return ret; + } + break; + case 6: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 63 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + { int m1 = z->l - z->c; (void)m1; /* do, line 74 */ + z->ket = z->c; /* [, line 75 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((811040 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab0; + among_var = find_among_b(z, a_1, 7); /* substring, line 75 */ + if (!(among_var)) goto lab0; + z->bra = z->c; /* ], line 75 */ + { int ret = r_R1(z); + if (ret == 0) goto lab0; /* call R1, line 75 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_del(z); /* delete, line 77 */ + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_s_ending, 98, 116, 0)) goto lab0; + { int ret = slice_del(z); /* delete, line 80 */ + if (ret < 0) return ret; + } + break; + } + lab0: + z->c = z->l - m1; + } + { int m2 = z->l - z->c; (void)m2; /* do, line 84 */ + z->ket = z->c; /* [, line 85 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1327104 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab1; + among_var = find_among_b(z, a_2, 4); /* substring, line 85 */ + if (!(among_var)) goto lab1; + z->bra = z->c; /* ], line 85 */ + { int ret = r_R1(z); + if (ret == 0) goto lab1; /* call R1, line 85 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: goto lab1; + case 1: + { int ret = slice_del(z); /* delete, line 87 */ + if (ret < 0) return ret; + } + break; + case 2: + if (in_grouping_b(z, g_st_ending, 98, 116, 0)) goto lab1; + { int ret = z->c - 3; + if (z->lb > ret || ret > z->l) goto lab1; + z->c = ret; /* hop, line 90 */ + } + { int ret = slice_del(z); /* delete, line 90 */ + if (ret < 0) return ret; + } + break; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 94 */ + z->ket = z->c; /* [, line 95 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1051024 >> (z->p[z->c - 1] & 0x1f)) & 1)) goto lab2; + among_var = find_among_b(z, a_4, 8); /* substring, line 95 */ + if (!(among_var)) goto lab2; + z->bra = z->c; /* ], line 95 */ + { int ret = r_R2(z); + if (ret == 0) goto lab2; /* call R2, line 95 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: goto lab2; + case 1: + { int ret = slice_del(z); /* delete, line 97 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 98 */ + z->ket = z->c; /* [, line 98 */ + if (!(eq_s_b(z, 2, s_11))) { z->c = z->l - m_keep; goto lab3; } + z->bra = z->c; /* ], line 98 */ + { int m4 = z->l - z->c; (void)m4; /* not, line 98 */ + if (!(eq_s_b(z, 1, s_12))) goto lab4; + { z->c = z->l - m_keep; goto lab3; } + lab4: + z->c = z->l - m4; + } + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 98 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 98 */ + if (ret < 0) return ret; + } + lab3: + ; + } + break; + case 2: + { int m5 = z->l - z->c; (void)m5; /* not, line 101 */ + if (!(eq_s_b(z, 1, s_13))) goto lab5; + goto lab2; + lab5: + z->c = z->l - m5; + } + { int ret = slice_del(z); /* delete, line 101 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 104 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 105 */ + z->ket = z->c; /* [, line 106 */ + { int m6 = z->l - z->c; (void)m6; /* or, line 106 */ + if (!(eq_s_b(z, 2, s_14))) goto lab8; + goto lab7; + lab8: + z->c = z->l - m6; + if (!(eq_s_b(z, 2, s_15))) { z->c = z->l - m_keep; goto lab6; } + } + lab7: + z->bra = z->c; /* ], line 106 */ + { int ret = r_R1(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab6; } /* call R1, line 106 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 106 */ + if (ret < 0) return ret; + } + lab6: + ; + } + break; + case 4: + { int ret = slice_del(z); /* delete, line 110 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 111 */ + z->ket = z->c; /* [, line 112 */ + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 103 && z->p[z->c - 1] != 104)) { z->c = z->l - m_keep; goto lab9; } + among_var = find_among_b(z, a_3, 2); /* substring, line 112 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab9; } + z->bra = z->c; /* ], line 112 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab9; } /* call R2, line 112 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab9; } + case 1: + { int ret = slice_del(z); /* delete, line 114 */ + if (ret < 0) return ret; + } + break; + } + lab9: + ; + } + break; + } + lab2: + z->c = z->l - m3; + } + return 1; +} + +extern int german_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 125 */ + { int ret = r_prelude(z); + if (ret == 0) goto lab0; /* call prelude, line 125 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 126 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab1; /* call mark_regions, line 126 */ + if (ret < 0) return ret; + } + lab1: + z->c = c2; + } + z->lb = z->c; z->c = z->l; /* backwards, line 127 */ + + { int m3 = z->l - z->c; (void)m3; /* do, line 128 */ + { int ret = r_standard_suffix(z); + if (ret == 0) goto lab2; /* call standard_suffix, line 128 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + z->c = z->lb; + { int c4 = z->c; /* do, line 129 */ + { int ret = r_postlude(z); + if (ret == 0) goto lab3; /* call postlude, line 129 */ + if (ret < 0) return ret; + } + lab3: + z->c = c4; + } + return 1; +} + +extern struct SN_env * german_ISO_8859_1_create_env(void) { return SN_create_env(0, 3, 0); } + +extern void german_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c new file mode 100644 index 00000000000..ff4b23e0605 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_hungarian.c @@ -0,0 +1,1230 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int hungarian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_double(struct SN_env * z); +static int r_undouble(struct SN_env * z); +static int r_factive(struct SN_env * z); +static int r_instrum(struct SN_env * z); +static int r_plur_owner(struct SN_env * z); +static int r_sing_owner(struct SN_env * z); +static int r_owned(struct SN_env * z); +static int r_plural(struct SN_env * z); +static int r_case_other(struct SN_env * z); +static int r_case_special(struct SN_env * z); +static int r_case(struct SN_env * z); +static int r_v_ending(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * hungarian_ISO_8859_1_create_env(void); +extern void hungarian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[2] = { 'c', 's' }; +static const symbol s_0_1[3] = { 'd', 'z', 's' }; +static const symbol s_0_2[2] = { 'g', 'y' }; +static const symbol s_0_3[2] = { 'l', 'y' }; +static const symbol s_0_4[2] = { 'n', 'y' }; +static const symbol s_0_5[2] = { 's', 'z' }; +static const symbol s_0_6[2] = { 't', 'y' }; +static const symbol s_0_7[2] = { 'z', 's' }; + +static const struct among a_0[8] = +{ +/* 0 */ { 2, s_0_0, -1, -1, 0}, +/* 1 */ { 3, s_0_1, -1, -1, 0}, +/* 2 */ { 2, s_0_2, -1, -1, 0}, +/* 3 */ { 2, s_0_3, -1, -1, 0}, +/* 4 */ { 2, s_0_4, -1, -1, 0}, +/* 5 */ { 2, s_0_5, -1, -1, 0}, +/* 6 */ { 2, s_0_6, -1, -1, 0}, +/* 7 */ { 2, s_0_7, -1, -1, 0} +}; + +static const symbol s_1_0[1] = { 0xE1 }; +static const symbol s_1_1[1] = { 0xE9 }; + +static const struct among a_1[2] = +{ +/* 0 */ { 1, s_1_0, -1, 1, 0}, +/* 1 */ { 1, s_1_1, -1, 2, 0} +}; + +static const symbol s_2_0[2] = { 'b', 'b' }; +static const symbol s_2_1[2] = { 'c', 'c' }; +static const symbol s_2_2[2] = { 'd', 'd' }; +static const symbol s_2_3[2] = { 'f', 'f' }; +static const symbol s_2_4[2] = { 'g', 'g' }; +static const symbol s_2_5[2] = { 'j', 'j' }; +static const symbol s_2_6[2] = { 'k', 'k' }; +static const symbol s_2_7[2] = { 'l', 'l' }; +static const symbol s_2_8[2] = { 'm', 'm' }; +static const symbol s_2_9[2] = { 'n', 'n' }; +static const symbol s_2_10[2] = { 'p', 'p' }; +static const symbol s_2_11[2] = { 'r', 'r' }; +static const symbol s_2_12[3] = { 'c', 'c', 's' }; +static const symbol s_2_13[2] = { 's', 's' }; +static const symbol s_2_14[3] = { 'z', 'z', 's' }; +static const symbol s_2_15[2] = { 't', 't' }; +static const symbol s_2_16[2] = { 'v', 'v' }; +static const symbol s_2_17[3] = { 'g', 'g', 'y' }; +static const symbol s_2_18[3] = { 'l', 'l', 'y' }; +static const symbol s_2_19[3] = { 'n', 'n', 'y' }; +static const symbol s_2_20[3] = { 't', 't', 'y' }; +static const symbol s_2_21[3] = { 's', 's', 'z' }; +static const symbol s_2_22[2] = { 'z', 'z' }; + +static const struct among a_2[23] = +{ +/* 0 */ { 2, s_2_0, -1, -1, 0}, +/* 1 */ { 2, s_2_1, -1, -1, 0}, +/* 2 */ { 2, s_2_2, -1, -1, 0}, +/* 3 */ { 2, s_2_3, -1, -1, 0}, +/* 4 */ { 2, s_2_4, -1, -1, 0}, +/* 5 */ { 2, s_2_5, -1, -1, 0}, +/* 6 */ { 2, s_2_6, -1, -1, 0}, +/* 7 */ { 2, s_2_7, -1, -1, 0}, +/* 8 */ { 2, s_2_8, -1, -1, 0}, +/* 9 */ { 2, s_2_9, -1, -1, 0}, +/* 10 */ { 2, s_2_10, -1, -1, 0}, +/* 11 */ { 2, s_2_11, -1, -1, 0}, +/* 12 */ { 3, s_2_12, -1, -1, 0}, +/* 13 */ { 2, s_2_13, -1, -1, 0}, +/* 14 */ { 3, s_2_14, -1, -1, 0}, +/* 15 */ { 2, s_2_15, -1, -1, 0}, +/* 16 */ { 2, s_2_16, -1, -1, 0}, +/* 17 */ { 3, s_2_17, -1, -1, 0}, +/* 18 */ { 3, s_2_18, -1, -1, 0}, +/* 19 */ { 3, s_2_19, -1, -1, 0}, +/* 20 */ { 3, s_2_20, -1, -1, 0}, +/* 21 */ { 3, s_2_21, -1, -1, 0}, +/* 22 */ { 2, s_2_22, -1, -1, 0} +}; + +static const symbol s_3_0[2] = { 'a', 'l' }; +static const symbol s_3_1[2] = { 'e', 'l' }; + +static const struct among a_3[2] = +{ +/* 0 */ { 2, s_3_0, -1, 1, 0}, +/* 1 */ { 2, s_3_1, -1, 2, 0} +}; + +static const symbol s_4_0[2] = { 'b', 'a' }; +static const symbol s_4_1[2] = { 'r', 'a' }; +static const symbol s_4_2[2] = { 'b', 'e' }; +static const symbol s_4_3[2] = { 'r', 'e' }; +static const symbol s_4_4[2] = { 'i', 'g' }; +static const symbol s_4_5[3] = { 'n', 'a', 'k' }; +static const symbol s_4_6[3] = { 'n', 'e', 'k' }; +static const symbol s_4_7[3] = { 'v', 'a', 'l' }; +static const symbol s_4_8[3] = { 'v', 'e', 'l' }; +static const symbol s_4_9[2] = { 'u', 'l' }; +static const symbol s_4_10[3] = { 'n', 0xE1, 'l' }; +static const symbol s_4_11[3] = { 'n', 0xE9, 'l' }; +static const symbol s_4_12[3] = { 'b', 0xF3, 'l' }; +static const symbol s_4_13[3] = { 'r', 0xF3, 'l' }; +static const symbol s_4_14[3] = { 't', 0xF3, 'l' }; +static const symbol s_4_15[3] = { 'b', 0xF5, 'l' }; +static const symbol s_4_16[3] = { 'r', 0xF5, 'l' }; +static const symbol s_4_17[3] = { 't', 0xF5, 'l' }; +static const symbol s_4_18[2] = { 0xFC, 'l' }; +static const symbol s_4_19[1] = { 'n' }; +static const symbol s_4_20[2] = { 'a', 'n' }; +static const symbol s_4_21[3] = { 'b', 'a', 'n' }; +static const symbol s_4_22[2] = { 'e', 'n' }; +static const symbol s_4_23[3] = { 'b', 'e', 'n' }; +static const symbol s_4_24[6] = { 'k', 0xE9, 'p', 'p', 'e', 'n' }; +static const symbol s_4_25[2] = { 'o', 'n' }; +static const symbol s_4_26[2] = { 0xF6, 'n' }; +static const symbol s_4_27[4] = { 'k', 0xE9, 'p', 'p' }; +static const symbol s_4_28[3] = { 'k', 'o', 'r' }; +static const symbol s_4_29[1] = { 't' }; +static const symbol s_4_30[2] = { 'a', 't' }; +static const symbol s_4_31[2] = { 'e', 't' }; +static const symbol s_4_32[4] = { 'k', 0xE9, 'n', 't' }; +static const symbol s_4_33[6] = { 'a', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_4_34[6] = { 'e', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_4_35[6] = { 'o', 'n', 'k', 0xE9, 'n', 't' }; +static const symbol s_4_36[2] = { 'o', 't' }; +static const symbol s_4_37[3] = { 0xE9, 'r', 't' }; +static const symbol s_4_38[2] = { 0xF6, 't' }; +static const symbol s_4_39[3] = { 'h', 'e', 'z' }; +static const symbol s_4_40[3] = { 'h', 'o', 'z' }; +static const symbol s_4_41[3] = { 'h', 0xF6, 'z' }; +static const symbol s_4_42[2] = { 'v', 0xE1 }; +static const symbol s_4_43[2] = { 'v', 0xE9 }; + +static const struct among a_4[44] = +{ +/* 0 */ { 2, s_4_0, -1, -1, 0}, +/* 1 */ { 2, s_4_1, -1, -1, 0}, +/* 2 */ { 2, s_4_2, -1, -1, 0}, +/* 3 */ { 2, s_4_3, -1, -1, 0}, +/* 4 */ { 2, s_4_4, -1, -1, 0}, +/* 5 */ { 3, s_4_5, -1, -1, 0}, +/* 6 */ { 3, s_4_6, -1, -1, 0}, +/* 7 */ { 3, s_4_7, -1, -1, 0}, +/* 8 */ { 3, s_4_8, -1, -1, 0}, +/* 9 */ { 2, s_4_9, -1, -1, 0}, +/* 10 */ { 3, s_4_10, -1, -1, 0}, +/* 11 */ { 3, s_4_11, -1, -1, 0}, +/* 12 */ { 3, s_4_12, -1, -1, 0}, +/* 13 */ { 3, s_4_13, -1, -1, 0}, +/* 14 */ { 3, s_4_14, -1, -1, 0}, +/* 15 */ { 3, s_4_15, -1, -1, 0}, +/* 16 */ { 3, s_4_16, -1, -1, 0}, +/* 17 */ { 3, s_4_17, -1, -1, 0}, +/* 18 */ { 2, s_4_18, -1, -1, 0}, +/* 19 */ { 1, s_4_19, -1, -1, 0}, +/* 20 */ { 2, s_4_20, 19, -1, 0}, +/* 21 */ { 3, s_4_21, 20, -1, 0}, +/* 22 */ { 2, s_4_22, 19, -1, 0}, +/* 23 */ { 3, s_4_23, 22, -1, 0}, +/* 24 */ { 6, s_4_24, 22, -1, 0}, +/* 25 */ { 2, s_4_25, 19, -1, 0}, +/* 26 */ { 2, s_4_26, 19, -1, 0}, +/* 27 */ { 4, s_4_27, -1, -1, 0}, +/* 28 */ { 3, s_4_28, -1, -1, 0}, +/* 29 */ { 1, s_4_29, -1, -1, 0}, +/* 30 */ { 2, s_4_30, 29, -1, 0}, +/* 31 */ { 2, s_4_31, 29, -1, 0}, +/* 32 */ { 4, s_4_32, 29, -1, 0}, +/* 33 */ { 6, s_4_33, 32, -1, 0}, +/* 34 */ { 6, s_4_34, 32, -1, 0}, +/* 35 */ { 6, s_4_35, 32, -1, 0}, +/* 36 */ { 2, s_4_36, 29, -1, 0}, +/* 37 */ { 3, s_4_37, 29, -1, 0}, +/* 38 */ { 2, s_4_38, 29, -1, 0}, +/* 39 */ { 3, s_4_39, -1, -1, 0}, +/* 40 */ { 3, s_4_40, -1, -1, 0}, +/* 41 */ { 3, s_4_41, -1, -1, 0}, +/* 42 */ { 2, s_4_42, -1, -1, 0}, +/* 43 */ { 2, s_4_43, -1, -1, 0} +}; + +static const symbol s_5_0[2] = { 0xE1, 'n' }; +static const symbol s_5_1[2] = { 0xE9, 'n' }; +static const symbol s_5_2[6] = { 0xE1, 'n', 'k', 0xE9, 'n', 't' }; + +static const struct among a_5[3] = +{ +/* 0 */ { 2, s_5_0, -1, 2, 0}, +/* 1 */ { 2, s_5_1, -1, 1, 0}, +/* 2 */ { 6, s_5_2, -1, 3, 0} +}; + +static const symbol s_6_0[4] = { 's', 't', 'u', 'l' }; +static const symbol s_6_1[5] = { 'a', 's', 't', 'u', 'l' }; +static const symbol s_6_2[5] = { 0xE1, 's', 't', 'u', 'l' }; +static const symbol s_6_3[4] = { 's', 't', 0xFC, 'l' }; +static const symbol s_6_4[5] = { 'e', 's', 't', 0xFC, 'l' }; +static const symbol s_6_5[5] = { 0xE9, 's', 't', 0xFC, 'l' }; + +static const struct among a_6[6] = +{ +/* 0 */ { 4, s_6_0, -1, 2, 0}, +/* 1 */ { 5, s_6_1, 0, 1, 0}, +/* 2 */ { 5, s_6_2, 0, 3, 0}, +/* 3 */ { 4, s_6_3, -1, 2, 0}, +/* 4 */ { 5, s_6_4, 3, 1, 0}, +/* 5 */ { 5, s_6_5, 3, 4, 0} +}; + +static const symbol s_7_0[1] = { 0xE1 }; +static const symbol s_7_1[1] = { 0xE9 }; + +static const struct among a_7[2] = +{ +/* 0 */ { 1, s_7_0, -1, 1, 0}, +/* 1 */ { 1, s_7_1, -1, 2, 0} +}; + +static const symbol s_8_0[1] = { 'k' }; +static const symbol s_8_1[2] = { 'a', 'k' }; +static const symbol s_8_2[2] = { 'e', 'k' }; +static const symbol s_8_3[2] = { 'o', 'k' }; +static const symbol s_8_4[2] = { 0xE1, 'k' }; +static const symbol s_8_5[2] = { 0xE9, 'k' }; +static const symbol s_8_6[2] = { 0xF6, 'k' }; + +static const struct among a_8[7] = +{ +/* 0 */ { 1, s_8_0, -1, 7, 0}, +/* 1 */ { 2, s_8_1, 0, 4, 0}, +/* 2 */ { 2, s_8_2, 0, 6, 0}, +/* 3 */ { 2, s_8_3, 0, 5, 0}, +/* 4 */ { 2, s_8_4, 0, 1, 0}, +/* 5 */ { 2, s_8_5, 0, 2, 0}, +/* 6 */ { 2, s_8_6, 0, 3, 0} +}; + +static const symbol s_9_0[2] = { 0xE9, 'i' }; +static const symbol s_9_1[3] = { 0xE1, 0xE9, 'i' }; +static const symbol s_9_2[3] = { 0xE9, 0xE9, 'i' }; +static const symbol s_9_3[1] = { 0xE9 }; +static const symbol s_9_4[2] = { 'k', 0xE9 }; +static const symbol s_9_5[3] = { 'a', 'k', 0xE9 }; +static const symbol s_9_6[3] = { 'e', 'k', 0xE9 }; +static const symbol s_9_7[3] = { 'o', 'k', 0xE9 }; +static const symbol s_9_8[3] = { 0xE1, 'k', 0xE9 }; +static const symbol s_9_9[3] = { 0xE9, 'k', 0xE9 }; +static const symbol s_9_10[3] = { 0xF6, 'k', 0xE9 }; +static const symbol s_9_11[2] = { 0xE9, 0xE9 }; + +static const struct among a_9[12] = +{ +/* 0 */ { 2, s_9_0, -1, 7, 0}, +/* 1 */ { 3, s_9_1, 0, 6, 0}, +/* 2 */ { 3, s_9_2, 0, 5, 0}, +/* 3 */ { 1, s_9_3, -1, 9, 0}, +/* 4 */ { 2, s_9_4, 3, 4, 0}, +/* 5 */ { 3, s_9_5, 4, 1, 0}, +/* 6 */ { 3, s_9_6, 4, 1, 0}, +/* 7 */ { 3, s_9_7, 4, 1, 0}, +/* 8 */ { 3, s_9_8, 4, 3, 0}, +/* 9 */ { 3, s_9_9, 4, 2, 0}, +/* 10 */ { 3, s_9_10, 4, 1, 0}, +/* 11 */ { 2, s_9_11, 3, 8, 0} +}; + +static const symbol s_10_0[1] = { 'a' }; +static const symbol s_10_1[2] = { 'j', 'a' }; +static const symbol s_10_2[1] = { 'd' }; +static const symbol s_10_3[2] = { 'a', 'd' }; +static const symbol s_10_4[2] = { 'e', 'd' }; +static const symbol s_10_5[2] = { 'o', 'd' }; +static const symbol s_10_6[2] = { 0xE1, 'd' }; +static const symbol s_10_7[2] = { 0xE9, 'd' }; +static const symbol s_10_8[2] = { 0xF6, 'd' }; +static const symbol s_10_9[1] = { 'e' }; +static const symbol s_10_10[2] = { 'j', 'e' }; +static const symbol s_10_11[2] = { 'n', 'k' }; +static const symbol s_10_12[3] = { 'u', 'n', 'k' }; +static const symbol s_10_13[3] = { 0xE1, 'n', 'k' }; +static const symbol s_10_14[3] = { 0xE9, 'n', 'k' }; +static const symbol s_10_15[3] = { 0xFC, 'n', 'k' }; +static const symbol s_10_16[2] = { 'u', 'k' }; +static const symbol s_10_17[3] = { 'j', 'u', 'k' }; +static const symbol s_10_18[4] = { 0xE1, 'j', 'u', 'k' }; +static const symbol s_10_19[2] = { 0xFC, 'k' }; +static const symbol s_10_20[3] = { 'j', 0xFC, 'k' }; +static const symbol s_10_21[4] = { 0xE9, 'j', 0xFC, 'k' }; +static const symbol s_10_22[1] = { 'm' }; +static const symbol s_10_23[2] = { 'a', 'm' }; +static const symbol s_10_24[2] = { 'e', 'm' }; +static const symbol s_10_25[2] = { 'o', 'm' }; +static const symbol s_10_26[2] = { 0xE1, 'm' }; +static const symbol s_10_27[2] = { 0xE9, 'm' }; +static const symbol s_10_28[1] = { 'o' }; +static const symbol s_10_29[1] = { 0xE1 }; +static const symbol s_10_30[1] = { 0xE9 }; + +static const struct among a_10[31] = +{ +/* 0 */ { 1, s_10_0, -1, 18, 0}, +/* 1 */ { 2, s_10_1, 0, 17, 0}, +/* 2 */ { 1, s_10_2, -1, 16, 0}, +/* 3 */ { 2, s_10_3, 2, 13, 0}, +/* 4 */ { 2, s_10_4, 2, 13, 0}, +/* 5 */ { 2, s_10_5, 2, 13, 0}, +/* 6 */ { 2, s_10_6, 2, 14, 0}, +/* 7 */ { 2, s_10_7, 2, 15, 0}, +/* 8 */ { 2, s_10_8, 2, 13, 0}, +/* 9 */ { 1, s_10_9, -1, 18, 0}, +/* 10 */ { 2, s_10_10, 9, 17, 0}, +/* 11 */ { 2, s_10_11, -1, 4, 0}, +/* 12 */ { 3, s_10_12, 11, 1, 0}, +/* 13 */ { 3, s_10_13, 11, 2, 0}, +/* 14 */ { 3, s_10_14, 11, 3, 0}, +/* 15 */ { 3, s_10_15, 11, 1, 0}, +/* 16 */ { 2, s_10_16, -1, 8, 0}, +/* 17 */ { 3, s_10_17, 16, 7, 0}, +/* 18 */ { 4, s_10_18, 17, 5, 0}, +/* 19 */ { 2, s_10_19, -1, 8, 0}, +/* 20 */ { 3, s_10_20, 19, 7, 0}, +/* 21 */ { 4, s_10_21, 20, 6, 0}, +/* 22 */ { 1, s_10_22, -1, 12, 0}, +/* 23 */ { 2, s_10_23, 22, 9, 0}, +/* 24 */ { 2, s_10_24, 22, 9, 0}, +/* 25 */ { 2, s_10_25, 22, 9, 0}, +/* 26 */ { 2, s_10_26, 22, 10, 0}, +/* 27 */ { 2, s_10_27, 22, 11, 0}, +/* 28 */ { 1, s_10_28, -1, 18, 0}, +/* 29 */ { 1, s_10_29, -1, 19, 0}, +/* 30 */ { 1, s_10_30, -1, 20, 0} +}; + +static const symbol s_11_0[2] = { 'i', 'd' }; +static const symbol s_11_1[3] = { 'a', 'i', 'd' }; +static const symbol s_11_2[4] = { 'j', 'a', 'i', 'd' }; +static const symbol s_11_3[3] = { 'e', 'i', 'd' }; +static const symbol s_11_4[4] = { 'j', 'e', 'i', 'd' }; +static const symbol s_11_5[3] = { 0xE1, 'i', 'd' }; +static const symbol s_11_6[3] = { 0xE9, 'i', 'd' }; +static const symbol s_11_7[1] = { 'i' }; +static const symbol s_11_8[2] = { 'a', 'i' }; +static const symbol s_11_9[3] = { 'j', 'a', 'i' }; +static const symbol s_11_10[2] = { 'e', 'i' }; +static const symbol s_11_11[3] = { 'j', 'e', 'i' }; +static const symbol s_11_12[2] = { 0xE1, 'i' }; +static const symbol s_11_13[2] = { 0xE9, 'i' }; +static const symbol s_11_14[4] = { 'i', 't', 'e', 'k' }; +static const symbol s_11_15[5] = { 'e', 'i', 't', 'e', 'k' }; +static const symbol s_11_16[6] = { 'j', 'e', 'i', 't', 'e', 'k' }; +static const symbol s_11_17[5] = { 0xE9, 'i', 't', 'e', 'k' }; +static const symbol s_11_18[2] = { 'i', 'k' }; +static const symbol s_11_19[3] = { 'a', 'i', 'k' }; +static const symbol s_11_20[4] = { 'j', 'a', 'i', 'k' }; +static const symbol s_11_21[3] = { 'e', 'i', 'k' }; +static const symbol s_11_22[4] = { 'j', 'e', 'i', 'k' }; +static const symbol s_11_23[3] = { 0xE1, 'i', 'k' }; +static const symbol s_11_24[3] = { 0xE9, 'i', 'k' }; +static const symbol s_11_25[3] = { 'i', 'n', 'k' }; +static const symbol s_11_26[4] = { 'a', 'i', 'n', 'k' }; +static const symbol s_11_27[5] = { 'j', 'a', 'i', 'n', 'k' }; +static const symbol s_11_28[4] = { 'e', 'i', 'n', 'k' }; +static const symbol s_11_29[5] = { 'j', 'e', 'i', 'n', 'k' }; +static const symbol s_11_30[4] = { 0xE1, 'i', 'n', 'k' }; +static const symbol s_11_31[4] = { 0xE9, 'i', 'n', 'k' }; +static const symbol s_11_32[5] = { 'a', 'i', 't', 'o', 'k' }; +static const symbol s_11_33[6] = { 'j', 'a', 'i', 't', 'o', 'k' }; +static const symbol s_11_34[5] = { 0xE1, 'i', 't', 'o', 'k' }; +static const symbol s_11_35[2] = { 'i', 'm' }; +static const symbol s_11_36[3] = { 'a', 'i', 'm' }; +static const symbol s_11_37[4] = { 'j', 'a', 'i', 'm' }; +static const symbol s_11_38[3] = { 'e', 'i', 'm' }; +static const symbol s_11_39[4] = { 'j', 'e', 'i', 'm' }; +static const symbol s_11_40[3] = { 0xE1, 'i', 'm' }; +static const symbol s_11_41[3] = { 0xE9, 'i', 'm' }; + +static const struct among a_11[42] = +{ +/* 0 */ { 2, s_11_0, -1, 10, 0}, +/* 1 */ { 3, s_11_1, 0, 9, 0}, +/* 2 */ { 4, s_11_2, 1, 6, 0}, +/* 3 */ { 3, s_11_3, 0, 9, 0}, +/* 4 */ { 4, s_11_4, 3, 6, 0}, +/* 5 */ { 3, s_11_5, 0, 7, 0}, +/* 6 */ { 3, s_11_6, 0, 8, 0}, +/* 7 */ { 1, s_11_7, -1, 15, 0}, +/* 8 */ { 2, s_11_8, 7, 14, 0}, +/* 9 */ { 3, s_11_9, 8, 11, 0}, +/* 10 */ { 2, s_11_10, 7, 14, 0}, +/* 11 */ { 3, s_11_11, 10, 11, 0}, +/* 12 */ { 2, s_11_12, 7, 12, 0}, +/* 13 */ { 2, s_11_13, 7, 13, 0}, +/* 14 */ { 4, s_11_14, -1, 24, 0}, +/* 15 */ { 5, s_11_15, 14, 21, 0}, +/* 16 */ { 6, s_11_16, 15, 20, 0}, +/* 17 */ { 5, s_11_17, 14, 23, 0}, +/* 18 */ { 2, s_11_18, -1, 29, 0}, +/* 19 */ { 3, s_11_19, 18, 26, 0}, +/* 20 */ { 4, s_11_20, 19, 25, 0}, +/* 21 */ { 3, s_11_21, 18, 26, 0}, +/* 22 */ { 4, s_11_22, 21, 25, 0}, +/* 23 */ { 3, s_11_23, 18, 27, 0}, +/* 24 */ { 3, s_11_24, 18, 28, 0}, +/* 25 */ { 3, s_11_25, -1, 20, 0}, +/* 26 */ { 4, s_11_26, 25, 17, 0}, +/* 27 */ { 5, s_11_27, 26, 16, 0}, +/* 28 */ { 4, s_11_28, 25, 17, 0}, +/* 29 */ { 5, s_11_29, 28, 16, 0}, +/* 30 */ { 4, s_11_30, 25, 18, 0}, +/* 31 */ { 4, s_11_31, 25, 19, 0}, +/* 32 */ { 5, s_11_32, -1, 21, 0}, +/* 33 */ { 6, s_11_33, 32, 20, 0}, +/* 34 */ { 5, s_11_34, -1, 22, 0}, +/* 35 */ { 2, s_11_35, -1, 5, 0}, +/* 36 */ { 3, s_11_36, 35, 4, 0}, +/* 37 */ { 4, s_11_37, 36, 1, 0}, +/* 38 */ { 3, s_11_38, 35, 4, 0}, +/* 39 */ { 4, s_11_39, 38, 1, 0}, +/* 40 */ { 3, s_11_40, 35, 2, 0}, +/* 41 */ { 3, s_11_41, 35, 3, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 52, 14 }; + +static const symbol s_0[] = { 'a' }; +static const symbol s_1[] = { 'e' }; +static const symbol s_2[] = { 'e' }; +static const symbol s_3[] = { 'a' }; +static const symbol s_4[] = { 'a' }; +static const symbol s_5[] = { 'a' }; +static const symbol s_6[] = { 'e' }; +static const symbol s_7[] = { 'a' }; +static const symbol s_8[] = { 'e' }; +static const symbol s_9[] = { 'e' }; +static const symbol s_10[] = { 'a' }; +static const symbol s_11[] = { 'e' }; +static const symbol s_12[] = { 'a' }; +static const symbol s_13[] = { 'e' }; +static const symbol s_14[] = { 'a' }; +static const symbol s_15[] = { 'e' }; +static const symbol s_16[] = { 'a' }; +static const symbol s_17[] = { 'e' }; +static const symbol s_18[] = { 'a' }; +static const symbol s_19[] = { 'e' }; +static const symbol s_20[] = { 'a' }; +static const symbol s_21[] = { 'e' }; +static const symbol s_22[] = { 'a' }; +static const symbol s_23[] = { 'e' }; +static const symbol s_24[] = { 'a' }; +static const symbol s_25[] = { 'e' }; +static const symbol s_26[] = { 'a' }; +static const symbol s_27[] = { 'e' }; +static const symbol s_28[] = { 'a' }; +static const symbol s_29[] = { 'e' }; +static const symbol s_30[] = { 'a' }; +static const symbol s_31[] = { 'e' }; +static const symbol s_32[] = { 'a' }; +static const symbol s_33[] = { 'e' }; +static const symbol s_34[] = { 'a' }; +static const symbol s_35[] = { 'e' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { int c1 = z->c; /* or, line 51 */ + if (in_grouping(z, g_v, 97, 252, 0)) goto lab1; + if (in_grouping(z, g_v, 97, 252, 1) < 0) goto lab1; /* goto */ /* non v, line 48 */ + { int c2 = z->c; /* or, line 49 */ + if (z->c + 1 >= z->l || z->p[z->c + 1] >> 5 != 3 || !((101187584 >> (z->p[z->c + 1] & 0x1f)) & 1)) goto lab3; + if (!(find_among(z, a_0, 8))) goto lab3; /* among, line 49 */ + goto lab2; + lab3: + z->c = c2; + if (z->c >= z->l) goto lab1; + z->c++; /* next, line 49 */ + } + lab2: + z->I[0] = z->c; /* setmark p1, line 50 */ + goto lab0; + lab1: + z->c = c1; + if (out_grouping(z, g_v, 97, 252, 0)) return 0; + { /* gopast */ /* grouping v, line 53 */ + int ret = out_grouping(z, g_v, 97, 252, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 53 */ + } +lab0: + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_v_ending(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 61 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 225 && z->p[z->c - 1] != 233)) return 0; + among_var = find_among_b(z, a_1, 2); /* substring, line 61 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 61 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 61 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 1, s_0); /* <-, line 62 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_1); /* <-, line 63 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_double(struct SN_env * z) { + { int m_test = z->l - z->c; /* test, line 68 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((106790108 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!(find_among_b(z, a_2, 23))) return 0; /* among, line 68 */ + z->c = z->l - m_test; + } + return 1; +} + +static int r_undouble(struct SN_env * z) { + if (z->c <= z->lb) return 0; + z->c--; /* next, line 73 */ + z->ket = z->c; /* [, line 73 */ + { int ret = z->c - 1; + if (z->lb > ret || ret > z->l) return 0; + z->c = ret; /* hop, line 73 */ + } + z->bra = z->c; /* ], line 73 */ + { int ret = slice_del(z); /* delete, line 73 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_instrum(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 77 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 108) return 0; + among_var = find_among_b(z, a_3, 2); /* substring, line 77 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 77 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 77 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_double(z); + if (ret == 0) return 0; /* call double, line 78 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_double(z); + if (ret == 0) return 0; /* call double, line 79 */ + if (ret < 0) return ret; + } + break; + } + { int ret = slice_del(z); /* delete, line 81 */ + if (ret < 0) return ret; + } + { int ret = r_undouble(z); + if (ret == 0) return 0; /* call undouble, line 82 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_case(struct SN_env * z) { + z->ket = z->c; /* [, line 87 */ + if (!(find_among_b(z, a_4, 44))) return 0; /* substring, line 87 */ + z->bra = z->c; /* ], line 87 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 87 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 111 */ + if (ret < 0) return ret; + } + { int ret = r_v_ending(z); + if (ret == 0) return 0; /* call v_ending, line 112 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_case_special(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 116 */ + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 110 && z->p[z->c - 1] != 116)) return 0; + among_var = find_among_b(z, a_5, 3); /* substring, line 116 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 116 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 116 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 1, s_2); /* <-, line 117 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_3); /* <-, line 118 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_4); /* <-, line 119 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_case_other(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 124 */ + if (z->c - 3 <= z->lb || z->p[z->c - 1] != 108) return 0; + among_var = find_among_b(z, a_6, 6); /* substring, line 124 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 124 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 124 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 125 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_del(z); /* delete, line 126 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_5); /* <-, line 127 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 1, s_6); /* <-, line 128 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_factive(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 133 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 225 && z->p[z->c - 1] != 233)) return 0; + among_var = find_among_b(z, a_7, 2); /* substring, line 133 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 133 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 133 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_double(z); + if (ret == 0) return 0; /* call double, line 134 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_double(z); + if (ret == 0) return 0; /* call double, line 135 */ + if (ret < 0) return ret; + } + break; + } + { int ret = slice_del(z); /* delete, line 137 */ + if (ret < 0) return ret; + } + { int ret = r_undouble(z); + if (ret == 0) return 0; /* call undouble, line 138 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_plural(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 142 */ + if (z->c <= z->lb || z->p[z->c - 1] != 107) return 0; + among_var = find_among_b(z, a_8, 7); /* substring, line 142 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 142 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 142 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 1, s_7); /* <-, line 143 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_8); /* <-, line 144 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 145 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_del(z); /* delete, line 146 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_del(z); /* delete, line 147 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_del(z); /* delete, line 148 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_del(z); /* delete, line 149 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_owned(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 154 */ + if (z->c <= z->lb || (z->p[z->c - 1] != 105 && z->p[z->c - 1] != 233)) return 0; + among_var = find_among_b(z, a_9, 12); /* substring, line 154 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 154 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 154 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 155 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_9); /* <-, line 156 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_10); /* <-, line 157 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_del(z); /* delete, line 158 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 1, s_11); /* <-, line 159 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 1, s_12); /* <-, line 160 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_del(z); /* delete, line 161 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_from_s(z, 1, s_13); /* <-, line 162 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_del(z); /* delete, line 163 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_sing_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 168 */ + among_var = find_among_b(z, a_10, 31); /* substring, line 168 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 168 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 168 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 169 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_14); /* <-, line 170 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_15); /* <-, line 171 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_del(z); /* delete, line 172 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 1, s_16); /* <-, line 173 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 1, s_17); /* <-, line 174 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_del(z); /* delete, line 175 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_del(z); /* delete, line 176 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_del(z); /* delete, line 177 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = slice_from_s(z, 1, s_18); /* <-, line 178 */ + if (ret < 0) return ret; + } + break; + case 11: + { int ret = slice_from_s(z, 1, s_19); /* <-, line 179 */ + if (ret < 0) return ret; + } + break; + case 12: + { int ret = slice_del(z); /* delete, line 180 */ + if (ret < 0) return ret; + } + break; + case 13: + { int ret = slice_del(z); /* delete, line 181 */ + if (ret < 0) return ret; + } + break; + case 14: + { int ret = slice_from_s(z, 1, s_20); /* <-, line 182 */ + if (ret < 0) return ret; + } + break; + case 15: + { int ret = slice_from_s(z, 1, s_21); /* <-, line 183 */ + if (ret < 0) return ret; + } + break; + case 16: + { int ret = slice_del(z); /* delete, line 184 */ + if (ret < 0) return ret; + } + break; + case 17: + { int ret = slice_del(z); /* delete, line 185 */ + if (ret < 0) return ret; + } + break; + case 18: + { int ret = slice_del(z); /* delete, line 186 */ + if (ret < 0) return ret; + } + break; + case 19: + { int ret = slice_from_s(z, 1, s_22); /* <-, line 187 */ + if (ret < 0) return ret; + } + break; + case 20: + { int ret = slice_from_s(z, 1, s_23); /* <-, line 188 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_plur_owner(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 193 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((10768 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_11, 42); /* substring, line 193 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 193 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 193 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 194 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_24); /* <-, line 195 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_25); /* <-, line 196 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_del(z); /* delete, line 197 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_del(z); /* delete, line 198 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_del(z); /* delete, line 199 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_from_s(z, 1, s_26); /* <-, line 200 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_from_s(z, 1, s_27); /* <-, line 201 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_del(z); /* delete, line 202 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = slice_del(z); /* delete, line 203 */ + if (ret < 0) return ret; + } + break; + case 11: + { int ret = slice_del(z); /* delete, line 204 */ + if (ret < 0) return ret; + } + break; + case 12: + { int ret = slice_from_s(z, 1, s_28); /* <-, line 205 */ + if (ret < 0) return ret; + } + break; + case 13: + { int ret = slice_from_s(z, 1, s_29); /* <-, line 206 */ + if (ret < 0) return ret; + } + break; + case 14: + { int ret = slice_del(z); /* delete, line 207 */ + if (ret < 0) return ret; + } + break; + case 15: + { int ret = slice_del(z); /* delete, line 208 */ + if (ret < 0) return ret; + } + break; + case 16: + { int ret = slice_del(z); /* delete, line 209 */ + if (ret < 0) return ret; + } + break; + case 17: + { int ret = slice_del(z); /* delete, line 210 */ + if (ret < 0) return ret; + } + break; + case 18: + { int ret = slice_from_s(z, 1, s_30); /* <-, line 211 */ + if (ret < 0) return ret; + } + break; + case 19: + { int ret = slice_from_s(z, 1, s_31); /* <-, line 212 */ + if (ret < 0) return ret; + } + break; + case 20: + { int ret = slice_del(z); /* delete, line 214 */ + if (ret < 0) return ret; + } + break; + case 21: + { int ret = slice_del(z); /* delete, line 215 */ + if (ret < 0) return ret; + } + break; + case 22: + { int ret = slice_from_s(z, 1, s_32); /* <-, line 216 */ + if (ret < 0) return ret; + } + break; + case 23: + { int ret = slice_from_s(z, 1, s_33); /* <-, line 217 */ + if (ret < 0) return ret; + } + break; + case 24: + { int ret = slice_del(z); /* delete, line 218 */ + if (ret < 0) return ret; + } + break; + case 25: + { int ret = slice_del(z); /* delete, line 219 */ + if (ret < 0) return ret; + } + break; + case 26: + { int ret = slice_del(z); /* delete, line 220 */ + if (ret < 0) return ret; + } + break; + case 27: + { int ret = slice_from_s(z, 1, s_34); /* <-, line 221 */ + if (ret < 0) return ret; + } + break; + case 28: + { int ret = slice_from_s(z, 1, s_35); /* <-, line 222 */ + if (ret < 0) return ret; + } + break; + case 29: + { int ret = slice_del(z); /* delete, line 223 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int hungarian_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 229 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab0; /* call mark_regions, line 229 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + z->lb = z->c; z->c = z->l; /* backwards, line 230 */ + + { int m2 = z->l - z->c; (void)m2; /* do, line 231 */ + { int ret = r_instrum(z); + if (ret == 0) goto lab1; /* call instrum, line 231 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 232 */ + { int ret = r_case(z); + if (ret == 0) goto lab2; /* call case, line 232 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 233 */ + { int ret = r_case_special(z); + if (ret == 0) goto lab3; /* call case_special, line 233 */ + if (ret < 0) return ret; + } + lab3: + z->c = z->l - m4; + } + { int m5 = z->l - z->c; (void)m5; /* do, line 234 */ + { int ret = r_case_other(z); + if (ret == 0) goto lab4; /* call case_other, line 234 */ + if (ret < 0) return ret; + } + lab4: + z->c = z->l - m5; + } + { int m6 = z->l - z->c; (void)m6; /* do, line 235 */ + { int ret = r_factive(z); + if (ret == 0) goto lab5; /* call factive, line 235 */ + if (ret < 0) return ret; + } + lab5: + z->c = z->l - m6; + } + { int m7 = z->l - z->c; (void)m7; /* do, line 236 */ + { int ret = r_owned(z); + if (ret == 0) goto lab6; /* call owned, line 236 */ + if (ret < 0) return ret; + } + lab6: + z->c = z->l - m7; + } + { int m8 = z->l - z->c; (void)m8; /* do, line 237 */ + { int ret = r_sing_owner(z); + if (ret == 0) goto lab7; /* call sing_owner, line 237 */ + if (ret < 0) return ret; + } + lab7: + z->c = z->l - m8; + } + { int m9 = z->l - z->c; (void)m9; /* do, line 238 */ + { int ret = r_plur_owner(z); + if (ret == 0) goto lab8; /* call plur_owner, line 238 */ + if (ret < 0) return ret; + } + lab8: + z->c = z->l - m9; + } + { int m10 = z->l - z->c; (void)m10; /* do, line 239 */ + { int ret = r_plural(z); + if (ret == 0) goto lab9; /* call plural, line 239 */ + if (ret < 0) return ret; + } + lab9: + z->c = z->l - m10; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * hungarian_ISO_8859_1_create_env(void) { return SN_create_env(0, 1, 0); } + +extern void hungarian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c new file mode 100644 index 00000000000..d941b0f0363 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c @@ -0,0 +1,1065 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int italian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_vowel_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_attached_pronoun(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * italian_ISO_8859_1_create_env(void); +extern void italian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[2] = { 'q', 'u' }; +static const symbol s_0_2[1] = { 0xE1 }; +static const symbol s_0_3[1] = { 0xE9 }; +static const symbol s_0_4[1] = { 0xED }; +static const symbol s_0_5[1] = { 0xF3 }; +static const symbol s_0_6[1] = { 0xFA }; + +static const struct among a_0[7] = +{ +/* 0 */ { 0, 0, -1, 7, 0}, +/* 1 */ { 2, s_0_1, 0, 6, 0}, +/* 2 */ { 1, s_0_2, 0, 1, 0}, +/* 3 */ { 1, s_0_3, 0, 2, 0}, +/* 4 */ { 1, s_0_4, 0, 3, 0}, +/* 5 */ { 1, s_0_5, 0, 4, 0}, +/* 6 */ { 1, s_0_6, 0, 5, 0} +}; + +static const symbol s_1_1[1] = { 'I' }; +static const symbol s_1_2[1] = { 'U' }; + +static const struct among a_1[3] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 1, s_1_1, 0, 1, 0}, +/* 2 */ { 1, s_1_2, 0, 2, 0} +}; + +static const symbol s_2_0[2] = { 'l', 'a' }; +static const symbol s_2_1[4] = { 'c', 'e', 'l', 'a' }; +static const symbol s_2_2[6] = { 'g', 'l', 'i', 'e', 'l', 'a' }; +static const symbol s_2_3[4] = { 'm', 'e', 'l', 'a' }; +static const symbol s_2_4[4] = { 't', 'e', 'l', 'a' }; +static const symbol s_2_5[4] = { 'v', 'e', 'l', 'a' }; +static const symbol s_2_6[2] = { 'l', 'e' }; +static const symbol s_2_7[4] = { 'c', 'e', 'l', 'e' }; +static const symbol s_2_8[6] = { 'g', 'l', 'i', 'e', 'l', 'e' }; +static const symbol s_2_9[4] = { 'm', 'e', 'l', 'e' }; +static const symbol s_2_10[4] = { 't', 'e', 'l', 'e' }; +static const symbol s_2_11[4] = { 'v', 'e', 'l', 'e' }; +static const symbol s_2_12[2] = { 'n', 'e' }; +static const symbol s_2_13[4] = { 'c', 'e', 'n', 'e' }; +static const symbol s_2_14[6] = { 'g', 'l', 'i', 'e', 'n', 'e' }; +static const symbol s_2_15[4] = { 'm', 'e', 'n', 'e' }; +static const symbol s_2_16[4] = { 's', 'e', 'n', 'e' }; +static const symbol s_2_17[4] = { 't', 'e', 'n', 'e' }; +static const symbol s_2_18[4] = { 'v', 'e', 'n', 'e' }; +static const symbol s_2_19[2] = { 'c', 'i' }; +static const symbol s_2_20[2] = { 'l', 'i' }; +static const symbol s_2_21[4] = { 'c', 'e', 'l', 'i' }; +static const symbol s_2_22[6] = { 'g', 'l', 'i', 'e', 'l', 'i' }; +static const symbol s_2_23[4] = { 'm', 'e', 'l', 'i' }; +static const symbol s_2_24[4] = { 't', 'e', 'l', 'i' }; +static const symbol s_2_25[4] = { 'v', 'e', 'l', 'i' }; +static const symbol s_2_26[3] = { 'g', 'l', 'i' }; +static const symbol s_2_27[2] = { 'm', 'i' }; +static const symbol s_2_28[2] = { 's', 'i' }; +static const symbol s_2_29[2] = { 't', 'i' }; +static const symbol s_2_30[2] = { 'v', 'i' }; +static const symbol s_2_31[2] = { 'l', 'o' }; +static const symbol s_2_32[4] = { 'c', 'e', 'l', 'o' }; +static const symbol s_2_33[6] = { 'g', 'l', 'i', 'e', 'l', 'o' }; +static const symbol s_2_34[4] = { 'm', 'e', 'l', 'o' }; +static const symbol s_2_35[4] = { 't', 'e', 'l', 'o' }; +static const symbol s_2_36[4] = { 'v', 'e', 'l', 'o' }; + +static const struct among a_2[37] = +{ +/* 0 */ { 2, s_2_0, -1, -1, 0}, +/* 1 */ { 4, s_2_1, 0, -1, 0}, +/* 2 */ { 6, s_2_2, 0, -1, 0}, +/* 3 */ { 4, s_2_3, 0, -1, 0}, +/* 4 */ { 4, s_2_4, 0, -1, 0}, +/* 5 */ { 4, s_2_5, 0, -1, 0}, +/* 6 */ { 2, s_2_6, -1, -1, 0}, +/* 7 */ { 4, s_2_7, 6, -1, 0}, +/* 8 */ { 6, s_2_8, 6, -1, 0}, +/* 9 */ { 4, s_2_9, 6, -1, 0}, +/* 10 */ { 4, s_2_10, 6, -1, 0}, +/* 11 */ { 4, s_2_11, 6, -1, 0}, +/* 12 */ { 2, s_2_12, -1, -1, 0}, +/* 13 */ { 4, s_2_13, 12, -1, 0}, +/* 14 */ { 6, s_2_14, 12, -1, 0}, +/* 15 */ { 4, s_2_15, 12, -1, 0}, +/* 16 */ { 4, s_2_16, 12, -1, 0}, +/* 17 */ { 4, s_2_17, 12, -1, 0}, +/* 18 */ { 4, s_2_18, 12, -1, 0}, +/* 19 */ { 2, s_2_19, -1, -1, 0}, +/* 20 */ { 2, s_2_20, -1, -1, 0}, +/* 21 */ { 4, s_2_21, 20, -1, 0}, +/* 22 */ { 6, s_2_22, 20, -1, 0}, +/* 23 */ { 4, s_2_23, 20, -1, 0}, +/* 24 */ { 4, s_2_24, 20, -1, 0}, +/* 25 */ { 4, s_2_25, 20, -1, 0}, +/* 26 */ { 3, s_2_26, 20, -1, 0}, +/* 27 */ { 2, s_2_27, -1, -1, 0}, +/* 28 */ { 2, s_2_28, -1, -1, 0}, +/* 29 */ { 2, s_2_29, -1, -1, 0}, +/* 30 */ { 2, s_2_30, -1, -1, 0}, +/* 31 */ { 2, s_2_31, -1, -1, 0}, +/* 32 */ { 4, s_2_32, 31, -1, 0}, +/* 33 */ { 6, s_2_33, 31, -1, 0}, +/* 34 */ { 4, s_2_34, 31, -1, 0}, +/* 35 */ { 4, s_2_35, 31, -1, 0}, +/* 36 */ { 4, s_2_36, 31, -1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_3_1[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_3_2[2] = { 'a', 'r' }; +static const symbol s_3_3[2] = { 'e', 'r' }; +static const symbol s_3_4[2] = { 'i', 'r' }; + +static const struct among a_3[5] = +{ +/* 0 */ { 4, s_3_0, -1, 1, 0}, +/* 1 */ { 4, s_3_1, -1, 1, 0}, +/* 2 */ { 2, s_3_2, -1, 2, 0}, +/* 3 */ { 2, s_3_3, -1, 2, 0}, +/* 4 */ { 2, s_3_4, -1, 2, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'o', 's' }; +static const symbol s_4_3[2] = { 'i', 'v' }; + +static const struct among a_4[4] = +{ +/* 0 */ { 2, s_4_0, -1, -1, 0}, +/* 1 */ { 4, s_4_1, -1, -1, 0}, +/* 2 */ { 2, s_4_2, -1, -1, 0}, +/* 3 */ { 2, s_4_3, -1, 1, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_5_2[2] = { 'i', 'v' }; + +static const struct among a_5[3] = +{ +/* 0 */ { 2, s_5_0, -1, 1, 0}, +/* 1 */ { 4, s_5_1, -1, 1, 0}, +/* 2 */ { 2, s_5_2, -1, 1, 0} +}; + +static const symbol s_6_0[3] = { 'i', 'c', 'a' }; +static const symbol s_6_1[5] = { 'l', 'o', 'g', 'i', 'a' }; +static const symbol s_6_2[3] = { 'o', 's', 'a' }; +static const symbol s_6_3[4] = { 'i', 's', 't', 'a' }; +static const symbol s_6_4[3] = { 'i', 'v', 'a' }; +static const symbol s_6_5[4] = { 'a', 'n', 'z', 'a' }; +static const symbol s_6_6[4] = { 'e', 'n', 'z', 'a' }; +static const symbol s_6_7[3] = { 'i', 'c', 'e' }; +static const symbol s_6_8[6] = { 'a', 't', 'r', 'i', 'c', 'e' }; +static const symbol s_6_9[4] = { 'i', 'c', 'h', 'e' }; +static const symbol s_6_10[5] = { 'l', 'o', 'g', 'i', 'e' }; +static const symbol s_6_11[5] = { 'a', 'b', 'i', 'l', 'e' }; +static const symbol s_6_12[5] = { 'i', 'b', 'i', 'l', 'e' }; +static const symbol s_6_13[6] = { 'u', 's', 'i', 'o', 'n', 'e' }; +static const symbol s_6_14[6] = { 'a', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_15[6] = { 'u', 'z', 'i', 'o', 'n', 'e' }; +static const symbol s_6_16[5] = { 'a', 't', 'o', 'r', 'e' }; +static const symbol s_6_17[3] = { 'o', 's', 'e' }; +static const symbol s_6_18[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_6_19[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_20[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_6_21[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_22[3] = { 'i', 'v', 'e' }; +static const symbol s_6_23[4] = { 'a', 'n', 'z', 'e' }; +static const symbol s_6_24[4] = { 'e', 'n', 'z', 'e' }; +static const symbol s_6_25[3] = { 'i', 'c', 'i' }; +static const symbol s_6_26[6] = { 'a', 't', 'r', 'i', 'c', 'i' }; +static const symbol s_6_27[4] = { 'i', 'c', 'h', 'i' }; +static const symbol s_6_28[5] = { 'a', 'b', 'i', 'l', 'i' }; +static const symbol s_6_29[5] = { 'i', 'b', 'i', 'l', 'i' }; +static const symbol s_6_30[4] = { 'i', 's', 'm', 'i' }; +static const symbol s_6_31[6] = { 'u', 's', 'i', 'o', 'n', 'i' }; +static const symbol s_6_32[6] = { 'a', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_33[6] = { 'u', 'z', 'i', 'o', 'n', 'i' }; +static const symbol s_6_34[5] = { 'a', 't', 'o', 'r', 'i' }; +static const symbol s_6_35[3] = { 'o', 's', 'i' }; +static const symbol s_6_36[4] = { 'a', 'n', 't', 'i' }; +static const symbol s_6_37[6] = { 'a', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_38[6] = { 'i', 'm', 'e', 'n', 't', 'i' }; +static const symbol s_6_39[4] = { 'i', 's', 't', 'i' }; +static const symbol s_6_40[3] = { 'i', 'v', 'i' }; +static const symbol s_6_41[3] = { 'i', 'c', 'o' }; +static const symbol s_6_42[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_6_43[3] = { 'o', 's', 'o' }; +static const symbol s_6_44[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_45[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_6_46[3] = { 'i', 'v', 'o' }; +static const symbol s_6_47[3] = { 'i', 't', 0xE0 }; +static const symbol s_6_48[4] = { 'i', 's', 't', 0xE0 }; +static const symbol s_6_49[4] = { 'i', 's', 't', 0xE8 }; +static const symbol s_6_50[4] = { 'i', 's', 't', 0xEC }; + +static const struct among a_6[51] = +{ +/* 0 */ { 3, s_6_0, -1, 1, 0}, +/* 1 */ { 5, s_6_1, -1, 3, 0}, +/* 2 */ { 3, s_6_2, -1, 1, 0}, +/* 3 */ { 4, s_6_3, -1, 1, 0}, +/* 4 */ { 3, s_6_4, -1, 9, 0}, +/* 5 */ { 4, s_6_5, -1, 1, 0}, +/* 6 */ { 4, s_6_6, -1, 5, 0}, +/* 7 */ { 3, s_6_7, -1, 1, 0}, +/* 8 */ { 6, s_6_8, 7, 1, 0}, +/* 9 */ { 4, s_6_9, -1, 1, 0}, +/* 10 */ { 5, s_6_10, -1, 3, 0}, +/* 11 */ { 5, s_6_11, -1, 1, 0}, +/* 12 */ { 5, s_6_12, -1, 1, 0}, +/* 13 */ { 6, s_6_13, -1, 4, 0}, +/* 14 */ { 6, s_6_14, -1, 2, 0}, +/* 15 */ { 6, s_6_15, -1, 4, 0}, +/* 16 */ { 5, s_6_16, -1, 2, 0}, +/* 17 */ { 3, s_6_17, -1, 1, 0}, +/* 18 */ { 4, s_6_18, -1, 1, 0}, +/* 19 */ { 5, s_6_19, -1, 1, 0}, +/* 20 */ { 6, s_6_20, 19, 7, 0}, +/* 21 */ { 4, s_6_21, -1, 1, 0}, +/* 22 */ { 3, s_6_22, -1, 9, 0}, +/* 23 */ { 4, s_6_23, -1, 1, 0}, +/* 24 */ { 4, s_6_24, -1, 5, 0}, +/* 25 */ { 3, s_6_25, -1, 1, 0}, +/* 26 */ { 6, s_6_26, 25, 1, 0}, +/* 27 */ { 4, s_6_27, -1, 1, 0}, +/* 28 */ { 5, s_6_28, -1, 1, 0}, +/* 29 */ { 5, s_6_29, -1, 1, 0}, +/* 30 */ { 4, s_6_30, -1, 1, 0}, +/* 31 */ { 6, s_6_31, -1, 4, 0}, +/* 32 */ { 6, s_6_32, -1, 2, 0}, +/* 33 */ { 6, s_6_33, -1, 4, 0}, +/* 34 */ { 5, s_6_34, -1, 2, 0}, +/* 35 */ { 3, s_6_35, -1, 1, 0}, +/* 36 */ { 4, s_6_36, -1, 1, 0}, +/* 37 */ { 6, s_6_37, -1, 6, 0}, +/* 38 */ { 6, s_6_38, -1, 6, 0}, +/* 39 */ { 4, s_6_39, -1, 1, 0}, +/* 40 */ { 3, s_6_40, -1, 9, 0}, +/* 41 */ { 3, s_6_41, -1, 1, 0}, +/* 42 */ { 4, s_6_42, -1, 1, 0}, +/* 43 */ { 3, s_6_43, -1, 1, 0}, +/* 44 */ { 6, s_6_44, -1, 6, 0}, +/* 45 */ { 6, s_6_45, -1, 6, 0}, +/* 46 */ { 3, s_6_46, -1, 9, 0}, +/* 47 */ { 3, s_6_47, -1, 8, 0}, +/* 48 */ { 4, s_6_48, -1, 1, 0}, +/* 49 */ { 4, s_6_49, -1, 1, 0}, +/* 50 */ { 4, s_6_50, -1, 1, 0} +}; + +static const symbol s_7_0[4] = { 'i', 's', 'c', 'a' }; +static const symbol s_7_1[4] = { 'e', 'n', 'd', 'a' }; +static const symbol s_7_2[3] = { 'a', 't', 'a' }; +static const symbol s_7_3[3] = { 'i', 't', 'a' }; +static const symbol s_7_4[3] = { 'u', 't', 'a' }; +static const symbol s_7_5[3] = { 'a', 'v', 'a' }; +static const symbol s_7_6[3] = { 'e', 'v', 'a' }; +static const symbol s_7_7[3] = { 'i', 'v', 'a' }; +static const symbol s_7_8[6] = { 'e', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_9[6] = { 'i', 'r', 'e', 'b', 'b', 'e' }; +static const symbol s_7_10[4] = { 'i', 's', 'c', 'e' }; +static const symbol s_7_11[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_7_12[3] = { 'a', 'r', 'e' }; +static const symbol s_7_13[3] = { 'e', 'r', 'e' }; +static const symbol s_7_14[3] = { 'i', 'r', 'e' }; +static const symbol s_7_15[4] = { 'a', 's', 's', 'e' }; +static const symbol s_7_16[3] = { 'a', 't', 'e' }; +static const symbol s_7_17[5] = { 'a', 'v', 'a', 't', 'e' }; +static const symbol s_7_18[5] = { 'e', 'v', 'a', 't', 'e' }; +static const symbol s_7_19[5] = { 'i', 'v', 'a', 't', 'e' }; +static const symbol s_7_20[3] = { 'e', 't', 'e' }; +static const symbol s_7_21[5] = { 'e', 'r', 'e', 't', 'e' }; +static const symbol s_7_22[5] = { 'i', 'r', 'e', 't', 'e' }; +static const symbol s_7_23[3] = { 'i', 't', 'e' }; +static const symbol s_7_24[6] = { 'e', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_25[6] = { 'i', 'r', 'e', 's', 't', 'e' }; +static const symbol s_7_26[3] = { 'u', 't', 'e' }; +static const symbol s_7_27[4] = { 'e', 'r', 'a', 'i' }; +static const symbol s_7_28[4] = { 'i', 'r', 'a', 'i' }; +static const symbol s_7_29[4] = { 'i', 's', 'c', 'i' }; +static const symbol s_7_30[4] = { 'e', 'n', 'd', 'i' }; +static const symbol s_7_31[4] = { 'e', 'r', 'e', 'i' }; +static const symbol s_7_32[4] = { 'i', 'r', 'e', 'i' }; +static const symbol s_7_33[4] = { 'a', 's', 's', 'i' }; +static const symbol s_7_34[3] = { 'a', 't', 'i' }; +static const symbol s_7_35[3] = { 'i', 't', 'i' }; +static const symbol s_7_36[6] = { 'e', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_37[6] = { 'i', 'r', 'e', 's', 't', 'i' }; +static const symbol s_7_38[3] = { 'u', 't', 'i' }; +static const symbol s_7_39[3] = { 'a', 'v', 'i' }; +static const symbol s_7_40[3] = { 'e', 'v', 'i' }; +static const symbol s_7_41[3] = { 'i', 'v', 'i' }; +static const symbol s_7_42[4] = { 'i', 's', 'c', 'o' }; +static const symbol s_7_43[4] = { 'a', 'n', 'd', 'o' }; +static const symbol s_7_44[4] = { 'e', 'n', 'd', 'o' }; +static const symbol s_7_45[4] = { 'Y', 'a', 'm', 'o' }; +static const symbol s_7_46[4] = { 'i', 'a', 'm', 'o' }; +static const symbol s_7_47[5] = { 'a', 'v', 'a', 'm', 'o' }; +static const symbol s_7_48[5] = { 'e', 'v', 'a', 'm', 'o' }; +static const symbol s_7_49[5] = { 'i', 'v', 'a', 'm', 'o' }; +static const symbol s_7_50[5] = { 'e', 'r', 'e', 'm', 'o' }; +static const symbol s_7_51[5] = { 'i', 'r', 'e', 'm', 'o' }; +static const symbol s_7_52[6] = { 'a', 's', 's', 'i', 'm', 'o' }; +static const symbol s_7_53[4] = { 'a', 'm', 'm', 'o' }; +static const symbol s_7_54[4] = { 'e', 'm', 'm', 'o' }; +static const symbol s_7_55[6] = { 'e', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_56[6] = { 'i', 'r', 'e', 'm', 'm', 'o' }; +static const symbol s_7_57[4] = { 'i', 'm', 'm', 'o' }; +static const symbol s_7_58[3] = { 'a', 'n', 'o' }; +static const symbol s_7_59[6] = { 'i', 's', 'c', 'a', 'n', 'o' }; +static const symbol s_7_60[5] = { 'a', 'v', 'a', 'n', 'o' }; +static const symbol s_7_61[5] = { 'e', 'v', 'a', 'n', 'o' }; +static const symbol s_7_62[5] = { 'i', 'v', 'a', 'n', 'o' }; +static const symbol s_7_63[6] = { 'e', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_64[6] = { 'i', 'r', 'a', 'n', 'n', 'o' }; +static const symbol s_7_65[3] = { 'o', 'n', 'o' }; +static const symbol s_7_66[6] = { 'i', 's', 'c', 'o', 'n', 'o' }; +static const symbol s_7_67[5] = { 'a', 'r', 'o', 'n', 'o' }; +static const symbol s_7_68[5] = { 'e', 'r', 'o', 'n', 'o' }; +static const symbol s_7_69[5] = { 'i', 'r', 'o', 'n', 'o' }; +static const symbol s_7_70[8] = { 'e', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_71[8] = { 'i', 'r', 'e', 'b', 'b', 'e', 'r', 'o' }; +static const symbol s_7_72[6] = { 'a', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_73[6] = { 'e', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_74[6] = { 'i', 's', 's', 'e', 'r', 'o' }; +static const symbol s_7_75[3] = { 'a', 't', 'o' }; +static const symbol s_7_76[3] = { 'i', 't', 'o' }; +static const symbol s_7_77[3] = { 'u', 't', 'o' }; +static const symbol s_7_78[3] = { 'a', 'v', 'o' }; +static const symbol s_7_79[3] = { 'e', 'v', 'o' }; +static const symbol s_7_80[3] = { 'i', 'v', 'o' }; +static const symbol s_7_81[2] = { 'a', 'r' }; +static const symbol s_7_82[2] = { 'i', 'r' }; +static const symbol s_7_83[3] = { 'e', 'r', 0xE0 }; +static const symbol s_7_84[3] = { 'i', 'r', 0xE0 }; +static const symbol s_7_85[3] = { 'e', 'r', 0xF2 }; +static const symbol s_7_86[3] = { 'i', 'r', 0xF2 }; + +static const struct among a_7[87] = +{ +/* 0 */ { 4, s_7_0, -1, 1, 0}, +/* 1 */ { 4, s_7_1, -1, 1, 0}, +/* 2 */ { 3, s_7_2, -1, 1, 0}, +/* 3 */ { 3, s_7_3, -1, 1, 0}, +/* 4 */ { 3, s_7_4, -1, 1, 0}, +/* 5 */ { 3, s_7_5, -1, 1, 0}, +/* 6 */ { 3, s_7_6, -1, 1, 0}, +/* 7 */ { 3, s_7_7, -1, 1, 0}, +/* 8 */ { 6, s_7_8, -1, 1, 0}, +/* 9 */ { 6, s_7_9, -1, 1, 0}, +/* 10 */ { 4, s_7_10, -1, 1, 0}, +/* 11 */ { 4, s_7_11, -1, 1, 0}, +/* 12 */ { 3, s_7_12, -1, 1, 0}, +/* 13 */ { 3, s_7_13, -1, 1, 0}, +/* 14 */ { 3, s_7_14, -1, 1, 0}, +/* 15 */ { 4, s_7_15, -1, 1, 0}, +/* 16 */ { 3, s_7_16, -1, 1, 0}, +/* 17 */ { 5, s_7_17, 16, 1, 0}, +/* 18 */ { 5, s_7_18, 16, 1, 0}, +/* 19 */ { 5, s_7_19, 16, 1, 0}, +/* 20 */ { 3, s_7_20, -1, 1, 0}, +/* 21 */ { 5, s_7_21, 20, 1, 0}, +/* 22 */ { 5, s_7_22, 20, 1, 0}, +/* 23 */ { 3, s_7_23, -1, 1, 0}, +/* 24 */ { 6, s_7_24, -1, 1, 0}, +/* 25 */ { 6, s_7_25, -1, 1, 0}, +/* 26 */ { 3, s_7_26, -1, 1, 0}, +/* 27 */ { 4, s_7_27, -1, 1, 0}, +/* 28 */ { 4, s_7_28, -1, 1, 0}, +/* 29 */ { 4, s_7_29, -1, 1, 0}, +/* 30 */ { 4, s_7_30, -1, 1, 0}, +/* 31 */ { 4, s_7_31, -1, 1, 0}, +/* 32 */ { 4, s_7_32, -1, 1, 0}, +/* 33 */ { 4, s_7_33, -1, 1, 0}, +/* 34 */ { 3, s_7_34, -1, 1, 0}, +/* 35 */ { 3, s_7_35, -1, 1, 0}, +/* 36 */ { 6, s_7_36, -1, 1, 0}, +/* 37 */ { 6, s_7_37, -1, 1, 0}, +/* 38 */ { 3, s_7_38, -1, 1, 0}, +/* 39 */ { 3, s_7_39, -1, 1, 0}, +/* 40 */ { 3, s_7_40, -1, 1, 0}, +/* 41 */ { 3, s_7_41, -1, 1, 0}, +/* 42 */ { 4, s_7_42, -1, 1, 0}, +/* 43 */ { 4, s_7_43, -1, 1, 0}, +/* 44 */ { 4, s_7_44, -1, 1, 0}, +/* 45 */ { 4, s_7_45, -1, 1, 0}, +/* 46 */ { 4, s_7_46, -1, 1, 0}, +/* 47 */ { 5, s_7_47, -1, 1, 0}, +/* 48 */ { 5, s_7_48, -1, 1, 0}, +/* 49 */ { 5, s_7_49, -1, 1, 0}, +/* 50 */ { 5, s_7_50, -1, 1, 0}, +/* 51 */ { 5, s_7_51, -1, 1, 0}, +/* 52 */ { 6, s_7_52, -1, 1, 0}, +/* 53 */ { 4, s_7_53, -1, 1, 0}, +/* 54 */ { 4, s_7_54, -1, 1, 0}, +/* 55 */ { 6, s_7_55, 54, 1, 0}, +/* 56 */ { 6, s_7_56, 54, 1, 0}, +/* 57 */ { 4, s_7_57, -1, 1, 0}, +/* 58 */ { 3, s_7_58, -1, 1, 0}, +/* 59 */ { 6, s_7_59, 58, 1, 0}, +/* 60 */ { 5, s_7_60, 58, 1, 0}, +/* 61 */ { 5, s_7_61, 58, 1, 0}, +/* 62 */ { 5, s_7_62, 58, 1, 0}, +/* 63 */ { 6, s_7_63, -1, 1, 0}, +/* 64 */ { 6, s_7_64, -1, 1, 0}, +/* 65 */ { 3, s_7_65, -1, 1, 0}, +/* 66 */ { 6, s_7_66, 65, 1, 0}, +/* 67 */ { 5, s_7_67, 65, 1, 0}, +/* 68 */ { 5, s_7_68, 65, 1, 0}, +/* 69 */ { 5, s_7_69, 65, 1, 0}, +/* 70 */ { 8, s_7_70, -1, 1, 0}, +/* 71 */ { 8, s_7_71, -1, 1, 0}, +/* 72 */ { 6, s_7_72, -1, 1, 0}, +/* 73 */ { 6, s_7_73, -1, 1, 0}, +/* 74 */ { 6, s_7_74, -1, 1, 0}, +/* 75 */ { 3, s_7_75, -1, 1, 0}, +/* 76 */ { 3, s_7_76, -1, 1, 0}, +/* 77 */ { 3, s_7_77, -1, 1, 0}, +/* 78 */ { 3, s_7_78, -1, 1, 0}, +/* 79 */ { 3, s_7_79, -1, 1, 0}, +/* 80 */ { 3, s_7_80, -1, 1, 0}, +/* 81 */ { 2, s_7_81, -1, 1, 0}, +/* 82 */ { 2, s_7_82, -1, 1, 0}, +/* 83 */ { 3, s_7_83, -1, 1, 0}, +/* 84 */ { 3, s_7_84, -1, 1, 0}, +/* 85 */ { 3, s_7_85, -1, 1, 0}, +/* 86 */ { 3, s_7_86, -1, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2, 1 }; + +static const unsigned char g_AEIO[] = { 17, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 8, 2 }; + +static const unsigned char g_CG[] = { 17 }; + +static const symbol s_0[] = { 0xE0 }; +static const symbol s_1[] = { 0xE8 }; +static const symbol s_2[] = { 0xEC }; +static const symbol s_3[] = { 0xF2 }; +static const symbol s_4[] = { 0xF9 }; +static const symbol s_5[] = { 'q', 'U' }; +static const symbol s_6[] = { 'u' }; +static const symbol s_7[] = { 'U' }; +static const symbol s_8[] = { 'i' }; +static const symbol s_9[] = { 'I' }; +static const symbol s_10[] = { 'i' }; +static const symbol s_11[] = { 'u' }; +static const symbol s_12[] = { 'e' }; +static const symbol s_13[] = { 'i', 'c' }; +static const symbol s_14[] = { 'l', 'o', 'g' }; +static const symbol s_15[] = { 'u' }; +static const symbol s_16[] = { 'e', 'n', 't', 'e' }; +static const symbol s_17[] = { 'a', 't' }; +static const symbol s_18[] = { 'a', 't' }; +static const symbol s_19[] = { 'i', 'c' }; +static const symbol s_20[] = { 'i' }; +static const symbol s_21[] = { 'h' }; + +static int r_prelude(struct SN_env * z) { + int among_var; + { int c_test = z->c; /* test, line 35 */ + while(1) { /* repeat, line 35 */ + int c1 = z->c; + z->bra = z->c; /* [, line 36 */ + among_var = find_among(z, a_0, 7); /* substring, line 36 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 36 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_0); /* <-, line 37 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_1); /* <-, line 38 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 1, s_2); /* <-, line 39 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 1, s_3); /* <-, line 40 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 1, s_4); /* <-, line 41 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 2, s_5); /* <-, line 42 */ + if (ret < 0) return ret; + } + break; + case 7: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 43 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + z->c = c_test; + } + while(1) { /* repeat, line 46 */ + int c2 = z->c; + while(1) { /* goto, line 46 */ + int c3 = z->c; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + z->bra = z->c; /* [, line 47 */ + { int c4 = z->c; /* or, line 47 */ + if (!(eq_s(z, 1, s_6))) goto lab4; + z->ket = z->c; /* ], line 47 */ + if (in_grouping(z, g_v, 97, 249, 0)) goto lab4; + { int ret = slice_from_s(z, 1, s_7); /* <-, line 47 */ + if (ret < 0) return ret; + } + goto lab3; + lab4: + z->c = c4; + if (!(eq_s(z, 1, s_8))) goto lab2; + z->ket = z->c; /* ], line 48 */ + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { int ret = slice_from_s(z, 1, s_9); /* <-, line 48 */ + if (ret < 0) return ret; + } + } + lab3: + z->c = c3; + break; + lab2: + z->c = c3; + if (z->c >= z->l) goto lab1; + z->c++; /* goto, line 46 */ + } + continue; + lab1: + z->c = c2; + break; + } + return 1; +} + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + z->I[1] = z->l; + z->I[2] = z->l; + { int c1 = z->c; /* do, line 58 */ + { int c2 = z->c; /* or, line 60 */ + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { int c3 = z->c; /* or, line 59 */ + if (out_grouping(z, g_v, 97, 249, 0)) goto lab4; + { /* gopast */ /* grouping v, line 59 */ + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + goto lab3; + lab4: + z->c = c3; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab2; + { /* gopast */ /* non v, line 59 */ + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab2; + z->c += ret; + } + } + lab3: + goto lab1; + lab2: + z->c = c2; + if (out_grouping(z, g_v, 97, 249, 0)) goto lab0; + { int c4 = z->c; /* or, line 61 */ + if (out_grouping(z, g_v, 97, 249, 0)) goto lab6; + { /* gopast */ /* grouping v, line 61 */ + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab6; + z->c += ret; + } + goto lab5; + lab6: + z->c = c4; + if (in_grouping(z, g_v, 97, 249, 0)) goto lab0; + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 61 */ + } + lab5: + ; + } + lab1: + z->I[0] = z->c; /* setmark pV, line 62 */ + lab0: + z->c = c1; + } + { int c5 = z->c; /* do, line 64 */ + { /* gopast */ /* grouping v, line 65 */ + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { /* gopast */ /* non v, line 65 */ + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[1] = z->c; /* setmark p1, line 65 */ + { /* gopast */ /* grouping v, line 66 */ + int ret = out_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + { /* gopast */ /* non v, line 66 */ + int ret = in_grouping(z, g_v, 97, 249, 1); + if (ret < 0) goto lab7; + z->c += ret; + } + z->I[2] = z->c; /* setmark p2, line 66 */ + lab7: + z->c = c5; + } + return 1; +} + +static int r_postlude(struct SN_env * z) { + int among_var; + while(1) { /* repeat, line 70 */ + int c1 = z->c; + z->bra = z->c; /* [, line 72 */ + if (z->c >= z->l || (z->p[z->c + 0] != 73 && z->p[z->c + 0] != 85)) among_var = 3; else + among_var = find_among(z, a_1, 3); /* substring, line 72 */ + if (!(among_var)) goto lab0; + z->ket = z->c; /* ], line 72 */ + switch(among_var) { + case 0: goto lab0; + case 1: + { int ret = slice_from_s(z, 1, s_10); /* <-, line 73 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_11); /* <-, line 74 */ + if (ret < 0) return ret; + } + break; + case 3: + if (z->c >= z->l) goto lab0; + z->c++; /* next, line 75 */ + break; + } + continue; + lab0: + z->c = c1; + break; + } + return 1; +} + +static int r_RV(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[2] <= z->c)) return 0; + return 1; +} + +static int r_attached_pronoun(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 87 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((33314 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + if (!(find_among_b(z, a_2, 37))) return 0; /* substring, line 87 */ + z->bra = z->c; /* ], line 87 */ + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 111 && z->p[z->c - 1] != 114)) return 0; + among_var = find_among_b(z, a_3, 5); /* among, line 97 */ + if (!(among_var)) return 0; + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 97 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 98 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_12); /* <-, line 99 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_standard_suffix(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 104 */ + among_var = find_among_b(z, a_6, 51); /* substring, line 104 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 104 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 111 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 111 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 113 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 113 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 114 */ + z->ket = z->c; /* [, line 114 */ + if (!(eq_s_b(z, 2, s_13))) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 114 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab0; } /* call R2, line 114 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 114 */ + if (ret < 0) return ret; + } + lab0: + ; + } + break; + case 3: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 117 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 3, s_14); /* <-, line 117 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 119 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 1, s_15); /* <-, line 119 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 121 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 4, s_16); /* <-, line 121 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = r_RV(z); + if (ret == 0) return 0; /* call RV, line 123 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 123 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 125 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 125 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 126 */ + z->ket = z->c; /* [, line 127 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4722696 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - m_keep; goto lab1; } + among_var = find_among_b(z, a_4, 4); /* substring, line 127 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab1; } + z->bra = z->c; /* ], line 127 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab1; } /* call R2, line 127 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 127 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab1; } + case 1: + z->ket = z->c; /* [, line 128 */ + if (!(eq_s_b(z, 2, s_17))) { z->c = z->l - m_keep; goto lab1; } + z->bra = z->c; /* ], line 128 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab1; } /* call R2, line 128 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 128 */ + if (ret < 0) return ret; + } + break; + } + lab1: + ; + } + break; + case 8: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 134 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 134 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 135 */ + z->ket = z->c; /* [, line 136 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4198408 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->c = z->l - m_keep; goto lab2; } + among_var = find_among_b(z, a_5, 3); /* substring, line 136 */ + if (!(among_var)) { z->c = z->l - m_keep; goto lab2; } + z->bra = z->c; /* ], line 136 */ + switch(among_var) { + case 0: { z->c = z->l - m_keep; goto lab2; } + case 1: + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab2; } /* call R2, line 137 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 137 */ + if (ret < 0) return ret; + } + break; + } + lab2: + ; + } + break; + case 9: + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 142 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 142 */ + if (ret < 0) return ret; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 143 */ + z->ket = z->c; /* [, line 143 */ + if (!(eq_s_b(z, 2, s_18))) { z->c = z->l - m_keep; goto lab3; } + z->bra = z->c; /* ], line 143 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 143 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 143 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 143 */ + if (!(eq_s_b(z, 2, s_19))) { z->c = z->l - m_keep; goto lab3; } + z->bra = z->c; /* ], line 143 */ + { int ret = r_R2(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab3; } /* call R2, line 143 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 143 */ + if (ret < 0) return ret; + } + lab3: + ; + } + break; + } + return 1; +} + +static int r_verb_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 148 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 148 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 149 */ + among_var = find_among_b(z, a_7, 87); /* substring, line 149 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 149 */ + switch(among_var) { + case 0: { z->lb = mlimit; return 0; } + case 1: + { int ret = slice_del(z); /* delete, line 163 */ + if (ret < 0) return ret; + } + break; + } + z->lb = mlimit; + } + return 1; +} + +static int r_vowel_suffix(struct SN_env * z) { + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 171 */ + z->ket = z->c; /* [, line 172 */ + if (in_grouping_b(z, g_AEIO, 97, 242, 0)) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 172 */ + { int ret = r_RV(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab0; } /* call RV, line 172 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 172 */ + if (ret < 0) return ret; + } + z->ket = z->c; /* [, line 173 */ + if (!(eq_s_b(z, 1, s_20))) { z->c = z->l - m_keep; goto lab0; } + z->bra = z->c; /* ], line 173 */ + { int ret = r_RV(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab0; } /* call RV, line 173 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 173 */ + if (ret < 0) return ret; + } + lab0: + ; + } + { int m_keep = z->l - z->c;/* (void) m_keep;*/ /* try, line 175 */ + z->ket = z->c; /* [, line 176 */ + if (!(eq_s_b(z, 1, s_21))) { z->c = z->l - m_keep; goto lab1; } + z->bra = z->c; /* ], line 176 */ + if (in_grouping_b(z, g_CG, 99, 103, 0)) { z->c = z->l - m_keep; goto lab1; } + { int ret = r_RV(z); + if (ret == 0) { z->c = z->l - m_keep; goto lab1; } /* call RV, line 176 */ + if (ret < 0) return ret; + } + { int ret = slice_del(z); /* delete, line 176 */ + if (ret < 0) return ret; + } + lab1: + ; + } + return 1; +} + +extern int italian_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 182 */ + { int ret = r_prelude(z); + if (ret == 0) goto lab0; /* call prelude, line 182 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 183 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab1; /* call mark_regions, line 183 */ + if (ret < 0) return ret; + } + lab1: + z->c = c2; + } + z->lb = z->c; z->c = z->l; /* backwards, line 184 */ + + { int m3 = z->l - z->c; (void)m3; /* do, line 185 */ + { int ret = r_attached_pronoun(z); + if (ret == 0) goto lab2; /* call attached_pronoun, line 185 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 186 */ + { int m5 = z->l - z->c; (void)m5; /* or, line 186 */ + { int ret = r_standard_suffix(z); + if (ret == 0) goto lab5; /* call standard_suffix, line 186 */ + if (ret < 0) return ret; + } + goto lab4; + lab5: + z->c = z->l - m5; + { int ret = r_verb_suffix(z); + if (ret == 0) goto lab3; /* call verb_suffix, line 186 */ + if (ret < 0) return ret; + } + } + lab4: + lab3: + z->c = z->l - m4; + } + { int m6 = z->l - z->c; (void)m6; /* do, line 187 */ + { int ret = r_vowel_suffix(z); + if (ret == 0) goto lab6; /* call vowel_suffix, line 187 */ + if (ret < 0) return ret; + } + lab6: + z->c = z->l - m6; + } + z->c = z->lb; + { int c7 = z->c; /* do, line 189 */ + { int ret = r_postlude(z); + if (ret == 0) goto lab7; /* call postlude, line 189 */ + if (ret < 0) return ret; + } + lab7: + z->c = c7; + } + return 1; +} + +extern struct SN_env * italian_ISO_8859_1_create_env(void) { return SN_create_env(0, 3, 0); } + +extern void italian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c new file mode 100644 index 00000000000..2debf1082d8 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c @@ -0,0 +1,297 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int norwegian_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_other_suffix(struct SN_env * z); +static int r_consonant_pair(struct SN_env * z); +static int r_main_suffix(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void); +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 'a' }; +static const symbol s_0_1[1] = { 'e' }; +static const symbol s_0_2[3] = { 'e', 'd', 'e' }; +static const symbol s_0_3[4] = { 'a', 'n', 'd', 'e' }; +static const symbol s_0_4[4] = { 'e', 'n', 'd', 'e' }; +static const symbol s_0_5[3] = { 'a', 'n', 'e' }; +static const symbol s_0_6[3] = { 'e', 'n', 'e' }; +static const symbol s_0_7[6] = { 'h', 'e', 't', 'e', 'n', 'e' }; +static const symbol s_0_8[4] = { 'e', 'r', 't', 'e' }; +static const symbol s_0_9[2] = { 'e', 'n' }; +static const symbol s_0_10[5] = { 'h', 'e', 't', 'e', 'n' }; +static const symbol s_0_11[2] = { 'a', 'r' }; +static const symbol s_0_12[2] = { 'e', 'r' }; +static const symbol s_0_13[5] = { 'h', 'e', 't', 'e', 'r' }; +static const symbol s_0_14[1] = { 's' }; +static const symbol s_0_15[2] = { 'a', 's' }; +static const symbol s_0_16[2] = { 'e', 's' }; +static const symbol s_0_17[4] = { 'e', 'd', 'e', 's' }; +static const symbol s_0_18[5] = { 'e', 'n', 'd', 'e', 's' }; +static const symbol s_0_19[4] = { 'e', 'n', 'e', 's' }; +static const symbol s_0_20[7] = { 'h', 'e', 't', 'e', 'n', 'e', 's' }; +static const symbol s_0_21[3] = { 'e', 'n', 's' }; +static const symbol s_0_22[6] = { 'h', 'e', 't', 'e', 'n', 's' }; +static const symbol s_0_23[3] = { 'e', 'r', 's' }; +static const symbol s_0_24[3] = { 'e', 't', 's' }; +static const symbol s_0_25[2] = { 'e', 't' }; +static const symbol s_0_26[3] = { 'h', 'e', 't' }; +static const symbol s_0_27[3] = { 'e', 'r', 't' }; +static const symbol s_0_28[3] = { 'a', 's', 't' }; + +static const struct among a_0[29] = +{ +/* 0 */ { 1, s_0_0, -1, 1, 0}, +/* 1 */ { 1, s_0_1, -1, 1, 0}, +/* 2 */ { 3, s_0_2, 1, 1, 0}, +/* 3 */ { 4, s_0_3, 1, 1, 0}, +/* 4 */ { 4, s_0_4, 1, 1, 0}, +/* 5 */ { 3, s_0_5, 1, 1, 0}, +/* 6 */ { 3, s_0_6, 1, 1, 0}, +/* 7 */ { 6, s_0_7, 6, 1, 0}, +/* 8 */ { 4, s_0_8, 1, 3, 0}, +/* 9 */ { 2, s_0_9, -1, 1, 0}, +/* 10 */ { 5, s_0_10, 9, 1, 0}, +/* 11 */ { 2, s_0_11, -1, 1, 0}, +/* 12 */ { 2, s_0_12, -1, 1, 0}, +/* 13 */ { 5, s_0_13, 12, 1, 0}, +/* 14 */ { 1, s_0_14, -1, 2, 0}, +/* 15 */ { 2, s_0_15, 14, 1, 0}, +/* 16 */ { 2, s_0_16, 14, 1, 0}, +/* 17 */ { 4, s_0_17, 16, 1, 0}, +/* 18 */ { 5, s_0_18, 16, 1, 0}, +/* 19 */ { 4, s_0_19, 16, 1, 0}, +/* 20 */ { 7, s_0_20, 19, 1, 0}, +/* 21 */ { 3, s_0_21, 14, 1, 0}, +/* 22 */ { 6, s_0_22, 21, 1, 0}, +/* 23 */ { 3, s_0_23, 14, 1, 0}, +/* 24 */ { 3, s_0_24, 14, 1, 0}, +/* 25 */ { 2, s_0_25, -1, 1, 0}, +/* 26 */ { 3, s_0_26, 25, 1, 0}, +/* 27 */ { 3, s_0_27, -1, 3, 0}, +/* 28 */ { 3, s_0_28, -1, 1, 0} +}; + +static const symbol s_1_0[2] = { 'd', 't' }; +static const symbol s_1_1[2] = { 'v', 't' }; + +static const struct among a_1[2] = +{ +/* 0 */ { 2, s_1_0, -1, -1, 0}, +/* 1 */ { 2, s_1_1, -1, -1, 0} +}; + +static const symbol s_2_0[3] = { 'l', 'e', 'g' }; +static const symbol s_2_1[4] = { 'e', 'l', 'e', 'g' }; +static const symbol s_2_2[2] = { 'i', 'g' }; +static const symbol s_2_3[3] = { 'e', 'i', 'g' }; +static const symbol s_2_4[3] = { 'l', 'i', 'g' }; +static const symbol s_2_5[4] = { 'e', 'l', 'i', 'g' }; +static const symbol s_2_6[3] = { 'e', 'l', 's' }; +static const symbol s_2_7[3] = { 'l', 'o', 'v' }; +static const symbol s_2_8[4] = { 'e', 'l', 'o', 'v' }; +static const symbol s_2_9[4] = { 's', 'l', 'o', 'v' }; +static const symbol s_2_10[7] = { 'h', 'e', 't', 's', 'l', 'o', 'v' }; + +static const struct among a_2[11] = +{ +/* 0 */ { 3, s_2_0, -1, 1, 0}, +/* 1 */ { 4, s_2_1, 0, 1, 0}, +/* 2 */ { 2, s_2_2, -1, 1, 0}, +/* 3 */ { 3, s_2_3, 2, 1, 0}, +/* 4 */ { 3, s_2_4, 2, 1, 0}, +/* 5 */ { 4, s_2_5, 4, 1, 0}, +/* 6 */ { 3, s_2_6, -1, 1, 0}, +/* 7 */ { 3, s_2_7, -1, 1, 0}, +/* 8 */ { 4, s_2_8, 7, 1, 0}, +/* 9 */ { 4, s_2_9, 7, 1, 0}, +/* 10 */ { 7, s_2_10, 9, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 128 }; + +static const unsigned char g_s_ending[] = { 119, 125, 149, 1 }; + +static const symbol s_0[] = { 'k' }; +static const symbol s_1[] = { 'e', 'r' }; + +static int r_mark_regions(struct SN_env * z) { + z->I[0] = z->l; + { int c_test = z->c; /* test, line 30 */ + { int ret = z->c + 3; + if (0 > ret || ret > z->l) return 0; + z->c = ret; /* hop, line 30 */ + } + z->I[1] = z->c; /* setmark x, line 30 */ + z->c = c_test; + } + if (out_grouping(z, g_v, 97, 248, 1) < 0) return 0; /* goto */ /* grouping v, line 31 */ + { /* gopast */ /* non v, line 31 */ + int ret = in_grouping(z, g_v, 97, 248, 1); + if (ret < 0) return 0; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 31 */ + /* try, line 32 */ + if (!(z->I[0] < z->I[1])) goto lab0; + z->I[0] = z->I[1]; +lab0: + return 1; +} + +static int r_main_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 38 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 38 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 38 */ + if (z->c <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((1851426 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_0, 29); /* substring, line 38 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 38 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 44 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m2 = z->l - z->c; (void)m2; /* or, line 46 */ + if (in_grouping_b(z, g_s_ending, 98, 122, 0)) goto lab1; + goto lab0; + lab1: + z->c = z->l - m2; + if (!(eq_s_b(z, 1, s_0))) return 0; + if (out_grouping_b(z, g_v, 97, 248, 0)) return 0; + } + lab0: + { int ret = slice_del(z); /* delete, line 46 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 2, s_1); /* <-, line 48 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_consonant_pair(struct SN_env * z) { + { int m_test = z->l - z->c; /* test, line 53 */ + { int mlimit; /* setlimit, line 54 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 54 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 54 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] != 116) { z->lb = mlimit; return 0; } + if (!(find_among_b(z, a_1, 2))) { z->lb = mlimit; return 0; } /* substring, line 54 */ + z->bra = z->c; /* ], line 54 */ + z->lb = mlimit; + } + z->c = z->l - m_test; + } + if (z->c <= z->lb) return 0; + z->c--; /* next, line 59 */ + z->bra = z->c; /* ], line 59 */ + { int ret = slice_del(z); /* delete, line 59 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_other_suffix(struct SN_env * z) { + int among_var; + { int mlimit; /* setlimit, line 63 */ + int m1 = z->l - z->c; (void)m1; + if (z->c < z->I[0]) return 0; + z->c = z->I[0]; /* tomark, line 63 */ + mlimit = z->lb; z->lb = z->c; + z->c = z->l - m1; + z->ket = z->c; /* [, line 63 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((4718720 >> (z->p[z->c - 1] & 0x1f)) & 1)) { z->lb = mlimit; return 0; } + among_var = find_among_b(z, a_2, 11); /* substring, line 63 */ + if (!(among_var)) { z->lb = mlimit; return 0; } + z->bra = z->c; /* ], line 63 */ + z->lb = mlimit; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 67 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +extern int norwegian_ISO_8859_1_stem(struct SN_env * z) { + { int c1 = z->c; /* do, line 74 */ + { int ret = r_mark_regions(z); + if (ret == 0) goto lab0; /* call mark_regions, line 74 */ + if (ret < 0) return ret; + } + lab0: + z->c = c1; + } + z->lb = z->c; z->c = z->l; /* backwards, line 75 */ + + { int m2 = z->l - z->c; (void)m2; /* do, line 76 */ + { int ret = r_main_suffix(z); + if (ret == 0) goto lab1; /* call main_suffix, line 76 */ + if (ret < 0) return ret; + } + lab1: + z->c = z->l - m2; + } + { int m3 = z->l - z->c; (void)m3; /* do, line 77 */ + { int ret = r_consonant_pair(z); + if (ret == 0) goto lab2; /* call consonant_pair, line 77 */ + if (ret < 0) return ret; + } + lab2: + z->c = z->l - m3; + } + { int m4 = z->l - z->c; (void)m4; /* do, line 78 */ + { int ret = r_other_suffix(z); + if (ret == 0) goto lab3; /* call other_suffix, line 78 */ + if (ret < 0) return ret; + } + lab3: + z->c = z->l - m4; + } + z->c = z->lb; + return 1; +} + +extern struct SN_env * norwegian_ISO_8859_1_create_env(void) { return SN_create_env(0, 2, 0); } + +extern void norwegian_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c new file mode 100644 index 00000000000..69e4fc4c1f2 --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c @@ -0,0 +1,749 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int porter_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_Step_5b(struct SN_env * z); +static int r_Step_5a(struct SN_env * z); +static int r_Step_4(struct SN_env * z); +static int r_Step_3(struct SN_env * z); +static int r_Step_2(struct SN_env * z); +static int r_Step_1c(struct SN_env * z); +static int r_Step_1b(struct SN_env * z); +static int r_Step_1a(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_shortv(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * porter_ISO_8859_1_create_env(void); +extern void porter_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_0[1] = { 's' }; +static const symbol s_0_1[3] = { 'i', 'e', 's' }; +static const symbol s_0_2[4] = { 's', 's', 'e', 's' }; +static const symbol s_0_3[2] = { 's', 's' }; + +static const struct among a_0[4] = +{ +/* 0 */ { 1, s_0_0, -1, 3, 0}, +/* 1 */ { 3, s_0_1, 0, 2, 0}, +/* 2 */ { 4, s_0_2, 0, 1, 0}, +/* 3 */ { 2, s_0_3, 0, -1, 0} +}; + +static const symbol s_1_1[2] = { 'b', 'b' }; +static const symbol s_1_2[2] = { 'd', 'd' }; +static const symbol s_1_3[2] = { 'f', 'f' }; +static const symbol s_1_4[2] = { 'g', 'g' }; +static const symbol s_1_5[2] = { 'b', 'l' }; +static const symbol s_1_6[2] = { 'm', 'm' }; +static const symbol s_1_7[2] = { 'n', 'n' }; +static const symbol s_1_8[2] = { 'p', 'p' }; +static const symbol s_1_9[2] = { 'r', 'r' }; +static const symbol s_1_10[2] = { 'a', 't' }; +static const symbol s_1_11[2] = { 't', 't' }; +static const symbol s_1_12[2] = { 'i', 'z' }; + +static const struct among a_1[13] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 2, s_1_1, 0, 2, 0}, +/* 2 */ { 2, s_1_2, 0, 2, 0}, +/* 3 */ { 2, s_1_3, 0, 2, 0}, +/* 4 */ { 2, s_1_4, 0, 2, 0}, +/* 5 */ { 2, s_1_5, 0, 1, 0}, +/* 6 */ { 2, s_1_6, 0, 2, 0}, +/* 7 */ { 2, s_1_7, 0, 2, 0}, +/* 8 */ { 2, s_1_8, 0, 2, 0}, +/* 9 */ { 2, s_1_9, 0, 2, 0}, +/* 10 */ { 2, s_1_10, 0, 1, 0}, +/* 11 */ { 2, s_1_11, 0, 2, 0}, +/* 12 */ { 2, s_1_12, 0, 1, 0} +}; + +static const symbol s_2_0[2] = { 'e', 'd' }; +static const symbol s_2_1[3] = { 'e', 'e', 'd' }; +static const symbol s_2_2[3] = { 'i', 'n', 'g' }; + +static const struct among a_2[3] = +{ +/* 0 */ { 2, s_2_0, -1, 2, 0}, +/* 1 */ { 3, s_2_1, 0, 1, 0}, +/* 2 */ { 3, s_2_2, -1, 2, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 'c', 'i' }; +static const symbol s_3_1[4] = { 'e', 'n', 'c', 'i' }; +static const symbol s_3_2[4] = { 'a', 'b', 'l', 'i' }; +static const symbol s_3_3[3] = { 'e', 'l', 'i' }; +static const symbol s_3_4[4] = { 'a', 'l', 'l', 'i' }; +static const symbol s_3_5[5] = { 'o', 'u', 's', 'l', 'i' }; +static const symbol s_3_6[5] = { 'e', 'n', 't', 'l', 'i' }; +static const symbol s_3_7[5] = { 'a', 'l', 'i', 't', 'i' }; +static const symbol s_3_8[6] = { 'b', 'i', 'l', 'i', 't', 'i' }; +static const symbol s_3_9[5] = { 'i', 'v', 'i', 't', 'i' }; +static const symbol s_3_10[6] = { 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_11[7] = { 'a', 't', 'i', 'o', 'n', 'a', 'l' }; +static const symbol s_3_12[5] = { 'a', 'l', 'i', 's', 'm' }; +static const symbol s_3_13[5] = { 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_14[7] = { 'i', 'z', 'a', 't', 'i', 'o', 'n' }; +static const symbol s_3_15[4] = { 'i', 'z', 'e', 'r' }; +static const symbol s_3_16[4] = { 'a', 't', 'o', 'r' }; +static const symbol s_3_17[7] = { 'i', 'v', 'e', 'n', 'e', 's', 's' }; +static const symbol s_3_18[7] = { 'f', 'u', 'l', 'n', 'e', 's', 's' }; +static const symbol s_3_19[7] = { 'o', 'u', 's', 'n', 'e', 's', 's' }; + +static const struct among a_3[20] = +{ +/* 0 */ { 4, s_3_0, -1, 3, 0}, +/* 1 */ { 4, s_3_1, -1, 2, 0}, +/* 2 */ { 4, s_3_2, -1, 4, 0}, +/* 3 */ { 3, s_3_3, -1, 6, 0}, +/* 4 */ { 4, s_3_4, -1, 9, 0}, +/* 5 */ { 5, s_3_5, -1, 12, 0}, +/* 6 */ { 5, s_3_6, -1, 5, 0}, +/* 7 */ { 5, s_3_7, -1, 10, 0}, +/* 8 */ { 6, s_3_8, -1, 14, 0}, +/* 9 */ { 5, s_3_9, -1, 13, 0}, +/* 10 */ { 6, s_3_10, -1, 1, 0}, +/* 11 */ { 7, s_3_11, 10, 8, 0}, +/* 12 */ { 5, s_3_12, -1, 10, 0}, +/* 13 */ { 5, s_3_13, -1, 8, 0}, +/* 14 */ { 7, s_3_14, 13, 7, 0}, +/* 15 */ { 4, s_3_15, -1, 7, 0}, +/* 16 */ { 4, s_3_16, -1, 8, 0}, +/* 17 */ { 7, s_3_17, -1, 13, 0}, +/* 18 */ { 7, s_3_18, -1, 11, 0}, +/* 19 */ { 7, s_3_19, -1, 12, 0} +}; + +static const symbol s_4_0[5] = { 'i', 'c', 'a', 't', 'e' }; +static const symbol s_4_1[5] = { 'a', 't', 'i', 'v', 'e' }; +static const symbol s_4_2[5] = { 'a', 'l', 'i', 'z', 'e' }; +static const symbol s_4_3[5] = { 'i', 'c', 'i', 't', 'i' }; +static const symbol s_4_4[4] = { 'i', 'c', 'a', 'l' }; +static const symbol s_4_5[3] = { 'f', 'u', 'l' }; +static const symbol s_4_6[4] = { 'n', 'e', 's', 's' }; + +static const struct among a_4[7] = +{ +/* 0 */ { 5, s_4_0, -1, 2, 0}, +/* 1 */ { 5, s_4_1, -1, 3, 0}, +/* 2 */ { 5, s_4_2, -1, 1, 0}, +/* 3 */ { 5, s_4_3, -1, 2, 0}, +/* 4 */ { 4, s_4_4, -1, 2, 0}, +/* 5 */ { 3, s_4_5, -1, 3, 0}, +/* 6 */ { 4, s_4_6, -1, 3, 0} +}; + +static const symbol s_5_0[2] = { 'i', 'c' }; +static const symbol s_5_1[4] = { 'a', 'n', 'c', 'e' }; +static const symbol s_5_2[4] = { 'e', 'n', 'c', 'e' }; +static const symbol s_5_3[4] = { 'a', 'b', 'l', 'e' }; +static const symbol s_5_4[4] = { 'i', 'b', 'l', 'e' }; +static const symbol s_5_5[3] = { 'a', 't', 'e' }; +static const symbol s_5_6[3] = { 'i', 'v', 'e' }; +static const symbol s_5_7[3] = { 'i', 'z', 'e' }; +static const symbol s_5_8[3] = { 'i', 't', 'i' }; +static const symbol s_5_9[2] = { 'a', 'l' }; +static const symbol s_5_10[3] = { 'i', 's', 'm' }; +static const symbol s_5_11[3] = { 'i', 'o', 'n' }; +static const symbol s_5_12[2] = { 'e', 'r' }; +static const symbol s_5_13[3] = { 'o', 'u', 's' }; +static const symbol s_5_14[3] = { 'a', 'n', 't' }; +static const symbol s_5_15[3] = { 'e', 'n', 't' }; +static const symbol s_5_16[4] = { 'm', 'e', 'n', 't' }; +static const symbol s_5_17[5] = { 'e', 'm', 'e', 'n', 't' }; +static const symbol s_5_18[2] = { 'o', 'u' }; + +static const struct among a_5[19] = +{ +/* 0 */ { 2, s_5_0, -1, 1, 0}, +/* 1 */ { 4, s_5_1, -1, 1, 0}, +/* 2 */ { 4, s_5_2, -1, 1, 0}, +/* 3 */ { 4, s_5_3, -1, 1, 0}, +/* 4 */ { 4, s_5_4, -1, 1, 0}, +/* 5 */ { 3, s_5_5, -1, 1, 0}, +/* 6 */ { 3, s_5_6, -1, 1, 0}, +/* 7 */ { 3, s_5_7, -1, 1, 0}, +/* 8 */ { 3, s_5_8, -1, 1, 0}, +/* 9 */ { 2, s_5_9, -1, 1, 0}, +/* 10 */ { 3, s_5_10, -1, 1, 0}, +/* 11 */ { 3, s_5_11, -1, 2, 0}, +/* 12 */ { 2, s_5_12, -1, 1, 0}, +/* 13 */ { 3, s_5_13, -1, 1, 0}, +/* 14 */ { 3, s_5_14, -1, 1, 0}, +/* 15 */ { 3, s_5_15, -1, 1, 0}, +/* 16 */ { 4, s_5_16, 15, 1, 0}, +/* 17 */ { 5, s_5_17, 16, 1, 0}, +/* 18 */ { 2, s_5_18, -1, 1, 0} +}; + +static const unsigned char g_v[] = { 17, 65, 16, 1 }; + +static const unsigned char g_v_WXY[] = { 1, 17, 65, 208, 1 }; + +static const symbol s_0[] = { 's', 's' }; +static const symbol s_1[] = { 'i' }; +static const symbol s_2[] = { 'e', 'e' }; +static const symbol s_3[] = { 'e' }; +static const symbol s_4[] = { 'e' }; +static const symbol s_5[] = { 'y' }; +static const symbol s_6[] = { 'Y' }; +static const symbol s_7[] = { 'i' }; +static const symbol s_8[] = { 't', 'i', 'o', 'n' }; +static const symbol s_9[] = { 'e', 'n', 'c', 'e' }; +static const symbol s_10[] = { 'a', 'n', 'c', 'e' }; +static const symbol s_11[] = { 'a', 'b', 'l', 'e' }; +static const symbol s_12[] = { 'e', 'n', 't' }; +static const symbol s_13[] = { 'e' }; +static const symbol s_14[] = { 'i', 'z', 'e' }; +static const symbol s_15[] = { 'a', 't', 'e' }; +static const symbol s_16[] = { 'a', 'l' }; +static const symbol s_17[] = { 'a', 'l' }; +static const symbol s_18[] = { 'f', 'u', 'l' }; +static const symbol s_19[] = { 'o', 'u', 's' }; +static const symbol s_20[] = { 'i', 'v', 'e' }; +static const symbol s_21[] = { 'b', 'l', 'e' }; +static const symbol s_22[] = { 'a', 'l' }; +static const symbol s_23[] = { 'i', 'c' }; +static const symbol s_24[] = { 's' }; +static const symbol s_25[] = { 't' }; +static const symbol s_26[] = { 'e' }; +static const symbol s_27[] = { 'l' }; +static const symbol s_28[] = { 'l' }; +static const symbol s_29[] = { 'y' }; +static const symbol s_30[] = { 'Y' }; +static const symbol s_31[] = { 'y' }; +static const symbol s_32[] = { 'Y' }; +static const symbol s_33[] = { 'Y' }; +static const symbol s_34[] = { 'y' }; + +static int r_shortv(struct SN_env * z) { + if (out_grouping_b(z, g_v_WXY, 89, 121, 0)) return 0; + if (in_grouping_b(z, g_v, 97, 121, 0)) return 0; + if (out_grouping_b(z, g_v, 97, 121, 0)) return 0; + return 1; +} + +static int r_R1(struct SN_env * z) { + if (!(z->I[0] <= z->c)) return 0; + return 1; +} + +static int r_R2(struct SN_env * z) { + if (!(z->I[1] <= z->c)) return 0; + return 1; +} + +static int r_Step_1a(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 25 */ + if (z->c <= z->lb || z->p[z->c - 1] != 115) return 0; + among_var = find_among_b(z, a_0, 4); /* substring, line 25 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 25 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 2, s_0); /* <-, line 26 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 1, s_1); /* <-, line 27 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 29 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_1b(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 34 */ + if (z->c - 1 <= z->lb || (z->p[z->c - 1] != 100 && z->p[z->c - 1] != 103)) return 0; + among_var = find_among_b(z, a_2, 3); /* substring, line 34 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 34 */ + switch(among_var) { + case 0: return 0; + case 1: + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 35 */ + if (ret < 0) return ret; + } + { int ret = slice_from_s(z, 2, s_2); /* <-, line 35 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m_test = z->l - z->c; /* test, line 38 */ + { /* gopast */ /* grouping v, line 38 */ + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + z->c = z->l - m_test; + } + { int ret = slice_del(z); /* delete, line 38 */ + if (ret < 0) return ret; + } + { int m_test = z->l - z->c; /* test, line 39 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((68514004 >> (z->p[z->c - 1] & 0x1f)) & 1)) among_var = 3; else + among_var = find_among_b(z, a_1, 13); /* substring, line 39 */ + if (!(among_var)) return 0; + z->c = z->l - m_test; + } + switch(among_var) { + case 0: return 0; + case 1: + { int c_keep = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_3); /* <+, line 41 */ + z->c = c_keep; + if (ret < 0) return ret; + } + break; + case 2: + z->ket = z->c; /* [, line 44 */ + if (z->c <= z->lb) return 0; + z->c--; /* next, line 44 */ + z->bra = z->c; /* ], line 44 */ + { int ret = slice_del(z); /* delete, line 44 */ + if (ret < 0) return ret; + } + break; + case 3: + if (z->c != z->I[0]) return 0; /* atmark, line 45 */ + { int m_test = z->l - z->c; /* test, line 45 */ + { int ret = r_shortv(z); + if (ret == 0) return 0; /* call shortv, line 45 */ + if (ret < 0) return ret; + } + z->c = z->l - m_test; + } + { int c_keep = z->c; + int ret = insert_s(z, z->c, z->c, 1, s_4); /* <+, line 45 */ + z->c = c_keep; + if (ret < 0) return ret; + } + break; + } + break; + } + return 1; +} + +static int r_Step_1c(struct SN_env * z) { + z->ket = z->c; /* [, line 52 */ + { int m1 = z->l - z->c; (void)m1; /* or, line 52 */ + if (!(eq_s_b(z, 1, s_5))) goto lab1; + goto lab0; + lab1: + z->c = z->l - m1; + if (!(eq_s_b(z, 1, s_6))) return 0; + } +lab0: + z->bra = z->c; /* ], line 52 */ + { /* gopast */ /* grouping v, line 53 */ + int ret = out_grouping_b(z, g_v, 97, 121, 1); + if (ret < 0) return 0; + z->c -= ret; + } + { int ret = slice_from_s(z, 1, s_7); /* <-, line 54 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_2(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 58 */ + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((815616 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_3, 20); /* substring, line 58 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 58 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 58 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 4, s_8); /* <-, line 59 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 4, s_9); /* <-, line 60 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_from_s(z, 4, s_10); /* <-, line 61 */ + if (ret < 0) return ret; + } + break; + case 4: + { int ret = slice_from_s(z, 4, s_11); /* <-, line 62 */ + if (ret < 0) return ret; + } + break; + case 5: + { int ret = slice_from_s(z, 3, s_12); /* <-, line 63 */ + if (ret < 0) return ret; + } + break; + case 6: + { int ret = slice_from_s(z, 1, s_13); /* <-, line 64 */ + if (ret < 0) return ret; + } + break; + case 7: + { int ret = slice_from_s(z, 3, s_14); /* <-, line 66 */ + if (ret < 0) return ret; + } + break; + case 8: + { int ret = slice_from_s(z, 3, s_15); /* <-, line 68 */ + if (ret < 0) return ret; + } + break; + case 9: + { int ret = slice_from_s(z, 2, s_16); /* <-, line 69 */ + if (ret < 0) return ret; + } + break; + case 10: + { int ret = slice_from_s(z, 2, s_17); /* <-, line 71 */ + if (ret < 0) return ret; + } + break; + case 11: + { int ret = slice_from_s(z, 3, s_18); /* <-, line 72 */ + if (ret < 0) return ret; + } + break; + case 12: + { int ret = slice_from_s(z, 3, s_19); /* <-, line 74 */ + if (ret < 0) return ret; + } + break; + case 13: + { int ret = slice_from_s(z, 3, s_20); /* <-, line 76 */ + if (ret < 0) return ret; + } + break; + case 14: + { int ret = slice_from_s(z, 3, s_21); /* <-, line 77 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_3(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 82 */ + if (z->c - 2 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((528928 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_4, 7); /* substring, line 82 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 82 */ + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 82 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_from_s(z, 2, s_22); /* <-, line 83 */ + if (ret < 0) return ret; + } + break; + case 2: + { int ret = slice_from_s(z, 2, s_23); /* <-, line 85 */ + if (ret < 0) return ret; + } + break; + case 3: + { int ret = slice_del(z); /* delete, line 87 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_4(struct SN_env * z) { + int among_var; + z->ket = z->c; /* [, line 92 */ + if (z->c - 1 <= z->lb || z->p[z->c - 1] >> 5 != 3 || !((3961384 >> (z->p[z->c - 1] & 0x1f)) & 1)) return 0; + among_var = find_among_b(z, a_5, 19); /* substring, line 92 */ + if (!(among_var)) return 0; + z->bra = z->c; /* ], line 92 */ + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 92 */ + if (ret < 0) return ret; + } + switch(among_var) { + case 0: return 0; + case 1: + { int ret = slice_del(z); /* delete, line 95 */ + if (ret < 0) return ret; + } + break; + case 2: + { int m1 = z->l - z->c; (void)m1; /* or, line 96 */ + if (!(eq_s_b(z, 1, s_24))) goto lab1; + goto lab0; + lab1: + z->c = z->l - m1; + if (!(eq_s_b(z, 1, s_25))) return 0; + } + lab0: + { int ret = slice_del(z); /* delete, line 96 */ + if (ret < 0) return ret; + } + break; + } + return 1; +} + +static int r_Step_5a(struct SN_env * z) { + z->ket = z->c; /* [, line 101 */ + if (!(eq_s_b(z, 1, s_26))) return 0; + z->bra = z->c; /* ], line 101 */ + { int m1 = z->l - z->c; (void)m1; /* or, line 102 */ + { int ret = r_R2(z); + if (ret == 0) goto lab1; /* call R2, line 102 */ + if (ret < 0) return ret; + } + goto lab0; + lab1: + z->c = z->l - m1; + { int ret = r_R1(z); + if (ret == 0) return 0; /* call R1, line 102 */ + if (ret < 0) return ret; + } + { int m2 = z->l - z->c; (void)m2; /* not, line 102 */ + { int ret = r_shortv(z); + if (ret == 0) goto lab2; /* call shortv, line 102 */ + if (ret < 0) return ret; + } + return 0; + lab2: + z->c = z->l - m2; + } + } +lab0: + { int ret = slice_del(z); /* delete, line 103 */ + if (ret < 0) return ret; + } + return 1; +} + +static int r_Step_5b(struct SN_env * z) { + z->ket = z->c; /* [, line 107 */ + if (!(eq_s_b(z, 1, s_27))) return 0; + z->bra = z->c; /* ], line 107 */ + { int ret = r_R2(z); + if (ret == 0) return 0; /* call R2, line 108 */ + if (ret < 0) return ret; + } + if (!(eq_s_b(z, 1, s_28))) return 0; + { int ret = slice_del(z); /* delete, line 109 */ + if (ret < 0) return ret; + } + return 1; +} + +extern int porter_ISO_8859_1_stem(struct SN_env * z) { + z->B[0] = 0; /* unset Y_found, line 115 */ + { int c1 = z->c; /* do, line 116 */ + z->bra = z->c; /* [, line 116 */ + if (!(eq_s(z, 1, s_29))) goto lab0; + z->ket = z->c; /* ], line 116 */ + { int ret = slice_from_s(z, 1, s_30); /* <-, line 116 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set Y_found, line 116 */ + lab0: + z->c = c1; + } + { int c2 = z->c; /* do, line 117 */ + while(1) { /* repeat, line 117 */ + int c3 = z->c; + while(1) { /* goto, line 117 */ + int c4 = z->c; + if (in_grouping(z, g_v, 97, 121, 0)) goto lab3; + z->bra = z->c; /* [, line 117 */ + if (!(eq_s(z, 1, s_31))) goto lab3; + z->ket = z->c; /* ], line 117 */ + z->c = c4; + break; + lab3: + z->c = c4; + if (z->c >= z->l) goto lab2; + z->c++; /* goto, line 117 */ + } + { int ret = slice_from_s(z, 1, s_32); /* <-, line 117 */ + if (ret < 0) return ret; + } + z->B[0] = 1; /* set Y_found, line 117 */ + continue; + lab2: + z->c = c3; + break; + } + z->c = c2; + } + z->I[0] = z->l; + z->I[1] = z->l; + { int c5 = z->c; /* do, line 121 */ + { /* gopast */ /* grouping v, line 122 */ + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { /* gopast */ /* non v, line 122 */ + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[0] = z->c; /* setmark p1, line 122 */ + { /* gopast */ /* grouping v, line 123 */ + int ret = out_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + { /* gopast */ /* non v, line 123 */ + int ret = in_grouping(z, g_v, 97, 121, 1); + if (ret < 0) goto lab4; + z->c += ret; + } + z->I[1] = z->c; /* setmark p2, line 123 */ + lab4: + z->c = c5; + } + z->lb = z->c; z->c = z->l; /* backwards, line 126 */ + + { int m6 = z->l - z->c; (void)m6; /* do, line 127 */ + { int ret = r_Step_1a(z); + if (ret == 0) goto lab5; /* call Step_1a, line 127 */ + if (ret < 0) return ret; + } + lab5: + z->c = z->l - m6; + } + { int m7 = z->l - z->c; (void)m7; /* do, line 128 */ + { int ret = r_Step_1b(z); + if (ret == 0) goto lab6; /* call Step_1b, line 128 */ + if (ret < 0) return ret; + } + lab6: + z->c = z->l - m7; + } + { int m8 = z->l - z->c; (void)m8; /* do, line 129 */ + { int ret = r_Step_1c(z); + if (ret == 0) goto lab7; /* call Step_1c, line 129 */ + if (ret < 0) return ret; + } + lab7: + z->c = z->l - m8; + } + { int m9 = z->l - z->c; (void)m9; /* do, line 130 */ + { int ret = r_Step_2(z); + if (ret == 0) goto lab8; /* call Step_2, line 130 */ + if (ret < 0) return ret; + } + lab8: + z->c = z->l - m9; + } + { int m10 = z->l - z->c; (void)m10; /* do, line 131 */ + { int ret = r_Step_3(z); + if (ret == 0) goto lab9; /* call Step_3, line 131 */ + if (ret < 0) return ret; + } + lab9: + z->c = z->l - m10; + } + { int m11 = z->l - z->c; (void)m11; /* do, line 132 */ + { int ret = r_Step_4(z); + if (ret == 0) goto lab10; /* call Step_4, line 132 */ + if (ret < 0) return ret; + } + lab10: + z->c = z->l - m11; + } + { int m12 = z->l - z->c; (void)m12; /* do, line 133 */ + { int ret = r_Step_5a(z); + if (ret == 0) goto lab11; /* call Step_5a, line 133 */ + if (ret < 0) return ret; + } + lab11: + z->c = z->l - m12; + } + { int m13 = z->l - z->c; (void)m13; /* do, line 134 */ + { int ret = r_Step_5b(z); + if (ret == 0) goto lab12; /* call Step_5b, line 134 */ + if (ret < 0) return ret; + } + lab12: + z->c = z->l - m13; + } + z->c = z->lb; + { int c14 = z->c; /* do, line 137 */ + if (!(z->B[0])) goto lab13; /* Boolean test Y_found, line 137 */ + while(1) { /* repeat, line 137 */ + int c15 = z->c; + while(1) { /* goto, line 137 */ + int c16 = z->c; + z->bra = z->c; /* [, line 137 */ + if (!(eq_s(z, 1, s_33))) goto lab15; + z->ket = z->c; /* ], line 137 */ + z->c = c16; + break; + lab15: + z->c = c16; + if (z->c >= z->l) goto lab14; + z->c++; /* goto, line 137 */ + } + { int ret = slice_from_s(z, 1, s_34); /* <-, line 137 */ + if (ret < 0) return ret; + } + continue; + lab14: + z->c = c15; + break; + } + lab13: + z->c = c14; + } + return 1; +} + +extern struct SN_env * porter_ISO_8859_1_create_env(void) { return SN_create_env(0, 2, 1); } + +extern void porter_ISO_8859_1_close_env(struct SN_env * z) { SN_close_env(z, 0); } + diff --git a/src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c b/src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c new file mode 100644 index 00000000000..06d425d008f --- /dev/null +++ b/src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c @@ -0,0 +1,1017 @@ + +/* This file was generated automatically by the Snowball to ANSI C compiler */ + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern int portuguese_ISO_8859_1_stem(struct SN_env * z); +#ifdef __cplusplus +} +#endif +static int r_residual_form(struct SN_env * z); +static int r_residual_suffix(struct SN_env * z); +static int r_verb_suffix(struct SN_env * z); +static int r_standard_suffix(struct SN_env * z); +static int r_R2(struct SN_env * z); +static int r_R1(struct SN_env * z); +static int r_RV(struct SN_env * z); +static int r_mark_regions(struct SN_env * z); +static int r_postlude(struct SN_env * z); +static int r_prelude(struct SN_env * z); +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct SN_env * portuguese_ISO_8859_1_create_env(void); +extern void portuguese_ISO_8859_1_close_env(struct SN_env * z); + + +#ifdef __cplusplus +} +#endif +static const symbol s_0_1[1] = { 0xE3 }; +static const symbol s_0_2[1] = { 0xF5 }; + +static const struct among a_0[3] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 1, s_0_1, 0, 1, 0}, +/* 2 */ { 1, s_0_2, 0, 2, 0} +}; + +static const symbol s_1_1[2] = { 'a', '~' }; +static const symbol s_1_2[2] = { 'o', '~' }; + +static const struct among a_1[3] = +{ +/* 0 */ { 0, 0, -1, 3, 0}, +/* 1 */ { 2, s_1_1, 0, 1, 0}, +/* 2 */ { 2, s_1_2, 0, 2, 0} +}; + +static const symbol s_2_0[2] = { 'i', 'c' }; +static const symbol s_2_1[2] = { 'a', 'd' }; +static const symbol s_2_2[2] = { 'o', 's' }; +static const symbol s_2_3[2] = { 'i', 'v' }; + +static const struct among a_2[4] = +{ +/* 0 */ { 2, s_2_0, -1, -1, 0}, +/* 1 */ { 2, s_2_1, -1, -1, 0}, +/* 2 */ { 2, s_2_2, -1, -1, 0}, +/* 3 */ { 2, s_2_3, -1, 1, 0} +}; + +static const symbol s_3_0[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_3_1[4] = { 'a', 'v', 'e', 'l' }; +static const symbol s_3_2[4] = { 0xED, 'v', 'e', 'l' }; + +static const struct among a_3[3] = +{ +/* 0 */ { 4, s_3_0, -1, 1, 0}, +/* 1 */ { 4, s_3_1, -1, 1, 0}, +/* 2 */ { 4, s_3_2, -1, 1, 0} +}; + +static const symbol s_4_0[2] = { 'i', 'c' }; +static const symbol s_4_1[4] = { 'a', 'b', 'i', 'l' }; +static const symbol s_4_2[2] = { 'i', 'v' }; + +static const struct among a_4[3] = +{ +/* 0 */ { 2, s_4_0, -1, 1, 0}, +/* 1 */ { 4, s_4_1, -1, 1, 0}, +/* 2 */ { 2, s_4_2, -1, 1, 0} +}; + +static const symbol s_5_0[3] = { 'i', 'c', 'a' }; +static const symbol s_5_1[5] = { 0xE2, 'n', 'c', 'i', 'a' }; +static const symbol s_5_2[5] = { 0xEA, 'n', 'c', 'i', 'a' }; +static const symbol s_5_3[3] = { 'i', 'r', 'a' }; +static const symbol s_5_4[5] = { 'a', 'd', 'o', 'r', 'a' }; +static const symbol s_5_5[3] = { 'o', 's', 'a' }; +static const symbol s_5_6[4] = { 'i', 's', 't', 'a' }; +static const symbol s_5_7[3] = { 'i', 'v', 'a' }; +static const symbol s_5_8[3] = { 'e', 'z', 'a' }; +static const symbol s_5_9[5] = { 'l', 'o', 'g', 0xED, 'a' }; +static const symbol s_5_10[5] = { 'i', 'd', 'a', 'd', 'e' }; +static const symbol s_5_11[4] = { 'a', 'n', 't', 'e' }; +static const symbol s_5_12[5] = { 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_13[6] = { 'a', 'm', 'e', 'n', 't', 'e' }; +static const symbol s_5_14[4] = { 0xE1, 'v', 'e', 'l' }; +static const symbol s_5_15[4] = { 0xED, 'v', 'e', 'l' }; +static const symbol s_5_16[5] = { 'u', 'c', 'i', 0xF3, 'n' }; +static const symbol s_5_17[3] = { 'i', 'c', 'o' }; +static const symbol s_5_18[4] = { 'i', 's', 'm', 'o' }; +static const symbol s_5_19[3] = { 'o', 's', 'o' }; +static const symbol s_5_20[6] = { 'a', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_21[6] = { 'i', 'm', 'e', 'n', 't', 'o' }; +static const symbol s_5_22[3] = { 'i', 'v', 'o' }; +static const symbol s_5_23[5] = { 'a', 0xE7, 'a', '~', 'o' }; +static const symbol s_5_24[4] = { 'a', 'd', 'o', 'r' }; +static const symbol s_5_25[4] = { 'i', 'c', 'a', 's' }; +static const symbol s_5_26[6] = { 0xEA, 'n', 'c', 'i', 'a', 's' }; +static const symbol s_5_27[4] = { 'i', 'r', 'a', 's' }; +static const symbol s_5_28[6] = { 'a', 'd', 'o', 'r', 'a', 's' }; +static const symbol s_5_29[4] = { 'o', 's', 'a', 's' }; +static const symbol s_5_30[5] = { 'i', 's', 't', 'a', 's' }; +static const symbol s_5_31[4] = { 'i', 'v', 'a', 's' }; +static const symbol s_5_32[4] = { 'e', 'z', 'a', 's' }; +static const symbol s_5_33[6] = { 'l', 'o', 'g', 0xED, 'a', 's' }; +static const symbol s_5_34[6] = { 'i', 'd', 'a', 'd', 'e', 's' }; +static const symbol s_5_35[7] = { 'u', 'c', 'i', 'o', 'n', 'e', 's' }; +static const symbol s_5_36[6] = { 'a', 'd', 'o', 'r', 'e', 's' }; +static const symbol s_5_37[5] = { 'a', 'n', 't', 'e', 's' }; +static const symbol s_5_38[6] = { 'a', 0xE7, 'o', '~', 'e', 's' }; +static const symbol s_5_39[4] = { 'i', 'c', 'o', 's' }; +static const symbol s_5_40[5] = { 'i', 's', 'm', 'o', 's' }; +static const symbol s_5_41[4] = { 'o', 's', 'o', 's' }; +static const symbol s_5_42[7] = { 'a', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_43[7] = { 'i', 'm', 'e', 'n', 't', 'o', 's' }; +static const symbol s_5_44[4] = { 'i', 'v', 'o', 's' }; + +static const struct among a_5[45] = +{ +/* 0 */ { 3, s_5_0, -1, 1, 0}, +/* 1 */ { 5, s_5_1, -1, 1, 0}, +/* 2 */ { 5, s_5_2, -1, 4, 0}, +/* 3 */ { 3, s_5_3, -1, 9, 0}, +/* 4 */ { 5, s_5_4, -1, 1, 0}, +/* 5 */ { 3, s_5_5, -1, 1, 0}, +/* 6 */ { 4, s_5_6, -1, 1, 0}, +/* 7 */ { 3, s_5_7, -1, 8, 0}, +/* 8 */ { 3, s_5_8, -1, 1, 0}, +/* 9 */ { 5, s_5_9, -1, 2, 0}, +/* 10 */ { 5, s_5_10, -1, 7, 0}, +/* 11 */ { 4, s_5_11, -1, 1, 0}, +/* 12 */ { 5, s_5_12, -1, 6, 0}, +/* 13 */ { 6, s_5_13, 12, 5, 0}, +/* 14 */ { 4, s_5_14, -1, 1, 0}, +/* 15 */ { 4, s_5_15, -1, 1, 0}, +/* 16 */ { 5, s_5_16, -1, 3, 0}, +/* 17 */ { 3, s_5_17, -1, 1, 0}, +/* 18 */ { 4, s_5_18, -1, 1, 0}, +/* 19 */ { 3, s_5_19, -1, 1, 0}, +/* 20 */ { 6, s_5_20, -1, 1, 0}, +/* 21 */ { 6, s_5_21, -1, 1, 0}, +/* 22 */ { 3, s_5_22, -1, 8, 0}, +/* 23 */ { 5, s_5_23, -1, 1, 0}, +/* 24 */ { 4, s_5_24, -1, 1, 0}, +/* 25 */ { 4, s_5_25, -1, 1, 0}, +/* 26 */ { 6, s_5_26, -1, 4, 0}, +/* 27 */ { 4, s_5_27, -1, 9, 0}, +/* 28 */ { 6, s_5_28, -1, 1, 0}, +/* 29 */ { 4, s_5_29, -1, 1, 0}, +/* 30 */ { 5, s_5_30, -1, 1, 0}, +/* 31 */ { 4, s_5_31, -1, 8, 0}, +/* 32 */ { 4, s_5_32, -1, 1, 0}, +/* 33 */ { 6, s_5_33, -1, 2, 0}, +/* 34 */ { 6, s_5_34, -1, 7, 0}, +/* 35 */ { 7, s_5_35, -1, 3, 0}, +/* 36 */ { 6, s_5_36, -1, 1, 0}, +/* 37 */ { 5, s_5_37, -1, 1, 0}, +/* 38 */ { 6, s_5_38, -1, 1, 0}, +/* 39 */ { 4, s_5_39, -1, 1, 0}, +/* 40 */ { 5, s_5_40, -1, 1, 0}, +/* 41 */ { 4, s_5_41, -1, 1, 0}, +/* 42 */ { 7, s_5_42, -1, 1, 0}, +/* 43 */ { 7, s_5_43, -1, 1, 0}, +/* 44 */ { 4, s_5_44, -1, 8, 0} +}; + +static const symbol s_6_0[3] = { 'a', 'd', 'a' }; +static const symbol s_6_1[3] = { 'i', 'd', 'a' }; +static const symbol s_6_2[2] = { 'i', 'a' }; +static const symbol s_6_3[4] = { 'a', 'r', 'i', 'a' }; +static const symbol s_6_4[4] = { 'e', 'r', 'i', 'a' }; +static const symbol s_6_5[4] = { 'i', 'r', 'i', 'a' }; +static const symbol s_6_6[3] = { 'a', 'r', 'a' }; +static const symbol s_6_7[3] = { 'e', 'r', 'a' }; +static const symbol s_6_8[3] = { 'i', 'r', 'a' }; +static const symbol s_6_9[3] = { 'a', 'v', 'a' }; +static const symbol s_6_10[4] = { 'a', 's', 's', 'e' }; +static const symbol s_6_11[4] = { 'e', 's', 's', 'e' }; +static const symbol s_6_12[4] = { 'i', 's', 's', 'e' }; +static const symbol s_6_13[4] = { 'a', 's', 't', 'e' }; +static const symbol s_6_14[4] = { 'e', 's', 't', 'e' }; +static const symbol s_6_15[4] = { 'i', 's', 't', 'e' }; +static const symbol s_6_16[2] = { 'e', 'i' }; +static const symbol s_6_17[4] = { 'a', 'r', 'e', 'i' }; +static const symbol s_6_18[4] = { 'e', 'r', 'e', 'i' }; +s |