Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docs/editor/scripts/urdujs/keywords.js.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,44 @@ export syntax karo = function(ctx) {
}


}


//try catch finally
export syntax koshish = function(ctx){
let tryblock = ctx.next().value;
let next = ctx.next();
if(next.value!=null){
if(next.value.value.token.value === "pakro"){
let catchparams =ctx.next().value;
let catchblock = ctx.next().value;
let akhir = ctx.next();
if(akhir.value!=null){
if(akhir.value.value.token.value === "akhir"){
let finallyblock = ctx.next().value;
return #`try ${tryblock} catch ${catchparams} ${catchblock} finally ${finallyblock}`;
} else {
return #`console.log("galti: akhir sahi tarah nahin likha")`;
}
} else {
return #`try ${tryblock} catch ${catchparams} ${catchblock}`;

}
}
if(next.value.value.token.value === "akhir"){
let finallyblock = ctx.next().value;
return #`try ${tryblock} finally ${finallyblock}`;
}
else {
return #`console.log("galti: koshish ke liye pakro ya akhir hona lazmi hai!")`;
}
} else {
return #`console.log("galti: koshish ke liye pakro ya akhir hona lazmi hai!")`;
}

}

//throw
export syntax phenko = function(ctx){
return #`throw`;
}
3 changes: 2 additions & 1 deletion hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
bhejo,
khali,
pucho,
karo
karo,
koshish
} from './src/keywords'

/////////////////////////////////
Expand Down
29 changes: 27 additions & 2 deletions src/keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ export syntax karo = function(ctx) {
} else {
return #`console.log("galti: karo ke liye jabtak hona lazmi hai!")`;
}


}

//try catch finally
export syntax koshish = function(ctx){
let tryblock = ctx.next().value;
let pakro = ctx.next();
if(pakro.value!=null){
if(pakro.value.value.token.value === "pakro"){
let catchparams =ctx.next().value;
let catchblock = ctx.next().value;
let akhir = ctx.next();
if(akhir.value!=null){
if(akhir.value.value.token.value === "akhir"){
let finallyblock = ctx.next().value;
return #`try ${tryblock} catch ${catchparams} ${catchblock} finally ${finallyblock}`;
} else {
return #`console.log("galti: akhir sahi tarah nahin likha")`;
}
} else {
return #`try ${tryblock} catch ${catchparams} ${catchblock}`;

}
}
} else {
return #`console.log("galti: koshish ke liye pakro hona lazmi hai!")`;
}

}