Skip to content
Snippets Groups Projects
Commit 2d8bd986 authored by Martin Bodin's avatar Martin Bodin Committed by Thomas Wood
Browse files

Adding some examples of queries.

parent 24b2a4a1
Branches
No related tags found
No related merge requests found
......@@ -91,6 +91,13 @@ Reach condition:
<div style="font-size:0.8em">Instructions: type 'S' for step (next function call), 'N' for next (next call at same level), 'B' for backstep (symmetric to step), 'P' for previous (symmetric to next), 'F' for finish (next call at upper level), 'R' for restart.</div>
<div style="font-size:0.8em">Examples of conditions:
<ul>
<li><pre style = "display:inline">type === "fun" && (v1, true)</pre> (we are at the beginning of a function and v1 is defined)</li>
<li><pre style = "display:inline">line === 32 && t.field === "bar"</pre> (we are at line 32 and we are setting the field “bar” of the current location)</li>
<li><pre style = "display:inline">heap[0].bar === 12</pre> (the first cell of the heap has a field “bar” defined equal to 12)</li>
</ul></div>
<div id='file_list'></div>
<div class='source_div'>
......
......@@ -16,7 +16,7 @@ function stepTo(step) {
}
// Take a predicate in form of a JavaScript code (string) and returns either true or an error message (string).
// The predicate can make use of the line or any local variable.
// The predicate can make use of the line, the event type, , the heap, or any local variable of the context ctx.
function goToPred(pred) {
function check(i){
......@@ -27,6 +27,8 @@ function goToPred(pred) {
obj = jsenv_of_env(jsheap, item.ctx);
}
obj.line = item.line;
obj.type = item.type;
obj.heap = jsheap;
try {
if (check_pred(pred, obj)){
stepTo(i);
......@@ -54,7 +56,7 @@ function goToPred(pred) {
return true;
if (error === datalog.length)
return "There was an execution error at every execution of your condition: is this a valid JavaScript code?";
return "There was an execution error at every execution of your condition: are you sure that this is a valid JavaScript code?";
return "Not found";
}
......@@ -220,6 +222,8 @@ function text_of_value(heap, v, target) {
function updateContext(heap, env) { // env here is the ctx
$("#disp_context").html("");
if (env === undefined)
return;
// TODO: une fonction de conversion de env vers array
while (env.tag === "env_cons") {
var target = fresh_id();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment