code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2010 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless requ... | JavaScript |
/*jslint onevar: false, plusplus: false */
/*
JS Beautifier
---------------
Written by Einar Lielmanis, <einar@jsbeautifier.org>
http://jsbeautifier.org/
Originally converted to javascript by Vital, <vital76@gmail.com>
You are free to use this in any way you want, in case you find this useful or worki... | JavaScript |
// jslint.js
// 2009-08-01
/*
Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights t... | JavaScript |
/*extern JSLINT */
/*jslint rhino: true*/
(function (a) {
if (!a[0]) {
print("Usage: jslint.js file.js");
quit(1);
}
var input = read(a[0]);
if (!input) {
print("jslint: Couldn't open file '" + a[0] + "'.");
quit(1);
}
if (!JSLINT(input, {bitwise: false, eqeqeq: ... | JavaScript |
// this is stored into sys specially, rather than created by sys
Sk.sysmodules = new Sk.builtin.dict([]);
Sk.realsyspath = undefined;
/**
* @param {string} name to look for
* @param {string} ext extension to use (.py or .js)
* @param {boolean=} failok will throw if not true
*/
Sk.importSearchPathForName = function... | JavaScript |
Sk.builtin.int_ = function(x, base)
{
if (x instanceof Sk.builtin.str)
{
// todo; this should handle longs too
if (base === undefined) base = 10; // default radix is 10, not dwim
if ( x.v.substring(0,2).toLowerCase() == '0x' && base != 16 && base != 0) {
throw new Sk.builtin.ValueError("int... | JavaScript |
// builtins are supposed to come from the __builtin__ module, but we don't do
// that yet.
Sk.builtin = {};
// todo; these should all be func objects too, otherwise str() of them won't
// work, etc.
Sk.builtin.range = function(start, stop, step)
{
var ret = [];
var s = new Sk.builtin.slice(start, stop, step);... | JavaScript |
/**
* py sort is guaranteed to be stable, js's is not (and isn't in some
* browsers). we also have to do cmp/key/rev anyway, so this is a simple
* mergesort implementation to handle sorting for list (and other stuff
* eventually).
*
* @param {Array.<Object>} arr
* @param {Sk.builtin.func} cmp
* @param {Sk.built... | JavaScript |
/**
* @constructor
* @param {Array.<Object>} S
*/
Sk.builtin.set = function(S)
{
if (!(this instanceof Sk.builtin.set)) return new Sk.builtin.set(S);
if (typeof(S) === 'undefined')
{
S = [];
}
this.set_reset_();
S = new Sk.builtin.list(S);
// python sorts sets on init, but not t... | JavaScript |
/** @param {...*} x */
var out;
/**
* @constructor
* @param {string} filename
* @param {SymbolTable} st
* @param {number} flags
* @param {string=} sourceCodeForAnnotation used to add original source to listing if desired
*/
function Compiler(filename, st, flags, sourceCodeForAnnotation)
{
this.filename = fil... | JavaScript |
/**
* @constructor
*/
Sk.builtin.object = function()
{
if (!(this instanceof Sk.builtin.object)) return new Sk.builtin.object();
this['$d'] = new Sk.builtin.dict([]);
return this;
};
Sk.builtin.object.prototype.GenericGetAttr = function(name)
{
goog.asserts.assert(typeof name === "string");
var ... | JavaScript |
// Note: the hacky names on int, long, float have to correspond with the
// uniquization that the compiler does for words that are reserved in
// Javascript. This is a bit hokey.
Sk.builtins = {
'range': Sk.builtin.range,
'len': Sk.builtin.len,
'min': Sk.builtin.min,
'max': Sk.builtin.max,
'sum': Sk.builtin.sum,
'abs':... | JavaScript |
/*
* This is a port of tokenize.py by Ka-Ping Yee.
*
* each call to readline should return one line of input as a string, or
* undefined if it's finished.
*
* callback is called for each token with 5 args:
* 1. the token type
* 2. the token string
* 3. [ start_row, start_col ]
* 4. [ end_row, end_col ]
* 5. ... | JavaScript |
/**
* @constructor
* @param {Array.<Object>} L
* @extends Sk.builtin.object
*/
Sk.builtin.list = function(L)
{
if (!(this instanceof Sk.builtin.list)) return new Sk.builtin.list(L);
if (Object.prototype.toString.apply(L) === '[object Array]')
{
this.v = L;
}
else
{
if (L.tp$... | JavaScript |
Sk.misceval = {};
Sk.misceval.isIndex = function(o)
{
return o === null || typeof o === "number" || o.constructor === Sk.builtin.lng || o.tp$index;
};
goog.exportSymbol("Sk.misceval.isIndex", Sk.misceval.isIndex);
Sk.misceval.asIndex = function(o)
{
if (!Sk.misceval.isIndex(o)) return undefined;
if (o ===... | JavaScript |
//
// This is pretty much a straight port of ast.c from CPython 2.6.5.
//
// The previous version was easier to work with and more JS-ish, but having a
// somewhat different ast structure than cpython makes testing more difficult.
//
// This way, we can use a dump from the ast module on any arbitrary python
// code and... | JavaScript |
var interned = {};
/**
* @constructor
* @param {*} x
* @extends Sk.builtin.object
*/
Sk.builtin.str = function(x)
{
if (x === undefined) throw "error: trying to str() undefined (should be at least null)";
if (x instanceof Sk.builtin.str && x !== Sk.builtin.str.prototype.ob$type) return x;
if (!(this in... | JavaScript |
Sk.builtin.float_ = function(x)
{
if (x instanceof Sk.builtin.str)
{
if (x.v === "inf") return Infinity;
if (x.v === "-inf") return -Infinity;
if (!isNaN(x.v))
return parseFloat(x.v);
else {
throw new Sk.builtin.ValueError("float: Argument: " + x.v + " is ... | JavaScript |
/**
* @constructor
* @param {Array.<Object>|Object} L
*/
Sk.builtin.tuple = function(L)
{
if (arguments.length > 1) {
throw new TypeError("tuple must be created from a sequence");
}
if (L instanceof Sk.builtin.tuple) return;
if (!(this instanceof Sk.builtin.tuple)) return new Sk.builtin.tuple(L);
... | JavaScript |
/**
* @constructor
* @param {Function} code javascript code object for the function
* @param {Object} globals where this function was defined
* @param {Object} args arguments to the original call (stored into locals for
* the generator to reenter)
* @param {Object=} closure dict of free variables
* @param {Objec... | JavaScript |
// long aka "bigint" implementation
//
// the representation used is similar to python 2.6's:
//
// - each 'digit' of the long is 15 bits, which gives enough space in each to
// perform a multiplication without losing precision in the mantissa of
// javascript's number representation (a double).
//
// - the numbers are... | JavaScript |
/**
* Base namespace for Skulpt. This is the only symbol that Skulpt adds to the
* global namespace. Other user accessible symbols are noted and described
* below.
*/
var Sk = Sk || {};
/**
*
* Set various customizable parts of Skulpt.
*
* output: Replacable output redirection (called from print, etc.).
* re... | JavaScript |
/* Flags for def-use information */
var DEF_GLOBAL = 1; /* global stmt */
var DEF_LOCAL = 2; /* assignment in code block */
var DEF_PARAM = 2<<1; /* formal parameter */
var USE = 2<<2; /* name is used */
var DEF_STAR = 2<<3; /* parameter is star arg */
var DEF_DOUBLE... | JavaScript |
/**
*
* @constructor
*
* @param {*} name name or object to get type of, if only one arg
*
* @param {Array.<Object>=} bases
*
* @param {Object=} dict
*
*
* This type represents the type of `type'. *Calling* an instance of
* this builtin type named "type" creates class objects. The resulting
* class objects ... | JavaScript |
var $builtinmodule = function(name)
{
var sys = {};
var args = [];
var argv = Sk.getSysArgv();
for (var i = 0; i < argv.length; ++i)
args.push(new Sk.builtin.str(argv[i]));
sys.argv = new Sk.builtins['list'](args);
sys.copyright = Sk.builtin['str']("Copyright 2009-2010 Scott Graham.\nA... | JavaScript |
Sk.abstr = {};
//
//
//
//
// Number
//
//
//
//
Sk.abstr.binop_type_error = function(v, w, name)
{
throw new TypeError("unsupported operand type(s) for " + name + ": '"
+ v.tp$name + "' and '" + w.tp$name + "'");
};
// this can't be a table for closure
// bnm -- this seems like the most logical plac... | JavaScript |
/**
* @constructor
*
* co_varnames and co_name come from generated code, must access as dict.
*/
Sk.builtin.method = function(func, self)
{
this.im_func = func;
this.im_self = self;
//print("constructing method", this.im_func.tp$name, this.im_self.tp$name);
};
goog.exportSymbol("Sk.builtin.method", Sk.b... | JavaScript |
/**
* @constructor
* @param {Array.<Object>} L
*/
Sk.builtin.dict = function dict(L)
{
if (!(this instanceof Sk.builtin.dict)) return new Sk.builtin.dict(L);
this.size = 0;
for (var i = 0; i < L.length; i += 2)
{
this.mp$ass_subscript(L[i], L[i+1]);
}
this.__class__ = Sk.builtin.di... | JavaScript |
// low level parser to a concrete syntax tree, derived from cpython's lib2to3
/**
*
* @constructor
* @param {Object} grammar
*
* p = new Parser(grammar);
* p.setup([start]);
* foreach input token:
* if p.addtoken(...):
* break
* root = p.rootnode
*
* can throw ParseError
*/
function Parser(gra... | JavaScript |
/**
* @constructor
* @param {number} start
* @param {number=} stop
* @param {null|number=} step
*/
Sk.builtin.slice = function slice(start, stop, step)
{
if (!(this instanceof Sk.builtin.slice)) return new Sk.builtin.slice(start, stop, step);
if (stop === undefined && step === undefined)
{
sto... | JavaScript |
Sk.ffi = Sk.ffi || {};
/**
* maps from Javascript Object/Array/string to Python dict/list/str.
*
* only works on basic objects that are being used as storage, doesn't handle
* functions, etc.
*/
Sk.ffi.remapToPy = function(obj)
{
if (Object.prototype.toString.call(obj) === "[object Array]")
{
var ... | JavaScript |
/**
* @constructor
* @param {...*} args
*/
Sk.builtin.Exception = function(args)
{
var args = Array.prototype.slice.call(arguments);
// hackage to allow shorter throws
for (var i = 0; i < args.length; ++i)
{
if (typeof args[i] === "string")
args[i] = new Sk.builtin.str(args[i]);
... | JavaScript |
/**
* @constructor
* @param {Sk.builtin.str} name
* @param {Sk.builtin.str} mode
* @param {Object} buffering
*/
Sk.builtin.file = function(name, mode, buffering)
{
this.mode = mode;
this.name = name;
this.closed = false;
if ( Sk.inBrowser ) { // todo: Maybe provide a replaceable function for non-imp... | JavaScript |
/**
* @constructor
*/
Sk.builtin.module = function()
{
};
goog.exportSymbol("Sk.builtin.module", Sk.builtin.module);
Sk.builtin.module.prototype.ob$type = Sk.builtin.type.makeIntoTypeObj('module', Sk.builtin.module);
Sk.builtin.module.prototype.tp$getattr = Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.modu... | JavaScript |
var $builtinmodule = function(name)
{
var mod = {};
var checkArgs = function(expected, actual, func) {
if (actual != expected ) {
throw new Sk.builtin.TypeError(func + " takes exactly " + expected +
" positional argument (" + actual + " given)")
}
}
mod.... | JavaScript |
var $builtinmodule = function(name)
{
var mod = {};
mod.pi = Math.PI;
mod.e = Math.E;
mod.abs = new Sk.builtin.func(function(x) {
return Math.abs(x);
});
mod.asin = new Sk.builtin.func(function(rad) {
return Math.asin(rad);
});
mod.acos = new Sk.builtin.func(function(rad) {
return ... | JavaScript |
//
//
// Turtle Graphics Module for Skulpt
//
// Brad Miller
//
//
//
var TurtleGraphics; // the single identifier needed in the global scope
if (! TurtleGraphics) {
TurtleGraphics = { };
}
(function () {
// Define private constants
var Degree2Rad = Math.PI / 180.0; // conversion factor for degrees t... | JavaScript |
var $builtinmodule = function(name)
{
var mod = {};
// todo; won't work compressed
mod.tp$name = "webgl";
//
// Setup code taken from 'tdl'. I tried to use more of it, but it's a bit
// broken.
//
var makeFailHTML = function(msg) {
return '' +
'<table style="backgro... | JavaScript |
// most of this file is from/based on 'tdl'
var $builtinmodule = function(name)
{
var mod = {};
var Buffer = function(array, opt_target) {
var target = opt_target || gl.ARRAY_BUFFER;
var buf = gl.createBuffer();
this.target = target;
this.buf = buf;
this.set(array);
... | JavaScript |
var $builtinmodule = function(name)
{
var mod = {};
// todo; should probably put this in a math package
mod.Mat44 = Sk.misceval.buildClass(mod, function($gbl, $loc)
{
$loc.__init__ = new Sk.builtin.func(function(self)
{
Sk.misceval.cal... | JavaScript |
// most of this file is from 'tdl'
var $builtinmodule = function(name)
{
var mod = {};
/**
* AttribBuffer manages a TypedArray as an array of vectors.
*
* @param {number} numComponents Number of components per
* vector.
* @param {number|!Array.<number>} numElements Number of vec... | JavaScript |
// more from 'tdl'
var $builtinmodule = function(name)
{
var mod = {};
var temp0v3_ = new Float32Array(3);
var temp1v3_ = new Float32Array(3);
var temp2v3_ = new Float32Array(3);
var temp0v4_ = new Float32Array(4);
var temp1v4_ = new Float32Array(4);
var temp2v4_ = new Float32Array(4);
... | JavaScript |
var ImageMod; // the single identifier needed in the global scope
if (! ImageMod) {
ImageMod = { };
ImageMod.canvasLib = [];
}
// todo create an empty image by reading image data from a blank canvas of the appropriate size
var $builtinmodule = function(name) {
var mod = {};
var image = function($gb... | JavaScript |
var $builtinmodule = function(name)
{
goog.require('goog.math');
// todo; need to convert long -> number
// not super useful since it'll go double in JS and
// then lose precision and generally kind of suck.
var mod = {};
mod.randomInt = new Sk.builtin.func(function(a)
... | JavaScript |
var $builtinmodule = function(name)
{
// todo; is this ok inside the module function when in browser?
goog.require('goog.json');
var mod = {};
mod.parse = new Sk.builtin.func(function(s)
{
return Sk.ffi.remapToPy(goog.json.parse(s.v));
});
mod.unsafeParse =... | JavaScript |
var $builtinmodule = function(name)
{
goog.require('goog.ui.Component');
var mod = {};
mod.Component = Sk.misceval.buildClass(mod, function($gbl, $loc)
{
$loc.__init__ = new Sk.builtin.func(function(self, opt_domHelper)
{
self.v = new... | JavaScript |
var $builtinmodule = function(name)
{
goog.require('goog.dom');
var mod = {};
mod.getElement = new Sk.builtin.func(function(element)
{
// todo; need to wrap this with something. Element is a
// browser builtin type though, not a Closure one.
... | JavaScript |
var $builtinmodule = function(name)
{
goog.require('goog.graphics');
var mod = {};
mod.createGraphics = new Sk.builtin.func(function(width, height, opt_coordWidth, opt_coordHeight, opt_domHelper)
{
return new Sk.ffi.stdwrap(mod.AbstractGraphics, goog.graphics.createGraphics(wid... | JavaScript |
/**
* @constructor
*
* @param {Function} code the javascript implementation of this function
* @param {Object=} globals the globals where this function was defined.
* Can be undefined (which will be stored as null) for builtins. (is
* that ok?)
* @param {Object=} closure dict of free variables
* @param {Object=... | JavaScript |
Sk.googlocs =
{'': '/__init__.js',
'goog': 'goog/__init__.js',
'goog.Delay': 'goog/async/delay.js',
'goog.Disposable': 'goog/disposable/disposable.js',
'goog.History': 'goog/history/history.js',
'goog.History.Event': 'goog/history/history.js',
'goog.History.EventType': 'goog/history/history.js',
'goog.Throttle':... | JavaScript |
goog.require('goog.Delay');
goog.require('goog.Disposable');
goog.require('goog.History');
goog.require('goog.History.Event');
goog.require('goog.History.EventType');
goog.require('goog.Throttle');
goog.require('goog.Timer');
goog.require('goog.Uri');
goog.require('goog.Uri.QueryData');
goog.require('goog.arra... | JavaScript |
Sk.closureCtorHack = function() {
if (window.goog && goog.asserts && goog.asserts.AssertionError) goog.asserts.AssertionError.$isctor=true;
if (window.goog && goog.async && goog.async.Throttle) goog.async.Throttle.$isctor=true;
if (window.goog && goog.Throttle) goog.Throttle.$isctor=true;
if (window.goog && goog.async ... | JavaScript |
/* Demonstration of embedding CodeMirror in a bigger application. The
* interface defined here is a mess of prompts and confirms, and
* should probably not be used in a real project.
*/
function MirrorFrame(place, options) {
this.home = document.createElement("DIV");
if (place.appendChild)
place.appendChild... | JavaScript |
var HTMLMixedParser = Editor.Parser = (function() {
if (!(CSSParser && JSParser && XMLParser))
throw new Error("CSS, JS, and XML parsers must be loaded for HTML mixed mode to work.");
XMLParser.configure({useHTMLKludges: true});
function parseMixed(stream) {
var htmlParser = XMLParser.make(stream), local... | JavaScript |
/* Simple parser for CSS */
var CSSParser = Editor.Parser = (function() {
var tokenizeCSS = (function() {
function normal(source, setState) {
var ch = source.next();
if (ch == "@") {
source.nextWhileMatches(/\w/);
return "css-at";
}
else if (ch == "/" && source.equals("*")... | JavaScript |
/* Functionality for finding, storing, and restoring selections
*
* This does not provide a generic API, just the minimal functionality
* required by the CodeMirror system.
*/
// Namespace object.
var select = {};
(function() {
select.ie_selection = document.selection && document.selection.createRangeCollection... | JavaScript |
/* A few useful utility functions. */
// Capture a method on an object.
function method(obj, name) {
return function() {obj[name].apply(obj, arguments);};
}
// The value used to signal the end of a sequence in iterators.
var StopIteration = {toString: function() {return "StopIteration"}};
// Apply a function to ea... | JavaScript |
var SparqlParser = Editor.Parser = (function() {
function wordRegexp(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
}
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
"isblank", "isliteral", "union", "a"]);
var ... | JavaScript |
/* This file defines an XML parser, with a few kludges to make it
* useable for HTML. autoSelfClosers defines a set of tag names that
* are expected to not have a closing tag, and doNotIndent specifies
* the tags inside of which no indentation should happen (see Config
* object). These can be disabled by passing th... | JavaScript |
/* Tokenizer for JavaScript code */
var tokenizeJavaScript = (function() {
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
while (!source.endOfLine()) {
... | JavaScript |
// A framework for simple tokenizers. Takes care of newlines and
// white-space, and of getting the text from the source stream into
// the token object. A state is a function of two arguments -- a
// string stream and a setState function. The second can be used to
// change the tokenizer's state, and can be ignored fo... | JavaScript |
/* CodeMirror main module
*
* Implements the CodeMirror constructor and prototype, which take care
* of initializing the editor frame, and providing the outside interface.
*/
// The CodeMirrorConfig object is used to specify a default
// configuration. If you specify such an object before loading this
// file, the... | JavaScript |
// Minimal framing needed to use CodeMirror-style parsers to highlight
// code. Load this along with tokenize.js, stringstream.js, and your
// parser. Then call highlightText, passing a string as the first
// argument, and as the second argument either a callback function
// that will be called with an array of SPAN no... | JavaScript |
/* The Editor object manages the content of the editable frame. It
* catches events, colours nodes, and indents lines. This file also
* holds some functions for transforming arbitrary DOM structures into
* plain sequences of <span> and <br> elements
*/
var internetExplorer = document.selection && window.ActiveXObj... | JavaScript |
/* String streams are the things fed to parsers (which can feed them
* to a tokenizer if they want). They provide peek and next methods
* for looking at the current character (next 'consumes' this
* character, peek does not), and a get method for retrieving all the
* text that was consumed since the last time get w... | JavaScript |
/**
* Storage and control for undo information within a CodeMirror
* editor. 'Why on earth is such a complicated mess required for
* that?', I hear you ask. The goal, in implementing this, was to make
* the complexity of storing and reverting undo information depend
* only on the size of the edited or restored con... | JavaScript |
/* Parse function for JavaScript. Makes use of the tokenizer from
* tokenizejavascript.js. Note that your parsers do not have to be
* this complicated -- if you don't want to recognize local variables,
* in many languages it is enough to just look for braces, semicolons,
* parentheses, etc, and know when you are in... | JavaScript |
var DummyParser = Editor.Parser = (function() {
function tokenizeDummy(source) {
while (!source.endOfLine()) source.next();
return "text";
}
function parseDummy(source) {
function indentTo(n) {return function() {return n;}}
source = tokenizer(source, tokenizeDummy);
var space = 0;
var ite... | JavaScript |
/**
* Test Harness for CodeMirror
* JS-unit compatible tests here. The two available assertions are
* assertEquals (strict equality) and assertEquivalent (looser equivalency).
*
* 'editor' is a global object for the CodeMirror editor shared between all
* tests. After manipulating it in each test, try to restore... | JavaScript |
/* Tokenizer for CSharp code */
var tokenizeCSharp = (function() {
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
var next;
while (!source.endOfLine()) ... | JavaScript |
/* Parse function for JavaScript. Makes use of the tokenizer from
* tokenizecsharp.js. Note that your parsers do not have to be
* this complicated -- if you don't want to recognize local variables,
* in many languages it is enough to just look for braces, semicolons,
* parentheses, etc, and know when you are inside... | JavaScript |
/*
Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
The copyrights embodied in the content of this file are licensed by
Yahoo! Inc. under the BSD (revised) open source license
@author Dan Vlad Dascalescu <dandv@yahoo-inc.com>
Parse function for PHP. Makes use of the tokenizer from tokenizephp.js.
Based on pa... | JavaScript |
/*
Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
The copyrights embodied in the content of this file are licensed by
Yahoo! Inc. under the BSD (revised) open source license
@author Dan Vlad Dascalescu <dandv@yahoo-inc.com>
Based on parsehtmlmixed.js by Marijn Haverbeke.
*/
var PHPHTMLMixedParser = Editor.... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.