<commit_before>import Effect from "./Effect";
import Noise from "../Voices/Noise";

export default class Reverb extends Effect {
	constructor (context) {
		super(context);
		this.name = "reverb";
		this.attack = 0;
		this.decay = 0.2;
		this.release = 0.8;
	}

	setup () {
		this.effect = this.context.createConvolver();

		this.reverbTime = 2;

		this.attack = 0;
		this.decay = 0.2;
		this.release = 0.8;

		this.wet = this.context.createGain();
		this.wet.gain.value = 1;
		this.dry = this.context.createGain();
		this.dry.gain.value = 1;

		this.buffer = this.renderTail();
		this.wireUp();
	}

	wireUp() {
		this.input.connect(this.dry);
		this.input.connect(this.effect);

		this.dry.connect(this.output);
		this.effect.connect(this.wet);
		this.wet.connect(this.output);
	}

	renderTail () {
		let tailContext = new OfflineAudioContext(2, this.context.sampleRate * this.reverbTime, this.context.sampleRate);
		//let buffer = tailContext.createBufferSource();
		let tail = new Noise(tailContext, 1);
		tail.init();
		tail.connect(tailContext.destination);
		tail.attack = this.attack;
		tail.decay = this.decay;
		tail.release = this.release;
		tail.on(100);
		tail.off();
		return tailContext.startRendering().then((buffer) => {

			// this.source = this.context.createBufferSource(buffer);
			// this.source.buffer = buffer;
			// this.source.start();
			// this.source.connect(this.output);

			this.effect.buffer = buffer;
			console.log(buffer, this.effect);
		});
	}

	set decayTime(value) {
		let dc = value/3;
		this.reverbTime = value;
		this.attack = 0;
		this.decay = dc;
		this.release = dc;
		this.buffer = this.renderTail();
	}

}<commit_msg>IE didn't like that sound started before rendering started.<commit_after>import Effect from "./Effect";
import Noise from "../Voices/Noise";

export default class Reverb extends Effect {
	constructor (context) {
		super(context);
		this.name = "reverb";
		this.attack = 0;
		this.decay = 0.2;
		this.release = 0.8;
	}

	setup () {
		this.effect = this.context.createConvolver();

		this.reverbTime = 2;

		this.attack = 0;
		this.decay = 0.2;
		this.release = 0.8;

		this.wet = this.context.createGain();
		this.wet.gain.value = 1;
		this.dry = this.context.createGain();
		this.dry.gain.value = 1;

		this.buffer = this.renderTail();
		this.wireUp();
	}

	wireUp() {
		this.input.connect(this.dry);
		this.input.connect(this.effect);

		this.dry.connect(this.output);
		this.effect.connect(this.wet);
		this.wet.connect(this.output);
	}

	renderTail () {
		let tailContext = new OfflineAudioContext(2, this.context.sampleRate * this.reverbTime, this.context.sampleRate);
		let tail = new Noise(tailContext, 1);
		tail.init();
		tail.connect(tailContext.destination);
		tail.attack = this.attack;
		tail.decay = this.decay;
		tail.release = this.release;

		let rt = tailContext.startRendering().then((buffer) => {
			this.effect.buffer = buffer;
		});

		tail.on(100);
		tail.off();

		return rt;
	}

	set decayTime(value) {
		let dc = value/3;
		this.reverbTime = value;
		this.attack = 0;
		this.decay = dc;
		this.release = dc;
		this.buffer = this.renderTail();
	}

}<|endoftext|>


<commit_before>import Entity, { printMessage, action, time, state } from "Entity";

export class Van extends Entity {
  name() {
    return 'sandwich board'
  }

  actions() {
    return [
      action(
        "Knock on the window.",
        () => {
          printMessage("You see some movement inside the van, but there's no respones.");
          state.currentTime.add(5, 'minutes');
        }
      )
    ];
  }
}

export default new Van();
<commit_msg>Van is google analytics<commit_after>import Entity, { printMessage, action, time, state } from "Entity";

export class Van extends Entity {
  name() {
    return 'sandwich board'
  }

  actions() {
    return [
      action(
        "Knock on the window.",
        () => {
          printMessage("You see some movement inside the van, but there's no respones.");
          printMessage(`On the side you notice the inscription: "Google Analytics"`);
          state.currentTime.add(5, 'minutes');
        }
      )
    ];
  }
}

export default new Van();
<|endoftext|>


<commit_before>
var simplegrammar = require('simplegrammar');
var contexts = require('./contexts');
var expressions = require('./expressions');

var get = simplegrammar.get;
var peek = simplegrammar.peek;

var ClassExpression = expressions.ClassExpression,
    ModuleExpression = expressions.ModuleExpression,
    JavaScriptNamespaceExpression = expressions.JavaScriptNamespaceExpression,
    JavaScriptQualifiedNameExpression = expressions.JavaScriptQualifiedNameExpression,
    DefExpression = expressions.DefExpression,
    CallExpression = expressions.CallExpression,
    ArrayExpression = expressions.ArrayExpression,
    IndexedExpression = expressions.IndexedExpression,
    MakeQualifiedCallExpression = expressions.MakeQualifiedCallExpression,
    QualifiedCallExpression = expressions.QualifiedCallExpression,
    IfExpression = expressions.IfExpression,
    UnlessExpression = expressions.UnlessExpression,
    WhileExpression = expressions.WhileExpression,
    UntilExpression = expressions.UntilExpression,
    CompositeExpression = expressions.CompositeExpression,
    AssignmentExpression = expressions.AssignmentExpression,
    MakeQualifiedNameExpression = expressions.MakeQualifiedNameExpression,
    QualifiedNameExpression = expressions.QualifiedNameExpression,
    MakeNameExpression = expressions.MakeNameExpression,
    InstanceVariableExpression = expressions.InstanceVariableExpression,
    ClassVariableExpression = expressions.ClassVariableExpression,
    NameExpression = expressions.NameExpression,
    ConstantExpression = expressions.ConstantExpression,
    IntegerExpression = expressions.IntegerExpression,
    EqualExpression = expressions.EqualExpression,
    NotEqualExpression = expressions.NotEqualExpression,
    LessExpression = expressions.LessExpression,
    GreaterExpression = expressions.GreaterExpression,
    LessEqualExpression = expressions.LessEqualExpression,
    GreaterEqualExpression = expressions.GreaterEqualExpression,
    AddExpression = expressions.AddExpression,
    SubtractExpression = expressions.SubtractExpression,
    MultiplyExpression = expressions.MultiplyExpression,
    DivideExpression = expressions.DivideExpression;

// escape character function

function escape(ch) {
    if (ch === 't')
        return '\t';
    if (ch === 'r')
        return '\r';
    if (ch === 'n')
        return '\n';

    return ch;
}

var rules = [
    get([' ','\t','\r']).oneOrMore().skip(),
    get('#').upTo('\n').skip(),
    get('"').upTo('"', '\\', escape).generate('String', function (value) { return new ConstantExpression(value.substring(1, value.length - 1)); }),
    get('0-9').oneOrMore().generate('Integer', function (value) { return new IntegerExpression(value) }),
    get(['a-z', 'A-Z', '_'], get(['a-z', 'A-Z', '0-9', '_']).zeroOrMore()).generate('Name', function (value) { return MakeNameExpression(value) }),

    // Operators
    get('+').generate('Plus'),
    get('-').generate('Minus'),
    get('*').generate('Multiply'),
    get('/').generate('Divide'),
    get('==').generate('Equal'),
    get('!=').generate('NotEqual'),
    get('<=').generate('LessEqual'),
    get('<').generate('Less'),
    get('>=').generate('GreaterEqual'),
    get('>').generate('Greater'),
    get('=').generate('Assign'),

    // Punctuation
    get('(').generate('LeftParenthesis'),
    get(')').generate('RightParenthesis'),
    get('[').generate('LeftBracket'),
    get(']').generate('RightBracket'),
    get(',').generate('Comma'),
    get('.').generate('Dot'),

    // Booleans

    get('false').generate('Expression', function() { return new ConstantExpression(false); }),
    get('true').generate('Expression', function() { return new ConstantExpression(true); }),

    // Program

    get('StatementList').generate('Program', function (value) { return new CompositeExpression(value); }),
    get('StatementList', 'Statement').generate('StatementList', function (values) { if (values[1] == null) return values[0]; var list = values[0]; list.push(values[1]); return list; }),
    get('Statement').generate('StatementList', function (value) { if (value == null) return []; return [value]; }),

    // Class

    get('class', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new ClassExpression(values[1].getName(), new CompositeExpression(values[3])); }),

    // Module

    get('module', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new ModuleExpression(values[1].getName(), new CompositeExpression(values[3])); }),

    // Def
    get('def', 'Name', 'LeftParenthesis', 'RightParenthesis', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), [], new CompositeExpression(values[5])); }),
    get('def', 'Name', 'LeftParenthesis', 'NameList', 'RightParenthesis', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), values[3], new CompositeExpression(values[6])); }),
    get('def', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), [], new CompositeExpression(values[3])); }),

    get('Name', 'Comma', 'NameList').generate('NameList', function (values) { var list = values[2]; list.unshift(values[0].getName()); return list; }),
    get('Name', peek('RightParenthesis')).generate('NameList', function (values) { return [values[0].getName()]; }),

    // If, Unless and Suite
    get('if', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new IfExpression(values[1], new CompositeExpression(values[3])); }),
    get('if', 'Expression', 'EndOfStatement', 'Suite', 'else', 'Suite', 'end').generate('Expression', function (values) { return new IfExpression(values[1], new CompositeExpression(values[3]), new CompositeExpression(values[5])); }),
    get('unless', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UnlessExpression(values[1], new CompositeExpression(values[3])); }),
    get('unless', 'Expression', 'EndOfStatement', 'Suite', 'else', 'Suite', 'end').generate('Expression', function (values) { return new UnlessExpression(values[1], new CompositeExpression(values[3]), new CompositeExpression(values[5])); }),
    peek('end').generate('Suite', function (values) { return []; }),
    peek('else').generate('Suite', function (values) { return []; }),
    get('Statement', 'Suite').generate('Suite', function (values) { if (values[0] == null) return values[1]; var vals = values[1]; vals.unshift(values[0]); return vals; }),
    //get('Expression', 'Suite').generate('Suite', function (values) { var vals = values[1]; vals.unshift(values[0]); return vals; }),

    // While and Suite
    get('while', 'Expression', 'do', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new WhileExpression(values[1], new CompositeExpression(values[4])); }),
    get('while', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new WhileExpression(values[1], new CompositeExpression(values[3])); }),

    // Until and Suite
    get('until', 'Expression', 'do', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UntilExpression(values[1], new CompositeExpression(values[4])); }),
    get('until', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UntilExpression(values[1], new CompositeExpression(values[3])); }),

    // Begin to End
    get('begin', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new CompositeExpression(values[2]); }),

    // Call
