rjdbcm / Aspidites

The reference implementation of the Woma Programming Language compiler.
http://aspidites.org
GNU General Public License v3.0
2 stars 1 forks source link

Unary ops don't get caught during parsing. #34

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 3 years ago

Unary ops don't get caught during parsing.

https://github.com/rjdbcm/Aspidites/blob/5f0640ef07b1a6cc13cbd2306d7a8ca84ea336b9/Aspidites/parser/convert.py#L47


            if expr.count(end) > 1:
                expr = "Maybe(SafeMod, " + expr
            continue
        # TODO Unary ops don't get caught during parsing.
        elif '-' in expr and expr.count('-') % 2 == 0:
            expr = "Maybe(SafeUnaryAdd, " + expr.replace("+", '') + end
            continue
        elif '-' in expr and expr.count('-') % 2 == 1:
            expr = "Maybe(SafeUnarySub, " + expr.replace("-", '') + end
            continue
        elif '+' in expr:
            expr = "Maybe(SafeUnaryAdd, " + expr.replace("+", '') + end
            continue
    return expr

a8613140e182fa43e123b339fb24c6ae5114de38

github-actions[bot] commented 2 years ago

Closed in 0b47657aecaff5cb24abe34b2bd6c4fd1da7d2dc