/*
*   $Id: actionscript.c,v 1.1 2004/01/03 03:59:19 svoisen Exp $
*
*   Copyright (c) 2004, Sean Voisen
*
*   This source code is released for free distribution under the terms of the
*   GNU General Public License.
*
*   This module contains functions for generating tags for ActionScript language
*   files.
*/

/*
*   INCLUDE FILES
*/
#include "general.h"	/* must always come first */
#include "parse.h"

/*
*   FUNCTION DEFINITIONS
*/

static void installActionScriptRegex (const langType language)
{
    addTagRegex (language, "^[ \t]*[(private|public|static)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\\(",
	    "\\1", "f,function,functions", NULL);
		
	addTagRegex (language, "^[ \t]*[(public)( \t)]*function[ \t]+(set|get)[ \t]+([A-Za-z0-9_]+)[ \t]*\\(",
		"\\2", "p,property,properties", NULL);
	
	/*additional basic AS 1.0 regex added by Richard Leider*/
	addTagRegex (language, ".*\.prototype\.([A-Za-z0-9 ]+)=([ \t]?)function([ \t]?)*\\(",
	    "\\1", "f,function,functions", NULL);
	
}

/* Create parser definition stucture */


extern parserDefinition* ActionScriptParser (void)

{
    static const char *const extensions [] = { "as", NULL };
    parserDefinition *const def = parserNew ("ActionScript");
    def->extensions = extensions;
    def->initialize = installActionScriptRegex;
    def->regex      = TRUE;
    return def;
}

