2
* $Id: actionscript.c,v 1.1 2004/01/03 03:59:19 svoisen Exp $
4
* Original file copyright (c) 2004, Sean Voisen
6
* Modified October 8, 2007 By Mike Fahy (VeryVito) of www.turdhead.com
7
* - Added initial AS3 support
8
* - Threw in some "TODO" and "NOTE" bits
10
* Modified October 9, 2007 By Ali Rantakari of hasseg.org:
11
* - Added more allowed AS3 attribute keywords (override, final, internal
12
* etc...) for classes, getters & setters, variables
13
* - Allowed varying versions of "note" and "todo" spellings
14
* - Allowed points (.) in package names so that they would display the
15
* whole package name instead of just the first level
16
* - Added interfaces matching support
17
* - Reformatted some name parameters:
18
* - Getters and setters: display either "get" or "set" in front
19
* of the property name
20
* - Todos & notes: made the name be the text that comes after the
21
* "todo" or "note" text
22
* - Variables: Moved the variable type after the name and separated
23
* them with " : " according to ActionScript syntax
24
* Modified March 6, 2009 by Chris Macksey (cmacksey@users.sourceforge.net)
25
* - Tweaked to work better with Geany
27
* This source code is released for free distribution under the terms of the
28
* GNU General Public License.
30
* This module contains functions for generating tags for ActionScript language
37
#include "general.h" /* must always come first */
41
* FUNCTION DEFINITIONS
45
static void installActionScriptRegex (const langType language)
48
addTagRegex (language, "^[ \t]*[(private|public|static|protected|internal|final|override)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\\(([^\\{]*)",
49
"\\1 (\\2", "f,function,functions,methods", NULL);
51
/* Getters and setters */
52
addTagRegex (language, "^[ \t]*[(public|static|internal|final|override)( \t)]*function[ \t]+(set|get)[ \t]+([A-Za-z0-9_]+)[ \t]*\\(",
53
"\\2 \\1", "f,field,fields", NULL);
56
addTagRegex (language, "^[ \t]*[(private|public|static|protected|internal)( \t)]*var[ \t]+([A-Za-z0-9_]+)([ \t]*\\:[ \t]*([A-Za-z0-9_]+))*[ \t]*",
57
"\\1 \\: \\3", "v,variable,variables", NULL);
60
addTagRegex (language, "^[ \t]*[(private|public|static|protected|internal)( \t)]*const[ \t]+([A-Za-z0-9_]+)([ \t]*\\:[ \t]*([A-Za-z0-9_]+))*[ \t]*",
61
"\\1 : \\3", "m,macro,macros", NULL);
64
addTagRegex (language, "^[ \t]*[(private|public|static|dynamic|final|internal)( \t)]*class[ \t]+([A-Za-z0-9_]+)[ \t]*([^\\{]*)",
65
"\\1 (\\2)", "c,class,classes", NULL);
68
addTagRegex (language, "^[ \t]*[(private|public|static|dynamic|final|internal)( \t)]*interface[ \t]+([A-Za-z0-9_]+)[ \t]*([^\\{]*)",
69
"\\1 (\\2)", "i,interface,interfaces", NULL);
72
addTagRegex (language, "^[ \t]*[(private|public|static)( \t)]*package[ \t]+([A-Za-z0-9_.]+)[ \t]*",
73
"\\1", "p,package", NULL);
76
addTagRegex (language, "\\/\\/[ \t]*(NOTE|note|Note)[ \t]*\\:*(.*)",
77
"\\2", "o,other", NULL);
80
addTagRegex (language, "\\/\\/[ \t]*(TODO|todo|ToDo|Todo)[ \t]*\\:*(.*)",
81
"\\2", "o,other", NULL);
83
/* Prototypes (Put this in for AS1 compatibility...) */
84
addTagRegex (language, ".*\\.prototype\\.([A-Za-z0-9 ]+)[ \t]*\\=([ \t]*)function( [ \t]?)*\\(",
85
"\\1", "p,prototype", NULL);
88
/* Create parser definition stucture */
89
extern parserDefinition* ActionScriptParser (void)
92
static const char *const extensions [] = { "as", NULL };
93
parserDefinition *const def = parserNew ("ActionScript");
94
def->extensions = extensions;
95
def->initialize = installActionScriptRegex;