Difference between revisions of "Function lists"

From EditPlus Wiki
Jump to: navigation, search
(CSS)
m
 
(21 intermediate revisions by 18 users not shown)
Line 1: Line 1:
==CSS==
+
==JavaScript==
Since CSS doesn't have a "function" keyword, we need to find a way to identify lines containing a selector. I've chosen to use the most common method; selectors start at the beginning of the line with an alphanumeric character, all other lines (properties, comments) must be indented (or generally start with a non-alphanumeric character). Example:
+
  
/*
+
Both function pattern regular expressions support partial display using the first tagged expression in the Function Pattern dialog.
  Example of a comment
+
*/
+
td.test
+
{
+
  background-color:  #ffffff;
+
  color:              #000000;
+
  padding:            2px;
+
}
+
  
In EditPlus:
+
^[ \t]*function[ \t](.*\(.*\)).*$
 +
^[ \t]*([^:=]+[:=] function ?\(.*\)).*
  
#Go to Tools > Preferences
+
These expressions will find functions of the following forms in your file:
#Find the Settings & syntax option under the Files section
+
#Select CSS from the File Types list
+
#In the Function Pattern box, enter:  
+
^[a-zA-Z0-9]
+
  
If you are unfamiliar with [[Regular Expressions]]: the ^ matches the beginning of the line, so that's where our search will start. After that, match a single character in the range of a-z, it's capital equivelant or 0-9, also known as alphanumeric. Since we indicated this character must be directly after the beginning of the line, any line with a leading space or tab will be ignored, as will the {} lines.
+
function foobarspaz(arg1, arg2) {}
 +
foobarspaz: function(arg1, arg2) {}
 +
foobarspaz = function(arg1, arg2) {}
  
If you open up the Function List again, you'll get a list of all selectors; just be careful on how you format the CSS.
+
==PHP5==
 +
When using classes in PHP5 the function keyword can be preceded by "public", "private" or "protected".  The following updated regex takes account of this change from PHP4.  If you don't know why you might need this, then you probably don't.
  
