<commit_before>$(document).ready(function() {
  $('#parse').click(function() {
    try {
      var myCodeMirror = $(".CodeMirror")[0].CodeMirror
      var source = myCodeMirror.getValue()

      out.className = "unhidden";
      
      // Import: Change: $('#input').val() -> source, i forget it, again 
      var tree = calculator.parse(source);
      plegadoConstantes(tree);
      $('#output').html(JSON.stringify(tree,undefined,2));
    } catch (e) {
      $('#output').html('<div class="error"><pre>\n' + String(e) + '\n</pre></div>');
    }
  });

  $("#examples").change(function(ev) {
    var f = ev.target.files[0]; 
    var r = new FileReader();
    r.onload = function(e) { 
      var contents = e.target.result;
      
      var myCodeMirror = $('.CodeMirror')[0].CodeMirror;
      myCodeMirror.setValue(contents);
    }
    r.readAsText(f);
  });

});
function plegadoConstantes(tree){
	switch (tree.type){
		case "BLOCK":
		case "procedure":			
			if(tree.hasOwnProperty("procs") && tree.procs != "NULL"){
				plegadoConstantes(tree.procs);
			}
			if(tree.hasOwnProperty("stat")){
				for (var i in tree.stat.statement_list){
					plegadoConstantes(tree.stat.statement_list[i]);
				}
			}
			break;
		case "ASSING":
			tree = {
				type="=",
				left=tree.left,
				right=tree.value
			};
			break;<commit_msg>change<commit_after>$(document).ready(function() {
  $('#parse').click(function() {
    try {
      var myCodeMirror = $(".CodeMirror")[0].CodeMirror
      var source = myCodeMirror.getValue()

      out.className = "unhidden";
      
      // Import: Change: $('#input').val() -> source, i forget it, again 
      var tree = calculator.parse(source);
      plegadoConstantes(tree);
      $('#output').html(JSON.stringify(tree,undefined,2));
    } catch (e) {
      $('#output').html('<div class="error"><pre>\n' + String(e) + '\n</pre></div>');
    }
  });

  $("#examples").change(function(ev) {
    var f = ev.target.files[0]; 
    var r = new FileReader();
    r.onload = function(e) { 
      var contents = e.target.result;
      
      var myCodeMirror = $('.CodeMirror')[0].CodeMirror;
      myCodeMirror.setValue(contents);
    }
    r.readAsText(f);
  });

});
function plegadoConstantes(tree){
	switch (tree.type){
		case "BLOCK":
		case "procedure":			
			if(tree.hasOwnProperty("procs") && tree.procs != "NULL"){
				plegadoConstantes(tree.procs);
			}
			if(tree.hasOwnProperty("stat")){
				for (var i in tree.stat.statement_list){
					plegadoConstantes(tree.stat.statement_list[i]);
				}
			}
			break;
		case "ASSING":
			alert(tree.left.id+tree.value);
			break;
{'fraction_non_alphanumeric': 0.19140774836977367, 'fraction_numerical': 0.0030686612965093976, 'mean_word_length': 3.0061443932411676, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1601711', 'n_tokens_mistral': 977, 'n_tokens_neox': 872, 'n_words': 146}