From 14a6aa4c488bcd2d49103cbee1424b2769d77ce0 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 12 Aug 2016 14:05:45 +0200 Subject: Initial import --- orig/pq-web/pas2js.sed | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 orig/pq-web/pas2js.sed (limited to 'orig/pq-web/pas2js.sed') diff --git a/orig/pq-web/pas2js.sed b/orig/pq-web/pas2js.sed new file mode 100755 index 0000000..12e812a --- /dev/null +++ b/orig/pq-web/pas2js.sed @@ -0,0 +1,38 @@ +#!/usr/bin/sed -f + +# Convert Pascal syntax to Javascript + +s,{,/*,g +s,},*/,g +s/ = / == /g +s/:=/=/g +s/procedure/function/g +s/begin/{/ +s/end;/}/g +s/end/}/g + +s/not/!/g +s/ and / \&\& /g +s/ or / || /g +s/<>/!=/g +s/ mod / % /g + +s/if /if (/g +s/ then/)/g + +s/while /while (/g +s/for /for (/g +s/with /with (/g +s/ do/)/ + +s/case /switch (/g +/\Wcase\W/ s/ of/) {/g + +s/Result =/return/g + +/^function / s/): [A-Za-z][A-Za-z]*;/)/ +/^function / s/: [A-Za-z][A-Za-z]*;/()/ +#/^function / s/: [A-Za-z][A-Za-z]*//g + +/\Wfor\W/ s/ to /; i <= / +/\Wfor\W/ s/)/; ++i)/ -- cgit v1.2.3