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


static void initializeTerraformParser (const langType language)
{

	addLanguageRegexTable (language, "toplevel");
	addLanguageRegexTable (language, "comment");
	addLanguageRegexTable (language, "locals");
	addLanguageRegexTable (language, "multicomment");

	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^(\\#|//)",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^/\\*",
	                               "", "", "{tenter=multicomment}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^locals[[:space:]]*\\{",
	                               "", "", "{tenter=locals}", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^resource[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\"",
	                               "\\2", "r", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^data[[:space:]]\"([^\"]+)\"[[:space:]]\"([^\"]+)\"",
	                               "\\2", "d", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^variable[[:space:]]\"([^\"]+)\"",
	                               "\\1", "v", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^provider[[:space:]]\"([^\"]+)\"",
	                               "\\1", "p", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^module[[:space:]]\"([^\"]+)\"",
	                               "\\1", "m", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^output[[:space:]]\"([^\"]+)\"",
	                               "\\1", "o", "", NULL);
	addLanguageTagMultiTableRegex (language, "toplevel",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^[^\n]+",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^\n",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "comment",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^\\}",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^\\{",
	                               "", "", "{tenter=locals}", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^(\\#|//)",
	                               "", "", "{tenter=comment}", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^/\\*",
	                               "", "", "{tenter=multicomment}", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^([a-z0-9_]+)+[[:space:]]*=[[:space:]]+",
	                               "\\1", "l", "", NULL);
	addLanguageTagMultiTableRegex (language, "locals",
	                               "^.",
	                               "", "", "", NULL);
	addLanguageTagMultiTableRegex (language, "multicomment",
	                               "^\\*/",
	                               "", "", "{tleave}", NULL);
	addLanguageTagMultiTableRegex (language, "multicomment",
	                               "^.",
	                               "", "", "", NULL);
}

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

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

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

	static roleDefinition TerraformVariableRoleTable [] = {
		{ true, "assigned", "assigned in Variable Definitions (.tfvars) files" },
	};
	static kindDefinition TerraformKindTable [] = {
		{
		  true, 'r', "resource", "resources",
		},
		{
		  true, 'd', "data", "data",
		},
		{
		  true, 'v', "variable", "variables",
		  ATTACH_ROLES(TerraformVariableRoleTable),
		},
		{
		  true, 'p', "provider", "providers",
		},
		{
		  true, 'm', "module", "modules",
		},
		{
		  true, 'o', "output", "output",
		},
		{
		  true, 'l', "local", "locals",
		},
	};

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

	def->versionCurrent= 1;
	def->versionAge    = 1;
	def->enabled       = true;
	def->extensions    = extensions;
	def->patterns      = patterns;
	def->aliases       = aliases;
	def->method        = METHOD_NOT_CRAFTED|METHOD_REGEX;
	def->kindTable     = TerraformKindTable;
	def->kindCount     = ARRAY_SIZE(TerraformKindTable);
	def->initialize    = initializeTerraformParser;

	return def;
}
