/*************************************************************************** * * Copyright (c) 2009, Brickman Brick (brickcentral.livejournal.com) * * This source code is released for free distribution under the terms of the * GNU General Public License. * * povray.c * This module is a regex-based parser for the POV-Ray scene description * language. It is able to detect the following povray language directives; * #declare, #local and #macro. * Please visit http://www.povray.org for more information. * **************************************************************************/ /* INCLUDE FILES */ #include "general.h" /* always include first */ #include "parse.h" /* always include */ /* FUNCTION DEFINITIONS */ static void installPOVRayRegex (const langType language) { addTagRegex (language, "^#declare[ \t]*([a-zA-Z0-9_]+)", "\\1", "d,declare", NULL); addTagRegex (language, "^#local[ \t]*([a-zA-Z0-9_]+)", "\\1", "l,local", NULL); addTagRegex (language, "^#macro[ \t]*([a-zA-Z0-9_]+)", "\\1", "m,macro", NULL); } /* Create parser definition stucture */ extern parserDefinition* POVRayParser (void) { static const char *const extensions [] = { "pov", "inc", NULL }; parserDefinition* def = parserNew ("POVRay"); def->extensions = extensions; def->initialize = installPOVRayRegex; def->regex = TRUE; return def; }