You can also develop more advanced, more general, stricter patterns like
+
  ^[ \t]*(public[ \t]|protected[ \t]|private[ \t]|)[ \t]*function[ \t].*\([^;]*$
  ^([@:\.#]?[A-z][A-z0-9_-]*)([ \t]*[,+> ][ \t]*([:\.#]?[A-z][A-z0-9_-]*))*[ \t]*{?
+
This particular pattern still lacks support for some complexer selectors, e.g. 'a[hreflang|="en"]', 'html:lang("en")' or multiline ones, and chokes on comments.
+
<div style="overflow:auto; height: 1px; ">
+
[http://picas.servepics.com/anal/anal-fisting.html gay anal] ass parade [http://picas.servepics.com/anal/teen-tight-ass.html hot ass] butts [http://picas.servepics.com/anal/anal-destruction.html big booty] asian teen [http://picas.servepics.com/anal/eminem-ass-like-that.html tight ass] fat ass [http://picas.servepics.com/anal/latina-ass.html asses] asian girls in thongs [http://picas.servepics.com/anal/anal-virgin.html tight ass] hot asians [http://picas.servepics.com/anal/girls-with-big-asses.html anal fisting] asian chicks [http://picas.servepics.com/anal/girls-butts.html black booty] japanese anime [http://picas.servepics.com/anal/booty-shorts.html onion booty] japanese schoolgirl [http://picas.servepics.com/anal/thick-booty.html butt] asian lesbians [http://picas.servepics.com/anal/big-black-booty.html tight ass] hot asian [http://picas.servepics.com/anal/nice-butts.html anal fisting] asian thumbs [http://picas.servepics.com/anal/white-booty.html butts] asian teens [http://picas.servepics.com/anal/ass-lick.html butts] asian [http://picas.servepics.com/anal/jennifer-lopez-ass.html anal fisting] camel toe babes [http://picas.servepics.com/anal/anal-sex-pregnant.html teen anal] asian sex [http://picas.servepics.com/anal/brazilian-booty.html booty] asian school girls [http://picas.servepics.com/anal/ass-and-titties.html teen ass] camel toe [http://picas.servepics.com/anal/i-like-big-butts.html anal] ass fuck [http://picas.servepics.com/anal/seymore-butts.html gay anal] free asians [http://picas.servepics.com/anal/butthole.html butts] sexy ass [http://picas.servepics.com/anal/anal-stretching.html big ass] anal fucking [http://picas.servepics.com/anal/extreme-anal-fucking.html black booty] black booty [http://picas.servepics.com/anal/black-ghetto-booty.html anal teen] anal fisting [http://picas.servepics.com/anal/fat-asses.html ass to mouth] asian school girls in thongs [http://picas.servepics.com/anal/mexican-ass.html big butt] free asian porn [http://picas.servepics.com/anal/booty-contest.html gay anal] ghetto booty [http://picas.servepics.com/anal/big-ghetto-booty.html sexy ass] big butts [http://picas.servepics.com/anal/brazilian-butts.html ass to mouth] tight ass [http://picas.servepics.com/anal/shemale-anal.html gay anal] asian thumbs [http://picas.servepics.com/anal/anal-cum-shots.html ass parade] japanese nudities [http://picas.servepics.com/anal/virgin-anal.html hot ass] little camel toe [http://picas.servepics.com/anal/ebony-black-ass.html big tits round asses] asses [http://picas.servepics.com/anal/womens-butts.html teen anal] gay anal [http://picas.servepics.com/anal/anal-pleasure.html anal fucking] cameltoes [http://picas.servepics.com/anal/big-ass-bitches.html ass in thong] asian anal [http://picas.servepics.com/anal/thick-butt.html ghetto booty] young camel toe [http://picas.servepics.com/anal/small-butts.html gay anal] ass parade [http://picas.servepics.com/anal/black-anal-deep.html big ass] japanese anime [http://picas.servepics.com/anal/butt-shots.html teen anal] nice butt [http://picas.servepics.com/anal/nice-ass-in-thong.html nice ass] camel toe teen [http://picas.servepics.com/anal/anal-slut.html ass like that] ass in thong [http://picas.servepics.com/anal/tight-teen-ass.html perfect ass] asian [http://picas.servepics.com/anal/huge-asses.html tight ass] hot asian [http://picas.servepics.com/anal/bubble-butt-white.html ass teen] free asians [http://picas.servepics.com/anal/licking-ass.html ass and pussy] japanese porn [http://picas.servepics.com/anal/lick-ass.html nice butt] asian school girls in thongs [http://picas.servepics.com/anal/bikini-ass.html perfect ass] asian models [http://picas.servepics.com/anal/big-black-butts.html ass and pussy] asian lesbian [http://picas.servepics.com/anal/mexican-booty.html nice ass] asian models [http://picas.servepics.com/anal/big-latina-ass.html hot ass] asian lesbian [http://picas.servepics.com/anal/jessica-simpson-butt.html booty] asian girls [http://picas.servepics.com/anal/big-booty-thongs.html teen ass] tight ass [http://picas.servepics.com/anal/anal-cumshot.html big butts] perfect butt [http://picas.servepics.com/anal/big-booty-girls.html fat ass] hot ass [http://picas.servepics.com/anal/gay-anal-cum-shots.html tight ass] ass [http://picas.servepics.com/anal/brazil-booty.html perfect butt] ass fuck [http://picas.servepics.com/anal/ass-spanking.html ass in thong] big black ass [http://picas.servepics.com/anal/anal-orgy.html nice ass] japanese animation [http://picas.servepics.com/anal/teenage-butt-girls.html ghetto booty] asian lesbian
+
</div>
+
  
==HTML==
+
To also show classes in the function list use the following:
Of course HTML does not have functions, but especially in longer documents it is convenient to be able to jump to headings. You can either regex-search for "<h[1-6]" and select ''Set Marker'' or you use the function list (Ctrl-F11) with a pattern like this in Settings & Syntax > Files > HTML > Function Pattern
+
  ^[ \t]*((public[ \t]|protected[ \t]|private[ \t]|)[ \t]*function[ \t].*\()|(class[ \t].*\{)[^;]*$
 
+
  <(h[1-6]|caption)
+

Latest revision as of 21:24, 25 March 2010

JavaScript

Both function pattern regular expressions support partial display using the first tagged expression in the Function Pattern dialog.

^[ \t]*function[ \t](.*\(.*\)).*$
^[ \t]*([^:=]+[:=] function ?\(.*\)).*

These expressions will find functions of the following forms in your file:

function foobarspaz(arg1, arg2) {}
foobarspaz: function(arg1, arg2) {}
foobarspaz = function(arg1, arg2) {}

PHP5

When using classes in PHP5 the function keyword can be preceded by "public", "private" or "protected". The following updated regex takes account of this change from PHP4. If you don't know why you might need this, then you probably don't.

^[ \t]*(public[ \t]|protected[ \t]|private[ \t]|)[ \t]*function[ \t].*\([^;]*$

To also show classes in the function list use the following:

^[ \t]*((public[ \t]|protected[ \t]|private[ \t]|)[ \t]*function[ \t].*\()|(class[ \t].*\{)[^;]*$