connorferster / handcalcs

Python library for converting Python calculations into rendered latex.
Apache License 2.0
5.59k stars 427 forks source link

Bug: Indented comment after calcs causes error. #172

Open sebanalysis opened 1 year ago

sebanalysis commented 1 year ago

Input:

%%render
a = 1
 #

Error:

ParseException: Expected == | = | + | - | * | // | / | % | , | <= | < | >= | > | != term, found end of text  (at char 1), (line:1, col:2)

This is a common issue when using a decorator, when there are indented comments after the return. Although this is only if the comment indent is >= 4 spaces The following causes a time sapping mystery error because nothing is wrong with the function itself.

@handcalcs.decorator.handcalc()
def test():
    B = 1
    return B

    #

test()