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


static void initializeCMakeParser (const langType language)
{

	addLanguageRegexTable (language, "main");
	addLanguageRegexTable (language, "variable");
	addLanguageRegexTable (language, "variableScoped");
	addLanguageRegexTable (language, "function");
	addLanguageRegexTable (language, "macro");
	addLanguageRegexTable (language, "target");
	addLanguageRegexTable (language, "option");
	addLanguageRegexTable (language, "project");
	addLanguageRegexTable (language, "commentBegin");
	addLanguageRegexTable (language, "commentMultiline");
	addLanguageRegexTable (language, "skipComment");
	addLanguageRegexTable (language, "skipWhiteSpace");
	addLanguageRegexTable (language, "skipToName");
	addLanguageRegexTable (language, "nextToken");
	addLanguageRegexTable (language, "inFunction");
	addLanguageRegexTable (language, "inVariable");

	addLanguageTagMultiTableRegex (language, "main",
	                               "^[^sSfFmMaAoOpP# \t\n][^ #\t\n]*[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^set[ \t]*\\(",
	                               "", "", "{icase}{tenter=variable}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^function[ \t]*\\(",
	                               "", "", "{icase}{tenter=function}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^macro[ \t]*\\(",
	                               "", "", "{icase}{tenter=macro}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^add_(custom_target|executable|library)[ \t]*\\(",
	                               "", "", "{icase}{tenter=target}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^option[ \t]*\\(",
	                               "", "", "{icase}{tenter=option}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^project[ \t]*\\(",
	                               "", "", "{icase}{tenter=project}", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^[^ \t\n]+[ \t\n]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "main",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "variable",
	                               "^([A-Za-z0-9_.-]+)[ \t\n\\)]+",
	                               "\\1", "v", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "variable",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "variable",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "variable",
	                               "^([A-Za-z0-9_.-]+)(#)",
	                               "\\1", "v", "{tleave}{_advanceTo=2start}", NULL);
	addLanguageTagMultiTableRegex (language, "variableScoped",
	                               "^[A-Za-z0-9_.-]+[# \t\n\\)]",
	                               "", "", "{tjump=inVariable}{_advanceTo=0start}", NULL);
	addLanguageTagMultiTableRegex (language, "variableScoped",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "variableScoped",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "function",
	                               "^([A-Za-z_][A-Za-z0-9_]*)([# \t\n\\)])",
	                               "\\1", "f", "{_advanceTo=2start}{tjump=inFunction}{scope=push}", NULL);
	addLanguageTagMultiTableRegex (language, "function",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "function",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "macro",
	                               "^([A-Za-z_][A-Za-z0-9_]*)[ \t\n\\)]+",
	                               "\\1", "m", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "macro",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "macro",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "macro",
	                               "^([A-Za-z_][A-Za-z0-9_]*)(#)",
	                               "\\1", "m", "{tleave}{_advanceTo=2start}", NULL);
	addLanguageTagMultiTableRegex (language, "target",
	                               "^([A-Za-z0-9_.-]+)[ \t\n\\)]+",
	                               "\\1", "t", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "target",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "target",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "target",
	                               "^([A-Za-z0-9_.-]+)(#)",
	                               "\\1", "t", "{tleave}{_advanceTo=2start}", NULL);
	addLanguageTagMultiTableRegex (language, "option",
	                               "^([A-Za-z0-9_.-]+)[ \t\n\\)]+",
	                               "\\1", "D", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "option",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "option",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "option",
	                               "^([A-Za-z0-9_.-]+)(#)",
	                               "\\1", "D", "{tleave}{_advanceTo=2start}", NULL);
	addLanguageTagMultiTableRegex (language, "project",
	                               "^([A-Za-z0-9_.-]+)([# \t\n\\)])",
	                               "\\1", "p", "{tleave}{_advanceTo=2start}", NULL);
	addLanguageTagMultiTableRegex (language, "project",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "project",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "commentBegin",
	                               "^\\[\\[",
	                               "", "", "{tjump=commentMultiline}", NULL);
	addLanguageTagMultiTableRegex (language, "commentBegin",
	                               "^[^\n]*[ \t\n]*",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "commentMultiline",
	                               "^\\]\\][ \t\n]*",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "commentMultiline",
	                               "^.[^]]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "skipComment",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "skipWhiteSpace",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "skipToName",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "skipToName",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "nextToken",
	                               "^[^ \t\n]+[ \t\n]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^([^eEsSfFmMaAoO# \t\n]|[eE][^nN]|[eE][nN][^dD]|[eE][nN][dD][^fF#])[^ #\t\n]*[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^#",
	                               "", "", "{tenter=commentBegin}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^set[ \t]*\\(",
	                               "", "", "{icase}{tenter=variableScoped}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^function[ \t]*\\(",
	                               "", "", "{icase}{tenter=function}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^macro[ \t]*\\(",
	                               "", "", "{icase}{tenter=macro}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^endfunction[ \t]*\\([^)]*\\)",
	                               "", "", "{icase}{tleave}{scope=pop}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^add_(custom_target|executable|library)[ \t]*\\(",
	                               "", "", "{icase}{tenter=target}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^option[ \t]*\\(",
	                               "", "", "{icase}{tenter=option}", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^[^ \t\n]+[ \t\n]*",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "inFunction",
	                               "^[ \t\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "inVariable",
	                               "^[^\")]+((\"(\\\\\"|[^\"])*\")([^\")]+(\"(\\\\\"|[^\"])*\"))*)[ \t\n]PARENT_SCOPE[# \t\n)]",
	                               "", "", "{tjump=variable}{_advanceTo=0start}", NULL);
	addLanguageTagMultiTableRegex (language, "inVariable",
	                               "^([A-Za-z0-9_.-]+)[ \t\n\\)]+",
	                               "\\1", "v", "{tleave}{scope=ref}", NULL);
	addLanguageTagMultiTableRegex (language, "inVariable",
	                               "^([A-Za-z0-9_.-]+)(#)",
	                               "\\1", "v", "{tleave}{scope=ref}{_advanceTo=2start}", NULL);
}

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

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

	static const char *const patterns [] = {
		"CMakeLists.txt",
		NULL
	};

	static kindDefinition CMakeKindTable [] = {
		{
		  true, 'f', "function", "functions",
		},
		{
		  true, 'm', "macro", "macros",
		},
		{
		  true, 't', "target", "targets",
		},
		{
		  true, 'v', "variable", "variable definitions",
		},
		{
		  true, 'D', "option", "options specified with -D",
		},
		{
		  true, 'p', "project", "projects",
		},
	};

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

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

	return def;
}
