Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsexplain
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verified Software
jsexplain
Commits
b539d631
Commit
b539d631
authored
8 years ago
by
Thomas Wood
Browse files
Options
Downloads
Plain Diff
merge
parents
3fbc12f5
2e72e1c3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
driver.html
+1
-1
1 addition, 1 deletion
driver.html
generator/tests/jsref/Translate_syntax.js
+3
-2
3 additions, 2 deletions
generator/tests/jsref/Translate_syntax.js
navig-driver.js
+29
-13
29 additions, 13 deletions
navig-driver.js
with
33 additions
and
16 deletions
driver.html
+
1
−
1
View file @
b539d631
...
...
@@ -111,7 +111,7 @@
<div
class=
'source_div'
style=
""
>
Load example:
<select
id=
'select_source_code'
><
option
disabled
selected
>
Examples
</option><
/select>
<select
id=
'select_source_code'
></select>
Load file:
<input
type=
'file'
accept=
'.js'
id=
'select_file'
/>
<table
id=
'main_table'
><tr>
<td>
...
...
This diff is collapsed.
Click to expand it.
generator/tests/jsref/Translate_syntax.js
+
3
−
2
View file @
b539d631
...
...
@@ -2,8 +2,9 @@ var Translate_syntax = {
eval_counter
:
0
,
parse_esprima
:
function
(
strictness
,
src
)
{
try
{
// TODO Fixup line numbers for eval context
return
Some
(
parseSource
(
src
,
"
_eval_
"
+
Translate_syntax
.
eval_counter
++
,
true
));
// EVAL: Uncomment line below to enable multiple eval tabs
//return Some(parseSource(src, "_eval_" + Translate_syntax.eval_counter++, true));
return
Some
(
parseSource
(
src
,
"
_eval_
"
,
true
));
}
catch
(
e
)
{
return
None
();
}
...
...
This diff is collapsed.
Click to expand it.
navig-driver.js
+
29
−
13
View file @
b539d631
...
...
@@ -70,6 +70,7 @@ var source = null;
var
interpreter
=
null
;
var
source_docs
=
{};
var
initialSourceName
=
""
;
// Initial source code
...
...
@@ -118,24 +119,40 @@ function newSourceDoc(name, text, readOnly) {
.
text
(
name
)
.
click
(
e
=>
selectSourceDoc
(
e
.
target
.
textContent
))
.
appendTo
(
'
#source_tabs
'
);
if
(
name
===
'
_eval_
'
)
{
tab
.
hide
();
}
source_docs
[
name
].
doc_name
=
name
;
source_docs
[
name
].
tab
=
tab
;
source_docs
[
name
].
readOnly
=
Boolean
(
readOnly
);
}
return
source_docs
[
name
];
}
function
selectSourceDocFromLoc
(
loc
)
{
var
name
=
loc
.
file
;
if
(
name
===
'
_eval_
'
)
{
source_docs
[
'
_eval_
'
].
tab
.
show
();
source_docs
[
'
_eval_
'
].
setValue
(
loc
.
sourceText
);
}
var
old_doc
=
selectSourceDoc
(
loc
.
file
);
if
(
old_doc
.
doc_name
===
"
_eval_
"
&&
name
!==
"
_eval_
"
)
{
source_docs
[
'
_eval_
'
].
tab
.
hide
();
}
}
// Switches current source doc
function
selectSourceDoc
(
name
)
{
var
old_doc
=
source
.
swapDoc
(
source_docs
[
name
]);
if
(
old_doc
.
tab
)
old_doc
.
tab
.
removeClass
(
'
file_item_current
'
);
source_docs
[
name
].
tab
.
addClass
(
'
file_item_current
'
);
source
.
setOption
(
'
readOnly
'
,
source_docs
[
name
].
readOnly
);
return
old_doc
;
}
// Sets the initial source doc
function
setInitialSourceCode
(
name
,
text
)
{
initSourceDocs
();
var
doc
=
newSourceDoc
(
name
,
text
);
initialSourceName
=
name
;
$
(
"
#source_code
"
).
val
(
text
);
...
...
@@ -145,7 +162,9 @@ function setInitialSourceCode(name, text) {
}
}
$
(
'
#select_source_code
'
).
change
(
e
=>
{
setInitialSourceCode
(
"
_toplevel_
"
,
e
.
target
.
value
)});
$
(
'
#select_source_code
'
).
change
(
e
=>
{
setInitialSourceCode
(
"
example
"
+
e
.
target
.
selectedOptions
[
0
].
index
+
"
.js
"
,
e
.
target
.
value
)
});
$
(
'
#select_file
'
).
change
(
e
=>
{
var
f
=
e
.
target
.
files
[
0
];
var
fr
=
new
FileReader
();
...
...
@@ -153,12 +172,11 @@ $('#select_file').change(e => {
fr
.
readAsText
(
f
);
});
// --------------- Initialization ----------------
// WARNING: do not move this initialization further down in the file
// source code displayed initially
function
setExample
(
idx
)
{
$
(
'
#select_source_code option
'
)[
idx
].
selected
=
true
;
$
(
'
#select_source_code
'
).
change
();
}
setInitialSourceCode
(
"
_toplevel_
"
,
source_files
[
0
]);
// --------------- Predicate search ----------------
...
...
@@ -1145,9 +1163,7 @@ function updateSelection() {
// source panel
source_loc_selected
=
item
.
source_loc
;
newSourceDoc
(
item
.
source_loc
.
file
,
item
.
source_loc
.
sourceText
);
selectSourceDoc
(
item
.
source_loc
.
file
);
selectSourceDocFromLoc
(
source_loc_selected
);
updateSelectionInCodeMirror
(
source
,
source_loc_selected
);
// console.log(source_loc_selected);
...
...
@@ -1340,7 +1356,7 @@ function readSourceParseAndRun() {
// TODO handle parsing error
// TODO handle out of scope errors
try
{
program
=
parseSource
(
code
,
"
_toplevel_
"
);
program
=
parseSource
(
code
,
initialSourceName
);
}
catch
(
e
)
{
return
"
Parse error
"
;
}
...
...
@@ -1387,8 +1403,8 @@ readSourceParseAndRun();
// $("#reach_condition").val("I_line()");
// button_test_handler();
//
set
SourceCode(source_files[3]
);
//
stepTo(5873);
//set
Example(3
);
//stepTo(5873);
function
showCurrent
()
{
console
.
log
(
tracer_items
[
tracer_pos
]);
...
...
@@ -1404,4 +1420,4 @@ function findToken(token) {
return
-
1
;
};
//S_line() == 4 && S("j") == 2
\ No newline at end of file
//S_line() == 4 && S("j") == 2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment