#include <msp/strings/format.h>
#include <msp/strings/utils.h>
+#include "except.h"
#include "input.h"
#include "textparser.h"
#include "token.h"
namespace Msp {
namespace DataFile {
-class parse_error: public runtime_error
-{
-public:
- parse_error(const std::string &t):
- runtime_error(t.empty() ? "at end of input" : format("after '%s'", t))
- { }
-
- virtual ~parse_error() throw() { }
-};
-
-
-class syntax_error: public runtime_error
-{
-public:
- syntax_error(const std::string &t):
- runtime_error(t.empty() ? "at end of input" : format("at '%s'", t))
- { }
-
- virtual ~syntax_error() throw() { }
-};
-
-
TextParser::TextParser(Input &i, const string &s):
ParserMode(i, s)
{ }
c = in.get();
int next = in.peek();
- if(c=='/' && next=='/')
+ if(c=='/' && next=='/' && !comment)
comment = 1;
- else if(c=='/' && next=='*')
+ else if(c=='/' && next=='*' && !comment)
comment = 2;
else if(c=='\n' && comment==1)
comment = 0;