aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp.cpp')
-rw-r--r--src/resp.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/resp.cpp b/src/resp.cpp
index b264850..66847fd 100644
--- a/src/resp.cpp
+++ b/src/resp.cpp
@@ -37,7 +37,7 @@ bool
is_form(const AST* ast, const std::string& form)
{
const ATuple* call = ast->to_tuple();
- if (!call)
+ if (!call || call->empty())
return false;
const ASymbol* const sym = call->fst()->to_symbol();
@@ -89,7 +89,8 @@ main(int argc, char** argv)
{
// Read command line arguments
map<string,string> args;
- list<string> files;
+ typedef list<const char*> Files;
+ Files files;
for (int i = 1; i < argc; ++i) {
if (!strncmp(argv[i], "-h", 3)) {
return print_usage(argv[0], false);
@@ -148,8 +149,8 @@ main(int argc, char** argv)
fs.open(output.c_str());
ostream& os = (output == "") ? std::cout : fs;
- for (list<string>::iterator f = files.begin(); f != files.end(); ++f) {
- ifstream is(f->c_str());
+ for (Files::iterator f = files.begin(); f != files.end(); ++f) {
+ ifstream is(*f);
try {
while (is.good() && !is.eof()) {
Cursor loc(*f);
@@ -183,14 +184,14 @@ main(int argc, char** argv)
ret = repl(*cenv);
} else { // Evalute (or just type check if -T, or just compile if -S all files
- for (list<string>::iterator f = files.begin(); f != files.end(); ++f) {
- const string& filename = *f;
+ for (Files::iterator f = files.begin(); f != files.end(); ++f) {
+ const string filename = *f;
if (!batch)
output = filename + ".out";
- ifstream is(f->c_str());
+ ifstream is(*f);
if (is.good()) {
- Cursor cursor(*f);
+ Cursor cursor(filename);
ret = ret | eval(*cenv, cursor, is, !batch);
} else {
cerr << argv[0] << ": " << *f << ": " << strerror(errno) << endl;