/**
 * This file automatically has been generated by ULS and
 *  contains an implementation of lexical analyzer
 *  for parsing the programming language 'tokseq'.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
#include <uls/uls_core.h>
#include <uls/uld_conf.h>

static int load_pairs(uls_lex_ptr_t uls)
{
	uld_names_map_ptr_t names_map;
	int   i, stat = 0;

	names_map = uld_prepare_names(uls);
	 {
	uld_line_t tok_names;

	tok_names.name = "EOI";
	tok_names.name2 = "NULL";
	tok_names.tokid_changed = 1;
	tok_names.tokid = 128;
	tok_names.aliases = "";
	uld_change_names(names_map, uls_ptr(tok_names));

	tok_names.name = "ERR";
	tok_names.name2 = "NULL";
	tok_names.tokid_changed = 1;
	tok_names.tokid = 129;
	tok_names.aliases = "";
	uld_change_names(names_map, uls_ptr(tok_names));

	tok_names.name = "ID";
	tok_names.name2 = "NULL";
	tok_names.tokid_changed = 1;
	tok_names.tokid = 130;
	tok_names.aliases = "IDENT";
	uld_change_names(names_map, uls_ptr(tok_names));

	 }

	if (uld_post_names(names_map) < 0) {
		stat = -1;
	}

	return stat;
}

int uls_init_tokseq(uls_lex_ptr_t uls)
{
	const char *confname = "simple";

	if (uls_init_astr(uls, confname) <  0) {
		return -1;
	}

	if (load_pairs(uls) < 0) {
		return -1;
	}

	return 0;
}

uls_lex_ptr_t uls_create_tokseq(void)
{
	const char *confname = "simple";
	uls_lex_ptr_t uls;

	if ((uls = uls_create_astr(confname)) == NULL) {
		return NULL;
	}

	if (load_pairs(uls) < 0) {
		return NULL;
	}

	return uls;
}

int uls_destroy_tokseq(uls_lex_ptr_t uls)
{
	return uls_destroy(uls);
}