//    get('Call').generate('Term'),
    get('Name', 'LeftBracket', 'ExpressionList', 'RightBracket').generate('Term', function (values) { return new IndexedExpression(values[0], values[2]); }),
    get('Name', 'ExpressionList').generate('Term', function (values) { return new CallExpression(values[0].getName(), values[1]); }),
    get('Name', 'LeftParenthesis', 'ExpressionList', 'RightParenthesis').generate('Term', function (values) { return new CallExpression(values[0].getName(), values[2]); }),
    get('Name', 'LeftParenthesis', 'RightParenthesis').generate('Term', function (values) { return new CallExpression(values[0].getName(), []); }),

    // Assignment
    get('Name', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),
    get('InstanceVariable', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),
    get('ClassVariable', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),

    // Qualified Call
    get('QualifiedCall').generate('Term'),
    get('QualifiedName', 'ExpressionList').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], values[1]); }),
    get('QualifiedName', 'LeftParenthesis', 'ExpressionList', 'RightParenthesis').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], values[2]); }),
    get('QualifiedName', 'LeftParenthesis', 'RightParenthesis').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], []); }),
    get('QualifiedName').generate('QualifiedCall', function (value) { return MakeQualifiedCallExpression(value, null); }),

    // Qualified Name
    get('QualifiedName', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('Name', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('Integer', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('String', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),

    // Expression List
    get('Expression').generate('ExpressionList', function (value) { return [value]; }),
    get('ExpressionList', 'Comma', 'Expression').generate('ExpressionList', function (values) { list = values[0]; list.push(values[2]); return list }),

    // Comparison
    get('Expression', 'Equal', 'Expression').generate('Expression', function (values) { return new EqualExpression(values[0], values[2]); }),
    get('Expression', 'NotEqual', 'Expression').generate('Expression', function (values) { return new NotEqualExpression(values[0], values[2]); }),
    get('Expression', 'LessEqual', 'Expression').generate('Expression', function (values) { return new LessEqualExpression(values[0], values[2]); }),
    get('Expression', 'GreaterEqual', 'Expression').generate('Expression', function (values) { return new GreaterEqualExpression(values[0], values[2]); }),
    get('Expression', 'Less', 'Expression').generate('Expression', function (values) { return new LessExpression(values[0], values[2]); }),
    get('Expression', 'Greater', 'Expression').generate('Expression', function (values) { return new GreaterExpression(values[0], values[2]); }),

    // Skip initial end of lines in Expression
    //get(get('\n').oneOrMore(), 'Expression').generate('Expression', function (values) { return values[1] }),

    // Expression Level 1
    get('Expression1').generate('Expression'),
    get('Expression1', 'Plus', 'Expression0').generate('Expression1', function (values) { return new AddExpression(values[0], values[2]); }),
    get('Expression1', 'Minus', 'Expression0').generate('Expression1', function (values) { return new SubtractExpression(values[0], values[2]); }),

    // Expression Level 0
    get('Expression0').generate('Expression1'),
    get('Expression0', 'Multiply', 'Term').generate('Expression0', function (values) { return new MultiplyExpression(values[0], values[2]); }),
    get('Expression0', 'Divide', 'Term').generate('Expression0', function (values) { return new DivideExpression(values[0], values[2]); }),

    // Term
    get('Term').generate('Expression0'),
    get('Term', 'LeftBracket', 'ExpressionList', 'RightBracket').generate('Term', function (values) { return new IndexedExpression(values[0], values[2]); }),
    get('Integer').generate('Term'),
    get('@@', 'Name').generate('ClassVariable', function (values) { return new ClassVariableExpression(values[1].getName()); }),
    get('@', 'Name').generate('InstanceVariable', function (values) { return new InstanceVariableExpression(values[1].getName()); }),
    get('Name').generate('Term'),
    get('InstanceVariable').generate('Term'),
    get('ClassVariable').generate('Term'),
    get('String').generate('Term'),
    get('Array').generate('Term'),
    get('LeftParenthesis', 'Expression', 'RightParenthesis').generate('Expression0', function (values) { return values[1]; }),
    get('LeftBracket', 'RightBracket').generate('Array', function (values) { return new ArrayExpression([]); }),
    get('LeftBracket', 'ExpressionList', 'RightBracket').generate('Array', function (values) { return new ArrayExpression(values[1]); }),

    // Statement: Expressiong with end of expression
    get(['\n', ';', '']).generate('EndOfStatement'),
    get('Expression', 'EndOfStatement').generate('Statement', function (values) { return values[0] }),
    get('\n').generate('Statement', function (value) { return null; })
];

function createParser(text) {
    return simplegrammar.createParser(text, rules);
}

module.exports = {
    createParser: createParser
};

<commit_msg>Fix parsers<commit_after>
var simplegrammar = require('simplegrammar');
var expressions = require('./expressions');

var get = simplegrammar.get;
var peek = simplegrammar.peek;

var ClassExpression = expressions.ClassExpression,
    ModuleExpression = expressions.ModuleExpression,
    JavaScriptNamespaceExpression = expressions.JavaScriptNamespaceExpression,
    JavaScriptQualifiedNameExpression = expressions.JavaScriptQualifiedNameExpression,
    DefExpression = expressions.DefExpression,
    CallExpression = expressions.CallExpression,
    ArrayExpression = expressions.ArrayExpression,
    IndexedExpression = expressions.IndexedExpression,
    MakeQualifiedCallExpression = expressions.MakeQualifiedCallExpression,
    QualifiedCallExpression = expressions.QualifiedCallExpression,
    IfExpression = expressions.IfExpression,
    UnlessExpression = expressions.UnlessExpression,
    WhileExpression = expressions.WhileExpression,
    UntilExpression = expressions.UntilExpression,
    CompositeExpression = expressions.CompositeExpression,
    AssignmentExpression = expressions.AssignmentExpression,
    MakeQualifiedNameExpression = expressions.MakeQualifiedNameExpression,
    QualifiedNameExpression = expressions.QualifiedNameExpression,
    MakeNameExpression = expressions.MakeNameExpression,
    InstanceVariableExpression = expressions.InstanceVariableExpression,
    ClassVariableExpression = expressions.ClassVariableExpression,
    NameExpression = expressions.NameExpression,
    ConstantExpression = expressions.ConstantExpression,
    IntegerExpression = expressions.IntegerExpression,
    EqualExpression = expressions.EqualExpression,
    NotEqualExpression = expressions.NotEqualExpression,
    LessExpression = expressions.LessExpression,
    GreaterExpression = expressions.GreaterExpression,
    LessEqualExpression = expressions.LessEqualExpression,
    GreaterEqualExpression = expressions.GreaterEqualExpression,
    AddExpression = expressions.AddExpression,
    SubtractExpression = expressions.SubtractExpression,
    MultiplyExpression = expressions.MultiplyExpression,
    DivideExpression = expressions.DivideExpression;

// escape character function

function escape(ch) {
    if (ch === 't')
        return '\t';
    if (ch === 'r')
        return '\r';
    if (ch === 'n')
        return '\n';

    return ch;
}

var rules = [
    get([' ','\t','\r']).oneOrMore().skip(),
    get('#').upTo('\n').skip(),
    get('"').upTo('"', '\\', escape).generate('String', function (value) { return new ConstantExpression(value.substring(1, value.length - 1)); }),
    get('0-9').oneOrMore().generate('Integer', function (value) { return new IntegerExpression(value) }),
    get(['a-z', 'A-Z', '_'], get(['a-z', 'A-Z', '0-9', '_']).zeroOrMore()).generate('Name', function (value) { return MakeNameExpression(value) }),

    // Operators
    get('+').generate('Plus'),
    get('-').generate('Minus'),
    get('*').generate('Multiply'),
    get('/').generate('Divide'),
    get('==').generate('Equal'),
    get('!=').generate('NotEqual'),
    get('<=').generate('LessEqual'),
    get('<').generate('Less'),
    get('>=').generate('GreaterEqual'),
    get('>').generate('Greater'),
    get('=').generate('Assign'),

    // Punctuation
    get('(').generate('LeftParenthesis'),
    get(')').generate('RightParenthesis'),
    get('[').generate('LeftBracket'),
    get(']').generate('RightBracket'),
    get(',').generate('Comma'),
    get('.').generate('Dot'),

    // Booleans

    get('false').generate('Expression', function() { return new ConstantExpression(false); }),
    get('true').generate('Expression', function() { return new ConstantExpression(true); }),

    // Program

    get('StatementList').generate('Program', function (value) { return new CompositeExpression(value); }),
    get('StatementList', 'Statement').generate('StatementList', function (values) { if (values[1] == null) return values[0]; var list = values[0]; list.push(values[1]); return list; }),
    get('Statement').generate('StatementList', function (value) { if (value == null) return []; return [value]; }),

    // Class

    get('class', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new ClassExpression(values[1].getName(), new CompositeExpression(values[3])); }),

    // Module

    get('module', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new ModuleExpression(values[1].getName(), new CompositeExpression(values[3])); }),

    // Def
    get('def', 'Name', 'LeftParenthesis', 'RightParenthesis', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), [], new CompositeExpression(values[5])); }),
    get('def', 'Name', 'LeftParenthesis', 'NameList', 'RightParenthesis', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), values[3], new CompositeExpression(values[6])); }),
    get('def', 'Name', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new DefExpression(values[1].getName(), [], new CompositeExpression(values[3])); }),

    get('Name', 'Comma', 'NameList').generate('NameList', function (values) { var list = values[2]; list.unshift(values[0].getName()); return list; }),
    get('Name', peek('RightParenthesis')).generate('NameList', function (values) { return [values[0].getName()]; }),

    // If, Unless and Suite
    get('if', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new IfExpression(values[1], new CompositeExpression(values[3])); }),
    get('if', 'Expression', 'EndOfStatement', 'Suite', 'else', 'Suite', 'end').generate('Expression', function (values) { return new IfExpression(values[1], new CompositeExpression(values[3]), new CompositeExpression(values[5])); }),
    get('unless', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UnlessExpression(values[1], new CompositeExpression(values[3])); }),
    get('unless', 'Expression', 'EndOfStatement', 'Suite', 'else', 'Suite', 'end').generate('Expression', function (values) { return new UnlessExpression(values[1], new CompositeExpression(values[3]), new CompositeExpression(values[5])); }),
    peek('end').generate('Suite', function (values) { return []; }),
    peek('else').generate('Suite', function (values) { return []; }),
    get('Statement', 'Suite').generate('Suite', function (values) { if (values[0] == null) return values[1]; var vals = values[1]; vals.unshift(values[0]); return vals; }),
    //get('Expression', 'Suite').generate('Suite', function (values) { var vals = values[1]; vals.unshift(values[0]); return vals; }),

    // While and Suite
    get('while', 'Expression', 'do', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new WhileExpression(values[1], new CompositeExpression(values[4])); }),
    get('while', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new WhileExpression(values[1], new CompositeExpression(values[3])); }),

    // Until and Suite
    get('until', 'Expression', 'do', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UntilExpression(values[1], new CompositeExpression(values[4])); }),
    get('until', 'Expression', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new UntilExpression(values[1], new CompositeExpression(values[3])); }),

    // Begin to End
    get('begin', 'EndOfStatement', 'Suite', 'end').generate('Expression', function (values) { return new CompositeExpression(values[2]); }),

    // Call
