Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wacc_26_web_client
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rk4718
wacc_26_web_client
Commits
c8a32334
Commit
c8a32334
authored
Mar 13, 2020
by
Matej Genci
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'line_execution' into 'master'
Implement a basic line by line executor See merge request
!2
parents
a20f30b4
74eec1c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
3 deletions
+63
-3
src/App.js
src/App.js
+63
-3
No files found.
src/App.js
View file @
c8a32334
...
...
@@ -24,7 +24,37 @@ class App extends React.Component {
js
:
{
code
:
""
,
markers
:
[],},
arm
:
{
code
:
""
,
markers
:
[],},
graphData
:
[{}],
consoleReset
:
0
consoleReset
:
0
,
mainStatements
:
[{}],
statementIndex
:
0
,
currentNode
:
{
name
:
""
,
attributes
:
{
value
:
""
},
highlighting
:
{
wacc
:
[{
startRow
:
0
,
startCol
:
0
,
endRow
:
0
,
endCol
:
0
,
className
:
""
,
type
:
""
}],
js
:
[{
startRow
:
0
,
startCol
:
0
,
endRow
:
0
,
endCol
:
0
,
className
:
""
,
type
:
""
}],
arm
:
[{
startRow
:
0
,
startCol
:
0
,
endRow
:
0
,
endCol
:
0
,
className
:
""
,
type
:
""
}]
},
children
:
[{}]
}
}
}
...
...
@@ -76,7 +106,36 @@ class App extends React.Component {
graphData
:
graph
})
}
}
};
proccesLine
=
()
=>
{
if
(
this
.
state
.
statementIndex
<
this
.
state
.
mainStatements
.
length
){
let
current
=
this
.
state
.
currentNode
;
let
jsLines
=
this
.
state
.
js
.
code
.
split
(
/;
\n(?!
}
)
/
);
// console.log(jsLines)
// console.log(current)
let
codeLine
=
jsLines
[
current
.
highlighting
.
js
[
0
].
startRow
];
codeLine
=
codeLine
.
replace
(
"
var
"
,
"
window.
"
);
eval
(
codeLine
);;
let
newIndex
=
this
.
state
.
statementIndex
+
1
;
this
.
setState
({
currentNode
:
this
.
state
.
mainStatements
[
newIndex
],
statementIndex
:
newIndex
})
}
else
{
console
.
log
(
"
Finished executing code
"
)
}
};
getStatements
=
()
=>
{
let
rootChildren
=
this
.
state
.
graphData
.
children
;
let
funcMain
=
rootChildren
[
rootChildren
.
length
-
1
];
let
mainFuncStatementsNode
=
funcMain
.
children
[
0
];
let
mainFuncStatements
=
mainFuncStatementsNode
.
children
;
this
.
setState
({
mainStatements
:
mainFuncStatements
,
currentNode
:
mainFuncStatements
[
0
],
statementIndex
:
0
})
};
render
()
{
return
(
...
...
@@ -88,8 +147,9 @@ class App extends React.Component {
<
CardBody
>
<
ButtonStrip
onCompileClick
=
{(
e
)
=>
{
this
.
processWaccCode
(
this
.
state
.
wacc
.
code
)
this
.
processWaccCode
(
this
.
state
.
wacc
.
code
)
.
then
(()
=>
{
this
.
clearConsole
()
this
.
getStatements
()})
}}
onExecuteClick
=
{(
e
)
=>
{
eval
(
this
.
state
.
js
.
code
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment