static void installAntRegex (const langType language) { addTagRegex (language, "^[ \t]*<[ \t]*project.*name=\"([^\"]+)\".*", "\\1", "p,project,projects", NULL); addTagRegex (language, "^[ \t]*<[ \t]*target.*name=\"([^\"]+)\".*", "\\1", "t,target,targets", NULL); }
static void installDosBatchRegex (const langType language) { addTagRegex (language, "^:([A-Za-z_0-9]+)", "\\1", "l,label,labels", NULL); addTagRegex (language, "set[ \t]+([A-Za-z_0-9]+)[ \t]*=", "\\1", "v,variable,variables", NULL); }
/* * FUNCTION DEFINITIONS */ static void installSlangRegex (const langType language) { addTagRegex (language, "^.*define[ \t]+([A-Z_][A-Z0-9_]*)[^;]*$", "\\1", "f,function,functions", "i"); addTagRegex (language, "^[ \t]*implements[ \t]+\\([ \t]*\"([^\"]*)\"[ \t]*\\)[ \t]*;", "\\1", "n,namespace,namespaces", NULL); }
static void installMatLabRegex (const langType language) { /* function [x,y,z] = asdf */ addTagRegex (language, "^function[ \t]*\\[.*\\][ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL); /* function x = asdf */ addTagRegex (language, "^function[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL); /* function asdf */ addTagRegex (language, "^function[ \t]*([a-zA-Z0-9_]+)[^=]*$", "\\1", "f,function", NULL); /* variables */ addTagRegex (language, "^[ \t]*([a-zA-Z0-9_]+)[ \t]*=[ \t]", "\\1", "v,variable", NULL); }
static void installAntRegex (const langType language) { addTagRegex (language, "^[ \t]*<[ \t]*project[^>]+name=\"([^\"]+)\".*", "\\1", "p,project,projects", NULL); addTagRegex (language, "^[ \t]*<[ \t]*target[^>]+name=\"([^\"]+)\".*", "\\1", "t,target,targets", NULL); addTagRegex (language, "^[ \t]*<[ \t]*property[^>]+name=\"([^\"]+)\".*", "\\1", "P,property,property", NULL); addTagRegex (language, "^[ \t]*<[ \t]*import[^>]+file=\"([^\"]+)\".*", "\\1", "i,import,imports", NULL); }
static void installMyrddinRegex (const langType language) { addTagRegex (language, "^(\\s*extern)?\\s*const\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*=.*$", "\\2", "f,function,functions", NULL); addTagRegex (language, "^(\\s*extern)?\\s*var\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*=.*$", "\\2", "v,var,variables", NULL); addTagRegex (language, "^\\s*pkg\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*=$", "\\1", "p,pkg,packages", NULL); }
static void installRRegex (const langType language) { /* This is a function, looks as follows: * itent <- function(arg1, arg2) { * do_something; * } */ addTagRegex (language, "^[ \t]*([.a-zA-Z0-9_]+)([ \t]*)<-([ \t]*)function", "\\1", "f,function", NULL); /* This loads someting, e.g. a library, simply: library(libname) */ addTagRegex (language, "^[ \t]*(library|source|load|data)[\\(]([a-zA-Z0-9_]+)[\\)]", "\\2", "s,other", NULL); }
static void installHtmlRegex (const langType language) { #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*" addTagRegex (language, "<a" POSSIBLE_ATTRIBUTES "[ \t]+name=\"?([^>\"]+)\"?" POSSIBLE_ATTRIBUTES "[ \t]*>", "\\2", "a,anchor,named anchors", "i"); addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(", "\\1", "f,function,JavaScript functions", NULL); }
static void installHtmlRegex (const langType language) { #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*" addTagRegex (language, "<a" POSSIBLE_ATTRIBUTES "[ \t]+name=\"?([^>\"]+)\"?" POSSIBLE_ATTRIBUTES "[ \t]*>", "\\2", "m,member,named anchors", "i"); addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(", "\\1", "f,function,JavaScript functions", NULL); /* the following matches headings with tags inside like * <h1><a href="#id109"><i>Some Text</i></a></h1> * and * <h1>Some Text</h1> */ #define SPACES "[ \t]*" #define ATTRS "[^>]*" #define INNER_HEADING \ ATTRS ">" SPACES "(<" ATTRS ">" SPACES ")*([^<]+).*" addTagRegex (language, "<h1" INNER_HEADING "</h1>", "\\2", "n,namespace,H1 heading", "i"); addTagRegex (language, "<h2" INNER_HEADING "</h2>", "\\2", "c,class,H2 heading", "i"); addTagRegex (language, "<h3" INNER_HEADING "</h3>", "\\2", "v,variable,H3 heading", "i"); }
static void installDTSRegex (const langType language) { /* phandle = <0x00> */ addTagRegex (language, "^[ \t]*phandle[ \t]+=[ \t]+<(0x[a-fA-F0-9]+)>", "\\1", "p,phandler,phandlers", "{scope=ref}"); /* label: */ addTagRegex (language, "^[ \t]*([a-zA-Z][a-zA-Z0-9_]*)[ \t]*:", "\\1", "l,label,labels", "{scope=push}{exclusive}"); /* extras for tracking scopes */ addTagRegex (language, "^[ \t]*([a-zA-Z][a-zA-Z0-9_]*)[ \t]*\\{", "", "", "{scope=push}{placeholder}{exclusive}"); addTagRegex (language, "^[ \t]*\\};", "", "", "{scope=pop}{exclusive}"); }
static void installPHPRegex (const langType language) { addTagRegex(language, "(^|[ \t])class[ \t]+([" ALPHA "_][" ALNUM "_]*)", "\\2", "c,class,classes", NULL); addTagRegex(language, "(^|[ \t])interface[ \t]+([" ALPHA "_][" ALNUM "_]*)", "\\2", "i,interface,interfaces", NULL); addTagRegex(language, "(^|[ \t])define[ \t]+[ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)", "\\2", "d,define,constant definitions", NULL); addTagRegex(language, "(^|[ \t])const[ \t]+[ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)", "\\2", "d,define,constant definitions", NULL); addTagRegex(language, "(^|[ \t])[ \t]+(public|protected|private)([ \t]static)?[ \t]*function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)", "\\4", "f,function,functions", NULL); addTagRegex(language, "(^|[ \t])(var|public|protected|private|static)[ \t]+\\$([" ALPHA "_][" ALNUM "_]*)[ \t]*[=;]", "\\3", "v,variable,variables", NULL); /* function regex is covered by PHP regex */ addTagRegex (language, "(^|[ \t])([A-Za-z0-9_]+)[ \t]*[=:][ \t]*function[ \t]*\\(", "\\2", "j,jsfunction,javascript functions", NULL); addTagRegex (language, "(^|[ \t])([A-Za-z0-9_.]+)\\.([A-Za-z0-9_]+)[ \t]*=[ \t]*function[ \t]*\\(", "\\2.\\3", "j,jsfunction,javascript functions", NULL); addTagRegex (language, "(^|[ \t])([A-Za-z0-9_.]+)\\.([A-Za-z0-9_]+)[ \t]*=[ \t]*function[ \t]*\\(", "\\3", "j,jsfunction,javascript functions", NULL); }
static void installCobolRegex (const langType language) { addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)[ \t]+(BLANK|OCCURS|IS|JUST|PIC|REDEFINES|RENAMES|SIGN|SYNC|USAGE|VALUE)", "\\1", "d,data,data items", "i"); addTagRegex (language, "^[ \t]*[FSR]D[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", "\\1", "f,file,file descriptions (FD, SD, RD)", "i"); addTagRegex (language, "^[ \t]*[0-9]+[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", "\\1", "g,group,group items", "i"); addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)\\.", "\\1", "p,paragraph,paragraphs", "i"); addTagRegex (language, "^[ \t]*PROGRAM-ID\\.[ \t]+([A-Z0-9][A-Z0-9-]*)\\.", "\\1", "P,program,program ids", "i"); addTagRegex (language, "^[ \t]*([A-Z0-9][A-Z0-9-]*)[ \t]+SECTION\\.", "\\1", "s,section,sections", "i"); }
static void installJavaScriptRegex (const langType language) { // Old skool Functions // function foo (blarg) {...} addTagRegex (language, "^[ \t]*function[ \t]+([A-Za-z0-9_$]+)[ \t]*\\(([^\\{]*)", "\\1", "f,function,functions,methods", NULL); // variables which have function values // var f00 = function (blarg) { addTagRegex (language, "^[ \t]*var[ \t]+([A-Za-z0-9_$]+)[ \t]*\\=[ \t]+function[ \t]*\\(([^\\{]*)", "\\1", "f,function,functions,methods", NULL); // Methods of the form // foo : function (blarg) { addTagRegex (language, "^[ \t]*([A-Za-z0-9_$]*)[ \t]*\\:[ \t]*function[ \t]*\\(([^\\{]*)", "\\1", "f,function,functions,methods", NULL); // properties of the form // this will duplicate methods -- need to filter them out in a post processing stage :/ // foo : bar addTagRegex (language, "^[ \t]*([A-Za-z0-9_$]*)[ \t]*\\:[ \t]*", "\\1", "p,property,properties", NULL); // Variables // var foo; addTagRegex (language, "^[ \t]*var[ \t]+([A-Za-z0-9_$]+)[ \t]*[,;]+", "\\1", "v,variable,variables", NULL); // Variables // var foo = blah .. this will duplicate variables which have functions as values addTagRegex (language, "^[ \t]*var[ \t]+([A-Za-z0-9_$]+)[ \t]*\\=[ \t]*", "\\1", "v,variable,variables", NULL); //multiple variables // var foo[=quux],bar; addTagRegex (language, "^[ \t]*var[ \t]+([A-Za-z0-9_$]+)[ \t]*([^,]*)\\,[ \t]*([A-Za-z0-9_$]+)", "\\3", "v,variable,variables", NULL); // Classes // using @class metadata addTagRegex (language, "^[ \t]*\\*[ \t]*\\@class[ \t]*([A-Za-z0-9_$]+)", "\\1", "c,class,classes", NULL); // Notes addTagRegex (language, "\\/\\/[ \t]*(NOTE|note|Note)[ \t]*\\:*(.*)", "\\2", "i,{Notes}", NULL); // Todos addTagRegex (language, "\\/\\/[ \t]*(TODO|todo|ToDo|Todo)[ \t]*\\:*(.*)", "\\2", "i,{To do}", NULL); // Prototypes (Put this in for AS1 compatibility...) addTagRegex (language, ".*\\.prototype\\.([A-Za-z0-9 ]+)[ \t]*\\=([ \t]*)function( [ \t]?)*\\(", "\\1", "p,prototype", NULL); }
static void installYaccRegex (const langType language) { addTagRegex (language, "^([A-Za-z][A-Za-z_0-9]+)[ \t]*:", "\\1", "l,label,labels", NULL); }
static void installRexxRegex (const langType language) { addTagRegex (language, "^([A-Za-z0-9@#$\\.!?_]+)[ \t]*:", "\\1", "s,subroutine,subroutines", NULL); }
static void installJavaScriptRegex (const langType language) { addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(", "\\1", "f,function,functions", NULL); }