//    get('Call').generate('Term'),
    get('Name', 'LeftBracket', 'ExpressionList', 'RightBracket').generate('Term', function (values) { return new IndexedExpression(values[0], values[2]); }),
    get('Name', 'ExpressionList').generate('Term', function (values) { return new CallExpression(values[0].getName(), values[1]); }),
    get('Name', 'LeftParenthesis', 'ExpressionList', 'RightParenthesis').generate('Term', function (values) { return new CallExpression(values[0].getName(), values[2]); }),
    get('Name', 'LeftParenthesis', 'RightParenthesis').generate('Term', function (values) { return new CallExpression(values[0].getName(), []); }),

    // Assignment
    get('Name', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),
    get('InstanceVariable', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),
    get('ClassVariable', 'Assign', 'Expression').generate('Expression', function (values) { return new AssignmentExpression(values[0], values[2]); }),

    // Qualified Call
    get('QualifiedCall').generate('Term'),
    get('QualifiedName', 'ExpressionList').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], values[1]); }),
    get('QualifiedName', 'LeftParenthesis', 'ExpressionList', 'RightParenthesis').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], values[2]); }),
    get('QualifiedName', 'LeftParenthesis', 'RightParenthesis').generate('QualifiedCall', function (values) { return MakeQualifiedCallExpression(values[0], []); }),
    get('QualifiedName').generate('QualifiedCall', function (value) { return MakeQualifiedCallExpression(value, null); }),

    // Qualified Name
    get('QualifiedName', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('Name', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('Integer', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),
    get('String', 'Dot', 'Name').generate('QualifiedName', function (values) { return MakeQualifiedNameExpression(values[0], values[2].getName()); }),

    // Expression List
    get('Expression').generate('ExpressionList', function (value) { return [value]; }),
    get('ExpressionList', 'Comma', 'Expression').generate('ExpressionList', function (values) { list = values[0]; list.push(values[2]); return list }),

    // Comparison
    get('Expression', 'Equal', 'Expression').generate('Expression', function (values) { return new EqualExpression(values[0], values[2]); }),
    get('Expression', 'NotEqual', 'Expression').generate('Expression', function (values) { return new NotEqualExpression(values[0], values[2]); }),
    get('Expression', 'LessEqual', 'Expression').generate('Expression', function (values) { return new LessEqualExpression(values[0], values[2]); }),
    get('Expression', 'GreaterEqual', 'Expression').generate('Expression', function (values) { return new GreaterEqualExpression(values[0], values[2]); }),
    get('Expression', 'Less', 'Expression').generate('Expression', function (values) { return new LessExpression(values[0], values[2]); }),
    get('Expression', 'Greater', 'Expression').generate('Expression', function (values) { return new GreaterExpression(values[0], values[2]); }),

    // Skip initial end of lines in Expression
    //get(get('\n').oneOrMore(), 'Expression').generate('Expression', function (values) { return values[1] }),

    // Expression Level 1
    get('Expression1').generate('Expression'),
    get('Expression1', 'Plus', 'Expression0').generate('Expression1', function (values) { return new AddExpression(values[0], values[2]); }),
    get('Expression1', 'Minus', 'Expression0').generate('Expression1', function (values) { return new SubtractExpression(values[0], values[2]); }),

    // Expression Level 0
    get('Expression0').generate('Expression1'),
    get('Expression0', 'Multiply', 'Term').generate('Expression0', function (values) { return new MultiplyExpression(values[0], values[2]); }),
    get('Expression0', 'Divide', 'Term').generate('Expression0', function (values) { return new DivideExpression(values[0], values[2]); }),

    // Term
    get('Term').generate('Expression0'),
    get('Term', 'LeftBracket', 'ExpressionList', 'RightBracket').generate('Term', function (values) { return new IndexedExpression(values[0], values[2]); }),
    get('Integer').generate('Term'),
    get('@@', 'Name').generate('ClassVariable', function (values) { return new ClassVariableExpression(values[1].getName()); }),
    get('@', 'Name').generate('InstanceVariable', function (values) { return new InstanceVariableExpression(values[1].getName()); }),
    get('Name').generate('Term'),
    get('InstanceVariable').generate('Term'),
    get('ClassVariable').generate('Term'),
    get('String').generate('Term'),
    get('Array').generate('Term'),
    get('LeftParenthesis', 'Expression', 'RightParenthesis').generate('Expression0', function (values) { return values[1]; }),
    get('LeftBracket', 'RightBracket').generate('Array', function (values) { return new ArrayExpression([]); }),
    get('LeftBracket', 'ExpressionList', 'RightBracket').generate('Array', function (values) { return new ArrayExpression(values[1]); }),

    // Statement: Expressiong with end of expression
    get(['\n', ';', '']).generate('EndOfStatement'),
    get('Expression', 'EndOfStatement').generate('Statement', function (values) { return values[0] }),
    get('\n').generate('Statement', function (value) { return null; })
];

function createParser(text) {
    return simplegrammar.createParser(text, rules);
}

module.exports = {
    createParser: createParser
};

<|endoftext|>


<commit_before>module.exports = function(app) {

  // TODO load minified in production environment

  app.get('/jquery.js', function(req,res) {
    res.sendfile('bower_components/jquery/dist/jquery.js');
  });

  app.get('/bootstrap.js', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/js/bootstrap.js');
  });

  app.get('/bootstrap.css', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/css/bootstrap.css');
  });

  app.get('/bootstrap.css.map', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/css/bootstrap.css.map');
  });

  app.get('/fonts/glyphicons-halflings-regular.svg', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg');
  });

  app.get('/fonts/glyphicons-halflings-regular.ttf', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf');
  });

  app.get('/fonts/glyphicons-halflings-regular.woff', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff');
  });
};
<commit_msg>provide d3<commit_after>module.exports = function(app) {

  // TODO load minified in production environment

  app.get('/jquery.js', function(req,res) {
    res.sendfile('bower_components/jquery/dist/jquery.js');
  });

  app.get('/bootstrap.js', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/js/bootstrap.js');
  });

  app.get('/bootstrap.css', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/css/bootstrap.css');
  });

  app.get('/bootstrap.css.map', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/css/bootstrap.css.map');
  });

  app.get('/fonts/glyphicons-halflings-regular.svg', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg');
  });

  app.get('/fonts/glyphicons-halflings-regular.ttf', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf');
  });

  app.get('/fonts/glyphicons-halflings-regular.woff', function(req,res) {
    res.sendfile('bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff');
  });

  app.get('/d3.js', function(req, res) {
    res.sendfile('bower_components/d3/d3.js')
  });
};
<|endoftext|>


