Bug 401893

Summary: Octave backend can't finished an execution of expression only from comments
Product: [Applications] cantor Reporter: Nikita Sirgienko <warquark>
Component: octave-backendAssignee: Alexander Semke <alexander.semke>
Status: RESOLVED FIXED    
Severity: normal CC: alexanderrieder
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 19.04

Description Nikita Sirgienko 2018-12-08 16:36:05 UTC
SUMMARY
Current logic don't handle this situation very well, because for a expression only from comments index of prompt doesn't increase and we don't expect it.
Regexp will not handle this very well, so I think, we need use Octave include files, create Octave AST from command and check, that the AST not from comment only (using embedded octave could be useful for Octave backend at all, not only in this situation).

STEPS TO REPRODUCE
1. Open Octave worksheet
2. Add command entry with only comments, like "#Comment"
3. Run the entry

OBSERVED RESULT
The entry never finished.
But we could interrupt the expression or restart Backend.

EXPECTED RESULT
The entry finished without output.
Comment 1 Nikita Sirgienko 2019-03-14 21:47:20 UTC
Git commit 87afb9441dde48165312d5bad6405cab259c407f by Nikita Sirgienko.
Committed on 14/03/2019 at 21:42.
Pushed by sirgienko into branch 'master'.

[Octave] Some fixes
  - Fix problem with comment in multiline octave command
  - Fix bug with empty command, which never finish execution
FIXED-IN: 19.04

M  +27   -0    src/backends/octave/octaveexpression.cpp
M  +1    -1    src/backends/octave/octavesession.cpp
M  +23   -3    src/backends/octave/testoctave.cpp
M  +1    -0    src/backends/octave/testoctave.h

https://commits.kde.org/cantor/87afb9441dde48165312d5bad6405cab259c407f
Comment 2 Nikita Sirgienko 2019-03-14 21:49:15 UTC
Simple state machine (three states: code, string, comment), which remove all comments from user command enough for solving this problem.