if num == 1:
print(num, "is not a prime number")
elif num > 1:
check for factors
for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
print(i,"times",num//i,"is",num)
break
else:
print(num,"is a prime number")
**Expected result**
1. Keyword 'print' should be highlighted
2. Python syntax should be identified and highlighted correctly
**Actual result**
Syntax highlighting is not correct:
<img width="373" alt="ScreenShot 2024-04-01 at 13 27 02 " src="https://github.com/dandavison/delta/assets/7710361/977c2d70-7122-48f1-97e5-3acba4c2483c">
The code after comment tag "#" is treated as comment as well
***Others***
1. It seems shell script which uses "#" for comment as Python has the same issue
2. As for other comment tag ("//", e.g.), works correctly
Please let me know if more verifications required and thanks for the assistance.
Environment
Test steps
To take input from the user
num = int(input("Enter a number: "))
if num == 1: print(num, "is not a prime number") elif num > 1:
check for factors
for i in range(2,num): if (num % i) == 0: print(num,"is not a prime number") print(i,"times",num//i,"is",num) break else: print(num,"is a prime number")
if input number is less than
or equal to 1, it is not prime
else: print(num,"is not a prime number")
command rg --no-config -C 2 print ./test.py --json | delta --syntax-theme="Nord"