<commit_before>module.exports = {
  parserOptions: {
    ecmaVersion: 6,
    sourceType: 'module',
    ecmaFeatures: {impliedStrict: true}
  },
  env: {
    browser: true,
    node: true,
    jquery: true,
    greasemonkey: true,
    es6: true
  },
  globals: {
    FSH: true,
    localforage: false,
    ga: false,
    GameController: false,
    GameData: false
  },
  'extends': 'eslint:recommended',
  rules: {

    /*  Possible Errors  */
    'no-await-in-loop': ['error'],
    'no-compare-neg-zero': ['error'],
    'no-console': ['error', {allow: ['error']}],
    'no-extra-parens': ['error', 'all', {conditionalAssign: false}],
    'no-prototype-builtins': ['error'],
    'no-template-curly-in-string': ['error'],
    'valid-jsdoc': ['error'],

    /*  Best Practices  */
    'accessor-pairs': ['error'],
    'array-callback-return': ['error'],
    'block-scoped-var': ['error'],
    'class-methods-use-this': ['error'],
    complexity: ['error', 3],
    'consistent-return': ['off'],
    curly: ['error'],
    'default-case': ['error'],
    'dot-location': ['error', 'property'],
    'dot-notation': ['error'],
    eqeqeq: ['error'],
    'guard-for-in': ['error'],
    'no-alert': ['warn'],
    'no-caller': ['error'],
    'no-div-regex': ['error'],
    'no-else-return': ['error'],
    'no-empty-function': ['error'],
    'no-eq-null': ['error'],
    'no-eval': ['error'],
    'no-extend-native': ['error'],
    'no-extra-bind': ['error'],
    'no-extra-label': ['error'],
    'no-floating-decimal': ['error'],
    'no-implicit-coercion': ['error'],
    'no-implicit-globals': ['error'],
    'no-implied-eval': ['error'],
    'no-invalid-this': ['error'],
    'no-iterator': ['error'],
    'no-labels': ['error'],
    'no-lone-blocks': ['error'],
    'no-loop-func': ['error'],
    // 'no-magic-numbers': ['error', {
    //   'ignore': [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 24, 60, 100, 1000],
    //   'ignoreArrayIndexes': true
    // }],
    'no-multi-spaces': ['error'],
    'no-multi-str': ['error'],
    'no-new': ['error'],
    'no-new-func': ['error'],
    'no-new-wrappers': ['error'],
    'no-octal-escape': ['error'],
    'no-param-reassign': ['error'],
    'no-proto': ['error'],
    'no-restricted-properties': ['error'],
    'no-return-assign': ['error'],
    'no-return-await': ['error'],
    'no-script-url': ['error'],
    'no-self-compare': ['error'],
    'no-sequences': ['error'],
    'no-throw-literal': ['error'],
    'no-unmodified-loop-condition': ['error'],
    'no-unused-expressions': ['error'],
    'no-useless-call': ['error'],
    'no-useless-concat': ['error'],
    'no-useless-escape': ['error'],
    'no-useless-return': ['error'],
    'no-void': ['error'],
    // 'no-warning-comments': ['warn'],
    'no-with': ['error'],
    'prefer-promise-reject-errors': ['error'],
    radix: ['error'],
    'require-await': ['error'],
    'vars-on-top': ['off'],
    'wrap-iife': ['error', 'outside'],
    yoda: ['error'],

    /*  Variables  */
    'init-declarations': ['off'],
    'no-catch-shadow': ['error'],
    'no-label-var': ['error'],
    'no-restricted-globals': ['error', 'event'],
    'no-shadow': ['error'],
    'no-shadow-restricted-names': ['error'],
    'no-undef-init': ['error'],
    'no-undefined': ['error'],
    'no-use-before-define': ['error'],

    /*  Stylistic Issues  */
    'array-bracket-spacing': ['error', 'never'],
    'block-spacing': ['error', 'never'],
    'brace-style': ['error', '1tbs', {allowSingleLine: true}],
    camelcase: ['off'],
    'capitalized-comments': ['off'],
    'comma-dangle': ['error', 'only-multiline'],
    'comma-spacing': ['error'],
    'comma-style': ['error'],
    'computed-property-spacing': ['error'],
    'consistent-this': ['error', 'that'],
    'eol-last': ['error'],
    'func-call-spacing': ['error'],
    'func-name-matching': ['error'],
    // 'func-names': ['error', 'as-needed'],
    'func-style': ['error', 'declaration'],
    'id-blacklist': ['off'],
    'id-length': ['off'],
    'id-match': ['off'],
    indent: ['error', 2],
    'jsx-quotes': ['off'],
    'key-spacing': ['error'],
    'keyword-spacing': ['error'],
    'line-comment-position': ['off'],
    'linebreak-style': ['error', 'windows'],
    'lines-around-comment': ['off'],
    'lines-around-directive': ['off'],
    'max-depth': ['error', 2],
    'max-len': ['error', {
      code: 80,
      ignoreComments: true,
      ignoreTrailingComments: true,
      ignoreUrls: true
    }],
    'max-lines': ['error', {
      max: 239, // 200
      skipBlankLines: true,
      skipComments: true
    }],
    'max-nested-callbacks': ['error', 2],
    'max-params': ['error', 5],
    'max-statements': ['error', 27],
    'max-statements-per-line': ['error', {max: 3}],
    'multiline-ternary': ['off'],
    'new-cap': ['error', {
      capIsNewExceptions: [
        'GM_getValue',
        'GM_setValue',
        'GM_listValues',
        'Deferred',
        'DataTable'
      ]
    }],
    'new-parens': ['error'],
    'newline-after-var': ['off'],
    'newline-before-return': ['off'],
    'newline-per-chained-call': ['off'],
    'no-array-constructor': ['error'],
    'no-bitwise': ['error'],
    'no-continue': ['off'],
    'no-inline-comments': ['off'],
    'no-lonely-if': ['error'],
    'no-mixed-operators': ['off'],
    'no-multi-assign': ['error'],
    'no-multiple-empty-lines': ['error', {
      max: 1,
      maxEOF: 1,
      maxBOF: 1
    }],
    'no-negated-condition': ['off'],
    'no-nested-ternary': ['error'],
    'no-new-object': ['error'],
    'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
    'no-restricted-syntax': ['off'],
    'no-tabs': ['error'],
    'no-ternary': ['error'],
    'no-trailing-spaces': ['error'],
    'no-underscore-dangle': ['off'],
    'no-unneeded-ternary': ['error', {defaultAssignment: false}],
    'no-whitespace-before-property': ['error'],
    'nonblock-statement-body-position': ['off'],
    'object-curly-newline': ['error', {multiline: true}],
    'object-curly-spacing': ['error', 'never'],
    'object-property-newline': ['error',
      {allowMultiplePropertiesPerLine: true}],
    'one-var': ['error', 'never'],
    'one-var-declaration-per-line': ['error', 'always'],
    'operator-assignment': ['error', 'always'],
    'operator-linebreak': ['error', 'after'],
    'padded-blocks': ['off'],
    'quote-props': ['error', 'as-needed', {keywords: true, numbers: true}],
    quotes: ['error', 'single'],
    'require-jsdoc': ['off'],
    semi: ['error'],
    'semi-spacing': ['error'],
    'sort-keys': ['off'],
    'sort-vars': ['off'],
    'space-before-blocks': ['error'],
    'space-before-function-paren': ['error', 'never'],
    'space-in-parens': ['error'],
    'space-infix-ops': ['error'],
    'space-unary-ops': ['error', {words: true, nonwords: false}],
    'spaced-comment': ['warn', 'always', {
      line: {
        markers: ['#if'],
        exceptions: ['#endif']
      }
    }],
    'template-tag-spacing': ['off'],
    'unicode-bom': ['error'],
    'wrap-regex': ['off'],

    /*  ECMAScript 6  */
    'no-duplicate-imports': ['error', {includeExports: true}],
    'sort-imports': ['error', {
      memberSyntaxSortOrder: [
        'none', 'single', 'multiple', 'all'
      ]
    }],
  }
};
<commit_msg>exceptions for block comments<commit_after>module.exports = {
  parserOptions: {
    ecmaVersion: 6,
    sourceType: 'module',
    ecmaFeatures: {impliedStrict: true}
  },
  env: {
    browser: true,
    node: true,
    jquery: true,
    greasemonkey: true,
    es6: true
  },
  globals: {
    FSH: true,
    localforage: false,
    ga: false,
    GameController: false,
    GameData: false
  },
  'extends': 'eslint:recommended',
  rules: {

    /*  Possible Errors  */
    'no-await-in-loop': ['error'],
    'no-compare-neg-zero': ['error'],
    'no-console': ['error', {allow: ['error']}],
    'no-extra-parens': ['error', 'all', {conditionalAssign: false}],
    'no-prototype-builtins': ['error'],
    'no-template-curly-in-string': ['error'],
    'valid-jsdoc': ['error'],

    /*  Best Practices  */
    'accessor-pairs': ['error'],
    'array-callback-return': ['error'],
    'block-scoped-var': ['error'],
    'class-methods-use-this': ['error'],
    complexity: ['error', 3],
    'consistent-return': ['off'],
    curly: ['error'],
    'default-case': ['error'],
    'dot-location': ['error', 'property'],
    'dot-notation': ['error'],
    eqeqeq: ['error'],
    'guard-for-in': ['error'],
    'no-alert': ['warn'],
    'no-caller': ['error'],
    'no-div-regex': ['error'],
    'no-else-return': ['error'],
    'no-empty-function': ['error'],
    'no-eq-null': ['error'],
    'no-eval': ['error'],
    'no-extend-native': ['error'],
    'no-extra-bind': ['error'],
    'no-extra-label': ['error'],
    'no-floating-decimal': ['error'],
    'no-implicit-coercion': ['error'],
    'no-implicit-globals': ['error'],
    'no-implied-eval': ['error'],
    'no-invalid-this': ['error'],
    'no-iterator': ['error'],
    'no-labels': ['error'],
    'no-lone-blocks': ['error'],
    'no-loop-func': ['error'],
    // 'no-magic-numbers': ['error', {
    //   'ignore': [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 24, 60, 100, 1000],
    //   'ignoreArrayIndexes': true
    // }],
    'no-multi-spaces': ['error'],
    'no-multi-str': ['error'],
    'no-new': ['error'],
    'no-new-func': ['error'],
    'no-new-wrappers': ['error'],
    'no-octal-escape': ['error'],
    'no-param-reassign': ['error'],
    'no-proto': ['error'],
    'no-restricted-properties': ['error'],
    'no-return-assign': ['error'],
    'no-return-await': ['error'],
    'no-script-url': ['error'],
    'no-self-compare': ['error'],
    'no-sequences': ['error'],
    'no-throw-literal': ['error'],
    'no-unmodified-loop-condition': ['error'],
    'no-unused-expressions': ['error'],
    'no-useless-call': ['error'],
    'no-useless-concat': ['error'],
    'no-useless-escape': ['error'],
    'no-useless-return': ['error'],
    'no-void': ['error'],
    // 'no-warning-comments': ['warn'],
    'no-with': ['error'],
    'prefer-promise-reject-errors': ['error'],
    radix: ['error'],
    'require-await': ['error'],
    'vars-on-top': ['off'],
    'wrap-iife': ['error', 'outside'],
    yoda: ['error'],

    /*  Variables  */
    'init-declarations': ['off'],
    'no-catch-shadow': ['error'],
    'no-label-var': ['error'],
    'no-restricted-globals': ['error', 'event'],
    'no-shadow': ['error'],
    'no-shadow-restricted-names': ['error'],
    'no-undef-init': ['error'],
    'no-undefined': ['error'],
    'no-use-before-define': ['error'],

    /*  Stylistic Issues  */
    'array-bracket-spacing': ['error', 'never'],
    'block-spacing': ['error', 'never'],
    'brace-style': ['error', '1tbs', {allowSingleLine: true}],
    camelcase: ['off'],
    'capitalized-comments': ['off'],
    'comma-dangle': ['error', 'only-multiline'],
    'comma-spacing': ['error'],
    'comma-style': ['error'],
    'computed-property-spacing': ['error'],
    'consistent-this': ['error', 'that'],
    'eol-last': ['error'],
    'func-call-spacing': ['error'],
    'func-name-matching': ['error'],
    // 'func-names': ['error', 'as-needed'],
    'func-style': ['error', 'declaration'],
    'id-blacklist': ['off'],
    'id-length': ['off'],
    'id-match': ['off'],
    indent: ['error', 2],
    'jsx-quotes': ['off'],
    'key-spacing': ['error'],
    'keyword-spacing': ['error'],
    'line-comment-position': ['off'],
    'linebreak-style': ['error', 'windows'],
    'lines-around-comment': ['off'],
    'lines-around-directive': ['off'],
    'max-depth': ['error', 2],
    'max-len': ['error', {
      code: 80,
      ignoreComments: true,
      ignoreTrailingComments: true,
      ignoreUrls: true
    }],
    'max-lines': ['error', {
      max: 239, // 200
      skipBlankLines: true,
      skipComments: true
    }],
    'max-nested-callbacks': ['error', 2],
    'max-params': ['error', 5],
    'max-statements': ['error', 27],
    'max-statements-per-line': ['error', {max: 3}],
    'multiline-ternary': ['off'],
    'new-cap': ['error', {
      capIsNewExceptions: [
        'GM_getValue',
        'GM_setValue',
        'GM_listValues',
        'Deferred',
        'DataTable'
      ]
    }],
    'new-parens': ['error'],
    'newline-after-var': ['off'],
    'newline-before-return': ['off'],
    'newline-per-chained-call': ['off'],
    'no-array-constructor': ['error'],
    'no-bitwise': ['error'],
    'no-continue': ['off'],
    'no-inline-comments': ['off'],
    'no-lonely-if': ['error'],
    'no-mixed-operators': ['off'],
    'no-multi-assign': ['error'],
    'no-multiple-empty-lines': ['error', {
      max: 1,
      maxEOF: 1,
      maxBOF: 1
    }],
    'no-negated-condition': ['off'],
    'no-nested-ternary': ['error'],
    'no-new-object': ['error'],
    'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
    'no-restricted-syntax': ['off'],
    'no-tabs': ['error'],
    'no-ternary': ['error'],
    'no-trailing-spaces': ['error'],
    'no-underscore-dangle': ['off'],
    'no-unneeded-ternary': ['error', {defaultAssignment: false}],
    'no-whitespace-before-property': ['error'],
    'nonblock-statement-body-position': ['off'],
    'object-curly-newline': ['error', {multiline: true}],
    'object-curly-spacing': ['error', 'never'],
    'object-property-newline': ['error',
      {allowMultiplePropertiesPerLine: true}],
    'one-var': ['error', 'never'],
    'one-var-declaration-per-line': ['error', 'always'],
    'operator-assignment': ['error', 'always'],
    'operator-linebreak': ['error', 'after'],
    'padded-blocks': ['off'],
    'quote-props': ['error', 'as-needed', {keywords: true, numbers: true}],
    quotes: ['error', 'single'],
    'require-jsdoc': ['off'],
    semi: ['error'],
    'semi-spacing': ['error'],
    'sort-keys': ['off'],
    'sort-vars': ['off'],
    'space-before-blocks': ['error'],
    'space-before-function-paren': ['error', 'never'],
    'space-in-parens': ['error'],
    'space-infix-ops': ['error'],
    'space-unary-ops': ['error', {words: true, nonwords: false}],
    'spaced-comment': ['warn', 'always', {
      markers: ['#if', '#set'],
      exceptions: ['#endif']
    }],
    'template-tag-spacing': ['off'],
    'unicode-bom': ['error'],
    'wrap-regex': ['off'],

    /*  ECMAScript 6  */
    'no-duplicate-imports': ['error', {includeExports: true}],
    'sort-imports': ['error', {
      memberSyntaxSortOrder: [
        'none', 'single', 'multiple', 'all'
      ]
    }],
  }
};
<|endoftext|>


