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
5b6a75f5
Commit
5b6a75f5
authored
Mar 13, 2020
by
Raghav Khanna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle larger blocks
parent
84d4becc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
public/index.html
public/index.html
+1
-1
src/App.js
src/App.js
+16
-7
src/Comm.js
src/Comm.js
+3
-3
No files found.
public/index.html
View file @
5b6a75f5
...
...
@@ -15,7 +15,7 @@
// Fixes for printing with new lines.
let
waccPrintingBuffer
=
""
function
waccPrint
(
str
)
{
printing_b
uffer
+=
str
waccPrintingB
uffer
+=
str
}
function
waccPrintLn
(
str
)
{
...
...
src/App.js
View file @
5b6a75f5
...
...
@@ -9,7 +9,7 @@ import Terminal from 'terminal-in-react';
import
Card
from
"
./components/Card/Card.js
"
;
import
CardBody
from
"
./components/Card/CardBody.js
"
;
import
{
sendWaccCode
,
astMetaToGraphData
}
from
'
./Comm
'
import
{
sendWaccCode
,
astMetaToGraphData
,
highlightNode
}
from
'
./Comm
'
import
GridItem
from
"
./components/Grid/GridItem
"
;
import
GridContainer
from
"
./components/Grid/GridContainer
"
;
...
...
@@ -117,19 +117,28 @@ class App extends React.Component {
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.
"
);
let
jsLines
=
this
.
state
.
js
.
code
.
split
(
"
\n
"
);
let
startLine
=
current
.
highlighting
.
js
[
0
].
startRow
;
let
endLine
=
current
.
highlighting
.
js
[
0
].
endRow
;
let
codeLine
=
""
;
if
(
startLine
==
endLine
){
codeLine
=
jsLines
[
startLine
];
}
else
{
for
(
let
i
=
startLine
;
i
<
endLine
;
i
++
){
codeLine
=
codeLine
.
concat
(
jsLines
[
i
],
"
\n
"
)
}
}
codeLine
=
codeLine
.
replace
(
"
let
"
,
"
window.
"
);
eval
(
codeLine
);
;
let
newIndex
=
this
.
state
.
statementIndex
+
1
;
// let highlightData = highlightNode(current);
this
.
setState
({
currentNode
:
this
.
state
.
mainStatements
[
newIndex
],
statementIndex
:
newIndex
})
}
else
{
eval
(
"
waccPrintFinished()
"
);
eval
(
"
waccPrintingBuffer =
\"\"
"
)
console
.
log
(
"
Finished executing code
"
)
}
};
...
...
src/Comm.js
View file @
5b6a75f5
...
...
@@ -12,7 +12,7 @@ export function astMetaToGraphData(astMeta) {
function
generateMarkerObject
(
start
,
end
,
off
=
0
,
style
=
"
ast-node-highlight
"
)
{
return
{
startRow
:
start
.
lineNum
-
1
,
startCol
:
start
.
charNum
+
off
,
startCol
:
start
.
charNum
,
endRow
:
end
.
lineNum
-
1
,
endCol
:
end
.
charNum
,
className
:
style
,
...
...
@@ -24,7 +24,7 @@ function generateArmMarkers(lineNums, style = "ast-node-highlight") {
return
lineNums
.
map
(
ln
=>
({
startRow
:
ln
-
1
,
className
:
style
,
type
:
"
background
"
}))
}
function
highlightNode
(
node
,
style
=
"
ast-node-highlight
"
)
{
export
function
highlightNode
(
node
,
style
=
"
ast-node-highlight
"
)
{
return
{
wacc
:
[
generateMarkerObject
(
node
.
waccStart
,
node
.
waccEnd
,
style
)],
js
:
typeof
node
.
jsStart
===
"
undefined
"
?
[{}]
:
[
generateMarkerObject
(
node
.
jsStart
,
node
.
jsEnd
,
-
1
,
style
)],
...
...
@@ -64,7 +64,7 @@ export async function sendWaccCode(code) {
})
.
catch
(
error
=>
{
if
(
typeof
error
.
response
.
data
.
errors
!==
"
undefined
"
)
{
var
errors
=
error
.
response
.
data
.
errors
;
let
errors
=
error
.
response
.
data
.
errors
;
for
(
let
entry
of
errors
.
keys
())
{
console
.
log
(
errors
[
entry
])
}
...
...
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