Skip to content

Commit 94550a8

Browse files
committed
الٹا کو ٹھیک
1 parent 3ee9bdb commit 94550a8

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

samples/مشروط۔پای

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
ورنہاگر کچھ == ۲:
66
چھاپ("دنیا")
77
ورنہ:
8-
چھاپ("سمجھ نہیں آئی۔۔۔")
8+
چھاپ("سمجھ نہیں آئی۔۔۔")

src/lex.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def t_ID(t):
240240

241241
t.type = reserved.get(t.value,'ID') # Check for reserved words
242242

243-
243+
print ("looking for error:", t.type, ", ", t.value)
244244

245245
# ------------- Debugging ---------------
246246
# print ("Type is:", t.type)
@@ -272,13 +272,19 @@ def t_ID(t):
272272
# Error handling rule
273273
def t_error(t):
274274
# ------------- Debugging ---------------
275-
# print("Illegal character '%s'" % t.value[0])
275+
print("Illegal character '%s'" % t.value[0])
276276
# ------------- Debugging ---------------
277277

278-
t.value = unidecode(t.value[0])
278+
if args["reverse"] is False:
279+
t.value = unidecode(t.value[0])
280+
else:
281+
t.value = t.value[0]
282+
279283
t.lexer.skip(1)
280284

285+
281286
# ------------- Debugging ---------------
287+
# print("Now becomes '%s'" % t.value[0])
282288
# print("still keeping it tho")
283289
# ------------- Debugging ---------------
284290

@@ -331,13 +337,17 @@ def t_COMMENT(t):
331337
"،": ",",
332338
}
333339

340+
print ("normal:", dots_and_stuff)
341+
334342
if args["reverse"]:
335343
dots_and_stuff = {value:key for key, value in dots_and_stuff.items()}
336-
# print ("Reversed:", reserved)
344+
print ("Reversed:", dots_and_stuff)
337345

338346
for key, value in dots_and_stuff.items():
339347
code = code.replace(key, value)
340348

349+
print ("Code is,\n", code)
350+
341351
lexer.input(code)
342352

343353
if args["keep"] or args["keep_only"]:

0 commit comments

Comments
 (0)