<commit_before>/**
 * Package file that includes all Shumway files. This packaging system is a bit magical.
 * We use esprima to parse the sources and then estransform to apply a series of AST
 * level transformations. First we fold identifiers prefixed by "$". These are usually
 * environment variables. Next, we fold simple binary expression like "+" which then let
 * us evaluate the argument to the load call expressions below. For these we include the
 * source file and recurse.
 *
 */

load($SHUMWAY_ROOT + "lib/DataView.js/DataView.js");
load($SHUMWAY_ROOT + "lib/Kanvas/kanvas.js");

load($SHUMWAY_ROOT + "src/swf/util.js");
load($SHUMWAY_ROOT + "src/swf/swf.js");
load($SHUMWAY_ROOT + "src/swf/types.js");
load($SHUMWAY_ROOT + "src/swf/structs.js");
load($SHUMWAY_ROOT + "src/swf/tags.js");
load($SHUMWAY_ROOT + "src/swf/inflate.js");
load($SHUMWAY_ROOT + "src/swf/stream.js");
load($SHUMWAY_ROOT + "src/swf/templates.js");
load($SHUMWAY_ROOT + "src/swf/generator.js");

load($SHUMWAY_ROOT + "src/swf/bitmap.js");
load($SHUMWAY_ROOT + "src/swf/button.js");
load($SHUMWAY_ROOT + "src/swf/font.js");

load($SHUMWAY_ROOT + "src/swf/image.js");
load($SHUMWAY_ROOT + "src/swf/label.js");
load($SHUMWAY_ROOT + "src/swf/shape.js");
load($SHUMWAY_ROOT + "src/swf/sound.js");
load($SHUMWAY_ROOT + "src/swf/text.js");
load($SHUMWAY_ROOT + "src/swf/mp3worker.js");
load($SHUMWAY_ROOT + "src/swf/embed.js");
load($SHUMWAY_ROOT + "src/swf/renderer.js");
// Load the non-generated parser, we load the generated parser
// in the worker scripts instead.
load($SHUMWAY_ROOT + "src/swf/handlers.js");
// load("build/content/swf/handlers.js");
load($SHUMWAY_ROOT + "src/swf/parser.js");
load($SHUMWAY_ROOT + "src/avm1/classes.js");
load($SHUMWAY_ROOT + "src/avm1/globals.js");
load($SHUMWAY_ROOT + "src/avm1/stream.js");
load($SHUMWAY_ROOT + "src/avm1/interpreter.js");

load($SHUMWAY_ROOT + "src/avm2/util.js");
load($SHUMWAY_ROOT + "src/avm2/options.js");
load($SHUMWAY_ROOT + "src/avm2/metrics.js");

var Counter = new metrics.Counter(true);
var Timer = metrics.Timer;
var Option = options.Option;
var OptionSet = options.OptionSet;
var systemOptions = new OptionSet("System Options");
var disassemble = systemOptions.register(new Option("d", "disassemble", "boolean", false, "disassemble"));
var traceLevel = systemOptions.register(new Option("t", "traceLevel", "number", 0, "trace level"));

window.print = function(s) {
  console.log(s);
};

console.time("Parse preLoadedUTFStrings");
var preLoadedUTFStrings = {
  "builtin.abc": loadJSON($SHUMWAY_ROOT + "extension/firefox/build/content/avm2/generated/builtin/builtin.abc.strings.json"),
  "resource://shumway/flash/playerGlobal.min.abc": loadJSON($SHUMWAY_ROOT + "extension/firefox/build/content/flash/playerGlobal.min.abc.strings.json")
};
console.timeEnd("Parse preLoadedUTFStrings");

load($SHUMWAY_ROOT + "src/avm2/constants.js");
load($SHUMWAY_ROOT + "src/avm2/errors.js");
load($SHUMWAY_ROOT + "src/avm2/opcodes.js");
load($SHUMWAY_ROOT + "src/avm2/parser.js");
load($SHUMWAY_ROOT + "src/avm2/analyze.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/lljs/src/estransform.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/lljs/src/escodegen.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/inferrer.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/ir.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/builder.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/looper.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/backend.js");
load($SHUMWAY_ROOT + "src/avm2/domain.js");
load($SHUMWAY_ROOT + "src/avm2/runtime.js");
load($SHUMWAY_ROOT + "src/avm2/xml.js");
load($SHUMWAY_ROOT + "src/avm2/native.js");
load($SHUMWAY_ROOT + "src/avm2/disassembler.js");
load($SHUMWAY_ROOT + "src/avm2/interpreter.js");
load($SHUMWAY_ROOT + "src/avm2/vm.js");

