/*
 * Generated by ./misc/optlib2c from optlib/yacc.ctags, Don't edit this manually.
 */
#include "general.h"
#include "parse.h"
#include "routines.h"
#include "field.h"
#include "xtag.h"


static void initializeYACCParser (const langType language)
{
	addLanguageOptscriptToHook (language, SCRIPT_HOOK_PRELUDE,
		"{{    /token-type false def\n"
		"    /type-dict 57 dict def\n"
		"}}");

	addLanguageRegexTable (language, "toplevel");
	addLanguageRegexTable (language, "comment");
	addLanguageRegexTable (language, "cPrologue");
	addLanguageRegexTable (language, "grammar");
	addLanguageRegexTable (language, "cEpilogue");
	addLanguageRegexTable (language, "token");
	addLanguageRegexTable (language, "cUnion");
	addLanguageRegexTable (language, "cString");
	addLanguageRegexTable (language, "iString");
	addLanguageRegexTable (language, "rule");
	addLanguageRegexTable (language, "cActionCommon");
	addLanguageRegexTable (language, "cAction");
	addLanguageRegexTable (language, "type");
	addLanguageRegexTable (language, "cCharlit");

	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^/\\*",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^%token[ \t\n]+",
	                               "", "", "{tenter=token}"
		"{{\n"
		"    /token-type false def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^%(union)[^\\{]*\\{",
	                               "", "", "{tenter=cUnion}{_guest=C,1start,}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^%(code[^\\{]*)?\\{",
	                               "", "", "{tenter=cPrologue}{_guest=C,0end,}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^%(type|nterm)[ \n\t]*",
	                               "", "", "{tenter=type}"
		"{{\n"
		"    /token-type false def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^%%",
	                               "", "", "{tjump=grammar}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^[^\n]*\n",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^[^*]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^\\*/",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cPrologue",
	                               "^[^%]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cPrologue",
	                               "^%\\}",
	                               "", "", "{tleave}{_guest=,,0start}", NULL);
	addLanguageTagMultiTableRegex (language, "cPrologue",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "grammar",
	                               "^%%",
	                               "", "", "{tjump=cEpilogue}{_guest=C,0end,}", NULL);
	addLanguageTagMultiTableRegex (language, "grammar",
	                               "^([a-zA-Z_.][-a-zA-Z_.0-9]+)[ \t\n]*:[ \t\n]*",
	                               "\\1", "l", "{tenter=rule}"
		"{{\n"
		"    type-dict \\1 known {\n"
		"        type-dict \\1 get . exch typeref:\n"
		"    } if\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "grammar",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cEpilogue",
	                               "^.+",
	                               "", "", "{_guest=,,0end}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^N?_[ \t]*\\(",
	                               "", "", "{tenter=iString}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^([_a-zA-Z][_a-zA-Z0-9]*)[ \t\n]*",
	                               "\\1", "t", ""
		"{{\n"
		"    token-type false ne {\n"
		"        . token-type typeref:\n"
		"    } if\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^<[ \t]*([_a-zA-Z][_a-zA-Z0-9 *]*)[ \t]*>[ \t\n]*",
	                               "", "", ""
		"{{\n"
		"    /token-type \\1 def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^'",
	                               "", "", "{tenter=cCharlit}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^-?[ \t\n]*(0x)?[0-9]+[ \t\n]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^%",
	                               "", "", "{tleave}{_advanceTo=0start}"
		"{{\n"
		"    /token-type false def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "token",
	                               "^.|\n",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^[^\"/\\{\\}]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^'",
	                               "", "", "{tenter=cCharlit}", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^/\\*",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^\\{",
	                               "", "", "{tenter=cAction}", NULL);
	addLanguageTagMultiTableRegex (language, "cUnion",
	                               "^\\}",
	                               "", "", "{tleave}{_guest=,,0end}{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "cString",
	                               "^[^\\\\\"]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cString",
	                               "^\\\\.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cString",
	                               "^\"",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "iString",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "iString",
	                               "^\\)",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "iString",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "rule",
	                               "^[^\\{;]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "rule",
	                               "^\\{",
	                               "", "", "{tenter=cAction}", NULL);
	addLanguageTagMultiTableRegex (language, "rule",
	                               "^;",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "rule",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cActionCommon",
	                               "^[^\"/\\{\\}]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cActionCommon",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "cActionCommon",
	                               "^'",
	                               "", "", "{tenter=cCharlit}", NULL);
	addLanguageTagMultiTableRegex (language, "cActionCommon",
	                               "^/\\*",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "cActionCommon",
	                               "^\\{",
	                               "", "", "{tenter=cAction}", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^[^\"/\\{\\}]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^'",
	                               "", "", "{tenter=cCharlit}", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^/\\*",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^\\{",
	                               "", "", "{tenter=cAction}", NULL);
	addLanguageTagMultiTableRegex (language, "cAction",
	                               "^\\}",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^N?_[ \t]*\\(",
	                               "", "", "{tenter=iString}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^([_a-zA-Z][_a-zA-Z0-9]*)[ \t\n]*",
	                               "", "", ""
		"{{\n"
		"    token-type false ne {\n"
		"        type-dict \\1 token-type put\n"
		"    } if\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^<[ \t]*([_a-zA-Z][_a-zA-Z0-9 *]*)[ \t]*>[ \t\n]*",
	                               "", "", ""
		"{{\n"
		"    /token-type \\1 def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^\"",
	                               "", "", "{tenter=cString}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^'",
	                               "", "", "{tenter=cCharlit}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^%",
	                               "", "", "{tleave}{_advanceTo=0start}"
		"{{\n"
		"    /token-type false def\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "type",
	                               "^.|\n",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "cCharlit",
	                               "^[^\\\\]'",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "cCharlit",
	                               "^\\\\.'",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "cCharlit",
	                               "^'",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "cCharlit",
	                               "^.",
	                               "", "", "", NULL);
}

extern parserDefinition* YACCParser (void)
{
	static const char *const extensions [] = {
		"y",
		NULL
	};

	static const char *const aliases [] = {
		NULL
	};

	static const char *const patterns [] = {
		NULL
	};

	static kindDefinition YACCKindTable [] = {
		{
		  true, 't', "token", "tokens",
		},
		{
		  true, 'l', "label", "labels",
		},
	};

	parserDefinition* const def = parserNew ("YACC");

	def->versionCurrent= 0;
	def->versionAge    = 0;
	def->enabled       = true;
	def->extensions    = extensions;
	def->patterns      = patterns;
	def->aliases       = aliases;
	def->method        = METHOD_NOT_CRAFTED|METHOD_REGEX;
	def->useCork       = CORK_QUEUE;
	def->kindTable     = YACCKindTable;
	def->kindCount     = ARRAY_SIZE(YACCKindTable);
	def->initialize    = initializeYACCParser;

	return def;
}
