mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
netlist: fix line-number tracking when at end of line.
* Also remove a semicolon from nlm_opamp.cpp
This commit is contained in:
parent
b0b2e1351a
commit
77dbc79547
@ -297,7 +297,7 @@ static NETLIST_START(MC3340_DIP)
|
||||
|
||||
NET_C(R17_5K1.2, D3.A, Q8.B)
|
||||
NET_C(D3.K, R18_510.1)
|
||||
ALIAS(GND, R18_510.2);
|
||||
ALIAS(GND, R18_510.2)
|
||||
|
||||
ALIAS(1, INPUT)
|
||||
ALIAS(2, CONTROL)
|
||||
|
@ -74,6 +74,13 @@ public:
|
||||
|
||||
bool eof() const { return m_strm->eof(); }
|
||||
|
||||
/// \brief Read a line of UTF8 characters from the stream.
|
||||
///
|
||||
/// The line will not contain a trailing linefeed
|
||||
///
|
||||
/// \param line pstring reference to the result
|
||||
/// \returns Returns false if at end of file
|
||||
///
|
||||
bool readline(pstring &line)
|
||||
{
|
||||
putf8string::code_t c = 0;
|
||||
@ -96,6 +103,35 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \brief Read a line of UTF8 characters from the stream including trailing linefeed.
|
||||
///
|
||||
/// The line will contain the trailing linefeed
|
||||
///
|
||||
/// \param line pstring reference to the result
|
||||
/// \returns Returns false if at end of file
|
||||
///
|
||||
bool readline_lf(pstring &line)
|
||||
{
|
||||
putf8string::code_t c = 0;
|
||||
m_linebuf = putf8string("");
|
||||
if (!this->readcode(c))
|
||||
{
|
||||
line = "";
|
||||
return false;
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
if (c != 13) // ignore CR
|
||||
m_linebuf += putf8string(1, c);
|
||||
if (c == 10)
|
||||
break;
|
||||
if (!this->readcode(c))
|
||||
break;
|
||||
}
|
||||
line = m_linebuf;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readbyte(std::istream::char_type &b)
|
||||
{
|
||||
if (m_strm->eof())
|
||||
|
@ -48,7 +48,7 @@ namespace plib {
|
||||
if (m_px == m_cur_line.end())
|
||||
{
|
||||
//++m_source_location.back();
|
||||
if (m_strm->readline(m_cur_line))
|
||||
if (m_strm->readline_lf(m_cur_line))
|
||||
{
|
||||
m_px = m_cur_line.begin();
|
||||
if (*m_px != '#')
|
||||
@ -56,7 +56,6 @@ namespace plib {
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return '\n';
|
||||
}
|
||||
pstring::value_type c = *(m_px++);
|
||||
return c;
|
||||
@ -169,7 +168,7 @@ namespace plib {
|
||||
if (ret.str() == "1")
|
||||
benter = true;
|
||||
if (ret.str() == "2")
|
||||
bexit = false;
|
||||
bexit = true;
|
||||
// FIXME: process flags; actually only 1 (file enter) and 2 (after file exit)
|
||||
ret = get_token_queue();
|
||||
}
|
||||
@ -177,7 +176,7 @@ namespace plib {
|
||||
m_source_location.pop_back();
|
||||
if (!benter) // new location!
|
||||
m_source_location.pop_back();
|
||||
m_source_location.emplace_back(plib::source_location(file, lineno));
|
||||
m_source_location.emplace_back(plib::source_location(file, lineno - 1));
|
||||
}
|
||||
else if (ret.is_type(token_type::SOURCELINE))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user