load($SHUMWAY_ROOT + "extension/firefox/content/web/avm2utils.js");
load($SHUMWAY_ROOT + "src/flash/util.js");

// Manually add directories here, this doesn't get automatically updated by
// make update-flash-refs.

load($SHUMWAY_ROOT + "src/flash/display");
load($SHUMWAY_ROOT + "src/flash/events");
load($SHUMWAY_ROOT + "src/flash/external");
load($SHUMWAY_ROOT + "src/flash/filters");
load($SHUMWAY_ROOT + "src/flash/geom");
load($SHUMWAY_ROOT + "src/flash/media");
load($SHUMWAY_ROOT + "src/flash/net");
load($SHUMWAY_ROOT + "src/flash/system");
load($SHUMWAY_ROOT + "src/flash/text");
load($SHUMWAY_ROOT + "src/flash/ui");
load($SHUMWAY_ROOT + "src/flash/utils");

load($SHUMWAY_ROOT + "src/flash/stubs.js");<commit_msg>Doesn't really make to measure parsing time this way.<commit_after>/**
 * Package file that includes all Shumway files. This packaging system is a bit magical.
 * We use esprima to parse the sources and then estransform to apply a series of AST
 * level transformations. First we fold identifiers prefixed by "$". These are usually
 * environment variables. Next, we fold simple binary expression like "+" which then let
 * us evaluate the argument to the load call expressions below. For these we include the
 * source file and recurse.
 *
 */

load($SHUMWAY_ROOT + "lib/DataView.js/DataView.js");
load($SHUMWAY_ROOT + "lib/Kanvas/kanvas.js");

load($SHUMWAY_ROOT + "src/swf/util.js");
load($SHUMWAY_ROOT + "src/swf/swf.js");
load($SHUMWAY_ROOT + "src/swf/types.js");
load($SHUMWAY_ROOT + "src/swf/structs.js");
load($SHUMWAY_ROOT + "src/swf/tags.js");
load($SHUMWAY_ROOT + "src/swf/inflate.js");
load($SHUMWAY_ROOT + "src/swf/stream.js");
load($SHUMWAY_ROOT + "src/swf/templates.js");
load($SHUMWAY_ROOT + "src/swf/generator.js");

load($SHUMWAY_ROOT + "src/swf/bitmap.js");
load($SHUMWAY_ROOT + "src/swf/button.js");
load($SHUMWAY_ROOT + "src/swf/font.js");

load($SHUMWAY_ROOT + "src/swf/image.js");
load($SHUMWAY_ROOT + "src/swf/label.js");
load($SHUMWAY_ROOT + "src/swf/shape.js");
load($SHUMWAY_ROOT + "src/swf/sound.js");
load($SHUMWAY_ROOT + "src/swf/text.js");
load($SHUMWAY_ROOT + "src/swf/mp3worker.js");
load($SHUMWAY_ROOT + "src/swf/embed.js");
load($SHUMWAY_ROOT + "src/swf/renderer.js");
// Load the non-generated parser, we load the generated parser
// in the worker scripts instead.
load($SHUMWAY_ROOT + "src/swf/handlers.js");
// load("build/content/swf/handlers.js");
load($SHUMWAY_ROOT + "src/swf/parser.js");
load($SHUMWAY_ROOT + "src/avm1/classes.js");
load($SHUMWAY_ROOT + "src/avm1/globals.js");
load($SHUMWAY_ROOT + "src/avm1/stream.js");
load($SHUMWAY_ROOT + "src/avm1/interpreter.js");

load($SHUMWAY_ROOT + "src/avm2/util.js");
load($SHUMWAY_ROOT + "src/avm2/options.js");
load($SHUMWAY_ROOT + "src/avm2/metrics.js");

var Counter = new metrics.Counter(true);
var Timer = metrics.Timer;
var Option = options.Option;
var OptionSet = options.OptionSet;
var systemOptions = new OptionSet("System Options");
var disassemble = systemOptions.register(new Option("d", "disassemble", "boolean", false, "disassemble"));
var traceLevel = systemOptions.register(new Option("t", "traceLevel", "number", 0, "trace level"));

window.print = function(s) {
  console.log(s);
};

var preLoadedUTFStrings = {
  "builtin.abc": loadJSON($SHUMWAY_ROOT + "extension/firefox/build/content/avm2/generated/builtin/builtin.abc.strings.json"),
  "resource://shumway/flash/playerGlobal.min.abc": loadJSON($SHUMWAY_ROOT + "extension/firefox/build/content/flash/playerGlobal.min.abc.strings.json")
};

load($SHUMWAY_ROOT + "src/avm2/constants.js");
load($SHUMWAY_ROOT + "src/avm2/errors.js");
load($SHUMWAY_ROOT + "src/avm2/opcodes.js");
load($SHUMWAY_ROOT + "src/avm2/parser.js");
load($SHUMWAY_ROOT + "src/avm2/analyze.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/lljs/src/estransform.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/lljs/src/escodegen.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/inferrer.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/ir.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/builder.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/looper.js");
load($SHUMWAY_ROOT + "src/avm2/compiler/c4/backend.js");
load($SHUMWAY_ROOT + "src/avm2/domain.js");
load($SHUMWAY_ROOT + "src/avm2/runtime.js");
load($SHUMWAY_ROOT + "src/avm2/xml.js");
load($SHUMWAY_ROOT + "src/avm2/native.js");
load($SHUMWAY_ROOT + "src/avm2/disassembler.js");
load($SHUMWAY_ROOT + "src/avm2/interpreter.js");
load($SHUMWAY_ROOT + "src/avm2/vm.js");

load($SHUMWAY_ROOT + "extension/firefox/content/web/avm2utils.js");
load($SHUMWAY_ROOT + "src/flash/util.js");

// Manually add directories here, this doesn't get automatically updated by
// make update-flash-refs.

load($SHUMWAY_ROOT + "src/flash/display");
load($SHUMWAY_ROOT + "src/flash/events");
load($SHUMWAY_ROOT + "src/flash/external");
load($SHUMWAY_ROOT + "src/flash/filters");
load($SHUMWAY_ROOT + "src/flash/geom");
load($SHUMWAY_ROOT + "src/flash/media");
load($SHUMWAY_ROOT + "src/flash/net");
load($SHUMWAY_ROOT + "src/flash/system");
load($SHUMWAY_ROOT + "src/flash/text");
load($SHUMWAY_ROOT + "src/flash/ui");
load($SHUMWAY_ROOT + "src/flash/utils");

load($SHUMWAY_ROOT + "src/flash/stubs.js");<|endoftext|>


<commit_before>'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // configurable paths
  var yeomanConfig = {
    app: 'app',
    dist: 'dist'
  };

  try {
    yeomanConfig.app = require('./component.json').appPath || yeomanConfig.app;
  } catch (e) {}

  grunt.initConfig({
    yeoman: yeomanConfig,
    watch: {
      coffee: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
        tasks: ['coffee:dist']
      },
      coffeeTest: {
        files: ['test/spec/{,*/}*.coffee'],
        tasks: ['coffee:test']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass']
      },
      livereload: {
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ],
        tasks: ['livereload']
      }
    },
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, yeomanConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '.tmp'),
              mountFolder(connect, 'test')
            ];
          }
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= connect.options.port %>'
      }
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ]
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },
    coffee: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/scripts',
          src: '{,*/}*.coffee',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.coffee',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/components',
        relativeAssets: true
      },
      dist: {},
      server: {
        options: {
          debugInfo: true
        }
      }
    },
    concat: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '.tmp/scripts/{,*/}*.js',
            '<%= yeoman.app %>/scripts/{,*/}*.js'
          ]
        }
      }
    },
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>'
      }
    },
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= yeoman.dist %>']
      }
    },
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/styles/main.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= yeoman.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    htmlmin: {
      dist: {
        options: {
          /*removeCommentsFromCDATA: true,
          // https://github.com/yeoman/grunt-usemin/issues/44
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true*/
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>',
          src: ['*.html', 'views/*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>/scripts',
          src: '*.js',
          dest: '<%= yeoman.dist %>/scripts'
        }]
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '<%= yeoman.dist %>/scripts/scripts.js'
          ]
        }
      }
    },
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,txt}',
            '.htaccess',
            // 'components/**/*',
            'images/{,*/}*.{gif,webp}',
            'styles/fonts/*'
          ]
        }]
      }
    }
  });

  grunt.renameTask('regarde', 'watch');

  grunt.registerTask('server', [
    'clean:server',
    'coffee:dist',
    'compass:server',
    'livereload-start',
    'connect:livereload',
    'open',
    'watch'
  ]);

  grunt.registerTask('test', [
    'clean:server',
    'coffee',
    'compass',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'jshint',
    'test',
    'coffee',
    'compass:dist',
    'useminPrepare',
    'concat',
    'imagemin',
    'cssmin',
    'htmlmin',
    'copy',
    // 'cdnify',
    'ngmin',
    'uglify',
    'rev',
    'usemin'
  ]);

  grunt.registerTask('default', ['build']);
};
<commit_msg>Remove jshint and test tasks in Gruntfile.<commit_after>'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // configurable paths
  var yeomanConfig = {
    app: 'app',
    dist: 'dist'
  };

  try {
    yeomanConfig.app = require('./component.json').appPath || yeomanConfig.app;
  } catch (e) {}

  grunt.initConfig({
    yeoman: yeomanConfig,
    watch: {
      coffee: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
        tasks: ['coffee:dist']
      },
      coffeeTest: {
        files: ['test/spec/{,*/}*.coffee'],
        tasks: ['coffee:test']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass']
      },
      livereload: {
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ],
        tasks: ['livereload']
      }
    },
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, yeomanConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '.tmp'),
              mountFolder(connect, 'test')
            ];
          }
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= connect.options.port %>'
      }
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ]
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },
    coffee: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/scripts',
          src: '{,*/}*.coffee',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
      test: {
        files: [{
          expand: true,
          cwd: 'test/spec',
          src: '{,*/}*.coffee',
          dest: '.tmp/spec',
          ext: '.js'
        }]
      }
    },
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/components',
        relativeAssets: true
      },
      dist: {},
      server: {
        options: {
          debugInfo: true
        }
      }
    },
    concat: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '.tmp/scripts/{,*/}*.js',
            '<%= yeoman.app %>/scripts/{,*/}*.js'
          ]
        }
      }
    },
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>'
      }
    },
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= yeoman.dist %>']
      }
    },
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/styles/main.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= yeoman.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    htmlmin: {
      dist: {
        options: {
          /*removeCommentsFromCDATA: true,
          // https://github.com/yeoman/grunt-usemin/issues/44
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true*/
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>',
          src: ['*.html', 'views/*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>/scripts',
          src: '*.js',
          dest: '<%= yeoman.dist %>/scripts'
        }]
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '<%= yeoman.dist %>/scripts/scripts.js'
          ]
        }
      }
    },
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,txt}',
            '.htaccess',
            // 'components/**/*',
            'images/{,*/}*.{gif,webp}',
            'styles/fonts/*'
          ]
        }]
      }
    }
  });

  grunt.renameTask('regarde', 'watch');

  grunt.registerTask('server', [
    'clean:server',
    'coffee:dist',
    'compass:server',
    'livereload-start',
    'connect:livereload',
    'open',
    'watch'
  ]);

  grunt.registerTask('test', [
    'clean:server',
    'coffee',
    'compass',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    //'jshint',
    //'test',
    'coffee',
    'compass:dist',
    'useminPrepare',
    'concat',
    'imagemin',
    'cssmin',
    'htmlmin',
    'copy',
    // 'cdnify',
    'ngmin',
    'uglify',
    'rev',
    'usemin'
  ]);

  grunt.registerTask('default', ['build']);
};
<|endoftext|>


