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


static void initializeSELinuxTypeEnforcementParser (const langType language)
{

	addLanguageRegexTable (language, "main");
	addLanguageRegexTable (language, "typedef");
	addLanguageRegexTable (language, "alias");
	addLanguageRegexTable (language, "compoundalias");
	addLanguageRegexTable (language, "lit");

	addLanguageTagMultiTableRegex (language, "main",
	                               "^#[^\n]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^[[:space:]]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^`",
	                               "", "", "{tenter=lit}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^[^pmtarbgu[:space:]][a-zA-Z0-9_]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^policy_module\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
	                               "\\1", "m", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^module[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "m", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^type[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*",
	                               "\\1", "t", "{tenter=typedef}"
		"{{\n"
		"   .\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^typealias[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*",
	                               "\\1", "t", "{_role=aliased}{tenter=typedef}"
		"{{\n"
		"   .\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^attribute[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "T", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "r", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^attribute_role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "R", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^bool[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "b", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^gen_(tunable|bool)\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
	                               "\\2", "b", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^user[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
	                               "\\1", "u", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^gen_user\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
	                               "\\1", "u", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "typedef",
	                               "^[[:space:]]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "typedef",
	                               "^alias[[:space:]]+",
	                               "", "", "{tenter=alias}", NULL);
	addLanguageTagMultiTableRegex (language, "typedef",
	                               "^;",
	                               "", "", "{tleave}"
		"{{\n"
		"   pop\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "typedef",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "alias",
	                               "^[[:space:]]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "alias",
	                               "^([a-zA-Z0-9_]+)[[:space:]]*",
	                               "\\1", "a", "{tleave}"
		"{{\n"
		"   dup :name . exch [ (type) 3 -1 roll ] typeref:\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "alias",
	                               "^\\{[[:space:]]*",
	                               "", "", "{tenter=compoundalias}", NULL);
	addLanguageTagMultiTableRegex (language, "alias",
	                               "^\\}[[:space:]]*",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "alias",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "compoundalias",
	                               "^[[:space:]]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "compoundalias",
	                               "^([a-zA-Z0-9_]+)[[:space:]]*",
	                               "\\1", "a", ""
		"{{\n"
		"   dup :name . exch [ (type) 3 -1 roll ] typeref:\n"
		"}}", NULL);
	addLanguageTagMultiTableRegex (language, "compoundalias",
	                               "^\\}[[:space:]]*",
	                               "", "", "{tleave}{_advanceTo=0start}", NULL);
	addLanguageTagMultiTableRegex (language, "compoundalias",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "lit",
	                               "^[^'`]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "lit",
	                               "^'",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "lit",
	                               "^`",
	                               "", "", "{tenter=lit}", NULL);
	addLanguageTagMultiTableRegex (language, "lit",
	                               "^.",
	                               "", "", "", NULL);
}

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

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

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

	static roleDefinition SELinuxTypeEnforcementTypeRoleTable [] = {
		{ true, "aliased", "aliased" },
	};
	static kindDefinition SELinuxTypeEnforcementKindTable [] = {
		{
		  true, 'm', "module", "policy modules",
		},
		{
		  true, 't', "type", "types",
		  ATTACH_ROLES(SELinuxTypeEnforcementTypeRoleTable),
		},
		{
		  true, 'a', "alias", "type aliases",
		},
		{
		  true, 'T', "attr", "type attributes",
		},
		{
		  true, 'r', "role", "roles",
		},
		{
		  true, 'R', "rattr", "role attributes",
		},
		{
		  true, 'b', "tunable", "tunables",
		},
		{
		  true, 'u', "user", "users",
		},
	};

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

	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     = SELinuxTypeEnforcementKindTable;
	def->kindCount     = ARRAY_SIZE(SELinuxTypeEnforcementKindTable);
	def->initialize    = initializeSELinuxTypeEnforcementParser;

	return def;
}
