Merge pull request #2134 from b4n/ctags/new-flex-parser
Add new upstream candidate Flex parser
This commit is contained in:
commit
349b8c40e2
@ -11,7 +11,6 @@ noinst_LTLIBRARIES = libctags.la
|
||||
parsers = \
|
||||
parsers/abaqus.c \
|
||||
parsers/abc.c \
|
||||
parsers/actionscript.c \
|
||||
parsers/asciidoc.c \
|
||||
parsers/asm.c \
|
||||
parsers/basic.c \
|
||||
@ -22,6 +21,7 @@ parsers = \
|
||||
parsers/diff.c \
|
||||
parsers/docbook.c \
|
||||
parsers/erlang.c \
|
||||
parsers/flex.c \
|
||||
parsers/fortran.c \
|
||||
parsers/go.c \
|
||||
parsers/haskell.c \
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
GLSLParser, \
|
||||
MatLabParser, \
|
||||
ValaParser, \
|
||||
ActionScriptParser, \
|
||||
FlexParser, \
|
||||
NsisParser, \
|
||||
MarkdownParser, \
|
||||
Txt2tagsParser, \
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* $Id: actionscript.c,v 1.1 2004/01/03 03:59:19 svoisen Exp $
|
||||
*
|
||||
* Original file copyright (c) 2004, Sean Voisen
|
||||
*
|
||||
* Modified October 8, 2007 By Mike Fahy (VeryVito) of www.turdhead.com
|
||||
* - Added initial AS3 support
|
||||
* - Threw in some "TODO" and "NOTE" bits
|
||||
*
|
||||
* Modified October 9, 2007 By Ali Rantakari of hasseg.org:
|
||||
* - Added more allowed AS3 attribute keywords (override, final, internal
|
||||
* etc...) for classes, getters & setters, variables
|
||||
* - Allowed varying versions of "note" and "todo" spellings
|
||||
* - Allowed points (.) in package names so that they would display the
|
||||
* whole package name instead of just the first level
|
||||
* - Added interfaces matching support
|
||||
* - Reformatted some name parameters:
|
||||
* - Getters and setters: display either "get" or "set" in front
|
||||
* of the property name
|
||||
* - Todos & notes: made the name be the text that comes after the
|
||||
* "todo" or "note" text
|
||||
* - Variables: Moved the variable type after the name and separated
|
||||
* them with " : " according to ActionScript syntax
|
||||
* Modified March 6, 2009 by Chris Macksey (cmacksey@users.sourceforge.net)
|
||||
* - Tweaked to work better with Geany
|
||||
*
|
||||
* 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"
|
||||
#include "routines.h"
|
||||
|
||||
static tagRegexTable actionscriptTagRegexTable[] = {
|
||||
/* Functions */
|
||||
{"^[ \t]*[(private|public|static|protected|internal|final|override)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\\(([^\\{]*)",
|
||||
"\\1 (\\2", "f,function,functions,methods", NULL, NULL},
|
||||
|
||||
/* Getters and setters */
|
||||
{"^[ \t]*[(public|static|internal|final|override)( \t)]*function[ \t]+(set|get)[ \t]+([A-Za-z0-9_]+)[ \t]*\\(",
|
||||
"\\2 \\1", "l,field,fields", NULL, NULL},
|
||||
|
||||
/* Variables */
|
||||
{"^[ \t]*[(private|public|static|protected|internal)( \t)]*var[ \t]+([A-Za-z0-9_]+)([ \t]*\\:[ \t]*([A-Za-z0-9_]+))*[ \t]*",
|
||||
"\\1 \\: \\3", "v,variable,variables", NULL, NULL},
|
||||
|
||||
/* Constants */
|
||||
{"^[ \t]*[(private|public|static|protected|internal)( \t)]*const[ \t]+([A-Za-z0-9_]+)([ \t]*\\:[ \t]*([A-Za-z0-9_]+))*[ \t]*",
|
||||
"\\1 : \\3", "m,macro,macros", NULL, NULL},
|
||||
|
||||
/* Classes */
|
||||
{"^[ \t]*[(private|public|static|dynamic|final|internal)( \t)]*class[ \t]+([A-Za-z0-9_]+)[ \t]*([^\\{]*)",
|
||||
"\\1 (\\2)", "c,class,classes", NULL, NULL},
|
||||
|
||||
/* Interfaces */
|
||||
{"^[ \t]*[(private|public|static|dynamic|final|internal)( \t)]*interface[ \t]+([A-Za-z0-9_]+)[ \t]*([^\\{]*)",
|
||||
"\\1 (\\2)", "i,interface,interfaces", NULL, NULL},
|
||||
|
||||
/* Packages */
|
||||
{"^[ \t]*[(private|public|static)( \t)]*package[ \t]+([A-Za-z0-9_.]+)[ \t]*",
|
||||
"\\1", "p,package", NULL, NULL},
|
||||
|
||||
/* Notes */
|
||||
{"\\/\\/[ \t]*(NOTE|note|Note)[ \t]*\\:*(.*)",
|
||||
"\\2", "o,other", NULL, NULL},
|
||||
|
||||
/* Todos */
|
||||
{"\\/\\/[ \t]*(TODO|todo|ToDo|Todo)[ \t]*\\:*(.*)",
|
||||
"\\2", "o,other", NULL, NULL},
|
||||
|
||||
/* Prototypes (Put this in for AS1 compatibility...) */
|
||||
{".*\\.prototype\\.([A-Za-z0-9 ]+)[ \t]*\\=([ \t]*)function( [ \t]?)*\\(",
|
||||
"\\1", "r,prototype", NULL, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* FUNCTION DEFINITIONS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Create parser definition structure */
|
||||
extern parserDefinition* ActionScriptParser (void)
|
||||
{
|
||||
static const char *const extensions [] = { "as", NULL };
|
||||
parserDefinition *const def = parserNew ("ActionScript");
|
||||
def->extensions = extensions;
|
||||
def->tagRegexTable = actionscriptTagRegexTable;
|
||||
def->tagRegexCount = ARRAY_SIZE (actionscriptTagRegexTable);
|
||||
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
|
||||
return def;
|
||||
}
|
||||
|
||||
2636
ctags/parsers/flex.c
Normal file
2636
ctags/parsers/flex.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -720,6 +720,7 @@ static void add_top_level_items(GeanyDocument *doc)
|
||||
case GEANY_FILETYPES_AS:
|
||||
{
|
||||
tag_list_add_groups(tag_store,
|
||||
&(tv_iters.tag_externvar), _("Imports"), ICON_NAMESPACE,
|
||||
&(tv_iters.tag_namespace), _("Package"), ICON_NAMESPACE,
|
||||
&(tv_iters.tag_interface), _("Interfaces"), ICON_STRUCT,
|
||||
&(tv_iters.tag_class), _("Classes"), ICON_CLASS,
|
||||
|
||||
@ -371,14 +371,16 @@ static TMParserMapEntry map_VALA[] = {
|
||||
/* not in universal-ctags */
|
||||
static TMParserMapEntry map_ACTIONSCRIPT[] = {
|
||||
{'f', tm_tag_function_t},
|
||||
{'l', tm_tag_field_t},
|
||||
{'v', tm_tag_variable_t},
|
||||
{'m', tm_tag_macro_t},
|
||||
{'c', tm_tag_class_t},
|
||||
{'i', tm_tag_interface_t},
|
||||
{'p', tm_tag_package_t},
|
||||
{'o', tm_tag_other_t},
|
||||
{'r', tm_tag_prototype_t},
|
||||
{'P', tm_tag_package_t},
|
||||
{'m', tm_tag_method_t},
|
||||
{'p', tm_tag_member_t},
|
||||
{'v', tm_tag_variable_t},
|
||||
{'l', tm_tag_variable_t},
|
||||
{'C', tm_tag_macro_t},
|
||||
{'I', tm_tag_externvar_t},
|
||||
{'x', tm_tag_other_t},
|
||||
};
|
||||
|
||||
/* not in universal-ctags */
|
||||
@ -767,6 +769,7 @@ gboolean tm_parser_has_full_context(TMParserType lang)
|
||||
switch (lang)
|
||||
{
|
||||
/* These parsers include full hierarchy in the tag scope, separated by tm_parser_context_separator() */
|
||||
case TM_PARSER_ACTIONSCRIPT:
|
||||
case TM_PARSER_C:
|
||||
case TM_PARSER_CPP:
|
||||
case TM_PARSER_CSHARP:
|
||||
|
||||
@ -12,6 +12,13 @@ test_sources = \
|
||||
3470609.js \
|
||||
3526726.tex \
|
||||
68hc11.asm \
|
||||
actionscript/as-first-token.as \
|
||||
actionscript/classes.as \
|
||||
actionscript/const2.as \
|
||||
actionscript/const.as \
|
||||
actionscript/method-attributes.as \
|
||||
actionscript/packages.as \
|
||||
actionscript/sampler.as \
|
||||
angle_bracket.cpp \
|
||||
anonymous_functions.php \
|
||||
arraylist.js \
|
||||
|
||||
1
tests/ctags/actionscript/as-first-token.as
Normal file
1
tests/ctags/actionscript/as-first-token.as
Normal file
@ -0,0 +1 @@
|
||||
function f1():void {}
|
||||
2
tests/ctags/actionscript/as-first-token.as.tags
Normal file
2
tests/ctags/actionscript/as-first-token.as.tags
Normal file
@ -0,0 +1,2 @@
|
||||
# format=tagmanager
|
||||
f1Ì16Ö0
|
||||
16
tests/ctags/actionscript/classes.as
Normal file
16
tests/ctags/actionscript/classes.as
Normal file
@ -0,0 +1,16 @@
|
||||
package {
|
||||
class C1 {
|
||||
public function m1():Boolean { return 0; }
|
||||
}
|
||||
class C2 extends C1 {}
|
||||
class C3 {}
|
||||
interface I1 {}
|
||||
interface I2 {}
|
||||
interface I3 extends I1, I2 {}
|
||||
interface I4 extends I3 {}
|
||||
class C4 implements I1 {}
|
||||
class C5 extends C3 implements I1 {}
|
||||
class C6 extends C3 implements I1, I2 {}
|
||||
|
||||
dynamic class C7{}
|
||||
}
|
||||
13
tests/ctags/actionscript/classes.as.tags
Normal file
13
tests/ctags/actionscript/classes.as.tags
Normal file
@ -0,0 +1,13 @@
|
||||
# format=tagmanager
|
||||
C1Ì1Ö0
|
||||
C2Ì1Ö0
|
||||
C3Ì1Ö0
|
||||
C4Ì1Ö0
|
||||
C5Ì1Ö0
|
||||
C6Ì1Ö0
|
||||
C7Ì1Ö0
|
||||
I1Ì32Ö0
|
||||
I2Ì32Ö0
|
||||
I3Ì32Ö0
|
||||
I4Ì32Ö0
|
||||
m1Ì128ÎC1Ö0
|
||||
8
tests/ctags/actionscript/const.as
Normal file
8
tests/ctags/actionscript/const.as
Normal file
@ -0,0 +1,8 @@
|
||||
// https://www.oreilly.com/library/view/essential-actionscript-30/0596526946/ch04s02.html
|
||||
public class AlarmClock {
|
||||
public static const MODE_VISUAL = 1;
|
||||
public static const MODE_AUDIO = 2;
|
||||
public static const MODE_BOTH = 3;
|
||||
|
||||
private var mode = AlarmClock.MODE_AUDIO;
|
||||
}
|
||||
6
tests/ctags/actionscript/const.as.tags
Normal file
6
tests/ctags/actionscript/const.as.tags
Normal file
@ -0,0 +1,6 @@
|
||||
# format=tagmanager
|
||||
AlarmClockÌ1Ö0
|
||||
MODE_AUDIOÌ65536ÎAlarmClockÖ0
|
||||
MODE_BOTHÌ65536ÎAlarmClockÖ0
|
||||
MODE_VISUALÌ65536ÎAlarmClockÖ0
|
||||
modeÌ16384ÎAlarmClockÖ0
|
||||
7
tests/ctags/actionscript/const2.as
Normal file
7
tests/ctags/actionscript/const2.as
Normal file
@ -0,0 +1,7 @@
|
||||
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#const
|
||||
const MIN_AGE:int = 21;
|
||||
|
||||
const product_array:Array = new Array("Studio", "Dreamweaver", "Flash", "ColdFusion", "Contribute", "Breeze");
|
||||
product_array.push("Flex"); // array operations are allowed
|
||||
product_array = ["Other"]; // assignment is an error
|
||||
trace(product_array);
|
||||
3
tests/ctags/actionscript/const2.as.tags
Normal file
3
tests/ctags/actionscript/const2.as.tags
Normal file
@ -0,0 +1,3 @@
|
||||
# format=tagmanager
|
||||
MIN_AGEÌ65536Ö0
|
||||
product_arrayÌ65536Ö0
|
||||
12
tests/ctags/actionscript/method-attributes.as
Normal file
12
tests/ctags/actionscript/method-attributes.as
Normal file
@ -0,0 +1,12 @@
|
||||
/* Not sure it's really valid, but the goal is to check not choking on
|
||||
* attributes, so so long as it's valid attributes it's fine */
|
||||
class C {
|
||||
public function f1():void {}
|
||||
private function f2():void {}
|
||||
protected function f3():void {}
|
||||
internal function f4():void {}
|
||||
public function f5():void {}
|
||||
public override function f6():void {}
|
||||
final function f7():void {}
|
||||
native function f8():void {}
|
||||
}
|
||||
10
tests/ctags/actionscript/method-attributes.as.tags
Normal file
10
tests/ctags/actionscript/method-attributes.as.tags
Normal file
@ -0,0 +1,10 @@
|
||||
# format=tagmanager
|
||||
CÌ1Ö0
|
||||
f1Ì128ÎCÖ0
|
||||
f2Ì128ÎCÖ0
|
||||
f3Ì128ÎCÖ0
|
||||
f4Ì128ÎCÖ0
|
||||
f5Ì128ÎCÖ0
|
||||
f6Ì128ÎCÖ0
|
||||
f7Ì128ÎCÖ0
|
||||
f8Ì128ÎCÖ0
|
||||
9
tests/ctags/actionscript/packages.as
Normal file
9
tests/ctags/actionscript/packages.as
Normal file
@ -0,0 +1,9 @@
|
||||
package P1 {}
|
||||
package P2 {
|
||||
function f1() {}
|
||||
}
|
||||
package P3 {
|
||||
class C1 {}
|
||||
}
|
||||
package qualified.test . pkg {
|
||||
}
|
||||
7
tests/ctags/actionscript/packages.as.tags
Normal file
7
tests/ctags/actionscript/packages.as.tags
Normal file
@ -0,0 +1,7 @@
|
||||
# format=tagmanager
|
||||
C1Ì1ÎP3Ö0
|
||||
P1Ì512Ö0
|
||||
P2Ì512Ö0
|
||||
P3Ì512Ö0
|
||||
f1Ì16ÎP2Ö0
|
||||
qualified.test.pkgÌ512Ö0
|
||||
66
tests/ctags/actionscript/sampler.as
Normal file
66
tests/ctags/actionscript/sampler.as
Normal file
@ -0,0 +1,66 @@
|
||||
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sampler/Sample.html
|
||||
package
|
||||
{
|
||||
import flash.sampler.*
|
||||
import flash.system.*
|
||||
import flash.utils.*
|
||||
import flash.display.Sprite
|
||||
public class sampleTypes extends Sprite
|
||||
{
|
||||
var b:Boolean = true
|
||||
public function sampleTypes() {
|
||||
flash.sampler.startSampling();
|
||||
for(var i:int=0;i<10000;i++)
|
||||
new Object();
|
||||
|
||||
var cpuSamples:Array=[];
|
||||
var newSamples:Array=[];
|
||||
var delSamples:Array=[];
|
||||
var ids:Array=[]
|
||||
|
||||
var lastTime:Number=0;
|
||||
for each(var s:Sample in getSamples()) {
|
||||
|
||||
assert(s.time > 0); // positive
|
||||
assert(Math.floor(s.time) == s.time, s.time); // integral
|
||||
assert(s.time >= lastTime, s.time + ":" + lastTime); // ascending
|
||||
assert(s.stack == null || s.stack is Array)
|
||||
if(s.stack) {
|
||||
assert(s.stack[0] is StackFrame);
|
||||
assert(s.stack[0].name is String);
|
||||
}
|
||||
|
||||
if(s is NewObjectSample) {
|
||||
var nos = NewObjectSample(s);
|
||||
assert(s.id > 0, s.id);
|
||||
assert(s.type is Class, getQualifiedClassName(s.type));
|
||||
newSamples.push(s);
|
||||
ids[s.id] = "got one";
|
||||
} else if(s is DeleteObjectSample) {
|
||||
var dos = DeleteObjectSample(s);
|
||||
delSamples.push(s);
|
||||
assert(ids[dos.id] == "got one");
|
||||
} else if(s is Sample)
|
||||
cpuSamples.push(s);
|
||||
else {
|
||||
assert(false);
|
||||
}
|
||||
lastTime = s.time;
|
||||
}
|
||||
|
||||
trace(b)
|
||||
trace(newSamples.length > 0)
|
||||
trace(cpuSamples.length > 0)
|
||||
trace(delSamples.length > 0)
|
||||
|
||||
}
|
||||
|
||||
private function assert(e:Boolean, mess:String=null):void {
|
||||
b = e && b;
|
||||
if(true && !e) {
|
||||
if(mess) trace(mess);
|
||||
trace(new Error().getStackTrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
tests/ctags/actionscript/sampler.as.tags
Normal file
16
tests/ctags/actionscript/sampler.as.tags
Normal file
@ -0,0 +1,16 @@
|
||||
# format=tagmanager
|
||||
assertÌ128ÎsampleTypesÖ0
|
||||
bÌ16384ÎsampleTypesÖ0
|
||||
cpuSamplesÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
delSamplesÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
dosÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
flash.display.SpriteÌ32768Ö0
|
||||
flash.sampler.*Ì32768Ö0
|
||||
flash.system.*Ì32768Ö0
|
||||
flash.utils.*Ì32768Ö0
|
||||
idsÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
lastTimeÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
newSamplesÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
nosÌ16384ÎsampleTypes.sampleTypesÖ0
|
||||
sampleTypesÌ1Ö0
|
||||
sampleTypesÌ128ÎsampleTypesÖ0
|
||||
Loading…
x
Reference in New Issue
Block a user