<commit_before>/** @module reflect-helpers */

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root._R = factory();
}
}(this, function () {
var _R = {};
var indirectEval = eval;
var getNaiveFunctionSourceCode = Function.call.bind(Function.toString);

 _R.__directives = ['', 'use strict', 'use asm'];

 _R.DIRECTIVE_NORMAL = 0;
 _R.DIRECTIVE_STRICT = 1;
 _R.DIRECTIVE_ASM    = 2;

 /*
  * Changes directives used by created functions
 * @method
 * @param {integer|string} directive - directive to be used
 * @returns {boolean}
 */

 _R.$setDirective = function (directive) {
    if (typeof directive === 'number') {
        _R.__directive = JSON.stringify(_R.__directives[directive] || '');
    } else {
        _R.__directive = JSON.stringify(directive);
    }
 };

 _R.__directive = '';

/**
 * Tests variable name against current implementation rules.
 * " If you were to summarize all these rules in a single ASCII-only regular expression for JavaScript, it would be 11,236 characters long."
 * @method
 * @param {string} name - string to be tested
 * @returns {boolean}
 */

_R.isValidVariableName = function isValidVariableName(name) {
    try {
        indirectEval('var '+name+';');
    }
    catch (e) {
        return false;
    }
    return true;
}

function NativeFunctionSuppliedError() {
    var ret = Object.create(new Error());
    ret.message = '_R does not support native or bound functions as arguments!';
    ret.name = 'NativeFunctionSuppliedError';

    return ret;
}

_R.__boundFunction = (function(){}).bind(null);

/**
 * Tests if function is native or bound
 * @method
 * @param {function} func - function to be stringified
 * @throws {TypeError} when func isn't a function
 * @returns {boolean}
 */

_R.isBoundOrNativeFunction = function isBoundOrNativeFunction(func) {
    if (getNaiveFunctionSourceCode(func) === getNaiveFunctionSourceCode(func.bind(null))) {
        return true;
    }
    return false;
};

/**
 * Returns source code of function or throws error when it's impossible to retrieve
 * @method
 * @param {function} func - function to be stringified
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 * @returns {string}
 */

_R.getFunctionSourceCode = function getFunctionSourceCode(func) {
    var source = Function.toString.call(func);
    if (_R.isBoundOrNativeFunction(func)) {
        throw new NativeFunctionSuppliedError();
    }
    return source;
};

/**
 * Returns [[Class]] of what
 * @method
 * @param what - Object or primitive to be inspected
 */

_R.getInternalClass = function (what) {
    return Object.prototype.toString.call(what).match(/^\[object\s(.*)\]$/)[1];
};

/**
 * Returns function redefined in global context
 * @method
 * @param {function} func - function to be redefined
 * @param {function} [transformer] - transformation function applied to function source code. function callback(sourceCode, func)
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.declosureFunction = function(func, transform) {
    transformer = transformer || function(a) {return a};
    return indirectEval('('+transformer(_R.getFunctionSourceCode(func), func)+')');
}

/**
 * Creates named function using Function constructor
 * @method
 * @param {string} name - function name (exists in function scope, used for recursive calls, shouldn't be confused with function.name property)
 * @param {...string} restArgs - arguments to Function constructor
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.createNamedFunction = function createNamedFunction(name, restArgs) {
    name = ''+name || 'anonymous';
    if (!_R.isValidVariableName(name)) {
        throw new NativeFunctionSuppliedError();
    }
    restArgs = Array.prototype.slice.call(arguments, 1);
    return _R.declosureFunction(
            function($$$1){
                $$$directive;
                $$$1 = $$$2;
                return $$$1;
            },
            function transformSource(sourceCode){
                return sourceCode
                    .replace('$$$1', name, 'g')
                    .replace('$$$directive', _R.__directive)
                    .replace('$$$2', '('+_R.getFunctionSourceCode(Function.apply(null, restArgs))+')', 'g');
            }
    )();
};

/**
 * Redefines function in context of given object;
 * Default function name is
 * @method
 * @param {function} func - function name (exists in function scope, shouldn't be confused with function.name property)
 * @param {Object} [context] - context of new function
 * @param {string} [name] - name of new function (defaults to 'anonymous' (will NOT shadow arguments from context))
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.createClosure = function createClosure(func, context, name) {
    context = context || {};
    name = isValidVariableName(name) ? name : 'anonymous';
    var varsList = [];
    var argumentsNames;
    var argumentsValues;
    for (var key in context) {
        if (Object.hasOwnProperty.call(context, key) && _R.isValidVariableName(key)) {
            argumentsNames.push({name: key, val: context[key]});
        }
    }
    var argumentsNames  = varsList.map(function(el){return el.name});
    var argumentsValues = varsList.map(function(el){return el.val});
    var sourceCode = _R.__directive+';\n var '+name+ '= ('+_R.getFunctionSourceCode(func)+'); return '+name+';';

    return Function.apply(null, argumentsNames.concat(sourceCode)).apply(null, argumentsValues);
};

/**
 * Returns prototype of first argument
 * If argument isn't an object, returns null
 * Can return invalid object in IE8 and lower.
 * @method
 * @param {*} what
 * @returns {Object?} returns object or null
 */

_R.getObjectPrototype = function getObjectPrototype(what) {
    if (typeof what !== 'object' || typeof what !== 'function') {
        return null;
    }
    if (Object.getPrototypeOf) {
        return Object.getPrototypeOf(what);
    }
    else if (({}).__proto__) {
        return what.__proto__
    }
    else {
        // This branch doesn't work in certain cases

        // check against null and undefined
        // != test is intentional
        if (what != null) {
            return what.constructor ? (what.constructor.prototype || null) : null;
        }
    }
    return null;
}

/**
 * Returns array of objects existing in prototype chains
 * @method
 * @param {*} what
 * @returns {Object*}
 */

_R.getPrototypesChain = function getPrototypesChain(what) {
    var prototypesList = [];
    do {
        prototypesList.push(what);
    } while (what = _R.getObjectPrototype(what) && prototypesList.indexOf(what) !== -1);
    return prototypesList;
};

_R.toString = function() {
    return '[Object _R]';
};

return _R;
}));<commit_msg>Default directive set to 'use strict'<commit_after>/** @module reflect-helpers */

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root._R = factory();
}
}(this, function () {
var _R = {};
var indirectEval = eval;
var getNaiveFunctionSourceCode = Function.call.bind(Function.toString);

 _R.__directives = ['', 'use strict', 'use asm'];

 _R.DIRECTIVE_NORMAL = 0;
 _R.DIRECTIVE_STRICT = 1;
 _R.DIRECTIVE_ASM    = 2;

 /*
  * Changes directives used by created functions
 * @method
 * @param {integer|string} directive - directive to be used
 * @returns {boolean}
 */

 _R.$setDirective = function (directive) {
    if (typeof directive === 'number') {
        _R.__directive = JSON.stringify(_R.__directives[directive] || '');
    } else {
        _R.__directive = JSON.stringify(directive);
    }
 };

 _R.__directive = '';
 _R.$setDirective(_R.DIRECTIVE_STRICT);
/**
 * Tests variable name against current implementation rules.
 * " If you were to summarize all these rules in a single ASCII-only regular expression for JavaScript, it would be 11,236 characters long."
 * @method
 * @param {string} name - string to be tested
 * @returns {boolean}
 */

_R.isValidVariableName = function isValidVariableName(name) {
    try {
        indirectEval('var '+name+';');
    }
    catch (e) {
        return false;
    }
    return true;
}

function NativeFunctionSuppliedError() {
    var ret = Object.create(new Error());
    ret.message = '_R does not support native or bound functions as arguments!';
    ret.name = 'NativeFunctionSuppliedError';

    return ret;
}

_R.__boundFunction = (function(){}).bind(null);

/**
 * Tests if function is native or bound
 * @method
 * @param {function} func - function to be stringified
 * @throws {TypeError} when func isn't a function
 * @returns {boolean}
 */

_R.isBoundOrNativeFunction = function isBoundOrNativeFunction(func) {
    if (getNaiveFunctionSourceCode(func) === getNaiveFunctionSourceCode(func.bind(null))) {
        return true;
    }
    return false;
};

/**
 * Returns source code of function or throws error when it's impossible to retrieve
 * @method
 * @param {function} func - function to be stringified
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 * @returns {string}
 */

_R.getFunctionSourceCode = function getFunctionSourceCode(func) {
    var source = Function.toString.call(func);
    if (_R.isBoundOrNativeFunction(func)) {
        throw new NativeFunctionSuppliedError();
    }
    return source;
};

/**
 * Returns [[Class]] of what
 * @method
 * @param what - Object or primitive to be inspected
 */

_R.getInternalClass = function (what) {
    return Object.prototype.toString.call(what).match(/^\[object\s(.*)\]$/)[1];
};

/**
 * Returns function redefined in global context
 * @method
 * @param {function} func - function to be redefined
 * @param {function} [transformer] - transformation function applied to function source code. function callback(sourceCode, func)
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.declosureFunction = function(func, transform) {
    transformer = transformer || function(a) {return a};
    return indirectEval('('+transformer(_R.getFunctionSourceCode(func), func)+')');
}

/**
 * Creates named function using Function constructor
 * @method
 * @param {string} name - function name (exists in function scope, used for recursive calls, shouldn't be confused with function.name property)
 * @param {...string} restArgs - arguments to Function constructor
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.createNamedFunction = function createNamedFunction(name, restArgs) {
    name = ''+name || 'anonymous';
    if (!_R.isValidVariableName(name)) {
        throw new NativeFunctionSuppliedError();
    }
    restArgs = Array.prototype.slice.call(arguments, 1);
    return _R.declosureFunction(
            function($$$1){
                $$$directive;
                $$$1 = $$$2;
                return $$$1;
            },
            function transformSource(sourceCode){
                return sourceCode
                    .replace('$$$1', name, 'g')
                    .replace('$$$directive', _R.__directive)
                    .replace('$$$2', '('+_R.getFunctionSourceCode(Function.apply(null, restArgs))+')', 'g');
            }
    )();
};

/**
 * Redefines function in context of given object;
 * Default function name is
 * @method
 * @param {function} func - function name (exists in function scope, shouldn't be confused with function.name property)
 * @param {Object} [context] - context of new function
 * @param {string} [name] - name of new function (defaults to 'anonymous' (will NOT shadow arguments from context))
 * @throws {NativeFunctionSuppliedError} for bound functions and native code functions
 */

_R.createClosure = function createClosure(func, context, name) {
    context = context || {};
    name = isValidVariableName(name) ? name : 'anonymous';
    var varsList = [];
    var argumentsNames;
    var argumentsValues;
    for (var key in context) {
        if (Object.hasOwnProperty.call(context, key) && _R.isValidVariableName(key)) {
            argumentsNames.push({name: key, val: context[key]});
        }
    }
    var argumentsNames  = varsList.map(function(el){return el.name});
    var argumentsValues = varsList.map(function(el){return el.val});
    var sourceCode = _R.__directive+';\n var '+name+ '= ('+_R.getFunctionSourceCode(func)+'); return '+name+';';

    return Function.apply(null, argumentsNames.concat(sourceCode)).apply(null, argumentsValues);
};

/**
 * Returns prototype of first argument
 * If argument isn't an object, returns null
 * Can return invalid object in IE8 and lower.
 * @method
 * @param {*} what
 * @returns {Object?} returns object or null
 */

_R.getObjectPrototype = function getObjectPrototype(what) {
    if (typeof what !== 'object' || typeof what !== 'function') {
        return null;
    }
    if (Object.getPrototypeOf) {
        return Object.getPrototypeOf(what);
    }
    else if (({}).__proto__) {
        return what.__proto__
    }
    else {
        // This branch doesn't work in certain cases

        // check against null and undefined
        // != test is intentional
        if (what != null) {
            return what.constructor ? (what.constructor.prototype || null) : null;
        }
    }
    return null;
}

/**
 * Returns array of objects existing in prototype chains
 * @method
 * @param {*} what
 * @returns {Object*}
 */

_R.getPrototypesChain = function getPrototypesChain(what) {
    var prototypesList = [];
    do {
        prototypesList.push(what);
    } while (what = _R.getObjectPrototype(what) && prototypesList.indexOf(what) !== -1);
    return prototypesList;
};

_R.toString = function() {
    return '[Object _R]';
};

return _R;
}));<|endoftext|>


<commit_before>var mongoose = require('mongoose');
var TournamentContext = mongoose.model('TournamentContext');

var RssFeed = require('../utils/rssfeed')
var cronManager = require('../utils/cron-manager')

module.exports.tournamentcontext = function(req, res) {

if(req.params.id){
  //Search in Database tournament data
  console.log("here")
  TournamentContext.find({"id":req.params.id},
    function(err, docs){console.log("Boum" + err);})
  .exec(function(err, result) {
        console.log("Result" + JSON.stringify(result));
        res.status(200).json(result);
      });
} else {

  //Search in Database tournament data
  TournamentContext.find({}, "id name description date reglement privacy organizer capacity kind properties league alerts",
    function(err, docs){console.log("Boum" + err);})
  .exec(function(err, result) {
        console.log("Result" + JSON.stringify(result));
        res.status(200).json(result);
      });
}

  };

module.exports.findalerts = function(){
  var allEventAlerts = []
  TournamentContext.find({}, "id alerts", function(err, docs){console.log("Hmmm")}).exec(function(err,result){
    allEventAlerts=result
    console.log('Résultat Find Alerts' + JSON.stringify(allEventAlerts))

    cronManager.initializeJobs(allEventAlerts)

  })

}

  module.exports.create_event = function (req, res){
  	var event = new TournamentContext()
  	var reqBody  = req.body
  	console.log("Body Requete Create Event" + JSON.stringify(req.body))

    //Create unique identifier for tournament
    var now = new Date()
    var id = "TR" + now.getDate() + now.getMonth() + now.getFullYear() + now.getHours() + now.getMinutes() + now.getSeconds();

  	//Parse into event
  	event.id=id
  	event.name=reqBody.name
  	event.description=reqBody.description
  	event.date=reqBody.date
  	event.reglement=reqBody.reglement
  	event.privacy=reqBody.privacy
  	event.organizer=reqBody.organizer
  	event.capacity=reqBody.capacity
    event.kind=reqBody.kind
    event.properties=reqBody.properties
    event.league=reqBody.league
    event.alerts=reqBody.alerts
    console.log('Avant la sauvegarde' + JSON.stringify(event))

    //RssFeed.addItem(event)

  	event.save(function(err){
      console.log("Pb lors de la sauvegarde : " + err)
  		res.status(200).send("OK");
  	})

  };

  module.exports.delete_event = function(req, res){
    TournamentContext.findByIdAndRemove(req.params.id, (err, todo) => {
       var response = {
        message: "Todo successfully deleted",
        id: todo.id
    };
    res.status(200).send(response);
    })
  };

  <commit_msg>rssfeed<commit_after>var mongoose = require('mongoose');
var TournamentContext = mongoose.model('TournamentContext');

//var RssFeed = require('../utils/rssfeed')
var cronManager = require('../utils/cron-manager')

module.exports.tournamentcontext = function(req, res) {

if(req.params.id){
  //Search in Database tournament data
  console.log("here")
  TournamentContext.find({"id":req.params.id},
    function(err, docs){console.log("Boum" + err);})
  .exec(function(err, result) {
        console.log("Result" + JSON.stringify(result));
        res.status(200).json(result);
      });
} else {

  //Search in Database tournament data
  TournamentContext.find({}, "id name description date reglement privacy organizer capacity kind properties league alerts",
    function(err, docs){console.log("Boum" + err);})
  .exec(function(err, result) {
        console.log("Result" + JSON.stringify(result));
        res.status(200).json(result);
      });
}

  };

module.exports.findalerts = function(){
  var allEventAlerts = []
  TournamentContext.find({}, "id alerts", function(err, docs){console.log("Hmmm")}).exec(function(err,result){
    allEventAlerts=result
    console.log('Résultat Find Alerts' + JSON.stringify(allEventAlerts))

    cronManager.initializeJobs(allEventAlerts)

  })

}

  module.exports.create_event = function (req, res){
  	var event = new TournamentContext()
  	var reqBody  = req.body
  	console.log("Body Requete Create Event" + JSON.stringify(req.body))

    //Create unique identifier for tournament
    var now = new Date()
    var id = "TR" + now.getDate() + now.getMonth() + now.getFullYear() + now.getHours() + now.getMinutes() + now.getSeconds();

  	//Parse into event
  	event.id=id
  	event.name=reqBody.name
  	event.description=reqBody.description
  	event.date=reqBody.date
  	event.reglement=reqBody.reglement
  	event.privacy=reqBody.privacy
  	event.organizer=reqBody.organizer
  	event.capacity=reqBody.capacity
    event.kind=reqBody.kind
    event.properties=reqBody.properties
    event.league=reqBody.league
    event.alerts=reqBody.alerts
    console.log('Avant la sauvegarde' + JSON.stringify(event))

    //RssFeed.addItem(event)

  	event.save(function(err){
      console.log("Pb lors de la sauvegarde : " + err)
  		res.status(200).send("OK");
  	})

  };

  module.exports.delete_event = function(req, res){
    TournamentContext.findByIdAndRemove(req.params.id, (err, todo) => {
       var response = {
        message: "Todo successfully deleted",
        id: todo.id
    };
    res.status(200).send(response);
    })
  };

  <|endoftext|>