Page 1 of 1

Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 10 May 2018, 22:14
by Admin
Parmi les calculatrices proposant la programmation Python pour la rentrée 2018, seule la Casio Graph 90+E proposait à date un éditeur avec coloration syntaxique du code.

Mais les choses vont changer. ;)
zardam vient de soumettre un ajout au code source de la calculatrice NumWorks qui active enfin la coloration syntaxique dans l'éditeur, et NumWorks a dit que ce serait intégré :bj:

Toutefois malheureusement, il n'a pas été diffusé de firmware (ni simulateur) modifié qui en découle. Donc si tu veux en profiter dès maintenant, il va falloir soit que tu te compiles toi-même le code, soit que tu attendes que NumWorks intègre l'ajout en question.


Source : https://github.com/numworks/epsilon/pull/435 via viewtopic.php?f=100&t=21411#p230739

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 11 May 2018, 01:43
by compsystems
Ideas:

1: About coloring should also be done on mathematical expressions, ie coloring variables of one color, numbers of another, operators of another.

2: The ti-nspire is the first calculator that displays the math expressions in bidimensional format 2D or pretty print on a program :o, we hope that in the near future it will also be implemented in numworks.

Good ideas?

Image


interpreting long expressions in linear format 1D is very tedious

Image

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 12 May 2018, 08:57
by zardam
compsystems wrote:1: About coloring should also be done on mathematical expressions, ie coloring variables of one color, numbers of another, operators of another.


This is just my personal opinion, but I think that too much colors decrease the readability of the code. You focus more on the color than on the actual meaning of the code.

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 12 May 2018, 12:51
by Adriweb
A more advanced syntax highlighting "algorithm" (even better if "semantic highlighting", in fact that's what I use on my IDEs, and I couldn't do without it) is doable and preferable, but probably not on such screens and platforms, as zardam said.

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 12 May 2018, 15:32
by compsystems
zardam wrote:This is just my personal opinion, but I think that too much colors decrease the readability of the code. You focus more on the color than on the actual meaning of the code.


on the contrary, in complex mathematical expressions, making differences between operators and operands allows identifying the parts and subparts thereof.

In addition to highlighting, visualization in prettyprint is also required, since we are programming algorithms that involve mathematical expressions beyond arithmetic expressions.

I think that the highlighter should be configurable, that is, the user can customize the color, and which parts he wants to be highlighted

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 04 Jun 2018, 15:13
by Adriweb
Romain Goyet a repris/amélioré/nettoyé la version de Zardam utilisant le lexer de micropython, et c'est désormais mergé (ainsi que micropython 1.9.4, entre autre) :)

Le thème de couleur choisi correspond à celui présent sur le workshop:

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 16 Jun 2018, 11:47
by critor
@zardam

Comment as-tu fait pour sélectionner du texte dans l'éditeur ? :o
Image

Merci. :)

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 16 Jun 2018, 12:26
by Adriweb
C’est une indication des parenthèses selon le curseur en fait, pas une sélection.

Re: Ajout coloration syntaxique éditeur Python NumWorks

Unread postPosted: 16 Jun 2018, 12:44
by critor
Ah, dommage. :p

Merci.