mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 00:34:00 -06:00
Conversion tool for Pascal to JS.
Some broad syntax fixes, with various bad side effects. Too bad I don't know sed better.
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/sed -f
|
||||
|
||||
# Convert Pascal syntax to Javascript
|
||||
|
||||
s,{,/*,g
|
||||
s,},*/,g
|
||||
s/ = / == /g
|
||||
s/:=/=/g
|
||||
s/procedure/function/g
|
||||
s/begin/{/g
|
||||
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
|
||||
s/ of/) {/g
|
||||
|
||||
s/Result =/return/g
|
||||
Reference in New Issue
Block a user