Opened 19 months ago

Closed 9 months ago

#30953 closed defect (invalid)

Implicit line continuation in callable symbolic expression

Reported by: gh-jcamp0x2a Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: symbolics Keywords: line continuation symbolic expression preparser parentheses
Cc: strogdon, egourgoulhon, gh-kliem, slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues: close #4545?
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Reported in comment:19:ticket:30928

sage: f(x) = (x +  
....:         1)                                                                                    
  File "<ipython-input-10-ae23cb631161>", line 1
    __tmp__=var("x"); f = symbolic_expression((x + ).function(x)
                                                   ^
SyntaxError: invalid syntax

sage.repl.preparse.preparse_calculus needs to be modified to accommodate implicit line continuations such as inside parentheses, brackets, and braces.

Change History (16)

comment:1 Changed 19 months ago by strogdon

  • Cc strogdon added

comment:2 Changed 19 months ago by egourgoulhon

  • Cc egourgoulhon added

comment:3 Changed 19 months ago by egourgoulhon

I've just been struck by a silent failure (!) version of this bug. A minimal version is

sage: f(x) = 1/2*(1 + x 
....:             + x^2)                                                                            
sage: f                                                                                             
x |--> x^2 + 1/2*x + 1/2

This issue is present in Sage 9.1, 9.2 and 9.3.beta3.

comment:4 Changed 19 months ago by egourgoulhon

  • Priority changed from major to critical

Because this is a silent failure in an elementary operation.

comment:5 Changed 15 months ago by slelievre

  • Cc gh-kliem slelievre added

comment:6 Changed 15 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

comment:7 Changed 10 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

comment:8 Changed 10 months ago by gh-kliem

  • Authors set to Jonathan Kliem
  • Branch set to public/30953
  • Commit set to 72c89b14e7adf88cc188e43bf9b3899c4996f2b9
  • Dependencies set to #31951
  • Status changed from new to needs_review

Only works in the interactive shell so far and not when parsing *.sage files.


New commits:

d9c4e95fix completeness check for sage special syntax
72c89b1preparse implicit line continuations correctly in interactive shell

comment:9 Changed 9 months ago by gh-kliem

  • Status changed from needs_review to needs_work

I'm reworking the entire preparse now.

There is so much basic stuff that is just not working, e.g. line continuation for

sage: def foo():
....:     a = 2312334432134.factor()
Last edited 9 months ago by gh-kliem (previous) (diff)

comment:10 Changed 9 months ago by gh-kliem

  • Work issues set to close #4545?

comment:11 Changed 9 months ago by gh-kliem

  • Branch changed from public/30953 to public/31951
  • Commit changed from 72c89b14e7adf88cc188e43bf9b3899c4996f2b9 to bc8187324de61ff24581d665d4254214133d96f2

In https://trac.sagemath.org/ticket/31951#comment:42 I suggest a simple fix for #31951 and doing the more elaborate work here.


New commits:

9e7c480rework Sages input preparse, such that the syntax is valid after applying cleanup and token transformers
db167ddcorrect ticket number
9a5362aStylistic fixes
b465513Transfer doctests
3d86554Revert deprecations
fe36d2eMerge branch 'develop' into trac31951
5a7b172Remove unnecessary preparse_ipython
bc81873Fix a doctest failure

comment:12 Changed 9 months ago by gh-kliem

  • Authors changed from Jonathan Kliem to Jonathan Kliem, Kwankyu Lee

comment:13 Changed 9 months ago by gh-kliem

  • Branch changed from public/31951 to public/30953-new
  • Commit changed from bc8187324de61ff24581d665d4254214133d96f2 to e34168c0d17ee8a340570be2d5fa9c9f5674d071

Renamed the branch and added to commits.


New commits:

f7dbbcfdo not deprecate InterfaceShellTransformer
e34168cmake doctest stable

comment:14 Changed 9 months ago by klee

  • Authors Jonathan Kliem, Kwankyu Lee deleted
  • Branch public/30953-new deleted
  • Commit e34168c0d17ee8a340570be2d5fa9c9f5674d071 deleted
  • Milestone changed from sage-9.5 to sage-duplicate/invalid/wontfix
  • Status changed from needs_work to needs_review

Fixed in #31951.

comment:15 Changed 9 months ago by gh-kliem

  • Dependencies #31951 deleted
  • Status changed from needs_review to positive_review

This is fixed by #31951.

comment:16 Changed 9 months ago by mkoeppe

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.