Bug 120413 - LibreLogo: handle complex expressions
Summary: LibreLogo: handle complex expressions
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.2.0
Keywords:
Depends on:
Blocks: LibreLogo
  Show dependency treegraph
 
Reported: 2018-10-08 13:48 UTC by László Németh
Modified: 2018-11-05 15:49 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description László Németh 2018-10-08 13:48:48 UTC
Heuristic Logo->Python precompiler of LibreLogo often doesn't handle complex expressions correctly, also with the suggested extra parentheses. 

For example

PRINT RANDOM [1, 2] * RANDOM [3, 4]

results compiling error.

We need a plausible syntax for expressions and fast precompiling to handle Python lists and other complex expressions in LibreLogo function arguments etc.
Comment 1 Commit Notification 2018-11-05 15:47:05 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/740b99783b5480fcd1e5fce7c1beb5967d015041%5E%21

tdf#120413 LibreLogo: handle complex Logo expressions

It will be available in 6.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 László Németh 2018-11-05 15:49:56 UTC
Fixed for Logo functions (default and newly defined ones) and for newly defined procedures, also for the default PRINT procedure:

    tdf#120413 LibreLogo: handle complex Logo expressions
    
    Instead of the incomplete heuristic parenthesis expansion,
    now expressions with Logo functions and with own
    procedures are parsed completely, solving several issues
    with complex Logo expressions. For example, now functions with
    more than 1 argument don't need explicit parenthesization.
    
    NOTE: to handle both Logo and Python syntaxes of function calls,
    we differentiate the forms "f(x)" and "f (x)". The second form
    is handled as Logo syntax, not the Python one:
    
    f x*2 y z     -> f(x*2, y, z)
    f(x*2, x, z)  -> f(x*2, y, z)
    f (x*2) y z   -> f((x*2), y, z)
    
    so if you want to avoid of the following expansion:
    
    sin 45 + cos 45   -> sin(45 + cos(45))
    
    it's possible to use the following parenthesizations:
    
    sin(45) + cos 45  -> sin(45) + cos(45)
    (sin 45) + cos 45 -> (sin(45)) + cos(45)
    
    but not
    
    sin (45) + cos 45 -> sin((45) + cos(45))