'use strict';

const React = require("react");
const reactHotLoader = require("react-hot-loader");
const createReactClass = require("create-react-class");
const esprima = require("esprima");

const AstView = require("./components/ast-view");
const processAst = require("../ast/process");

module.exports = reactHotLoader.hot(module)(createReactClass({
	displayName: "App",
	getInitialState: function () {
		let ast = esprima.parseScript(require("raw-loader!../testcases/abbrev.js"));

		processAst(ast);

		return {
			ast: ast
		};
	},
	render: function () {
		return (<div>
			<AstView ast={this.state.ast} />
		</div>);
	}
}));
