Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
rk4718
wacc_26_web_client
Commits
523483a6
Commit
523483a6
authored
Mar 13, 2020
by
Matej Genci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Highlighting and more action buttons
parent
f36b61f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
27 deletions
+14
-27
src/App.js
src/App.js
+3
-20
src/Comm.js
src/Comm.js
+5
-5
src/view/ButonStrip.js
src/view/ButonStrip.js
+3
-2
src/view/CodeEditor.js
src/view/CodeEditor.js
+3
-0
No files found.
src/App.js
View file @
523483a6
...
@@ -68,32 +68,15 @@ class App extends React.Component {
...
@@ -68,32 +68,15 @@ class App extends React.Component {
let
hl
=
nodeData
.
highlighting
;
let
hl
=
nodeData
.
highlighting
;
this
.
setState
((
state
,
props
)
=>
{
this
.
setState
((
state
,
props
)
=>
{
let
armMarkers
=
state
.
arm
.
markers
;
hl
.
arm
.
array
.
forEach
(
element
=>
armMarkers
.
append
(
element
))
return
{
return
{
wacc
:
{
markers
:
state
.
wacc
.
markers
.
append
(
hl
.
wacc
)
},
wacc
:
{
code
:
state
.
wacc
.
code
,
markers
:
hl
.
wacc
},
js
:
{
markers
:
state
.
js
.
markers
.
append
(
hl
.
js
)
},
js
:
{
code
:
state
.
js
.
code
,
markers
:
hl
.
js
},
arm
:
{
markers
:
armMarkers
}
arm
:
{
code
:
state
.
arm
.
code
,
markers
:
hl
.
arm
}
}
}
})
})
}
}
onNodeOut
=
(
nodeData
,
evt
)
=>
{
onNodeOut
=
(
nodeData
,
evt
)
=>
{
let
hl
=
nodeData
.
highlighting
;
this
.
setState
((
state
,
props
)
=>
{
let
waccMarkerIdx
=
state
.
wacc
.
markers
.
indexOf
(
hl
.
wacc
);
let
jsMarkerIdx
=
state
.
js
.
markers
.
indexOf
(
hl
.
js
)
let
armMarkers
=
[];
return
{
wacc
:
{
markers
:
state
.
wacc
.
markers
.
splice
(
waccMarkerIdx
,
1
)},
js
:
{
markers
:
state
.
js
.
markers
.
splice
(
jsMarkerIdx
,
1
)},
arm
:
{
markers
:
armMarkers
}
}
})
}
}
readInputCallBack
=
(
codeToEval
)
=>
{
readInputCallBack
=
(
codeToEval
)
=>
{
...
...
src/Comm.js
View file @
523483a6
...
@@ -22,10 +22,10 @@ export function astMetaToGraphData(astMeta) {
...
@@ -22,10 +22,10 @@ export function astMetaToGraphData(astMeta) {
function
generateMarkerObject
(
start
,
end
)
{
function
generateMarkerObject
(
start
,
end
)
{
return
{
return
{
startRow
:
start
.
lineNum
,
startRow
:
start
.
lineNum
-
1
,
startCol
:
start
.
charNum
,
startCol
:
start
.
charNum
,
endRow
:
end
.
lineNum
,
endRow
:
end
.
lineNum
-
1
,
endCol
:
end
.
charNum
,
endCol
:
end
.
charNum
-
1
,
className
:
"
ast-node-highlight
"
,
className
:
"
ast-node-highlight
"
,
type
:
"
text
"
type
:
"
text
"
}
}
...
@@ -49,8 +49,8 @@ function createGraphNode(node, astMeta){
...
@@ -49,8 +49,8 @@ function createGraphNode(node, astMeta){
name
:
name
,
name
:
name
,
attributes
:
{
value
:
value
},
attributes
:
{
value
:
value
},
highlighting
:
{
highlighting
:
{
wacc
:
generateMarkerObject
(
node
.
waccStart
,
node
.
waccEnd
),
wacc
:
[
generateMarkerObject
(
node
.
waccStart
,
node
.
waccEnd
)
]
,
js
:
typeof
node
.
jsStart
===
"
undefined
"
?
{}
:
generateMarkerObject
(
node
.
jsStart
,
node
.
jsEnd
),
js
:
typeof
node
.
jsStart
===
"
undefined
"
?
[
{}
]
:
[
generateMarkerObject
(
node
.
jsStart
,
node
.
jsEnd
)
]
,
arm
:
[]
arm
:
[]
},
},
children
:
children
children
:
children
...
...
src/view/ButonStrip.js
View file @
523483a6
...
@@ -9,8 +9,9 @@ class ButtonStrip extends React.Component {
...
@@ -9,8 +9,9 @@ class ButtonStrip extends React.Component {
render
()
{
render
()
{
return
(
return
(
<
div
>
<
div
>
<
Button
onClick
=
{
this
.
props
.
onCompileClick
}
>
▶
<
/Button
>
<
Button
onClick
=
{
this
.
props
.
onCompileClick
}
>
COMPILE
<
/Button
>
<
Button
onClick
=
{
this
.
props
.
onStepJsClick
}
>
STEP
JS
LINE
<
/Button
>
<
Button
onClick
=
{
this
.
props
.
onExecuteClick
}
>
EXECUTE
<
/Button
>
<
Button
onClick
=
{
this
.
props
.
onStepWaccClick
}
>
STEP
WACC
LINE
<
/Button
>
<
/div
>
<
/div
>
)
)
}
}
...
...
src/view/CodeEditor.js
View file @
523483a6
...
@@ -20,6 +20,9 @@ class CodeEditor extends React.Component {
...
@@ -20,6 +20,9 @@ class CodeEditor extends React.Component {
return
(
return
(
<
div
className
=
"
ace-editor
"
>
<
div
className
=
"
ace-editor
"
>
{
this
.
heading
()}
{
this
.
heading
()}
<
p
>
Highlighting
{
JSON
.
stringify
(
this
.
props
.
markers
)}
<
/p
>
<
AceEditor
<
AceEditor
mode
=
"
java
"
mode
=
"
java
"
theme
=
"
github
"
theme
=
"
github
"
...
...
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