From 5f96b39c087696a61a02a497e9cf7d7e183a3fa0 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 1 Jul 2009 13:41:15 +0000 Subject: [PATCH] Allow bash script header --- chaiscript/chaiscript_engine.hpp | 2 +- chaiscript/chaiscript_parser.hpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/chaiscript/chaiscript_engine.hpp b/chaiscript/chaiscript_engine.hpp index 2a1428f..5226517 100644 --- a/chaiscript/chaiscript_engine.hpp +++ b/chaiscript/chaiscript_engine.hpp @@ -98,7 +98,7 @@ namespace chaiscript } catch (EvalError &ee) { if (filename != std::string("__EVAL__")) { - std::cout << "Eval error: \"" << ee.reason << "\" in '" << ee.location->filename << "' line: " << ee.location->start.line+1 << std::endl; + std::cout << "Eval error: \"" << ee.reason << "\" in '" << ee.location->filename << "' line: " << ee.location->start.line << std::endl; } else { std::cout << "Eval error: \"" << ee.reason << "\"" << std::endl; diff --git a/chaiscript/chaiscript_parser.hpp b/chaiscript/chaiscript_parser.hpp index ea913d5..284cdee 100644 --- a/chaiscript/chaiscript_parser.hpp +++ b/chaiscript/chaiscript_parser.hpp @@ -1269,6 +1269,12 @@ namespace chaiscript line = 1; col = 1; filename = fname; + if ((input.size() > 0) && (input[0] == '#')) { + while ((input_pos != input_end) && (!Eol())) { + ++input_pos; + } + } + if (Statements()) { if (input_pos != input_end) { throw Parse_Error("Unparsed input", File_Position(line, col), fname);