Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added read-url (reads text from the file pointed in that url) and mkd…
…ev (converts lambda to a device)
  • Loading branch information
EnKrypt committed Apr 9, 2012
1 parent c5df313 commit 650c7eb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Binary file modified Lisp.class
Binary file not shown.
32 changes: 31 additions & 1 deletion Lisp.java
Expand Up @@ -20,6 +20,7 @@
import java.io.*;
import java.util.*;
import java.util.regex.*;
import java.net.*;

public class Lisp{

Expand All @@ -32,6 +33,7 @@ public class Lisp{
static Pattern equo;
static Matcher enowa;
static Map var=new HashMap();
static Map mkdev=new HashMap();
static String result;
static String eresult;

Expand Down Expand Up @@ -211,6 +213,23 @@ else if (arg[0].equalsIgnoreCase("read")&&arg.length==2){
}
return cres;
}
else if (arg[0].equalsIgnoreCase("read-url")){
String lin="",cres="";
try{
URL url=new URL(arg[1]);
BufferedReader read=new BufferedReader(new InputStreamReader(url.openStream()));
while ((lin=read.readLine())!=null){
cres+=lin+" ";
}
read.close();
}
catch(Exception e){ e.printStackTrace(); }
return "'"+cres+"\"";
}
else if (arg[0].equalsIgnoreCase("mkdev")&&arg.length==3){
mkdev.put(arg[1],arg[2]);
return "";
}
else if (arg[0].equalsIgnoreCase("pass")){
String cres="";
return "";
Expand Down Expand Up @@ -271,7 +290,18 @@ else if (arg[0].equalsIgnoreCase("runlambda")){
return "(eval '"+to_eval+"\")";
}
else{
return "";
String devi="";
String param="";
for (int i=1;i<arg.length;i++){
param+=" "+arg[i];
}
try{
devi=mkdev.get(arg[0]).toString();
}
catch(NullPointerException npe){
devi="";
}
return "("+devi+param+")";
}
}
public static String[] requote(String[] ar) {
Expand Down
2 changes: 2 additions & 0 deletions README
Expand Up @@ -9,3 +9,5 @@ http://havesomepi.com/lisp/

JamezQ's version:
http://jq.dyndns-free.com/PL/

NOTE : This version does not strictly follow the Pl0 standard for better efficiency and ease.

0 comments on commit 650c7eb

Please sign in to comment.