#include <config.h>
-#include "Encoding.h"
#include "Parser.h"
+
+#include "Encoding.h"
#include "support/lstrings.h"
#include "support/textutils.h"
}
-void iparserdocstream::putback(docstring s)
+void iparserdocstream::putback(docstring const & s)
{
s_ = s + s_;
}
Parser::Parser(idocstream & is, std::string const & fixedenc)
- : lineno_(0), pos_(0), iss_(0), is_(is),
+ : lineno_(0), pos_(0), iss_(nullptr), is_(is),
encoding_iconv_(fixedenc.empty() ? "UTF-8" : fixedenc),
theCatcodesType_(NORMAL_CATCODES), curr_cat_(UNDECIDED_CATCODES),
fixed_enc_(!fixedenc.empty())
}
-bool Parser::setEncoding(std::string const & e, int const & p)
+bool Parser::setEncoding(std::string const & e, int p)
{
// We may (and need to) use unsafe encodings here: Since the text is
// converted to unicode while reading from is_, we never see text in
bool Parser::isParagraph()
{
- // A new paragraph in TeX ist started
+ // A new paragraph in TeX is started
// - either by a newline, following any amount of whitespace
// characters (including zero), and another newline
// - or the token \par
}
-bool Parser::good()
+bool Parser::good() const
{
if (pos_ < tokens_.size())
return true;
}
-bool Parser::hasOpt(string const l)
+bool Parser::hasOpt(string const & l)
{
// An optional argument can occur in any of the following forms:
// - \foo[bar]
}
-bool Parser::hasListPreamble(string const itemcmd)
+bool Parser::hasListPreamble(string const & itemcmd)
{
// remember current position
unsigned int oldpos = pos_;
}
case catIgnore: {
- cerr << "ignoring a char: " << c << "\n";
+ cerr << "ignoring a char: " << static_cast<uint32_t>(c) << "\n";
break;
}
}
-void Parser::error(string const & msg)
+void Parser::error(string const & msg) const
{
cerr << "Line ~" << lineno_ << ": parse error: " << msg << endl;
dump();