14 | Paste in some JavaScript and the parse tree will be displayed over there!
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-bitops-nsieve-bits.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | i check-bitops-nsieve-bits.js /^for (var i = 0; i < result.length; ++i)$/;" v lineno:37 type:number
8 | pad check-bitops-nsieve-bits.js /^function pad(n,width) {$/;" f lineno:8 type:string function(any, any)
9 | primes check-bitops-nsieve-bits.js /^function primes(isPrime, n) {$/;" f lineno:14 type:void function(Array[number], number)
10 | result check-bitops-nsieve-bits.js /^var result = [];$/;" v lineno:6 type:Array[number]
11 | ret check-bitops-nsieve-bits.js /^var ret = 0;$/;" v lineno:36 type:number
12 | sieve check-bitops-nsieve-bits.js /^function sieve() {$/;" f lineno:27 type:void function()
13 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-access-nsieve.js:
--------------------------------------------------------------------------------
1 | // The Great Computer Language Shootout
2 | // http://shootout.alioth.debian.org/
3 | //
4 | // modified by Isaac Gouy
5 |
6 | function pad(number,width){
7 | var s = number.toString();
8 | var prefixWidth = width - s.length;
9 | if (prefixWidth>0){
10 | for (var i=1; i<=prefixWidth; i++) s = " " + s;
11 | }
12 | return s;
13 | }
14 |
15 | function nsieve(m, isPrime){
16 | var i, k, count;
17 |
18 | for (i=2; i<=m; i++) { isPrime[i] = true; }
19 | count = 0;
20 |
21 | for (i=2; i<=m; i++){
22 | if (isPrime[i]) {
23 | for (k=i+i; k<=m; k+=i) isPrime[k] = false;
24 | count++;
25 | }
26 | }
27 | return count;
28 | }
29 |
30 | var ret = 0;
31 | function sieve() {
32 | for (var i = 1; i <= 3; i++ ) {
33 | var m = (1<
8 | i check-3d-morph.js /^for (var i = 0; i < loops; ++i) {$/;" v lineno:47 type:any
9 | i check-3d-morph.js /^for (var i = 0; i < nx; i++)$/;" v lineno:52 type:number
10 | i check-3d-morph.js /^for (var i=0; i < nx*nz*3; ++i) $/;" v lineno:44 type:any
11 | loops check-3d-morph.js /^var loops = 15$/;" v lineno:26 type:number
12 | morph check-3d-morph.js /^function morph(a, f) {$/;" f lineno:30 type:void function(Array[number], number)
13 | nx check-3d-morph.js /^var nx = 120$/;" v lineno:27 type:number
14 | nz check-3d-morph.js /^var nz = 120$/;" v lineno:28 type:number
15 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-cordic.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | AG_CONST check-math-cordic.js /^var AG_CONST = 0.6072529350;$/;" v lineno:28 type:number
8 | Angles check-math-cordic.js /^var Angles = [$/;" v lineno:45 type:Array[number]
9 | DEG2RAD check-math-cordic.js /^function DEG2RAD(X)$/;" f lineno:40 type:number function(any)
10 | FIXED check-math-cordic.js /^function FIXED(X)$/;" f lineno:30 type:number function(number)
11 | FLOAT check-math-cordic.js /^function FLOAT(X)$/;" f lineno:35 type:number function(any)
12 | cordic check-math-cordic.js /^function cordic( runs ) {$/;" f lineno:84 type:number function(number)
13 | cordicsincos check-math-cordic.js /^function cordicsincos() {$/;" f lineno:53 type:number function()
14 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-bitops-nsieve-bits.js:
--------------------------------------------------------------------------------
1 | // The Great Computer Language Shootout
2 | // http://shootout.alioth.debian.org
3 | //
4 | // Contributed by Ian Osgood
5 |
6 | var result = [];
7 |
8 | function pad(n,width) {
9 | var s = n.toString();
10 | while (s.length < width) s = ' ' + s;
11 | return s;
12 | }
13 |
14 | function primes(isPrime, n) {
15 | var i, count = 0, m = 10000<>5;
16 |
17 | for (i=0; i>5] & 1<<(i&31)) {
21 | for (var j=i+i; j>5] &= ~(1<<(j&31)));
23 | count++;
24 | }
25 | }
26 |
27 | function sieve() {
28 | for (var i = 4; i <= 4; i++) {
29 | var isPrime = new Array((10000<>5);
30 | primes(isPrime, i);
31 | }
32 | }
33 |
34 | sieve();
35 |
36 | var ret = 0;
37 | for (var i = 0; i < result.length; ++i)
38 | ret += result[i];
39 |
40 | assertEq(ret, -211235557404919)
41 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-bitops-3bit-bits-in-byte.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com
2 |
3 | // 1 op = 6 ANDs, 3 SHRs, 3 SHLs, 4 assigns, 2 ADDs
4 | // O(1)
5 | function fast3bitlookup(b) {
6 | var c, bi3b = 0xE994; // 0b1110 1001 1001 0100; // 3 2 2 1 2 1 1 0
7 | c = 3 & (bi3b >> ((b << 1) & 14));
8 | c += 3 & (bi3b >> ((b >> 2) & 14));
9 | c += 3 & (bi3b >> ((b >> 5) & 6));
10 | return c;
11 |
12 | /*
13 | lir4,0xE994; 9 instructions, no memory access, minimal register dependence, 6 shifts, 2 adds, 1 inline assign
14 | rlwinmr5,r3,1,28,30
15 | rlwinmr6,r3,30,28,30
16 | rlwinmr7,r3,27,29,30
17 | rlwnmr8,r4,r5,30,31
18 | rlwnmr9,r4,r6,30,31
19 | rlwnmr10,r4,r7,30,31
20 | addr3,r8,r9
21 | addr3,r3,r10
22 | */
23 | }
24 |
25 | var ret = 0;
26 | function TimeFunc(func) {
27 | var x, y, t;
28 | for(var x=0; x<500; x++)
29 | for(var y=0; y<256; y++) {
30 | ret += func(y);
31 | }
32 | }
33 |
34 | TimeFunc(fast3bitlookup);
35 | assertEq(ret, 512000)
36 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | PREFIX=/usr/local
2 | INSTALL=install
3 | NODE=node
4 |
5 | BIN_SRC=$(addprefix bin/,jsctags.js)
6 | LIB_SRC=$(addprefix lib/jsctags/,getopt.js log.js paperboy.js traits.js \
7 | underscore.js)
8 | LIB_CTAGS_SRC=$(addprefix lib/jsctags/ctags/,index.js interp.js nativefn.js \
9 | reader.js writer.js)
10 | LIB_NARCISSUS_SRC=$(addprefix lib/jsctags/narcissus/,index.js jscfa.js \
11 | jsdefs.js jslex.js jsparse.js)
12 |
13 | install:
14 | $(INSTALL) -d $(PREFIX)/bin
15 | $(INSTALL) $(BIN_SRC) $(BIN_SRC:%.js=$(PREFIX)/%)
16 | $(INSTALL) -d $(PREFIX)/lib/jsctags
17 | $(INSTALL) $(LIB_SRC) $(PREFIX)/lib/jsctags
18 | $(INSTALL) -d $(PREFIX)/lib/jsctags/ctags
19 | $(INSTALL) $(LIB_CTAGS_SRC) $(PREFIX)/lib/jsctags/ctags
20 | $(INSTALL) -d $(PREFIX)/lib/jsctags/narcissus
21 | $(INSTALL) $(LIB_NARCISSUS_SRC) $(PREFIX)/lib/jsctags/narcissus
22 |
23 | uninstall:
24 | rm -rf $(BIN_SRC:%.js=$(PREFIX)/%) $(PREFIX)/lib/jsctags
25 |
26 | serve:
27 | $(NODE) serve.js
28 |
29 | tags:
30 | $(NODE) bin/jsctags.js -Llib/jsctags js lib/jsctags
31 |
32 | .PHONY: all install uninstall serve tags
33 |
34 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-spectral-norm.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | A check-math-spectral-norm.js /^function A(i,j) {$/;" f lineno:6 type:number function(number, number)
8 | AtAu check-math-spectral-norm.js /^function AtAu(u,v,w) {$/;" f lineno:28 type:void function(Array[number], Array[number], Array[number])
9 | Atu check-math-spectral-norm.js /^function Atu(u,v) {$/;" f lineno:19 type:void function(Array[number], Array[number])
10 | Au check-math-spectral-norm.js /^function Au(u,v) {$/;" f lineno:10 type:void function(Array[number], Array[number])
11 | actual check-math-spectral-norm.js /^var actual = '';$/;" v lineno:49 type:string
12 | i check-math-spectral-norm.js /^for (var i = 6; i <= 48; i *= 2) {$/;" v lineno:50 type:number
13 | spectralnorm check-math-spectral-norm.js /^function spectralnorm(n) {$/;" f lineno:33 type:number function(number)
14 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-regexp-dna.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | clen check-regexp-dna.js /^GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\\n\\$/;" v lineno:12 type:undefined
8 | dnaInput check-regexp-dna.js /^var dnaInput = ">ONE Homo sapiens alu\\n\\$/;" v lineno:8 type:string
9 | dnaOutputString check-regexp-dna.js /^TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\\n\\$/;" v lineno:34 type:string
10 | ilen check-regexp-dna.js /^GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\\n\\$/;" v lineno:12 type:undefined
11 | l check-regexp-dna.js /^var l;$/;" v lineno:7 type:any
12 | seqs check-regexp-dna.js /^CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\\n\\$/;" v lineno:13 type:Array[RegExp]
13 | subs check-regexp-dna.js /^AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\\n\\$/;" v lineno:23 type:Object
14 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-spectral-norm.js:
--------------------------------------------------------------------------------
1 | // The Great Computer Language Shootout
2 | // http://shootout.alioth.debian.org/
3 | //
4 | // contributed by Ian Osgood
5 |
6 | function A(i,j) {
7 | return 1/((i+j)*(i+j+1)/2+i+1);
8 | }
9 |
10 | function Au(u,v) {
11 | for (var i=0; i0){
18 | return new TreeNode(
19 | bottomUpTree(2*item-1, depth-1)
20 | ,bottomUpTree(2*item, depth-1)
21 | ,item
22 | );
23 | }
24 | else {
25 | return new TreeNode(null,null,item);
26 | }
27 | }
28 |
29 | var ret;
30 |
31 | for ( var n = 4; n <= 7; n += 1 ) {
32 | var minDepth = 4;
33 | var maxDepth = Math.max(minDepth + 2, n);
34 | var stretchDepth = maxDepth + 1;
35 |
36 | var check = bottomUpTree(0,stretchDepth).itemCheck();
37 |
38 | var longLivedTree = bottomUpTree(0,maxDepth);
39 | for (var depth=minDepth; depth<=maxDepth; depth+=2){
40 | var iterations = 1 << (maxDepth - depth + minDepth);
41 |
42 | check = 0;
43 | for (var i=1; i<=iterations; i++){
44 | check += bottomUpTree(i,depth).itemCheck();
45 | check += bottomUpTree(-i,depth).itemCheck();
46 | }
47 | }
48 |
49 | ret = longLivedTree.itemCheck();
50 | }
51 |
52 | assertEq(ret, -1)
53 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ctags",
3 | "description": "Intelligent code indexing for JavaScript",
4 | "version": "0.1.0",
5 | "keywords": [ "ctags", "tags" ],
6 | "maintainers": [
7 | {
8 | "name": "Patrick Walton",
9 | "email": "pwalton@mozilla.com",
10 | "web": "http://pcwalton.blogspot.com/"
11 | }
12 | ],
13 | "contributors": [
14 | {
15 | "name": "Patrick Walton",
16 | "email": "pwalton@mozilla.com",
17 | "web": "http://pcwalton.blogspot.com/"
18 | }
19 | ],
20 | "bugs": "http://github.com/pcwalton/jsctags/issues",
21 | "licenses": [
22 | {
23 | "type": "MPL",
24 | "url": "http://www.mozilla.org/MPL/MPL-1.1.html"
25 | },
26 | {
27 | "type": "GPLv2",
28 | "url": "http://www.gnu.org/licenses/gpl-2.0.html"
29 | },
30 | {
31 | "type": "LGPLv2.1",
32 | "url": "http://www.gnu.org/licenses/lgpl-2.1.html"
33 | }
34 | ],
35 | "repositories": [
36 | {
37 | "type": "git",
38 | "url": "git://github.com/pcwalton/jsctags.git"
39 | }
40 | ],
41 | "dependencies": {},
42 | "homepage": "http://github.com/pcwalton/jsctags/",
43 | "engine": [ "node" ],
44 | "directories": [ "bin", "lib", "test" ],
45 | "implements": [ "CommonJS/Modules/1.0" ],
46 | "scripts": {
47 | "install": "install.js",
48 | "serve": "serve.js",
49 | "uninstall": "uninstall.js"
50 | }
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-bitops-bitwise-and.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | bitwiseAndValue = 4294967296;
27 | for (var i = 0; i < 60; i++)
28 | bitwiseAndValue = bitwiseAndValue & i;
29 | assertEq(bitwiseAndValue, 0)
30 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-mont.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | copyInt_ check-mont.js /^function copyInt_(x,n) {$/;" f lineno:33 type:void function(Array[number], number)
8 | copy_ check-mont.js /^function copy_(x,y) {$/;" f lineno:23 type:void function(Array[number], Array[number])
9 | expected check-mont.js /^var expected = [18770, 31456, 17999, 32635, 27508, 29131, 2856, 16233, 5439, 27580, 7093, 18192, 30804, 5472, 8529, 28649, 14852, 0, 0, 0];$/;" v lineno:6 type:Array[number]
10 | greater check-mont.js /^function greater(x,y) {$/;" f lineno:42 type:number function(Array[number], Array[number])
11 | i check-mont.js /^for (var i = 0; i < expected.length; i++) {$/;" v lineno:115 type:number
12 | mont_ check-mont.js /^function mont_(x,y,n,np) {$/;" f lineno:73 type:void function(Array[number], Array[number], Array[number], number)
13 | n check-mont.js /^var n = [27875, 25925, 30422, 12227, 27798, 32170, 10873, 21748, 30629, 26296, 20697, 5125, 4815, 2221, 14392, 23369, 5560, 2, 0, 0];$/;" v lineno:4 type:Array[number]
14 | np check-mont.js /^var np = 18229;$/;" v lineno:5 type:number
15 | passed check-mont.js /^var passed = expected.length == x.length;$/;" v lineno:114 type:boolean
16 | x check-mont.js /^var x = [9385, 32112, 25383, 16317, 30138, 14565, 17812, 24500, 2719, 30174, 3546, 9096, 15352, 19120, 20648, 14334, 7426, 0, 0, 0];$/;" v lineno:3 type:Array[number]
17 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/run-tests.js:
--------------------------------------------------------------------------------
1 | // How to write a test:
2 | // Have one toplevel function called test that takes one argument.
3 | // The type of the argument is the expected type of the result.
4 | // The argument should not be used in the body of the function.
5 | // Put your test in the body of "test" and return a value.
6 | // The type of the return value is compared to the type of the argument.
7 |
8 | var readFileSync = require('fs').readFileSync;
9 | var print = require('sys').puts;
10 | var runtest = require('./jscfa').runtest;
11 | var parse = require('./jsparse').parse;
12 | var numAll = process.argv[3], start, end;
13 |
14 | function testname(num) { return "./tests/test" + num + ".js"; }
15 |
16 | if (process.argv[2] === "some") {
17 | var range = process.argv[4], dash = range.indexOf("-");
18 | if (dash === -1)
19 | start = end = range; // run a single test
20 | else { // run a susbet of the tests
21 | start = Number(range.substring(0, dash)) || 1;
22 | if (dash === (range.length - 1))
23 | end = numAll;
24 | else
25 | end = Number(range.substring(dash + 1, range.length));
26 | }
27 | }
28 | else { // run all tests
29 | start = 1;
30 | end = numAll;
31 | }
32 |
33 | var failed_tests = [];
34 | for (var i = start; i <= end; i++) {
35 | var tn = testname(i);
36 | if (!runtest(parse(readFileSync(tn), tn, 1))) failed_tests.push(i);
37 | }
38 |
39 | print("\n");
40 | print("Number of tests: " + (end - start + 1));
41 | var numFailed = failed_tests.length;
42 | if (numFailed !== 0) {
43 | print("Number of failed tests: " + numFailed);
44 | for (var i = 0, len = numFailed; i < len; i++) print(failed_tests[i]);
45 | }
46 | else print("All tests passed.");
47 | print("\n");
48 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-partial-sums.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | actual check-math-partial-sums.js /^var actual = [];$/;" v lineno:32 type:Array[number]
8 | eps check-math-partial-sums.js /^var eps = 1e-12;$/;" v lineno:36 type:number
9 | expect check-math-partial-sums.js /^var expect = [2.9999999999999987,62.555269219624684,0.9990243902439033,30.174793391263677,42.99468748637077,7.509175672278132,1.6439579810301654,0.6926591377284127,0.785154022830656,2.9999999999999987,89.06036157695789,0.9995119570522216,30.30796333494624,42.99485339033617,8.202078771817716,1.6444459047881168,0.6929030995395857,0.7852760930922243,2.9999999999999987,126.54745783224483,0.999755918965097,30.314167756318135,42.994888939123,8.89510389696629,1.6446899560231332,0.6930251251486118,0.7853371282421086,2.9999999999999987,179.56450569047874,0.9998779445868421,30.314499725429847,42.99489723774016,9.588190046095265,1.644812003986005,0.693086149128997,0.785367645819433,2.9999999999999987,254.54355172132264,0.9999389685688135,30.31451920492601,42.99489939769195,10.281306710008463,1.6448730335545856,0.6931166639131536,0.7853829046083998];$/;" v lineno:37 type:Array[number]
10 | i check-math-partial-sums.js /^for (var i = 0; i < expect.length; ++i)$/;" v lineno:40 type:number
11 | i check-math-partial-sums.js /^for (var i = 1024; i <= 16384; i *= 2)$/;" v lineno:33 type:any
12 | partial check-math-partial-sums.js /^function partial(n){$/;" f lineno:5 type:Array[number] function(number)
13 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-access-binary-trees.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | TreeNode check-access-binary-trees.js /^function TreeNode(left,right,item){$/;" f lineno:5 type:TreeNode function(, , number)
8 | bottomUpTree check-access-binary-trees.js /^function bottomUpTree(item,depth){$/;" f lineno:16 type:TreeNode function(number, number)
9 | check check-access-binary-trees.js /^ var check = bottomUpTree(0,stretchDepth).itemCheck();$/;" v lineno:36 type:number
10 | depth check-access-binary-trees.js /^ for (var depth=minDepth; depth<=maxDepth; depth+=2){$/;" v lineno:39 type:number
11 | i check-access-binary-trees.js /^ for (var i=1; i<=iterations; i++){$/;" v lineno:43 type:number
12 | itemCheck check-access-binary-trees.js /^TreeNode.prototype.itemCheck = function(){$/;" f lineno:11 type:number function()
13 | iterations check-access-binary-trees.js /^ var iterations = 1 << (maxDepth - depth + minDepth);$/;" v lineno:40 type:number
14 | longLivedTree check-access-binary-trees.js /^ var longLivedTree = bottomUpTree(0,maxDepth);$/;" v lineno:38 type:TreeNode
15 | maxDepth check-access-binary-trees.js /^ var maxDepth = Math.max(minDepth + 2, n);$/;" v lineno:33 type:number
16 | minDepth check-access-binary-trees.js /^ var minDepth = 4;$/;" v lineno:32 type:number
17 | n check-access-binary-trees.js /^for ( var n = 4; n <= 7; n += 1 ) {$/;" v lineno:31 type:number
18 | ret check-access-binary-trees.js /^var ret;$/;" v lineno:29 type:number
19 | stretchDepth check-access-binary-trees.js /^ var stretchDepth = maxDepth + 1;$/;" v lineno:34 type:number
20 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-access-fannkuch.js:
--------------------------------------------------------------------------------
1 | /* The Great Computer Language Shootout
2 | http://shootout.alioth.debian.org/
3 | contributed by Isaac Gouy */
4 |
5 | function fannkuch(n) {
6 | var check = 0;
7 | var perm = Array(n);
8 | var perm1 = Array(n);
9 | var count = Array(n);
10 | var maxPerm = Array(n);
11 | var maxFlipsCount = 0;
12 | var m = n - 1;
13 |
14 | for (var i = 0; i < n; i++) perm1[i] = i;
15 | var r = n;
16 |
17 | while (true) {
18 | // write-out the first 30 permutations
19 | if (check < 30){
20 | var s = "";
21 | for(var i=0; i> 1;
34 | for (var i = 0; i < k2; i++) {
35 | var temp = perm[i]; perm[i] = perm[k - i]; perm[k - i] = temp;
36 | }
37 | flipsCount++;
38 | }
39 |
40 | if (flipsCount > maxFlipsCount) {
41 | maxFlipsCount = flipsCount;
42 | for (var i = 0; i < n; i++) maxPerm[i] = perm1[i];
43 | }
44 | }
45 |
46 | while (true) {
47 | if (r == n) return maxFlipsCount;
48 | var perm0 = perm1[0];
49 | var i = 0;
50 | while (i < r) {
51 | var j = i + 1;
52 | perm1[i] = perm1[j];
53 | i = j;
54 | }
55 | perm1[r] = perm0;
56 |
57 | count[r] = count[r] - 1;
58 | if (count[r] > 0) break;
59 | r++;
60 | }
61 | }
62 | }
63 |
64 | var n = 8;
65 | var ret = fannkuch(n);
66 | assertEq(ret, 22)
67 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-string-fasta.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | A check-string-fasta.js /^var last = 42, A = 3877, C = 29573, M = 139968;$/;" v lineno:6 type:number
8 | ALU check-string-fasta.js /^var ALU =$/;" v lineno:13 type:string
9 | C check-string-fasta.js /^var last = 42, A = 3877, C = 29573, M = 139968;$/;" v lineno:6 type:number
10 | HomoSap check-string-fasta.js /^var HomoSap = {$/;" v lineno:29 type:Object
11 | IUB check-string-fasta.js /^var IUB = {$/;" v lineno:22 type:Object
12 | M check-string-fasta.js /^var last = 42, A = 3877, C = 29573, M = 139968;$/;" v lineno:6 type:number
13 | actual1 check-string-fasta.js /^var actual1 = fastaRepeat(2*count*100000, ALU);$/;" v lineno:84 type:string
14 | actual2 check-string-fasta.js /^var actual2 = fastaRandom(3*count*1000, IUB);$/;" v lineno:85 type:string
15 | actual3 check-string-fasta.js /^var actual3 = fastaRandom(5*count*1000, HomoSap);$/;" v lineno:86 type:string
16 | count check-string-fasta.js /^var count = 7;$/;" v lineno:83 type:number
17 | fastaRandom check-string-fasta.js /^function fastaRandom(n, table) {$/;" f lineno:61 type:string function(number, Object)
18 | fastaRepeat check-string-fasta.js /^function fastaRepeat(n, seq) {$/;" f lineno:44 type:string function(number, string)
19 | last check-string-fasta.js /^var last = 42, A = 3877, C = 29573, M = 139968;$/;" v lineno:6 type:number
20 | makeCumulative check-string-fasta.js /^function makeCumulative(table) {$/;" f lineno:36 type:void function(Object)
21 | rand check-string-fasta.js /^function rand(max) {$/;" f lineno:8 type:number function(number)
22 | ret check-string-fasta.js /^var ret;$/;" v lineno:81 type:string
23 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-access-nbody.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | %anonymous_function check-access-nbody.js /^ (function(){$/;" f lineno:157 type:void function()
8 | Body check-access-nbody.js /^function Body(x,y,z,vx,vy,vz,mass){$/;" f lineno:9 type:Body function(number, number, number, number, number, number, number)
9 | DAYS_PER_YEAR check-access-nbody.js /^var DAYS_PER_YEAR = 365.24;$/;" v lineno:7 type:number
10 | Jupiter check-access-nbody.js /^function Jupiter(){$/;" f lineno:26 type:Body function()
11 | NBodySystem check-access-nbody.js /^function NBodySystem(bodies){$/;" f lineno:79 type:NBodySystem function(Array[Body])
12 | Neptune check-access-nbody.js /^function Neptune(){$/;" f lineno:62 type:Body function()
13 | PI check-access-nbody.js /^var PI = 3.141592653589793;$/;" v lineno:5 type:number
14 | SOLAR_MASS check-access-nbody.js /^var SOLAR_MASS = 4 * PI * PI;$/;" v lineno:6 type:number
15 | Saturn check-access-nbody.js /^function Saturn(){$/;" f lineno:38 type:Body function()
16 | Sun check-access-nbody.js /^function Sun(){$/;" f lineno:74 type:Body function()
17 | Uranus check-access-nbody.js /^function Uranus(){$/;" f lineno:50 type:Body function()
18 | advance check-access-nbody.js /^NBodySystem.prototype.advance = function(dt){$/;" f lineno:95 type:void function(number)
19 | energy check-access-nbody.js /^NBodySystem.prototype.energy = function(){$/;" f lineno:128 type:number function()
20 | n check-access-nbody.js /^for ( var n = 3; n <= 24; n *= 2 ) {$/;" v lineno:156 type:number
21 | offsetMomentum check-access-nbody.js /^Body.prototype.offsetMomentum = function(px,py,pz) {$/;" f lineno:19 type:Body function(number, number, number)
22 | ret check-access-nbody.js /^var ret;$/;" v lineno:154 type:number
23 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-partial-sums.js:
--------------------------------------------------------------------------------
1 | // The Computer Language Shootout
2 | // http://shootout.alioth.debian.org/
3 | // contributed by Isaac Gouy
4 |
5 | function partial(n){
6 | var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0;
7 | var twothirds = 2.0/3.0;
8 | var alt = -1.0;
9 | var k2 = k3 = sk = ck = 0.0;
10 |
11 | for (var k = 1; k <= n; k++){
12 | k2 = k*k;
13 | k3 = k2*k;
14 | sk = Math.sin(k);
15 | ck = Math.cos(k);
16 | alt = -alt;
17 |
18 | a1 += Math.pow(twothirds,k-1);
19 | a2 += Math.pow(k,-0.5);
20 | a3 += 1.0/(k*(k+1.0));
21 | a4 += 1.0/(k3 * sk*sk);
22 | a5 += 1.0/(k3 * ck*ck);
23 | a6 += 1.0/k;
24 | a7 += 1.0/k2;
25 | a8 += alt/k;
26 | a9 += alt/(2*k -1);
27 | }
28 |
29 | return [ a1, a2, a3, a4, a5, a6, a7, a8, a9 ];
30 | }
31 |
32 | var actual = [];
33 | for (var i = 1024; i <= 16384; i *= 2)
34 | Array.prototype.push.apply(actual, partial(i));
35 |
36 | var eps = 1e-12;
37 | var expect = [2.9999999999999987,62.555269219624684,0.9990243902439033,30.174793391263677,42.99468748637077,7.509175672278132,1.6439579810301654,0.6926591377284127,0.785154022830656,2.9999999999999987,89.06036157695789,0.9995119570522216,30.30796333494624,42.99485339033617,8.202078771817716,1.6444459047881168,0.6929030995395857,0.7852760930922243,2.9999999999999987,126.54745783224483,0.999755918965097,30.314167756318135,42.994888939123,8.89510389696629,1.6446899560231332,0.6930251251486118,0.7853371282421086,2.9999999999999987,179.56450569047874,0.9998779445868421,30.314499725429847,42.99489723774016,9.588190046095265,1.644812003986005,0.693086149128997,0.785367645819433,2.9999999999999987,254.54355172132264,0.9999389685688135,30.31451920492601,42.99489939769195,10.281306710008463,1.6448730335545856,0.6931166639131536,0.7853829046083998];
38 |
39 | assertEq(actual.length, expect.length);
40 | for (var i = 0; i < expect.length; ++i)
41 | assertEq(Math.abs(actual[i] - expect[i]) < eps, true);
42 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run-crypto.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('crypto.js');
31 |
32 | function PrintResult(name, result) {
33 | print(name + ': ' + result);
34 | }
35 |
36 |
37 | function PrintScore(score) {
38 | print('----');
39 | print('Score: ' + score);
40 | }
41 |
42 |
43 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
44 | NotifyScore: PrintScore });
45 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run-deltablue.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('deltablue.js');
31 |
32 | function PrintResult(name, result) {
33 | print(name + ': ' + result);
34 | }
35 |
36 |
37 | function PrintScore(score) {
38 | print('----');
39 | print('Score: ' + score);
40 | }
41 |
42 |
43 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
44 | NotifyScore: PrintScore });
45 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run-raytrace.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('raytrace.js');
31 |
32 | function PrintResult(name, result) {
33 | print(name + ': ' + result);
34 | }
35 |
36 |
37 | function PrintScore(score) {
38 | print('----');
39 | print('Score: ' + score);
40 | }
41 |
42 |
43 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
44 | NotifyScore: PrintScore });
45 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run-richards.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('richards.js');
31 |
32 | function PrintResult(name, result) {
33 | print(name + ': ' + result);
34 | }
35 |
36 |
37 | function PrintScore(score) {
38 | print('----');
39 | print('Score: ' + score);
40 | }
41 |
42 |
43 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
44 | NotifyScore: PrintScore });
45 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run-earley-boyer.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('earley-boyer.js');
31 |
32 | function PrintResult(name, result) {
33 | print(name + ': ' + result);
34 | }
35 |
36 |
37 | function PrintScore(score) {
38 | print('----');
39 | print('Score: ' + score);
40 | }
41 |
42 |
43 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
44 | NotifyScore: PrintScore });
45 |
--------------------------------------------------------------------------------
/lib/jsctags/servetypes.js:
--------------------------------------------------------------------------------
1 | var path = require('path');
2 | var parse = require('./narcissus/jsparse').parse;
3 | var getTags = require('./narcissus/jscfa').getTags;
4 | var formidable = require('../formidable');
5 |
6 | function analyze(cwd, req, resp) {
7 | // FIXME: extra field for header message (instead of "Not Found")
8 | function error(code, msg) {
9 | resp.writeHead(code, "Not Found", { 'Content-type': 'text/plain' });
10 | resp.end(code + " " + msg);
11 | }
12 |
13 | if (req.method !== 'POST') {
14 | resp.writeHead(405, "Invalid Method", { 'Content-type': 'text/plain' });
15 | resp.end("405 Only POST method allowed");
16 | return;
17 | }
18 |
19 | // FIXME: prevent formidable from saving files
20 | var form = new formidable.IncomingForm();
21 | var src;
22 |
23 | form
24 | .addListener('error', function(err) {
25 | error(400, err);
26 | })
27 | .addListener('field', function(field, value) {
28 | if (field === 'src')
29 | src = value;
30 | })
31 | .addListener('end', function() {
32 | if (!src) {
33 | error(400, 'No "src" field in POST');
34 | return;
35 | }
36 |
37 | // farm the work out to rn.js
38 | var spawn = require('child_process').spawn;
39 | var rn = spawn(path.join(cwd, 'rn.js'));
40 |
41 | // on timeout, kill the process and send an error
42 | var timeout = setTimeout(function() {
43 | if (rn) {
44 | rn.kill(); // ooh, brutal ;)
45 | error(500, "Service timed out");
46 | }
47 | }, 10000);
48 |
49 | // send the input program to rn.js
50 | rn.stdin.end(src);
51 |
52 | // forward the output ctags to the response
53 | var buf = [];
54 | rn.stdout.on("data", _(buf.push).bind(buf));
55 | rn.stdout.on("end", function() {
56 | clearTimeout(timeout);
57 | rn = null;
58 | resp.writeHead(200, "OK", { "Content-type": "application/json" });
59 | resp.end(buf.join(""));
60 | });
61 | });
62 |
63 | form.parse(req);
64 | }
65 |
66 | exports.analyze = analyze;
67 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/v8/run.js:
--------------------------------------------------------------------------------
1 | // Copyright 2008 Google Inc. All Rights Reserved.
2 | // Redistribution and use in source and binary forms, with or without
3 | // modification, are permitted provided that the following conditions are
4 | // met:
5 | //
6 | // * Redistributions of source code must retain the above copyright
7 | // notice, this list of conditions and the following disclaimer.
8 | // * Redistributions in binary form must reproduce the above
9 | // copyright notice, this list of conditions and the following
10 | // disclaimer in the documentation and/or other materials provided
11 | // with the distribution.
12 | // * Neither the name of Google Inc. nor the names of its
13 | // contributors may be used to endorse or promote products derived
14 | // from this software without specific prior written permission.
15 | //
16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
28 |
29 | load('base.js');
30 | load('richards.js');
31 | load('deltablue.js');
32 | load('crypto.js');
33 | load('raytrace.js');
34 | load('earley-boyer.js');
35 |
36 |
37 | function PrintResult(name, result) {
38 | print(name + ': ' + result);
39 | }
40 |
41 |
42 | function PrintScore(score) {
43 | print('----');
44 | print('Score: ' + score);
45 | }
46 |
47 |
48 | BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
49 | NotifyScore: PrintScore });
50 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/index.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is the Narcissus JavaScript engine.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Brendan Eich .
18 | * Portions created by the Initial Developer are Copyright (C) 2004
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | *
23 | * Alternatively, the contents of this file may be used under the terms of
24 | * either the GNU General Public License Version 2 or later (the "GPL"), or
25 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 | * in which case the provisions of the GPL or the LGPL are applicable instead
27 | * of those above. If you wish to allow use of your version of this file only
28 | * under the terms of either the GPL or the LGPL, and not to allow others to
29 | * use your version of this file under the terms of the MPL, indicate your
30 | * decision by deleting the provisions above and replace them with the notice
31 | * and other provisions required by the GPL or the LGPL. If you do not delete
32 | * the provisions above, a recipient may use your version of this file under
33 | * the terms of any one of the MPL, the GPL or the LGPL.
34 | *
35 | * ***** END LICENSE BLOCK ***** */
36 |
37 | /*
38 | * This package consists of enough of the Narcissus metacircular JavaScript
39 | * engine to parse JavaScript, packaged up into a CommonJS module for your own
40 | * pleasure.
41 | */
42 |
43 | require('./jsdefs');
44 | require('./jslex');
45 |
46 | var jscfa = require('./jscfa');
47 | var jsparse = require('./jsparse');
48 |
49 | exports.cfa2 = jscfa.cfa2;
50 | exports.jscfa = jscfa;
51 | exports.parse = jsparse.parse;
52 |
53 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-3d-morph.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | var loops = 15
27 | var nx = 120
28 | var nz = 120
29 |
30 | function morph(a, f) {
31 | var PI2nx = Math.PI * 8/nx
32 | var sin = Math.sin
33 | var f30 = -(50 * sin(f*Math.PI*2))
34 |
35 | for (var i = 0; i < nz; ++i) {
36 | for (var j = 0; j < nx; ++j) {
37 | a[3*(i*nx+j)+1] = sin((j-1) * PI2nx ) * -f30
38 | }
39 | }
40 | }
41 |
42 |
43 | var a = Array()
44 | for (var i=0; i < nx*nz*3; ++i)
45 | a[i] = 0
46 |
47 | for (var i = 0; i < loops; ++i) {
48 | morph(a, i/loops)
49 | }
50 |
51 | testOutput = 0;
52 | for (var i = 0; i < nx; i++)
53 | testOutput += a[3*(i*nx+i)+1];
54 | a = null;
55 |
56 | /* not based on any mathematical error calculation.*/
57 | acceptableDelta = 4e-15;
58 |
59 | assertEq((testOutput - 6.394884621840902e-14) < acceptableDelta, true);
60 |
--------------------------------------------------------------------------------
/serve.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | /* ***** BEGIN LICENSE BLOCK *****
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 | *
5 | * The contents of this file are subject to the Mozilla Public License Version
6 | * 1.1 (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | * http://www.mozilla.org/MPL/
9 | *
10 | * Software distributed under the License is distributed on an "AS IS" basis,
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 | * for the specific language governing rights and limitations under the
13 | * License.
14 | *
15 | * The Original Code is Bespin.
16 | *
17 | * The Initial Developer of the Original Code is
18 | * Mozilla.
19 | * Portions created by the Initial Developer are Copyright (C) 2009
20 | * the Initial Developer. All Rights Reserved.
21 | *
22 | * Contributor(s):
23 | * Bespin Team (bespin@mozilla.com)
24 | *
25 | * Alternatively, the contents of this file may be used under the terms of
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 | * in which case the provisions of the GPL or the LGPL are applicable instead
29 | * of those above. If you wish to allow use of your version of this file only
30 | * under the terms of either the GPL or the LGPL, and not to allow others to
31 | * use your version of this file under the terms of the MPL, indicate your
32 | * decision by deleting the provisions above and replace them with the notice
33 | * and other provisions required by the GPL or the LGPL. If you do not delete
34 | * the provisions above, a recipient may use your version of this file under
35 | * the terms of any one of the MPL, the GPL or the LGPL.
36 | *
37 | * ***** END LICENSE BLOCK ***** */
38 |
39 | require.paths.unshift('./lib/jsctags');
40 | var http = require('http'), paperboy = require('paperboy');
41 | var sys = require('sys');
42 |
43 | http.createServer(function(req, resp) {
44 | paperboy.deliver(__dirname, req, resp).
45 | error(function(code, msg) {
46 | resp.writeHead(code, { "Content-type": "text/plain" });
47 | resp.close();
48 | }).
49 | otherwise(function(err) {
50 | resp.writeHead(404, { "Content-type": "text/plain" });
51 | resp.close();
52 | });
53 | }).listen(8080);
54 |
55 |
--------------------------------------------------------------------------------
/lib/jsctags/log.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | var sys = require('sys');
39 |
40 | function log(level, args) {
41 | if (level >= exports.level) {
42 | sys.puts(Array.prototype.join.call(args, " "));
43 | }
44 | }
45 |
46 | var levels = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3 };
47 | exports.levels = levels;
48 |
49 | exports.level = levels.ERROR;
50 |
51 | exports.debug = function() { log(levels.DEBUG, arguments); };
52 | exports.warn = function() { log(levels.WARN, arguments); };
53 | exports.info = function() { log(levels.INFO, arguments); };
54 | exports.error = function() { log(levels.ERROR, arguments); };
55 |
56 |
--------------------------------------------------------------------------------
/lib/jsctags/ctags/interp.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | // Abstract interpreter, based on Narcissus.
39 |
40 | var getTags = require('narcissus/jscfa').getTags;
41 |
42 | //dimvar: opts stands for options. If we are using commonJS it gives
43 | //info about the module (see getModuleInfo@jsctags.js).
44 | exports.Interpreter = function(ast, file, lines, opts) {
45 | this.ast = ast;
46 | this.file = file;
47 | this.lines = lines;
48 | this.opts = opts;
49 | this.tags = [];
50 | };
51 |
52 | exports.Interpreter.prototype = {
53 | interpret: function() {
54 | this.tags = getTags(this.ast, this.file, this.lines, this.opts);
55 | }
56 | };
57 |
58 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-string-fasta.js:
--------------------------------------------------------------------------------
1 | // The Great Computer Language Shootout
2 | // http://shootout.alioth.debian.org
3 | //
4 | // Contributed by Ian Osgood
5 |
6 | var last = 42, A = 3877, C = 29573, M = 139968;
7 |
8 | function rand(max) {
9 | last = (last * A + C) % M;
10 | return max * last / M;
11 | }
12 |
13 | var ALU =
14 | "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
15 | "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +
16 | "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" +
17 | "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" +
18 | "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
19 | "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
20 | "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
21 |
22 | var IUB = {
23 | a:0.27, c:0.12, g:0.12, t:0.27,
24 | B:0.02, D:0.02, H:0.02, K:0.02,
25 | M:0.02, N:0.02, R:0.02, S:0.02,
26 | V:0.02, W:0.02, Y:0.02
27 | }
28 |
29 | var HomoSap = {
30 | a: 0.3029549426680,
31 | c: 0.1979883004921,
32 | g: 0.1975473066391,
33 | t: 0.3015094502008
34 | }
35 |
36 | function makeCumulative(table) {
37 | var last = null;
38 | for (var c in table) {
39 | if (last) table[c] += table[last];
40 | last = c;
41 | }
42 | }
43 |
44 | function fastaRepeat(n, seq) {
45 | var seqi = 0, lenOut = 60;
46 | while (n>0) {
47 | if (n0) {
65 | if (n)
8 | GenerateKey splay.js /^function GenerateKey() {$/;" f lineno:64 type:number function()
9 | GeneratePayloadTree splay.js /^function GeneratePayloadTree(depth, key) {$/;" f lineno:49 type:Object function(number, number)
10 | InsertNewNode splay.js /^function InsertNewNode() {$/;" f lineno:71 type:number function()
11 | Node splay.js /^SplayTree.Node = function(key, value) {$/;" f lineno:345 type:Node function(, )
12 | SplayRun splay.js /^function SplayRun() {$/;" f lineno:111 type:void function()
13 | SplaySetup splay.js /^function SplaySetup() {$/;" f lineno:83 type:void function()
14 | SplayTearDown splay.js /^function SplayTearDown() {$/;" f lineno:89 type:void function()
15 | SplayTree splay.js /^function SplayTree() {$/;" f lineno:130 type:SplayTree function()
16 | exportKeys splay.js /^SplayTree.prototype.exportKeys = function() {$/;" f lineno:258 type:Array[number] function()
17 | find splay.js /^SplayTree.prototype.find = function(key) {$/;" f lineno:223 type:null function(number)
18 | findGreatestLessThan splay.js /^SplayTree.prototype.findGreatestLessThan = function(key) {$/;" f lineno:236 type:null function(any)
19 | insert splay.js /^SplayTree.prototype.insert = function(key, value) {$/;" f lineno:159 type:void function(number, Object)
20 | isEmpty splay.js /^SplayTree.prototype.isEmpty = function() {$/;" f lineno:146 type:boolean function()
21 | kSplayTreeModifications splay.js /^var kSplayTreeModifications = 80;$/;" v lineno:43 type:number
22 | kSplayTreePayloadDepth splay.js /^var kSplayTreePayloadDepth = 5;$/;" v lineno:44 type:number
23 | kSplayTreeSize splay.js /^var kSplayTreeSize = 8000;$/;" v lineno:42 type:number
24 | remove splay.js /^SplayTree.prototype.remove = function(key) {$/;" f lineno:192 type:void function(any)
25 | splayTree splay.js /^var splayTree = null;$/;" v lineno:46 type:
26 | splay_ splay.js /^SplayTree.prototype.splay_ = function(key) {$/;" f lineno:277 type:void function(number)
27 | traverse_ splay.js /^SplayTree.Node.prototype.traverse_ = function(f) {$/;" f lineno:370 type:void function(void function())
28 |
--------------------------------------------------------------------------------
/lib/jsctags/ctags/nativefn.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | // Functions important for export detection that that we try to automatically
39 | // detect and implement.
40 |
41 | var sys = require('sys');
42 |
43 | // jQuery's "extend".
44 | function extend(interp, ctx, thisObject, args) {
45 | var objects = args.data.slice(0);
46 | if (objects.length === 0) {
47 | return interp.getNullValue();
48 | }
49 |
50 | var target = objects.length === 1 ? thisObject : objects.shift();
51 | interp.coerceToStorable(target);
52 |
53 | objects.forEach(function(obj) {
54 | for (var key in obj.data) {
55 | target.data[key] = obj.data[key];
56 | }
57 | });
58 |
59 | return target;
60 | }
61 |
62 | exports.nativeFns = {
63 | extend: extend, // jQuery
64 | mixin: extend // dojo, Bespin
65 | };
66 |
67 |
--------------------------------------------------------------------------------
/test/testcases/boot.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | // This module is set up to be dependency-less so that Narwhal
39 | // will be able to run it right away.
40 |
41 | bespin.useBespin = function(element, options) {
42 | var baseConfig = %s;
43 | options = options || {};
44 | for (var key in options) {
45 | baseConfig[key] = options[key];
46 | }
47 | var appconfig = bespin.tiki.require("appconfig");
48 | baseConfig.element = element;
49 | return appconfig.launch(baseConfig);
50 | };
51 |
52 | document.addEventListener("DOMContentLoaded", function() {
53 | var nodes = document.querySelectorAll(".bespin");
54 | for (var i = 0; i < nodes.length; i++) {
55 | var node = nodes[i];
56 | var options = node.getAttribute('data-bespinoptions');
57 | node.bespin = bespin.useBespin(node, JSON.parse(options));
58 | }
59 |
60 | // If users want a custom startup
61 | if (window.onBespinLoad) {
62 | window.onBespinLoad();
63 | }
64 | }, false);
65 |
--------------------------------------------------------------------------------
/bin/rn.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | /* ***** BEGIN LICENSE BLOCK *****
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 | *
5 | * The contents of this file are subject to the Mozilla Public License Version
6 | * 1.1 (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | * http://www.mozilla.org/MPL/
9 | *
10 | * Software distributed under the License is distributed on an "AS IS" basis,
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 | * for the specific language governing rights and limitations under the
13 | * License.
14 | *
15 | * The Original Code is Bespin.
16 | *
17 | * The Initial Developer of the Original Code is
18 | * Mozilla.
19 | * Portions created by the Initial Developer are Copyright (C) 2009
20 | * the Initial Developer. All Rights Reserved.
21 | *
22 | * Contributor(s):
23 | * Bespin Team (bespin@mozilla.com)
24 | *
25 | * Alternatively, the contents of this file may be used under the terms of
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 | * in which case the provisions of the GPL or the LGPL are applicable instead
29 | * of those above. If you wish to allow use of your version of this file only
30 | * under the terms of either the GPL or the LGPL, and not to allow others to
31 | * use your version of this file under the terms of the MPL, indicate your
32 | * decision by deleting the provisions above and replace them with the notice
33 | * and other provisions required by the GPL or the LGPL. If you do not delete
34 | * the provisions above, a recipient may use your version of this file under
35 | * the terms of any one of the MPL, the GPL or the LGPL.
36 | *
37 | * ***** END LICENSE BLOCK ***** */
38 |
39 | var argv = process.argv;
40 | var path = require('path');
41 |
42 | var cwd = path.dirname(argv[1]);
43 | var libdir = path.join(cwd, "..", "lib");
44 |
45 | require.paths.unshift(path.join(libdir, "jsctags"));
46 |
47 | var sys = require('sys');
48 | var _ = require('underscore')._;
49 | var getTags = require('narcissus/jscfa').getTags;
50 | var parse = require('narcissus/jsparse').parse;
51 |
52 | var stdin = process.openStdin();
53 |
54 | stdin.setEncoding("utf8");
55 |
56 | var buf = [];
57 | stdin.on("data", _(buf.push).bind(buf));
58 | stdin.on("end", function() {
59 | var src = buf.join("");
60 | var lines, ast;
61 | try {
62 | lines = src.split("\n");
63 | ast = parse(src, "js", 1);
64 | } catch (e) {
65 | sys.print(JSON.stringify({ error: e.message, stage: "parse" }));
66 | process.exit();
67 | }
68 |
69 | var json;
70 | try {
71 | json = getTags(ast, "js", lines, {});
72 | } catch (e) {
73 | json = { error: e.message, stage: "analysis" };
74 | }
75 |
76 | sys.print(JSON.stringify(json));
77 | process.exit();
78 | });
79 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-date-format-xparb.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | createNewFormat check-date-format-xparb.js /^Date.createNewFormat = function(format) {$/;" f lineno:26 type:void function(string)
8 | createParser check-date-format-xparb.js /^Date.createParser = function(format) {$/;" f lineno:117 type:void function(any)
9 | date check-date-format-xparb.js /^var date = new Date("1\/1\/2007 1:11:11");$/;" v lineno:411 type:Date
10 | dateFormat check-date-format-xparb.js /^Date.prototype.dateFormat = function(format) {$/;" f lineno:18 type:any function(string)
11 | escape check-date-format-xparb.js /^String.escape = function(string) {$/;" f lineno:347 type:string function(string)
12 | formatCodeToRegex check-date-format-xparb.js /^Date.formatCodeToRegex = function(character, currentGroup) {$/;" f lineno:172 type:Object function(string, number)
13 | getDayOfYear check-date-format-xparb.js /^Date.prototype.getDayOfYear = function() {$/;" f lineno:291 type:number function()
14 | getDaysInMonth check-date-format-xparb.js /^Date.prototype.getDaysInMonth = function() {$/;" f lineno:325 type:any function()
15 | getFirstDayOfMonth check-date-format-xparb.js /^Date.prototype.getFirstDayOfMonth = function() {$/;" f lineno:315 type:number function()
16 | getFormatCode check-date-format-xparb.js /^Date.getFormatCode = function(character) {$/;" f lineno:48 type:string function(string)
17 | getGMTOffset check-date-format-xparb.js /^Date.prototype.getGMTOffset = function() {$/;" f lineno:285 type: function()
18 | getLastDayOfMonth check-date-format-xparb.js /^Date.prototype.getLastDayOfMonth = function() {$/;" f lineno:320 type:number function()
19 | getSuffix check-date-format-xparb.js /^Date.prototype.getSuffix = function() {$/;" f lineno:330 type:string function()
20 | getTimezone check-date-format-xparb.js /^Date.prototype.getTimezone = function() {$/;" f lineno:279 type:string function()
21 | getWeekOfYear check-date-format-xparb.js /^Date.prototype.getWeekOfYear = function() {$/;" f lineno:300 type: function()
22 | isLeapYear check-date-format-xparb.js /^Date.prototype.isLeapYear = function() {$/;" f lineno:310 type: function()
23 | leftPad check-date-format-xparb.js /^String.leftPad = function (val, size, ch) {$/;" f lineno:351 type: function(number, number, string)
24 | longFormat check-date-format-xparb.js /^ var longFormat = date.dateFormat("l, F d, Y g:i:s A");$/;" v lineno:416 type:any
25 | parseDate check-date-format-xparb.js /^Date.parseDate = function(input, format) {$/;" f lineno:109 type:any function(any, any)
26 | ret check-date-format-xparb.js /^var ret;$/;" v lineno:413 type:any
27 | shortFormat check-date-format-xparb.js /^ var shortFormat = date.dateFormat("Y-m-d");$/;" v lineno:415 type:any
28 |
--------------------------------------------------------------------------------
/html/doctorjs/parse-type.js:
--------------------------------------------------------------------------------
1 | // quick-n-dirty parser of Dimitris's original type format
2 | function parseType(src) {
3 | function match(str) {
4 | var n = str.length;
5 | if (src.length && src.substring(0, n) === str) {
6 | src = src.substring(n).trim();
7 | return true;
8 | }
9 | return false;
10 | }
11 |
12 | function mustMatch(str, msg) {
13 | if (!match(str))
14 | throw new Error(msg + " (" + src + ")");
15 | }
16 |
17 | function Type() {
18 | var root;
19 | if (match("any")) {
20 | root = "any";
21 | } else if (match("string")) {
22 | root = "string";
23 | } else if (match("number")) {
24 | root = "number";
25 | } else if (match("Array")) {
26 | if (match("[")) {
27 | root = { kind: "array", elementType: Type() };
28 | mustMatch("]", "invalid array type");
29 | } else {
30 | root = { kind: "array", elementType: "any" };
31 | }
32 | } else if (src.length && src[0] === "<") {
33 | root = UnionType();
34 | } else {
35 | var re = /^([a-zA-Z_$][a-zA-Z_$0-9]*)/;
36 | var result = re.exec(src);
37 | if (!result)
38 | throw new Error("unrecognized type: " + src);
39 | root = result[0];
40 | src = src.substring(root.length).trim();
41 | }
42 |
43 | while (match("function")) {
44 | mustMatch("(", "invalid function type");
45 | var args = [];
46 | if (!match(")")) {
47 | do {
48 | args.push(Type());
49 | } while (match(","));
50 | mustMatch(")", "invalid function type");
51 | }
52 | root = { kind: "function", returnType: root, argTypes: args };
53 | }
54 |
55 | return root;
56 | }
57 |
58 | function UnionType() {
59 | mustMatch("<", "invalid union type");
60 | var variants = [];
61 | if (!match(">")) {
62 | do {
63 | variants.push(Type());
64 | } while (match("|"));
65 | mustMatch(">", "invalid union type");
66 | }
67 | return { kind: "union", variants: variants };
68 | }
69 |
70 | return Type();
71 | }
72 |
73 | // formatType : JSON type -> HTML source
74 | // render the JSON type as pretty HTML
75 | function formatType(type) {
76 | if (typeof type === "string")
77 | return type;
78 |
79 | if (type.kind === "function") {
80 | return "function(" +
81 | type.argTypes.map(formatType).join(", ") +
82 | ") → " +
83 | formatType(type.returnType);
84 | } else if (type.kind === "array") {
85 | return "Array[" + formatType(type.elementType) + "]";
86 | } else if (type.kind === "union") {
87 | return "<" + type.variants.map(formatType).join(" | ") + ">";
88 | }
89 |
90 | throw new Error("unrecognized type");
91 | }
92 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-string-tagcloud.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | %anonymous_function check-string-tagcloud.js /^ return '"' + this.replace(\/[\\x00-\\x1f\\\\"]\/g, function (a) {$/;" f lineno:211 type:string function(any)
8 | %anonymous_function check-string-tagcloud.js /^ (function (s) {$/;" f lineno:164 type:void function(String)
9 | %anonymous_function check-string-tagcloud.js /^ tagInfo.sort(function(a, b) { if (a.tag < b.tag) { return -1; } else if (a.tag == b.tag) { return 0; } else return 1; });$/;" f lineno:235 type:number function(any, any)
10 | %anonymous_function check-string-tagcloud.js /^var tagInfo = tagInfoJSON.parseJSON(function(a, b) { if (a == "popularity") { return Math.log(b) \/ log2; } else {return b; } });$/;" f lineno:229 type:number function(string, any)
11 | %anonymous_function check-string-tagcloud.js /^var tagcloud_norm = tagcloud.replace(\/([0-9.]+)px\/g, function(str, p1) { return p1.substr(0, 10) + 'px' })$/;" f lineno:269 type:string function(any, any)
12 | f check-string-tagcloud.js /^ function f(n) {$/;" f lineno:79 type:string function(any)
13 | log2 check-string-tagcloud.js /^var log2 = Math.log(2);$/;" v lineno:228 type:number
14 | makeTagCloud check-string-tagcloud.js /^function makeTagCloud(tagInfo)$/;" f lineno:231 type:string function(number)
15 | parseJSON check-string-tagcloud.js /^ s.parseJSON = function (filter) {$/;" f lineno:177 type:number function(number function(string, any))
16 | tagInfo check-string-tagcloud.js /^var tagInfo = tagInfoJSON.parseJSON(function(a, b) { if (a == "popularity") { return Math.log(b) \/ log2; } else {return b; } });$/;" v lineno:229 type:
17 | tagInfoJSON check-string-tagcloud.js /^var tagInfoJSON = "";$/;" v lineno:226 type:string
18 | tagcloud check-string-tagcloud.js /^var tagcloud = makeTagCloud(tagInfo);$/;" v lineno:264 type:string
19 | tagcloud_norm check-string-tagcloud.js /^var tagcloud_norm = tagcloud.replace(\/([0-9.]+)px\/g, function(str, p1) { return p1.substr(0, 10) + 'px' })$/;" v lineno:269 type:string
20 | toJSONString check-string-tagcloud.js /^ s.toJSONString = function () {$/;" f lineno:208 type:string function()
21 | toJSONString check-string-tagcloud.js /^ Array.prototype.toJSONString = function (w) {$/;" f lineno:40 type:string function(any)
22 | toJSONString check-string-tagcloud.js /^ Boolean.prototype.toJSONString = function () {$/;" f lineno:72 type:string function()
23 | toJSONString check-string-tagcloud.js /^ Date.prototype.toJSONString = function () {$/;" f lineno:77 type:string function()
24 | toJSONString check-string-tagcloud.js /^ Number.prototype.toJSONString = function () {$/;" f lineno:93 type:string function()
25 | toJSONString check-string-tagcloud.js /^ Object.prototype.toJSONString = function (w) {$/;" f lineno:99 type:string function(any)
26 | walk check-string-tagcloud.js /^ function walk(k, v) {$/;" f lineno:180 type:number function(string, any)
27 |
--------------------------------------------------------------------------------
/lib/jsctags/ctags/reader.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | var _ = require('underscore')._;
39 | var Trait = require('traits').Trait;
40 |
41 | exports.TagReader = Trait({
42 | readLines: function(lines) {
43 | var tags = [];
44 |
45 | _(lines).each(function(line) {
46 | var parts = line.split("\t");
47 | if (parts.length < 3) {
48 | return;
49 | }
50 |
51 | var name = parts[0];
52 | if (/^!_TAG_/.test(name)) {
53 | return;
54 | }
55 |
56 | // TODO: cope with tab characters in the addr
57 | var tag = { name: name, tagfile: parts[1], addr: parts[2] };
58 |
59 | var fieldIndex;
60 | if (parts.length > 3 && parts[3].indexOf(":") === -1) {
61 | tag.kind = parts[3];
62 | fieldIndex = 4;
63 | } else {
64 | fieldIndex = 3;
65 | }
66 |
67 | var fields = {};
68 | _(parts.slice(fieldIndex)).each(function(field) {
69 | var match = /^([^:]+):(.*)/.exec(field);
70 | fields[match[1]] = match[2];
71 | });
72 | tag.fields = fields;
73 |
74 | tags.push(tag);
75 | });
76 |
77 | this.add(tags);
78 | },
79 |
80 | readString: function(str) {
81 | this.readLines(str.split("\n"));
82 | }
83 | });
84 |
85 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-math-cordic.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) Rich Moore. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | /////. Start CORDIC
27 |
28 | var AG_CONST = 0.6072529350;
29 |
30 | function FIXED(X)
31 | {
32 | return X * 65536.0;
33 | }
34 |
35 | function FLOAT(X)
36 | {
37 | return X / 65536.0;
38 | }
39 |
40 | function DEG2RAD(X)
41 | {
42 | return 0.017453 * (X);
43 | }
44 |
45 | var Angles = [
46 | FIXED(45.0), FIXED(26.565), FIXED(14.0362), FIXED(7.12502),
47 | FIXED(3.57633), FIXED(1.78991), FIXED(0.895174), FIXED(0.447614),
48 | FIXED(0.223811), FIXED(0.111906), FIXED(0.055953),
49 | FIXED(0.027977)
50 | ];
51 |
52 |
53 | function cordicsincos() {
54 | var X;
55 | var Y;
56 | var TargetAngle;
57 | var CurrAngle;
58 | var Step;
59 |
60 | X = FIXED(AG_CONST); /* AG_CONST * cos(0) */
61 | Y = 0; /* AG_CONST * sin(0) */
62 |
63 | TargetAngle = FIXED(28.027);
64 | CurrAngle = 0;
65 | for (Step = 0; Step < 12; Step++) {
66 | var NewX;
67 | if (TargetAngle > CurrAngle) {
68 | NewX = X - (Y >> Step);
69 | Y = (X >> Step) + Y;
70 | X = NewX;
71 | CurrAngle += Angles[Step];
72 | } else {
73 | NewX = X + (Y >> Step);
74 | Y = -(X >> Step) + Y;
75 | X = NewX;
76 | CurrAngle -= Angles[Step];
77 | }
78 | }
79 | return CurrAngle;
80 | }
81 |
82 | ///// End CORDIC
83 |
84 | function cordic( runs ) {
85 | var actual;
86 |
87 | var start = new Date();
88 |
89 | for ( var i = 0 ; i < runs ; i++ ) {
90 | actual = cordicsincos();
91 | }
92 |
93 | var end = new Date();
94 |
95 | assertEq(actual, 1834995.3515519998)
96 |
97 | return end.getTime() - start.getTime();
98 | }
99 |
100 | cordic(25000);
101 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-crypto-sha1.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | b64_hmac_sha1 check-crypto-sha1.js /^function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}$/;" f lineno:26 type:string function(any, any)
8 | b64_sha1 check-crypto-sha1.js /^function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}$/;" f lineno:23 type:string function(any)
9 | b64pad check-crypto-sha1.js /^var b64pad = ""; \/* base-64 pad character. "=" for strict RFC compliance *\/$/;" v lineno:15 type:string
10 | binb2b64 check-crypto-sha1.js /^function binb2b64(binarray)$/;" f lineno:186 type:string function(Array[number])
11 | binb2hex check-crypto-sha1.js /^function binb2hex(binarray)$/;" f lineno:171 type:string function(Array[number])
12 | binb2str check-crypto-sha1.js /^function binb2str(bin)$/;" f lineno:159 type:string function(Array[number])
13 | chrsz check-crypto-sha1.js /^var chrsz = 8; \/* bits per input character. 8 - ASCII; 16 - Unicode *\/$/;" v lineno:16 type:number
14 | core_hmac_sha1 check-crypto-sha1.js /^function core_hmac_sha1(key, data)$/;" f lineno:108 type:Array[number] function(any, any)
15 | core_sha1 check-crypto-sha1.js /^function core_sha1(x, len)$/;" f lineno:40 type:Array[number] function(Array[number], number)
16 | hex_hmac_sha1 check-crypto-sha1.js /^function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}$/;" f lineno:25 type:string function(any, any)
17 | hex_sha1 check-crypto-sha1.js /^function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}$/;" f lineno:22 type:string function(string)
18 | hexcase check-crypto-sha1.js /^var hexcase = 0; \/* hex output format. 0 - lowercase; 1 - uppercase *\/$/;" v lineno:14 type:number
19 | i check-crypto-sha1.js /^From ancient grudge break to new mutiny,\\n\\$/;" v lineno:207 type:number
20 | plainText check-crypto-sha1.js /^var plainText = "Two households, both alike in dignity,\\n\\$/;" v lineno:205 type:string
21 | rol check-crypto-sha1.js /^function rol(num, cnt)$/;" f lineno:138 type:number function(number, number)
22 | safe_add check-crypto-sha1.js /^function safe_add(x, y)$/;" f lineno:128 type:number function(number, number)
23 | sha1Output check-crypto-sha1.js /^Whole misadventured piteous overthrows\\n\\$/;" v lineno:211 type:string
24 | sha1_ft check-crypto-sha1.js /^function sha1_ft(t, b, c, d)$/;" f lineno:88 type:number function(number, number, number, number)
25 | sha1_kt check-crypto-sha1.js /^function sha1_kt(t)$/;" f lineno:99 type:number function(number)
26 | sha1_vm_test check-crypto-sha1.js /^function sha1_vm_test()$/;" f lineno:32 type:boolean function()
27 | str2binb check-crypto-sha1.js /^function str2binb(str)$/;" f lineno:147 type:Array[number] function(string)
28 | str_hmac_sha1 check-crypto-sha1.js /^function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}$/;" f lineno:27 type:string function(any, any)
29 | str_sha1 check-crypto-sha1.js /^function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}$/;" f lineno:24 type:string function(any)
30 |
--------------------------------------------------------------------------------
/js/packages.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | // This script exports the CommonJS packages in the lib/ directory to Tiki so
39 | // that they can be loaded in the browser.
40 |
41 | tiki.register('::narcissus', {
42 | name: 'narcissus',
43 | version: "0.0.0",
44 | 'tiki:resources': [
45 | {
46 | id: 'narcissus:index',
47 | name: 'index',
48 | url: "../lib/jsctags/narcissus/index.js",
49 | type: 'script'
50 | },
51 | {
52 | id: 'narcissus:jsdefs',
53 | name: 'jsdefs.js',
54 | url: "../lib/jsctags/narcissus/jsdefs.js",
55 | type: 'script'
56 | },
57 | {
58 | id: 'narcissus:jslex',
59 | name: 'jslex.js',
60 | url: "../lib/jsctags/narcissus/jslex.js",
61 | type: 'script'
62 | },
63 | {
64 | id: 'narcissus:jsparse',
65 | name: 'jsparse.js',
66 | url: "../lib/jsctags/narcissus/jsparse.js",
67 | type: 'script'
68 | } ,
69 | {
70 | id: 'narcissus:jscfa',
71 | name: 'jscfa.js',
72 | url: "../lib/jsctags/narcissus/jscfa.js",
73 | type: 'script'
74 | }
75 | ]
76 | });
77 |
78 | // Turn on autowrap so that the same .js files can be used both offline and in
79 | // Tiki.
80 | var browser = tiki.require.loader.sources[0];
81 | browser.xhr = true;
82 | browser.autowrap = true;
83 |
84 |
--------------------------------------------------------------------------------
/lib/jsctags/jstypes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JavaScript Type Inference
5 |
6 |
7 |
8 |
9 |
10 |
58 |
59 |
60 |
61 |
62 | Examples:
63 |
64 |
polymorphism
65 |
convert to object
66 |
new vs no new
67 |
inheritance
68 |
recursion
69 |
first-class functions
70 |
exceptions
71 |
check-crypto-aes
72 |
73 |
74 |
75 |
76 |
77 | JavaScript type inference
78 |
79 |
80 |
81 | The type inference algorithm is based on the CFA2 control-flow
82 | analysis.
83 | Currently, it handles core JavaScript only (DOM support will be added
84 | soon). For comments and suggestions, email:
85 | dvardoulakis at mozilla dot com.
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
96 |
97 |
98 |
99 |
100 |
Line
Name
Type
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-crypto-md5.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | b64_hmac_md5 check-crypto-md5.js /^function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }$/;" f lineno:26 type:string function(any, any)
8 | b64_md5 check-crypto-md5.js /^function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}$/;" f lineno:23 type:string function(any)
9 | b64pad check-crypto-md5.js /^var b64pad = ""; \/* base-64 pad character. "=" for strict RFC compliance *\/$/;" v lineno:15 type:string
10 | binl2b64 check-crypto-md5.js /^function binl2b64(binarray)$/;" f lineno:240 type:string function(Array[number])
11 | binl2hex check-crypto-md5.js /^function binl2hex(binarray)$/;" f lineno:225 type:string function(Array[number])
12 | binl2str check-crypto-md5.js /^function binl2str(bin)$/;" f lineno:213 type:string function(Array[number])
13 | bit_rol check-crypto-md5.js /^function bit_rol(num, cnt)$/;" f lineno:192 type:number function(number, number)
14 | chrsz check-crypto-md5.js /^var chrsz = 8; \/* bits per input character. 8 - ASCII; 16 - Unicode *\/$/;" v lineno:16 type:number
15 | core_hmac_md5 check-crypto-md5.js /^function core_hmac_md5(key, data)$/;" f lineno:162 type:Array[number] function(any, any)
16 | core_md5 check-crypto-md5.js /^function core_md5(x, len)$/;" f lineno:40 type:Array[number] function(Array[number], number)
17 | hex_hmac_md5 check-crypto-md5.js /^function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }$/;" f lineno:25 type:string function(any, any)
18 | hex_md5 check-crypto-md5.js /^function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}$/;" f lineno:22 type:string function(string)
19 | hexcase check-crypto-md5.js /^var hexcase = 0; \/* hex output format. 0 - lowercase; 1 - uppercase *\/$/;" v lineno:14 type:number
20 | i check-crypto-md5.js /^Will they not hear? What, ho! you men, you beasts,\\n\\$/;" v lineno:260 type:number
21 | md5Output check-crypto-md5.js /^Throw your mistemper'd weapons to the ground,\\n\\$/;" v lineno:264 type:string
22 | md5_cmn check-crypto-md5.js /^function md5_cmn(q, a, b, x, s, t)$/;" f lineno:138 type:number function(number, number, number, number, number, number)
23 | md5_ff check-crypto-md5.js /^function md5_ff(a, b, c, d, x, s, t)$/;" f lineno:142 type:number function(number, number, number, number, number, number, number)
24 | md5_gg check-crypto-md5.js /^function md5_gg(a, b, c, d, x, s, t)$/;" f lineno:146 type:number function(number, number, number, number, number, number, number)
25 | md5_hh check-crypto-md5.js /^function md5_hh(a, b, c, d, x, s, t)$/;" f lineno:150 type:number function(number, number, number, number, number, number, number)
26 | md5_ii check-crypto-md5.js /^function md5_ii(a, b, c, d, x, s, t)$/;" f lineno:154 type:number function(number, number, number, number, number, number, number)
27 | md5_vm_test check-crypto-md5.js /^function md5_vm_test()$/;" f lineno:32 type:boolean function()
28 | plainText check-crypto-md5.js /^var plainText = "Rebellious subjects, enemies to peace,\\n\\$/;" v lineno:258 type:string
29 | safe_add check-crypto-md5.js /^function safe_add(x, y)$/;" f lineno:182 type:number function(number, number)
30 | str2binl check-crypto-md5.js /^function str2binl(str)$/;" f lineno:201 type:Array[number] function(string)
31 | str_hmac_md5 check-crypto-md5.js /^function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }$/;" f lineno:27 type:string function(any, any)
32 | str_md5 check-crypto-md5.js /^function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}$/;" f lineno:24 type:string function(any)
33 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-3d-cube.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | CalcCross check-3d-cube.js /^function CalcCross(V0, V1) {$/;" f lineno:70 type:Array[number] function(Array[number], Array[number])
8 | CalcNormal check-3d-cube.js /^function CalcNormal(V0, V1, V2) {$/;" f lineno:78 type:Array[number] function(Array[number], Array[number], Array[number])
9 | CreateP check-3d-cube.js /^function CreateP(X,Y,Z) {$/;" f lineno:91 type: function(number, number, number)
10 | DisplArea check-3d-cube.js /^var DisplArea = new Object();$/;" v lineno:13 type:
11 | DrawLine check-3d-cube.js /^function DrawLine(From, To) {$/;" f lineno:17 type:void function(CreateP, CreateP)
12 | DrawQube check-3d-cube.js /^function DrawQube() {$/;" f lineno:186 type:void function()
13 | I check-3d-cube.js /^var I = new Array(); \/\/ entity matrix$/;" v lineno:8 type:
14 | Init check-3d-cube.js /^function Init(CubeSize) {$/;" f lineno:251 type:void function(number)
15 | Loop check-3d-cube.js /^function Loop() {$/;" f lineno:232 type:void function()
16 | LoopTimer check-3d-cube.js /^var LoopTimer;$/;" v lineno:11 type:any
17 | MAdd check-3d-cube.js /^function MAdd(M1, M2) {$/;" f lineno:123 type:Array[Array] function(any, any)
18 | MMulti check-3d-cube.js /^function MMulti(M1, M2) {$/;" f lineno:96 type:Array[Array[number]] function(, )
19 | MQube check-3d-cube.js /^var MQube = new Array(); \/\/ position information of qube$/;" v lineno:7 type:
20 | MTrans check-3d-cube.js /^var MTrans = new Array(); \/\/ transformation matrix$/;" v lineno:6 type:
21 | Origin check-3d-cube.js /^var Origin = new Object();$/;" v lineno:9 type:
22 | Q check-3d-cube.js /^var Q = new Array();$/;" v lineno:5 type:
23 | RotateX check-3d-cube.js /^function RotateX(M, Phi) {$/;" f lineno:144 type:Array[Array[number]] function(, number)
24 | RotateY check-3d-cube.js /^function RotateY(M, Phi) {$/;" f lineno:158 type:Array[Array[number]] function(, number)
25 | RotateZ check-3d-cube.js /^function RotateZ(M, Phi) {$/;" f lineno:172 type:Array[Array[number]] function(, number)
26 | Testing check-3d-cube.js /^var Testing = new Object();$/;" v lineno:10 type:
27 | Translate check-3d-cube.js /^function Translate(M, Dx, Dy, Dz) {$/;" f lineno:134 type:Array[Array[number]] function(, number, number, number)
28 | VMulti check-3d-cube.js /^function VMulti(M, V) {$/;" f lineno:108 type:Array[number] function(, Array[number])
29 | VMulti2 check-3d-cube.js /^function VMulti2(M, V) {$/;" f lineno:115 type:Array[number] function(, Array[number])
30 | actual check-3d-cube.js /^var actual = '';$/;" v lineno:330 type:string
31 | expected check-3d-cube.js /^var expected = "-116.618229186398,212.51135212951073,62.5094191967962,1;127.83701023614447,417.11611179082263,90.41153816299942,1;293.9570894432935,196.58093046570656,252.17789153139591,1;49.501850020750915,-8.02382919560505,224.275772565193,1;6.042910556709444,103.41906953429206,-212.1778915313964,1;250.49814997925202,308.02382919560387,-184.27577256519325,1;416.61822918640064,87.48864787048812,-22.509419196796493,1;172.1629897638581,-117.1161117908236,-50.41153816299975,1;150.0000000000007,149.99999999999952,20,1;";$/;" v lineno:334 type:string
32 | i check-3d-cube.js /^for ( var i = 20; i <= 160; i *= 2 ) {$/;" v lineno:326 type:any
33 | i check-3d-cube.js /^for (var i = 0; i < Q.length; ++i) {$/;" v lineno:331 type:number
34 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-mont.js:
--------------------------------------------------------------------------------
1 | // regression test for Bug 452008 - TM: SRP in Clipperz crypto library fails when JIT (TraceMonkey) is enabled.
2 |
3 | var x = [9385, 32112, 25383, 16317, 30138, 14565, 17812, 24500, 2719, 30174, 3546, 9096, 15352, 19120, 20648, 14334, 7426, 0, 0, 0];
4 | var n = [27875, 25925, 30422, 12227, 27798, 32170, 10873, 21748, 30629, 26296, 20697, 5125, 4815, 2221, 14392, 23369, 5560, 2, 0, 0];
5 | var np = 18229;
6 | var expected = [18770, 31456, 17999, 32635, 27508, 29131, 2856, 16233, 5439, 27580, 7093, 18192, 30804, 5472, 8529, 28649, 14852, 0, 0, 0];
7 |
8 | //globals
9 | bpe=0; //bits stored per array element
10 | mask=0; //AND this with an array element to chop it down to bpe bits
11 |
12 | //initialize the global variables
13 | for (bpe=0; (1<<(bpe+1)) > (1<>=1; //bpe=number of bits in one element of the array representing the bigInt
15 | mask=(1<>=bpe;
38 | }
39 | }
40 |
41 | //is x > y? (x and y both nonnegative)
42 | function greater(x,y) {
43 | var i;
44 | var k=(x.length=0;i--)
55 | if (x[i]>y[i])
56 | return 1;
57 | else if (x[i]0 && n[kn-1]==0;kn--); //ignore leading zeros of n
82 | for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y
83 |
84 | copyInt_(sa,0);
85 |
86 | //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys
87 | for (i=0; i> bpe;
91 | t=x[i];
92 |
93 | //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe
94 | for (j=1;j>=bpe;
98 | }
99 | for (;j>=bpe;
103 | }
104 | sa[j-1]=c & mask;
105 | }
106 |
107 | if (!greater(n,sa))
108 | sub_(sa,n);
109 | copy_(x,sa);
110 | }
111 |
112 | mont_(x, x, n, np);
113 |
114 | var passed = expected.length == x.length;
115 | for (var i = 0; i < expected.length; i++) {
116 | if (passed)
117 | passed = expected[i] == x[i];
118 | }
119 | assertEq(passed, true);
120 |
--------------------------------------------------------------------------------
/html/doctorjs/jquery.spinner.js:
--------------------------------------------------------------------------------
1 | /*
2 | Spinner provides a simple approach for adding and removing a preloader
3 | for your web applications. Usage is as simple as calling $('elem').spinner() and
4 | subsequently $('elem').spinner.remove(). You may create your own preloader
5 | at http://www.ajaxload.info. Please note that if you use a custom preloader,
6 | you must pass in the new height and width as options.
7 |
8 | Copyright (C) 2010 Corey Ballou
9 | Website: http://www.jqueryin.com
10 | Documentation: http://www.jqueryin.com/projects/spinner-jquery-preloader-plugin/
11 |
12 | This program is free software; you can redistribute it and/or modify
13 | it under the terms of the GNU General Public License as published by
14 | the Free Software Foundation; either version 2 of the License, or
15 | (at your option) any later version.
16 |
17 | This program is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License for more details.
21 |
22 | You should have received a copy of the GNU General Public License along
23 | with this program; if not, write to the Free Software Foundation, Inc.,
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 | */
26 | (function($) {
27 | $.fn.spinner = function(options) {
28 | var opts = $.extend({}, $.fn.spinner.defaults, options);
29 |
30 | return this.each(function() {
31 | var l=0, t=0, w=0, h=0, shim=0, $s;
32 | var $this = $(this);
33 |
34 | // removal handling
35 | if (options == 'remove' || options == 'close') {
36 | var $s = $this.data('spinner');
37 | var o = $this.data('opts');
38 | if (typeof $s != 'undefined') {
39 | $s.remove();
40 | $this.removeData('spinner').removeData('opts');
41 | if (o.hide) $this.css('visibility', 'visible');
42 | o.onFinish.call(this);
43 | return;
44 | }
45 | }
46 |
47 | // retrieve element positioning
48 | var pos = $this.offset();
49 | w = $this.outerWidth();
50 | h = $this.outerHeight();
51 |
52 | // calculate vertical centering
53 | if (h > opts.height) shim = Math.round((h - opts.height)/ 2);
54 | else if (h < opts.height) shim = 0 - Math.round((opts.height - h) / 2);
55 | t = pos.top + shim + 'px';
56 |
57 | // calculate horizontal positioning
58 | if (opts.position == 'right') {
59 | l = pos.left + w + 10 + 'px';
60 | } else if (opts.position == 'left') {
61 | l = pos.left - opts.width - 10 + 'px';
62 | } else {
63 | l = pos.left + Math.round(.5 * w) - Math.round(.5 * opts.width) + 'px';
64 | }
65 |
66 | // call start callback
67 | opts.onStart.call(this);
68 |
69 | // hide element?
70 | if (opts.hide) $this.css('visibility', 'hidden');
71 |
72 | // create the spinner and attach
73 | $s = $('').appendTo('body');
74 |
75 | // removal handling
76 | $this.data('spinner', $s).data('opts', opts);
77 | });
78 | };
79 |
80 | // default spinner options
81 | $.fn.spinner.defaults = {
82 | position : 'right' // left, right, center
83 | , img : 'spinner.gif' // path to spinner img
84 | , height : 16 // height of spinner img
85 | , width : 16 // width of spinner img
86 | , zIndex : 1001 // z-index of spinner
87 | , hide : false // whether to hide the elem
88 | , onStart : function(){ } // start callback
89 | , onFinish : function(){ } // end callback
90 | };
91 | })(jQuery);
92 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/nonterms.txt:
--------------------------------------------------------------------------------
1 | END 0
2 | NEWLINE 1
3 | SEMICOLON 2
4 | COMMA 3
5 | ASSIGN 4
6 | HOOK 5
7 | COLON 6
8 | CONDITIONAL 7
9 | OR 8
10 | AND 9
11 | BITWISE_OR 10
12 | BITWISE_XOR 11
13 | BITWISE_AND 12
14 | EQ 13
15 | NE 14
16 | STRICT_EQ 15
17 | STRICT_NE 16
18 | LT 17
19 | LE 18
20 | GE 19
21 | GT 20
22 | LSH 21
23 | RSH 22
24 | URSH 23
25 | PLUS 24
26 | MINUS 25
27 | MUL 26
28 | DIV 27
29 | MOD 28
30 | NOT 29
31 | BITWISE_NOT 30
32 | UNARY_PLUS 31
33 | UNARY_MINUS 32
34 | INCREMENT 33
35 | DECREMENT 34
36 | DOT 35
37 | LEFT_BRACKET 36
38 | RIGHT_BRACKET 37
39 | LEFT_CURLY 38
40 | RIGHT_CURLY 39
41 | LEFT_PAREN 40
42 | RIGHT_PAREN 41
43 | SCRIPT 42
44 | BLOCK 43
45 | LABEL 44
46 | FOR_IN 45
47 | CALL 46
48 | NEW_WITH_ARGS 47
49 | INDEX 48
50 | ARRAY_INIT 49
51 | OBJECT_INIT 50
52 | PROPERTY_INIT 51
53 | GETTER 52
54 | SETTER 53
55 | GROUP 54
56 | LIST 55
57 | LET_STM 56
58 | LET_EXP 57
59 | LET_DEF 58
60 | IDENTIFIER 59
61 | NUMBER 60
62 | STRING 61
63 | REGEXP 62
64 | BREAK 63
65 | CASE 64
66 | CATCH 65
67 | CONST 66
68 | CONTINUE 67
69 | DEBUGGER 68
70 | DEFAULT 69
71 | DELETE 70
72 | DO 71
73 | ELSE 72
74 | ENUM 73
75 | FALSE 74
76 | FINALLY 75
77 | FOR 76
78 | FUNCTION 77
79 | IF 78
80 | IN 79
81 | INSTANCEOF 80
82 | LET 81
83 | NEW 82
84 | NULL 83
85 | RETURN 84
86 | SWITCH 85
87 | THIS 86
88 | THROW 87
89 | TRUE 88
90 | TRY 89
91 | TYPEOF 90
92 | VAR 91
93 | VOID 92
94 | YIELD 93
95 | WHILE 94
96 | WITH 95
97 | END 0
98 | NEWLINE 1
99 | SEMICOLON 2
100 | COMMA 3
101 | ASSIGN 4
102 | HOOK 5
103 | COLON 6
104 | CONDITIONAL 7
105 | OR 8
106 | AND 9
107 | BITWISE_OR 10
108 | BITWISE_XOR 11
109 | BITWISE_AND 12
110 | EQ 13
111 | NE 14
112 | STRICT_EQ 15
113 | STRICT_NE 16
114 | LT 17
115 | LE 18
116 | GE 19
117 | GT 20
118 | LSH 21
119 | RSH 22
120 | URSH 23
121 | PLUS 24
122 | MINUS 25
123 | MUL 26
124 | DIV 27
125 | MOD 28
126 | NOT 29
127 | BITWISE_NOT 30
128 | UNARY_PLUS 31
129 | UNARY_MINUS 32
130 | INCREMENT 33
131 | DECREMENT 34
132 | DOT 35
133 | LEFT_BRACKET 36
134 | RIGHT_BRACKET 37
135 | LEFT_CURLY 38
136 | RIGHT_CURLY 39
137 | LEFT_PAREN 40
138 | RIGHT_PAREN 41
139 | SCRIPT 42
140 | BLOCK 43
141 | LABEL 44
142 | FOR_IN 45
143 | CALL 46
144 | NEW_WITH_ARGS 47
145 | INDEX 48
146 | ARRAY_INIT 49
147 | OBJECT_INIT 50
148 | PROPERTY_INIT 51
149 | GETTER 52
150 | SETTER 53
151 | GROUP 54
152 | LIST 55
153 | LET_STM 56
154 | LET_EXP 57
155 | LET_DEF 58
156 | IDENTIFIER 59
157 | NUMBER 60
158 | STRING 61
159 | REGEXP 62
160 | BREAK 63
161 | CASE 64
162 | CATCH 65
163 | CONST 66
164 | CONTINUE 67
165 | DEBUGGER 68
166 | DEFAULT 69
167 | DELETE 70
168 | DO 71
169 | ELSE 72
170 | ENUM 73
171 | FALSE 74
172 | FINALLY 75
173 | FOR 76
174 | FUNCTION 77
175 | IF 78
176 | IN 79
177 | INSTANCEOF 80
178 | LET 81
179 | NEW 82
180 | NULL 83
181 | RETURN 84
182 | SWITCH 85
183 | THIS 86
184 | THROW 87
185 | TRUE 88
186 | TRY 89
187 | TYPEOF 90
188 | VAR 91
189 | VOID 92
190 | YIELD 93
191 | WHILE 94
192 | WITH 95
193 | END 0
194 | NEWLINE 1
195 | SEMICOLON 2
196 | COMMA 3
197 | ASSIGN 4
198 | HOOK 5
199 | COLON 6
200 | CONDITIONAL 7
201 | OR 8
202 | AND 9
203 | BITWISE_OR 10
204 | BITWISE_XOR 11
205 | BITWISE_AND 12
206 | EQ 13
207 | NE 14
208 | STRICT_EQ 15
209 | STRICT_NE 16
210 | LT 17
211 | LE 18
212 | GE 19
213 | GT 20
214 | LSH 21
215 | RSH 22
216 | URSH 23
217 | PLUS 24
218 | MINUS 25
219 | MUL 26
220 | DIV 27
221 | MOD 28
222 | NOT 29
223 | BITWISE_NOT 30
224 | UNARY_PLUS 31
225 | UNARY_MINUS 32
226 | INCREMENT 33
227 | DECREMENT 34
228 | DOT 35
229 | LEFT_BRACKET 36
230 | RIGHT_BRACKET 37
231 | LEFT_CURLY 38
232 | RIGHT_CURLY 39
233 | LEFT_PAREN 40
234 | RIGHT_PAREN 41
235 | SCRIPT 42
236 | BLOCK 43
237 | LABEL 44
238 | FOR_IN 45
239 | CALL 46
240 | NEW_WITH_ARGS 47
241 | INDEX 48
242 | ARRAY_INIT 49
243 | OBJECT_INIT 50
244 | PROPERTY_INIT 51
245 | GETTER 52
246 | SETTER 53
247 | GROUP 54
248 | LIST 55
249 | LET_STM 56
250 | LET_EXP 57
251 | LET_DEF 58
252 | IDENTIFIER 59
253 | NUMBER 60
254 | STRING 61
255 | REGEXP 62
256 | BREAK 63
257 | CASE 64
258 | CATCH 65
259 | CONST 66
260 | CONTINUE 67
261 | DEBUGGER 68
262 | DEFAULT 69
263 | DELETE 70
264 | DO 71
265 | ELSE 72
266 | ENUM 73
267 | FALSE 74
268 | FINALLY 75
269 | FOR 76
270 | FUNCTION 77
271 | IF 78
272 | IN 79
273 | INSTANCEOF 80
274 | LET 81
275 | NEW 82
276 | NULL 83
277 | RETURN 84
278 | SWITCH 85
279 | THIS 86
280 | THROW 87
281 | TRUE 88
282 | TRY 89
283 | TYPEOF 90
284 | VAR 91
285 | VOID 92
286 | YIELD 93
287 | WHILE 94
288 | WITH 95
289 |
--------------------------------------------------------------------------------
/lib/jsctags/narcissus/sunspider/check-3d-raytrace.tags:
--------------------------------------------------------------------------------
1 | !_TAG_FILE_FORMAT 2 /extended format/
2 | !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3 | !_TAG_PROGRAM_AUTHOR Patrick Walton /pwalton@mozilla.com/
4 | !_TAG_PROGRAM_NAME jsctags //
5 | !_TAG_PROGRAM_URL http://github.com/pcwalton/jsctags /GitHub repository/
6 | !_TAG_PROGRAM_VERSION 0.1 //
7 | Camera check-3d-raytrace.js /^function Camera(origin, lookat, up) {$/;" f lineno:261 type:Camera function(Array[number], Array[number], Array[number])
8 | Scene check-3d-raytrace.js /^function Scene(a_triangles) {$/;" f lineno:181 type:Scene function(Array[Triangle])
9 | Triangle check-3d-raytrace.js /^function Triangle(p1, p2, p3) {$/;" f lineno:125 type:Triangle function(Array[number], Array[number], Array[number])
10 | add check-3d-raytrace.js /^function add(v1, v2) {$/;" f lineno:67 type:Array[number] function(Array[number], Array[number])
11 | addVector check-3d-raytrace.js /^function addVector(self, v) {$/;" f lineno:38 type:Array[number] function(Array[number], )
12 | arrayToCanvasCommands check-3d-raytrace.js /^function arrayToCanvasCommands(pixels)$/;" f lineno:405 type:string function(Array[Array])
13 | blocked check-3d-raytrace.js /^Scene.prototype.blocked = function(O, D, far) {$/;" f lineno:244 type:boolean function(Array[number], Array[number], number)
14 | createVector check-3d-raytrace.js /^function createVector(x,y,z) {$/;" f lineno:26 type:Array[number] function(number, number, number)
15 | cross check-3d-raytrace.js /^function cross(v1, v2) {$/;" f lineno:87 type:Array[number] function(Array[number], Array[number])
16 | dot check-3d-raytrace.js /^function dot(v1, v2) {$/;" f lineno:79 type:number function(Array[number], Array[number])
17 | floorShader check-3d-raytrace.js /^ var floorShader = function(tri, pos, view) {$/;" f lineno:357 type:Array[number] function(, Array[number], Array[number])
18 | generateRayPair check-3d-raytrace.js /^Camera.prototype.generateRayPair = function(y) {$/;" f lineno:283 type:Array[Object] function(number)
19 | intersect check-3d-raytrace.js /^Scene.prototype.intersect = function(origin, dir, near, far) {$/;" f lineno:189 type: function(Array[number], Array[number], , )
20 | intersect check-3d-raytrace.js /^Triangle.prototype.intersect = function(orig, dir, near, far) {$/;" f lineno:160 type: function(Array[number], Array[number], , )
21 | invertMatrix check-3d-raytrace.js /^function invertMatrix(self) {$/;" f lineno:107 type:Array[number] function(Array[number])
22 | lengthVector check-3d-raytrace.js /^function lengthVector(self) {$/;" f lineno:34 type:number function(Array[number])
23 | normalise check-3d-raytrace.js /^function normalise(v) {$/;" f lineno:94 type:Array[number] function(Array[number])
24 | normaliseVector check-3d-raytrace.js /^function normaliseVector(self) {$/;" f lineno:59 type:Array[number] function(Array[number])
25 | raytraceScene check-3d-raytrace.js /^function raytraceScene()$/;" f lineno:313 type:Array[Array] function()
26 | render check-3d-raytrace.js /^Camera.prototype.render = function(scene, pixels, width, height) {$/;" f lineno:305 type:void function(Scene, Array[Array], number, number)
27 | renderRows check-3d-raytrace.js /^function renderRows(camera, scene, pixels, width, height, starty, stopy) {$/;" f lineno:292 type:void function(Camera, Scene, Array[Array], number, number, number, number)
28 | scale check-3d-raytrace.js /^function scale(v, scale) {$/;" f lineno:83 type:Array[number] function(Array[number], )
29 | scaleVector check-3d-raytrace.js /^function scaleVector(self, scale) {$/;" f lineno:52 type: function(, )
30 | scalev check-3d-raytrace.js /^function scalev(v1, v2) {$/;" f lineno:75 type:Array[number] function(Array[number], )
31 | sqrLengthVector check-3d-raytrace.js /^function sqrLengthVector(self) {$/;" f lineno:30 type:number function(any)
32 | sub check-3d-raytrace.js /^function sub(v1, v2) {$/;" f lineno:71 type:Array[number] function(Array[number], Array[number])
33 | subVector check-3d-raytrace.js /^function subVector(self, v) {$/;" f lineno:45 type:Array[number] function(Array[number], Array[number])
34 | transformMatrix check-3d-raytrace.js /^function transformMatrix(self, v) {$/;" f lineno:99 type:Array[number] function(Array[number], Array[number])
35 | zero check-3d-raytrace.js /^var zero = new Array(0,0,0);$/;" v lineno:187 type:Array[number]
36 |
--------------------------------------------------------------------------------
/lib/jsctags/ctags/index.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | var jscfa = require('narcissus').jscfa;
39 | var parse = require('narcissus').parse;
40 | var _ = require('underscore')._;
41 | var Interpreter = require('./interp').Interpreter;
42 | var TagReader = require('./reader').TagReader;
43 | var TagWriter = require('./writer').TagWriter;
44 | var Trait = require('traits').Trait;
45 |
46 | exports.Tags = function(initialTags) {
47 | this.tags = initialTags != null ? initialTags : [];
48 | this.init();
49 | };
50 |
51 | exports.Tags.prototype = Object.create(Object.prototype, Trait.compose(Trait({
52 | _search: function(id, pred) {
53 | var shadowTag = { name: id };
54 | var tags = this.tags;
55 | var index = _(tags).sortedIndex(shadowTag, function(tag) {
56 | return tag.name;
57 | });
58 |
59 | var start = index, end = index;
60 | while (start >= 0 && start < tags.length && pred(tags[start])) {
61 | start--;
62 | }
63 | while (end >= 0 && end < tags.length && pred(tags[end])) {
64 | end++;
65 | }
66 |
67 | return tags.slice(start + 1, end);
68 | },
69 |
70 | add: function(newTags) {
71 | var tags = this.tags;
72 | Array.prototype.push.apply(tags, newTags);
73 |
74 | tags.sort(function(a, b) {
75 | var nameA = a.name, nameB = b.name;
76 | if (nameA < nameB) {
77 | return -1;
78 | }
79 | if (nameA === nameB) {
80 | return 0;
81 | }
82 | return 1;
83 | });
84 | },
85 |
86 | /** Returns all the tags that match the given identifier. */
87 | get: function(id) {
88 | return this._search(id, function(tag) { return tag.name === id; });
89 | },
90 |
91 | /**
92 | * Adds the tags from the supplied JavaScript file to the internal store of
93 | * tags.
94 | */
95 | //dimvar: file ptr, path to file, options
96 | scan: function(src, file, opts) {
97 | if (opts === null || opts === undefined) {
98 | opts = {};
99 | }
100 |
101 | var lines = src.split("\n");
102 | var ast = parse(src, file, 1);
103 |
104 | var interp = new Interpreter(ast, file, lines, opts);
105 | interp.interpret();
106 | this.add(interp.tags);
107 | },
108 |
109 | /** Returns all the tags that begin with the given prefix. */
110 | stem: function(prefix) {
111 | var len = prefix.length;
112 | return this._search(prefix, function(tag) {
113 | return tag.name.substring(0, len) === prefix;
114 | });
115 | }
116 | }), TagReader, TagWriter));
117 |
118 |
--------------------------------------------------------------------------------
/lib/jsctags/ctags/writer.js:
--------------------------------------------------------------------------------
1 | /* ***** BEGIN LICENSE BLOCK *****
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 | *
4 | * The contents of this file are subject to the Mozilla Public License Version
5 | * 1.1 (the "License"); you may not use this file except in compliance with
6 | * the License. You may obtain a copy of the License at
7 | * http://www.mozilla.org/MPL/
8 | *
9 | * Software distributed under the License is distributed on an "AS IS" basis,
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 | * for the specific language governing rights and limitations under the
12 | * License.
13 | *
14 | * The Original Code is Bespin.
15 | *
16 | * The Initial Developer of the Original Code is
17 | * Mozilla.
18 | * Portions created by the Initial Developer are Copyright (C) 2009
19 | * the Initial Developer. All Rights Reserved.
20 | *
21 | * Contributor(s):
22 | * Bespin Team (bespin@mozilla.com)
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | var Trait = require('traits').Trait;
39 | var _ = require('underscore')._;
40 |
41 | const ESCAPES = { "\\": "\\\\", "\n": "\\n", "\r": "\\r", "\t": "\\t" };
42 |
43 | const METATAGS = [
44 | { name: '!_TAG_FILE_FORMAT', tagfile: 2, addr: "/extended format/" },
45 | {
46 | name: '!_TAG_FILE_SORTED',
47 | tagfile: 1,
48 | addr: "/0=unsorted, 1=sorted, 2=foldcase/"
49 | },
50 | {
51 | name: '!_TAG_PROGRAM_AUTHOR',
52 | tagfile: "Patrick Walton",
53 | addr: "/pwalton@mozilla.com/"
54 | },
55 | { name: '!_TAG_PROGRAM_NAME', tagfile: "jsctags" },
56 | {
57 | name: '!_TAG_PROGRAM_URL',
58 | tagfile: "http://github.com/pcwalton/jsctags",
59 | addr: "/GitHub repository/"
60 | },
61 | { name: '!_TAG_PROGRAM_VERSION', tagfile: "0.1" }
62 | ];
63 |
64 | const SPECIAL_FIELDS = { addr: true, kind: true, name: true, tagfile: true };
65 |
66 | exports.TagWriter = Trait({
67 | tags: Trait.required,
68 |
69 | init: function() {
70 | this.tags = this.tags.concat(METATAGS);
71 | },
72 |
73 | write: function(stream) {
74 | var lines = this.tags.map(function(tag) {
75 | var buf = [ tag.name, "\t", tag.tagfile, "\t" ];
76 |
77 | var addr = tag.addr;
78 | buf.push(addr !== undefined ? addr : "//");
79 |
80 | var tagfields = [];
81 | for (var key in tag) {
82 | if (!(key in SPECIAL_FIELDS)) {
83 | tagfields.push(key);
84 | }
85 | }
86 | tagfields.sort();
87 |
88 | var kind = tag.kind;
89 | if (kind === undefined && tagfields.length === 0) {
90 | buf.push("\n");
91 | return buf.join("");
92 | }
93 |
94 | buf.push(";\"");
95 |
96 | if (kind !== undefined) {
97 | buf.push("\t", kind);
98 | }
99 |
100 | tagfields.forEach(function(tagfield) {
101 | buf.push("\t", tagfield, ":");
102 |
103 | var escape = function(str) { return ESCAPES[str]; };
104 | var val = tag[tagfield].toString();
105 | buf.push(val.replace("[\\\n\r\t]", escape));
106 | });
107 |
108 | buf.push("\n");
109 | return buf.join("");
110 | });
111 |
112 | lines.sort().forEach(function(line) { stream.write(line); });
113 | },
114 |
115 | writeJSONP: function(stream, func) {
116 | var json = JSON.stringify(this.tags);
117 | _([ func, "(", json, ");" ]).each(function(str) {
118 | stream.write(str);
119 | });
120 | },
121 | });
122 |
123 |
--------------------------------------------------------------------------------