Skip to content

Escape sequences should be treated as single characters. #1695

@faze-geek

Description

@faze-geek

Realized this while working on #1589
Escape sequences are treated as 2 characters of a string in Lpython unlike in python. Although it is a small block and the if condition can be modified accordingly for the pull request, it should be corrected.

A minimal example is this -

def f():
    print(len("\t"))        # Single character for tab space
    print(len("\n"))        # Single character for new line
    print(len("\0"))        # Single character for null
    
f()

(lp) C:\Users\kunni\lpython>python try.py
1
1
1

(lp) C:\Users\kunni\lpython>src\bin\lpython try.py
2
2
2


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions