From 76500bc57fa7d27c73905739a12520706f817534 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sat, 4 Feb 2017 23:26:05 +0100 Subject: Parses list.squig --- main.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index b28e446..f8b9681 100644 --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,48 @@ #include +#include +#include #include "parser.h" using namespace std; +string readstream(istream &in){ + string res; + char buf[4096]; + while(true){ + in.read(buf,sizeof(buf)); + if(in.gcount()==0)break; + res.append(buf,in.gcount()); + } + return res; +} + int main(int argc,char **argv){ - (void)argc; - (void)argv; + string source,filename; + bool fromstdin=false; + if(argc==1)fromstdin=true; + else if(argc==2){ + if(strcmp(argv[1],"-")==0)fromstdin=true; + else filename=argv[1]; + } else { + cerr<<"Pass source on stdin, or filename as argument (or '-' for stdin)"<