Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
341 lines (290 sloc) 10.2 KB
/*
Copyright (c) 2012, Yahoo! Inc. All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Yahoo! Inc. nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of Yahoo! Inc.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
{
options: "-s-", // Default command line options
patterns:
{
MATCHINGBRACES: "(? ( LBRACE | LPAREN | [ ) .* C:1 )",
//"(?( \{| \(| \[).*!\\1)"
NONBRACE: "(! LPAREN LBRACE [ , ; )",
// "(! \{ \( \[ , ;)"
//NAME: "/.*/",
//STRING: "/'.*'/",
ANY:
{
match: "."
},
NONTERM: "(!:\{};)",
ALLFUNCS:
{
comment: "ALLFUNCS - list all declared functions",
match: "(? function NAME% ) | (? NAME%: function ) | (? NAME% = new? function)"
},
CALLEDFUNCS:
{
comment: "CALLEDFUNCS - list all functions which are being called",
match: "NAME% LPAREN"
},
FUNCSINMOD:
{
match: "DOT add LPAREN .% , function LPAREN . RPAREN (LBRACE) (.*? ALLFUNCS)* .* C:1"
},
FUNCSUSEDBYMOD:
{
match: "DOT add LPAREN .% , function LPAREN . RPAREN (LBRACE) (.*? CALLEDFUNCS)* .* C:1"
},
ALLREQUIRES:
{
match: "add LPAREN .% .*? (LBRACE) .* C:1 .* requires:(\[) (? STRING% ,?)* C:2"
},
CFT:
{
comment: "CFT - case fallthrough",
match: "(! break ) ; case"
},
DOT:
{
comment: "DOT - Synonym for \.",
match: "\."
},
LPAREN:
{
comment: "LPAREN - Synonym for \(",
match: "\("
},
NOT:
{
comment: "NOT:token - Synonym for (!token)",
pattern: "(.)",
match: "(! \1)"
},
RPAREN:
{
comment: "RPAREN - Synonum for \)",
match: "\)"
},
LBRACE:
{
comment: "LBRACE - Synonym for \{",
match: "\{"
},
F:
{
comment: "F:fun_name - show the declaration of function 'fun_name'",
pattern: "(.)",
match: "(? function \1%)|(? \1% : function)|(? \1% = new? function)"
},
FA:
{
comment: "FA:fun_name - show the declaration of 'fun_name' along with its arguments",
pattern: "(NAME)",
match: "F:\1(LPAREN).* C:1"
},
FB:
{
comment: "FB:fun_name - show the entire body of functions named 'fun_name'",
pattern: "(NAME)",
match: "FA:\1(LBRACE).*% C:1"
},
FC:
{
comment: "FC:fun_name - show call to function 'fun_name'",
pattern: "(NAME)",
match: "\1 (LPAREN) .* C:1"
},
FCF:
{
comment: "FCF:fun_name - show functions which call function 'fun_name'",
pattern: "(NAME)",
match: "F:.% (LPAREN) .* C:1 (LBRACE) ((!function)|(function (LPAREN) .* C:5 (LBRACE) .* C:6))* \1 LPAREN .* C:2"
},
FIF:
{
comment: "FIF:fun_name_1:fun_name_2 - show calls to fun_name_2 inside fun_name_1",
pattern: "(NAME):(NAME)",
match: "F:\1 (LPAREN) .* \2 .* C:1"
},
FM:
{
comment: "FM:mod_name - show all functions in module 'mod_name'",
pattern: "(STRING)",
match: "DOT add LPAREN \1 ,function LPAREN .? \) ( LBRACE ) (.*? F:.)* .* C:1"
},
FMF:
{
comment: "FMF:fun_name - (slow) show all functions in the module which defines 'fun_name'",
pattern: "(.)",
match: "DOT add LPAREN STRING% ,function LPAREN .? \) ( LBRACE ) (.*? F:.%)* .* F:\1 (.*? F:.%)* .* C:1"
},
FNB:
{
comment: "FNB - for statements without braces (code coverage tool can't handle this.)",
match: "(for (LPAREN) .* C:2)% (!LBRACE)"
},
FR:
{
comment: "FR:symbol - show functions which reference 'symbol'",
pattern: "(NAME)",
match: "F:.% (LPAREN) .* C:1 (LBRACE) ((!function)|(function (LPAREN) .* C:5 (LBRACE) .* C:6))* \1 .* C:2"
},
M:
{
comment: "M:mod_name - show module info (the add & requires parts) for 'mod_name'",
pattern: "(.)",
match: "add LPAREN \1% .*? (LBRACE) .* C:1 .* requires:(\[) (? STRING% ,?)* C:2"
},
MA:
{
comment: "MA - show all modules",
match: "add LPAREN STRING%"
},
MF:
{
comment: "MF:fun_name - show the module which defines function 'fun_name'",
pattern: "(NAME)",
match: "DOT add LPAREN STRING% ,function LPAREN .? \) ( LBRACE ) .* F:\1 .* C:1"
},
MCF:
{
comment: "MCF:fun_name - show modules which call function 'fun_name'",
pattern: "(NAME)",
match: "DOT add LPAREN STRING% ,function LPAREN .? \) ( LBRACE ) .* FC:\1 .* C:1"
},
MR:
{
comment: "MR:symbol - show modules which reference 'symbol'",
pattern: "(NAME)",
match: "DOT add LPAREN STRING% ,function LPAREN .? \) ( LBRACE ) .*? \1 .* C:1"
},
OI:
{
comment: "OI:symbol - show static object initialization for 'symbol'",
pattern: "(NAME)",
match: "\1 =|: ({|[) .* C:1"
},
REQUIRE:
{
comment: "REQUIRE:mod_name - show modules which require 'mod_name'",
pattern: "(.)",
match: "DOT add LPAREN .% ,function LPAREN .? \) (LBRACE) .* C:1 .* requires:(\[) .* \1 .* C:2"
},
TC:
{
comment: "TC - Show arrays and objects with trailing commas",
match: ", ]|}"
},
UC:
{
comment: "UC:mod_name - Show the use() callback for all uses of mod_name",
pattern: "(STRING)",
match: "use (LPAREN) \1, .* C:1"
},
USED:
{
comment: "USED:mod_name",
pattern: "(STRING)",
match: "(use (LPAREN).* \1 .* C:2) | (requires:([) .* \1 .* C:4)"
},
USES:
{
comment: "USES:mod_name - show calls to use() within module 'mod_name'",
pattern: "(STRING)",
match: "DOT add LPAREN \1 .*? (LBRACE) (? .*? use LPAREN STRING%)* .* C:1"
},
USEDBY:
{
comment: "USEDBY:mod_name - show modules which call use() on 'mod_name'",
pattern: "(STRING)",
match: "DOT add LPAREN STRING% ,function LPAREN .? \) (LBRACE) .* DOT use LPAREN \1 .* C:1"
},
V:
{
comment: "V:var_name - show the declaration of a variable named 'var_name'",
pattern: "(NAME)",
match: "var (?(! \1)(? =(? NONBRACE+| MATCHINGBRACES+)+ ,)| ,)*? \1%"
},
VF:
{
comment: "VF:var_name:fun_name - show all uses of 'var_name' inside function 'fun_name'",
pattern: "(NAME):(NAME)",
match: "F:\2(LPAREN).* C:1 (\{) (? (! \1%)* \1%)* .* C:2"
}
},
default: "src",
// Example filesets. Customize this for your environment.
searches:
{
current: { root: "." },
src: { root: "~/src" },
mustache:
{
root: "~/src",
directories:
[
"js/templates",
"php/templates"
],
filepatterns:
[
"*.js",
"*.mu"
],
exclude:
[
"mods.js"
]
},
php:
{
root: "~/src",
filepatterns:
[
"*.js",
"*.mu",
"*.php",
"*.inc",
"*.templ"
]
},
yui:
{
root: "~/yui3/build",
exclude:
[
"simpleyui",
"*-min.js",
"*-debug.js"
]
},
test:
{
root: "~/src/test"
}
}
}