softdevteam / eco Goto Github PK
View Code? Open in Web Editor NEWEditor for language composition
Editor for language composition
r"([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?"
should be the regular expression which is used to detect number or float literals.
Copy and paste
jumps
Token jumps
Select
Search
___________________________________________________________ Test_Undo.test_undo_random_insertdeleteundo_slow ___________________________________________________________
self = <test.test_eco.Test_Undo instance at 0x7fffc6247b90>
@slow
def test_undo_random_insertdeleteundo_slow(self):
> self.random_insert_delete_undo(programs.connect4)
test/test_eco.py:2175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_eco.py:2285: in random_insert_delete_undo
x = self.treemanager.key_delete()
treemanager.py:1011: in key_delete
self.delete_linebreak(self.cursor.line, node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <treemanager.TreeManager object at 0x7fffc129bd50>, y = 0, node = TextNode(Terminal(''\r''), 63, 0, <return>)
def delete_linebreak(self, y, node):
deleted = self.lines[y+1].node
> assert deleted is node
E assert TextNode(Terminal(''\r''), 63, 0, <return>) is TextNode(Terminal(''\r''), 63, 0, <return>)
treemanager.py:1462: AssertionError
------------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------------
self.treemanager.cursor_reset()
self.move(DOWN, 56)
self.move(RIGHT, 0)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 56)
self.move(RIGHT, 1)
self.treemanager.key_normal('u')
self.treemanager.cursor_reset()
self.move(DOWN, 56)
self.move(RIGHT, 4)
self.treemanager.key_normal('i')
self.treemanager.cursor_reset()
self.move(DOWN, 56)
self.move(RIGHT, 3)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 56)
self.move(RIGHT, 2)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 46)
self.move(RIGHT, 0)
self.treemanager.key_normal('\r')
self.treemanager.cursor_reset()
self.move(DOWN, 46)
self.move(RIGHT, 1)
self.treemanager.key_normal('!')
self.treemanager.cursor_reset()
self.move(DOWN, 46)
self.move(RIGHT, 3)
self.treemanager.key_normal('n')
self.treemanager.cursor_reset()
self.move(DOWN, 46)
self.move(RIGHT, 2)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 46)
self.move(RIGHT, 4)
self.treemanager.key_normal('a')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 4)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 3)
self.treemanager.key_normal('9')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 1)
self.treemanager.key_normal('(')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 2)
self.treemanager.key_normal('^')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 0)
self.treemanager.key_normal('.')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 50)
self.move(RIGHT, 1)
self.treemanager.key_normal('h')
self.treemanager.cursor_reset()
self.move(DOWN, 50)
self.move(RIGHT, 4)
self.treemanager.key_normal('}')
self.treemanager.cursor_reset()
self.move(DOWN, 50)
self.move(RIGHT, 0)
self.treemanager.key_normal('g')
self.treemanager.cursor_reset()
self.move(DOWN, 50)
self.move(RIGHT, 2)
self.treemanager.key_normal('n')
self.treemanager.cursor_reset()
self.move(DOWN, 50)
self.move(RIGHT, 3)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 60)
self.move(RIGHT, 4)
self.treemanager.key_normal(' ')
self.treemanager.cursor_reset()
self.move(DOWN, 60)
self.move(RIGHT, 2)
self.treemanager.key_normal('6')
self.treemanager.cursor_reset()
self.move(DOWN, 60)
self.move(RIGHT, 1)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 60)
self.move(RIGHT, 0)
self.treemanager.key_normal('o')
self.treemanager.cursor_reset()
self.move(DOWN, 60)
self.move(RIGHT, 3)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 44)
self.move(RIGHT, 2)
self.treemanager.key_normal('l')
self.treemanager.cursor_reset()
self.move(DOWN, 44)
self.move(RIGHT, 4)
self.treemanager.key_normal('y')
self.treemanager.cursor_reset()
self.move(DOWN, 44)
self.move(RIGHT, 0)
self.treemanager.key_normal('[')
self.treemanager.cursor_reset()
self.move(DOWN, 44)
self.move(RIGHT, 3)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 44)
self.move(RIGHT, 1)
self.treemanager.key_normal('5')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 17)
self.move(RIGHT, 4)
self.treemanager.key_normal('e')
self.treemanager.cursor_reset()
self.move(DOWN, 17)
self.move(RIGHT, 1)
self.treemanager.key_normal('v')
self.treemanager.cursor_reset()
self.move(DOWN, 17)
self.move(RIGHT, 2)
self.treemanager.key_normal('5')
self.treemanager.cursor_reset()
self.move(DOWN, 17)
self.move(RIGHT, 0)
self.treemanager.key_normal('d')
self.treemanager.cursor_reset()
self.move(DOWN, 17)
self.move(RIGHT, 3)
self.treemanager.key_normal('g')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 21)
self.move(RIGHT, 4)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 21)
self.move(RIGHT, 1)
self.treemanager.key_normal('7')
self.treemanager.cursor_reset()
self.move(DOWN, 21)
self.move(RIGHT, 0)
self.treemanager.key_normal(')')
self.treemanager.cursor_reset()
self.move(DOWN, 21)
self.move(RIGHT, 3)
self.treemanager.key_normal('&')
self.treemanager.cursor_reset()
self.move(DOWN, 21)
self.move(RIGHT, 2)
self.treemanager.key_normal('j')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 3)
self.treemanager.key_normal('y')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 1)
self.treemanager.key_normal('\r')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 0)
self.treemanager.key_normal('\r')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 4)
self.treemanager.key_normal('4')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 2)
self.treemanager.key_delete()
=========================================================== 1 failed, 84 passed, 8 skipped in 91.86 seconds ============================================================
The compilation functions used in PyHyp now accept additional arguments which allow the editor to feedback information which can later be used in the VM for backtraces. Although the VM could figure this stuff out itself at runtime, it is more convenient for the editor to supply this info as it already knows this ahead of time.
For the functions:
compile_py_func_global
compile_py_func
compile_py_meth
compile_php_func
eco should pass two additional arguments:
filename
-- the filename in which the language box appears.line_offset
-- the line number in filename
in which the language box appears.This is required for the PyHyp paper.
Many thanks
Users should have the possibility to create their own key bindings in eco.
In a prolog box, if you type:
p(X, Y) % this is a call to p
Then everything after and including the percent is invisible.
Spoke with Lukas, apparently the % is being considered a whitespace character, and these are not drawn to improve performance.
Cheers
In the presence of many language boxes it can be really hard to know which box you are in. Although the boxes are different colours:
We discussed putting a dashed border around the current box, whilst also colouring other boxes, but there may be issues with this.
Situation where colours are too subtle:
https://farm1.staticflickr.com/378/19751307154_2387137aa5_o.png
Example of dashed box idea:
https://farm4.staticflickr.com/3720/19753494503_2a8db22524_o.png
Hope this helps, Thanks
When loading an eco file the first undo doesn't work.
The overlay currently assumes that every line in the current document has the same height. This isn't always true, and it certainly isn't true if some of the language boxes contain images.
When a user changes their settings, the current behaviour of all open file / directory dialogs is to open in the CWD. If the user has already bound a setting to some/very/very/very/very/long/path/executable
it would be nicer to open the file / directory dialog directory some/very/very/very/very/long/path/
For now, we will assume that any Python file the user wants to debug is contained within one file, but it would be nice to extend this so that the user can debug multi-file programs.
Load Eco and press Ctrl-L immediately (don't create a file first!):
Traceback (most recent call last):
File "eco.py", line 814, in show_lbox_menu
self.getEditor().showLanguageBoxMenu()
AttributeError: 'NoneType' object has no attribute 'showLanguageBoxMenu'
When text is selected, it should be overwritten when typing.
=============================================== test session starts ===============================================
platform linux2 -- Python 2.7.11 -- py-1.4.31 -- pytest-2.7.1
rootdir: /home/snim2/Desktop/working/softdev/eco/lib/eco/test, inifile:
plugins: hypothesis, xdist, cov
collected 121 items
test/test_eco.py ..........ssssssss...................................................................................F...................
==================================================== FAILURES =====================================================
___________________________________ Test_Undo.test_undo_random_insertdeleteundo ___________________________________
self = <test.test_eco.Test_Undo instance at 0x7f20034b7a70>
def test_undo_random_insertdeleteundo(self):
> self.random_insert_delete_undo(programs.pythonsmall)
test/test_eco.py:2138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_eco.py:2228: in random_insert_delete_undo
self.text_compare(program)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test.test_eco.Test_Undo instance at 0x7f20034b7a70>
original = ['class X:', ' def helloworld(x, y, z):', ' for x in range(0, 10):', ' if x == 1:', ' return 1', ' else:', ...]
def text_compare(self, original):
original = original.replace("\r", "").split("\n")
current = self.treemanager.export_as_text("/dev/null").replace("\r", "").split("\n")
for i in xrange(len(current)):
> assert original[i] == current[i]
E assert ' y = 2' == '&e ( { ! y = 2'
E - y = 2
E + &e ( { ! y = 2
test/test_eco.py:1620: AssertionError
---------------------------------------------- Captured stdout call -----------------------------------------------
self.treemanager.cursor_reset()
self.move(DOWN, 1)
self.move(RIGHT, 0)
self.treemanager.key_normal(' ')
self.treemanager.cursor_reset()
self.move(DOWN, 1)
self.move(RIGHT, 3)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 1)
self.move(RIGHT, 2)
self.treemanager.key_normal('y')
self.treemanager.cursor_reset()
self.move(DOWN, 1)
self.move(RIGHT, 4)
self.treemanager.key_normal('*')
self.treemanager.cursor_reset()
self.move(DOWN, 1)
self.move(RIGHT, 1)
self.treemanager.key_normal('0')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 2)
self.move(RIGHT, 3)
self.treemanager.key_normal('a')
self.treemanager.cursor_reset()
self.move(DOWN, 2)
self.move(RIGHT, 4)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 2)
self.move(RIGHT, 2)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 2)
self.move(RIGHT, 1)
self.treemanager.key_normal('k')
self.treemanager.cursor_reset()
self.move(DOWN, 2)
self.move(RIGHT, 0)
self.treemanager.key_normal('t')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 13)
self.move(RIGHT, 1)
self.treemanager.key_normal('k')
self.treemanager.cursor_reset()
self.move(DOWN, 13)
self.move(RIGHT, 2)
self.treemanager.key_normal('&')
self.treemanager.cursor_reset()
self.move(DOWN, 13)
self.move(RIGHT, 0)
self.treemanager.key_normal('u')
self.treemanager.cursor_reset()
self.move(DOWN, 13)
self.move(RIGHT, 4)
self.treemanager.key_normal('\r')
self.treemanager.cursor_reset()
self.move(DOWN, 13)
self.move(RIGHT, 3)
self.treemanager.key_normal('w')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 4)
self.move(RIGHT, 1)
self.treemanager.key_normal('*')
self.treemanager.cursor_reset()
self.move(DOWN, 4)
self.move(RIGHT, 2)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 4)
self.move(RIGHT, 4)
self.treemanager.key_normal('!')
self.treemanager.cursor_reset()
self.move(DOWN, 4)
self.move(RIGHT, 3)
self.treemanager.key_normal('9')
self.treemanager.cursor_reset()
self.move(DOWN, 4)
self.move(RIGHT, 0)
self.treemanager.key_normal('x')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 12)
self.move(RIGHT, 4)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 12)
self.move(RIGHT, 1)
self.treemanager.key_normal('q')
self.treemanager.cursor_reset()
self.move(DOWN, 12)
self.move(RIGHT, 0)
self.treemanager.key_normal(':')
self.treemanager.cursor_reset()
self.move(DOWN, 12)
self.move(RIGHT, 2)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 12)
self.move(RIGHT, 3)
self.treemanager.key_normal('l')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 2)
self.treemanager.key_normal('q')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 3)
self.treemanager.key_normal('d')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 4)
self.treemanager.key_normal('z')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 1)
self.treemanager.key_normal(')')
self.treemanager.cursor_reset()
self.move(DOWN, 0)
self.move(RIGHT, 0)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 10)
self.move(RIGHT, 2)
self.treemanager.key_normal('y')
self.treemanager.cursor_reset()
self.move(DOWN, 10)
self.move(RIGHT, 4)
self.treemanager.key_normal('q')
self.treemanager.cursor_reset()
self.move(DOWN, 10)
self.move(RIGHT, 0)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 10)
self.move(RIGHT, 3)
self.treemanager.key_normal('+')
self.treemanager.cursor_reset()
self.move(DOWN, 10)
self.move(RIGHT, 1)
self.treemanager.key_normal('!')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 3)
self.move(RIGHT, 2)
self.treemanager.key_normal('5')
self.treemanager.cursor_reset()
self.move(DOWN, 3)
self.move(RIGHT, 0)
self.treemanager.key_normal('+')
self.treemanager.cursor_reset()
self.move(DOWN, 3)
self.move(RIGHT, 4)
self.treemanager.key_normal('+')
self.treemanager.cursor_reset()
self.move(DOWN, 3)
self.move(RIGHT, 1)
self.treemanager.key_normal('v')
self.treemanager.cursor_reset()
self.move(DOWN, 3)
self.move(RIGHT, 3)
self.treemanager.key_normal('=')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 7)
self.move(RIGHT, 3)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 7)
self.move(RIGHT, 2)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 7)
self.move(RIGHT, 0)
self.treemanager.key_normal('g')
self.treemanager.cursor_reset()
self.move(DOWN, 7)
self.move(RIGHT, 4)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 7)
self.move(RIGHT, 1)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 5)
self.move(RIGHT, 0)
self.treemanager.key_ctrl_z()
self.treemanager.cursor_reset()
self.move(DOWN, 5)
self.move(RIGHT, 3)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 5)
self.move(RIGHT, 4)
self.treemanager.key_normal('0')
self.treemanager.cursor_reset()
self.move(DOWN, 5)
self.move(RIGHT, 2)
self.treemanager.key_normal(')')
self.treemanager.cursor_reset()
self.move(DOWN, 5)
self.move(RIGHT, 1)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 6)
self.move(RIGHT, 0)
self.treemanager.key_normal('%')
self.treemanager.cursor_reset()
self.move(DOWN, 6)
self.move(RIGHT, 4)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 6)
self.move(RIGHT, 3)
self.treemanager.key_normal('c')
self.treemanager.cursor_reset()
self.move(DOWN, 6)
self.move(RIGHT, 1)
self.treemanager.key_normal('9')
self.treemanager.cursor_reset()
self.move(DOWN, 6)
self.move(RIGHT, 2)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 8)
self.move(RIGHT, 1)
self.treemanager.key_normal(']')
self.treemanager.cursor_reset()
self.move(DOWN, 8)
self.move(RIGHT, 3)
self.treemanager.key_normal('{')
self.treemanager.cursor_reset()
self.move(DOWN, 8)
self.move(RIGHT, 4)
self.treemanager.key_normal('l')
self.treemanager.cursor_reset()
self.move(DOWN, 8)
self.move(RIGHT, 0)
self.treemanager.key_normal('c')
self.treemanager.cursor_reset()
self.move(DOWN, 8)
self.move(RIGHT, 2)
self.treemanager.key_delete()
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 9)
self.move(RIGHT, 0)
self.treemanager.key_delete()
self.treemanager.cursor_reset()
self.move(DOWN, 9)
self.move(RIGHT, 3)
self.treemanager.key_normal('f')
self.treemanager.cursor_reset()
self.move(DOWN, 9)
self.move(RIGHT, 1)
self.treemanager.key_normal('h')
self.treemanager.cursor_reset()
self.move(DOWN, 9)
self.move(RIGHT, 2)
self.treemanager.key_normal('1')
self.treemanager.cursor_reset()
self.move(DOWN, 9)
self.move(RIGHT, 4)
self.treemanager.key_normal('v')
self.treemanager.undo_snapshot()
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 0)
self.treemanager.key_normal('&')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 4)
self.treemanager.key_normal('!')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 3)
self.treemanager.key_normal('{')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 2)
self.treemanager.key_normal('(')
self.treemanager.cursor_reset()
self.move(DOWN, 11)
self.move(RIGHT, 1)
self.treemanager.key_normal('e')
self.treemanager.undo_snapshot()
================================ 1 failed, 112 passed, 8 skipped in 146.04 seconds ================================
$
When pasting code the evaluation of the tree is not updated. The same happens when new code is pasted into eco.
Grammars written in Eco don't currently allow comments. Comments would be handy tho.
Eco doesn't seem to draw quite properly at HDPI resolutions (I'm running at 2560x1440):
The main annoyance is that the font baseline is incorrect: note the "y" (and the brackets!) spill below the language box. It looks to me like the y
offset of the language box is incorrect.
A minor annoyance is that the start and end brackets for the language box are indeed a pixel wide -- which at this resolution means that they're almost invisible.
If the cursor is on the 0th column of a line, pressing the left arrow key should move the cursor to the right-hand side of the right-most node on the line above.
If the cursor is on the right-hand side of the right-most node on a line, pressing the right arrow key should move the cursor to the 0th column of the line below.
This is not a major bug and probably a WONTFIX for version 1, but I thought it was worth documenting.
When I run through the tutorial I get line numbers that run from 1--9
and then line 0
below that. When I add another newline the gutter that contains the line numbers expands a little and I can see 10
where there used to be a 0
and 11
renders correctly.
Example:
$y = array(1,2,
$x = [x ** 2 for x in y.as_list()];
I presume that the error is the language box itself. The correct syntax would be:
$y = array(1,2,
$x = [x ** 2 for x in y.as_list()]);
The term $x = is treated as an argument.
Is this an error in the drawing or the parser?
$x = SELECT FOO FROM BAR
Search for x = SELECT
should return a result.
When on the first line of the file pressing the up key should jump to the start of the file. Same for the last line and the down key.
Also, up and down keys should not alter the x position of the cursor. Thus the cursor should jump from 2
to 1
to 2
in this example:
1 2|3
1|
1 2|3
The "export" functions for polyglot languages often depend on environment variables being set. It would be nicer for the user if these could be set in a separate tab of the settings dialog.
s = "abcr def"
should be
s = "abc
def"
and show an error
Some recent commits have broken the heatmap visualisation. This is partly because some external paths an binaries are set via the Settings dialog and some are not.
E.g. if I try to insert a pound sign:
File "/home/edd/research/eco/lib/eco/nodeeditor.py", line 608, in keyPressEvent
self.tm.key_normal(text)
File "/home/edd/research/eco/lib/eco/treemanager.py", line 711, in key_normal
if str(text).startswith("\r"):
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in range(128)
Bring code base up to date with changing Python style conventions by using .format()
rather than %
for string substitution.
When some text is selected the left and right keys should jump to the start or end of the selection. Currently it jumps to the next/previous character instead.
Pressing up should jump a line upwards, but taking the start of the selection as reference.
With the merge of #20, comments are not highlighted properly any more, as the highlighter only works on tokens. For the new comments, we need to make it work on nonterminals including their children.
!=
, !==
It would be useful to have the current line highlighted, but for debugging, this can be used to track which line the debugger is currently executing (we can do this just by moving the cursor).
Making this work with Eco themes might need some thought.
Rather than (or in addition to) displaying an AST in GraphViz, it would be nice to have something like the "outline" view in Eclipse, i.e. a QTreeView on the RHS of the editor, which shows a foldable outline of the AST. With an outline view, we could annotate both the outline and the editable AST in the main pane with different runtime information.
/cc @ltratt @ptersilie
require 'foobar'
require_relative 'foobar'
include 'foobar'
tr = zr*zr - zi*zi + cr
in this program fails to parse: http://android-scripting.googlecode.com/svn/trunk/jruby/src/bench/shootout/mandelbrot.rubydef fibonacci( n )
return n if ( 0..1 ).include? n
( fibonacci( n - 1 ) + fibonacci( n - 2 ) )
end
puts fibonacci( 5 )
def fib(n)
n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] }
end
fib(10)
a = []; a[0] = 1; a[1] = 1
i = 1
while i < 1000000
a[i+1] = (a[i] + a[i-1])%1000000007
i += 1
end
puts a[n]
puts (-20..20).map{|y|(-40..20).map{|x|z=0;32.times{z=z*z+Complex(x,y)/2e1};z.abs<2??*:' '}*''}
require 'complex'
def mandelbrot(a)
Array.new(50).inject(0) { |z,c| z*z + a }
end
(1.0).step(-1,-0.05) do |y|
(-2.0).step(0.5,0.0315) do |x|
print mandelbrot(Complex(x,y)).abs < 2 ? '*' : ' '
end
puts
end
Both Python and Javascript allow to write numbers in binary, octal and hex format:
a = 0b01
b = 0777
c = 0xc0ffe
This issue documents some problems with the Ruby parser.
$i = 0
$num = 5
begin
puts("Inside the loop i = #$i" )
$i +=1
end while $i < $num
$i = 0
$num = 5
until $i > $num do
puts("Inside the loop i = #$i" )
$i +=1;
end
$i = 0
$num = 5
begin
puts("Inside the loop i = #$i" )
$i +=1;
end until $i > $num
for i in 0..5
puts "Value of local variable is #{i}"
end
(0..5).each do |i|
puts "Value of local variable is #{i}"
end
This issue report is based on the code given in TUTORIAL
, which Eco shows to be correctly parsed.
Steps to reproduce:
TUTORIAL
Traceback is:
$ Traceback (most recent call last):
File "eco.py", line 265, in showWholeGraph
self.viewer.create_pydot_graph(editor.tm.get_mainparser().graph)
File "/home/snim2/Desktop/working/snim2/eco/lib/eco/viewer.py", line 170, in create_pydot_graph
if isinstance(node, AstNode):
AttributeError: 'NoneType' object has no attribute 'state_sets'
SL seems to have comments:
and the SL interpreter handles these correctly, but Eco tells me that any program with comments is syntactically incorrect.
Example:
$ cat sl_tests.sl
function main() {
// A comment
/* A multiline comment */
println("Hello, world!");
}
$ ../../mx/mx sl sl_tests.sl
Hello, world!
$
We briefly discussed renaming the classes in editor.py
to something like:
to clarify the different roles of the code in editor.py
and editortab.py
.
If everyone is happy with that nomenclature I'll raise a PR to resolve this issue.
If I make a new Python 2.7.5
file, type in a basic Python program, go to "view > tree", then enable "show tree" and then click on "AST", I get this error:
Traceback (most recent call last):
File "eco.py", line 194, in refresh
self.redraw()
File "eco.py", line 205, in redraw
self.viewer.get_tree_image(editor.tm.main_lbox, [], whitespaces, version=int(self.ui.comboBox.currentText()), ast=True)
File "/home/ltratt/src/eco/lib/eco/viewer.py", line 77, in get_tree_image
self.add_node_to_tree(tree, graph, whitespaces, restrict_nodes, ast, version)
File "/home/ltratt/src/eco/lib/eco/viewer.py", line 153, in add_node_to_tree
c_node = self.add_node_to_tree(node.symbol.parser, graph, whitespaces, restrict_nodes, ast, version)
File "/home/ltratt/src/eco/lib/eco/viewer.py", line 145, in add_node_to_tree
c_node = self.add_node_to_tree(c, graph, whitespaces, restrict_nodes, ast, version)
File "/home/ltratt/src/eco/lib/eco/viewer.py", line 145, in add_node_to_tree
c_node = self.add_node_to_tree(c, graph, whitespaces, restrict_nodes, ast, version)
File "/home/ltratt/src/eco/lib/eco/viewer.py", line 113, in add_node_to_tree
if node.indent:
File "/home/ltratt/src/eco/lib/eco/grammar_parser/bootstrap.py", line 502, in __getattribute__
return object.__getattribute__(self, name)
AttributeError: 'AstNode' object has no attribute 'indent'
Copy and paste currently takes a sequence of selected nodes and converts them to text before pasting. It would be preferable to copy and paste the nodes directly. Care needs to be taken with language boxes.
/cc @ltratt @ptersilie
1/2
1.2
;var _ = 3
;var $ = 4
;var $_$ = 5
;var x = 6 > 7
;bin/eco file1.py file2.php
At present, there are a small number of external tools whose data is visualised in Eco. Each one is hard-coded.
In the future it would be preferable to add new tools without having to interact with the other Eco classes. It would also be nice for the user to be able to choose whether or not to use each available tool with each document they have open.
To achieve this, a plugin API should be created, to allow tool vendors to add Eco support for their tools. This should use the eco.incparser.annotation
classes and as little other code as possible.
When shift
on its own is pressed, it deselects the current selection.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.