(
)
throws java.io.IOException
{
boolean saw_escape = false;
Integer code;
/*if (m_input.m_line_index > m_input.m_line_read) {
System.out.println("m_input.m_line_index = " + m_input.m_line_index);
System.out.println("m_input.m_line_read = " + m_input.m_line_read);
CUtility.ASSERT(m_input.m_line_index <= m_input.m_line_read);
}*/
if (m_input.m_eof_reached)
{
/* EOF has already been reached,
so return appropriate code. */
m_spec.m_current_token = END_OF_INPUT;
m_spec.m_lexeme = '\0';
return m_spec.m_current_token;
}
/* End of previous regular expression?
Refill line buffer? */
if (EOS == m_spec.m_current_token
/* ADDED */
|| m_input.m_line_index >= m_input.m_line_read)
/* ADDED */
{
if (m_spec.m_in_quote)
{
CError.parse_error(CError.E_SYNTAX,m_input.m_line_number);
}
while (true)
{
if (false == m_advance_stop
|| m_input.m_line_index >= m_input.m_line_read)
{
if (m_input.getLine())
{
/* EOF has already been reached,
so return appropriate code. */
m_spec.m_current_token = END_OF_INPUT;
m_spec.m_lexeme = '\0';
return m_spec.m_current_token;
}
m_input.m_line_index = 0;
}
else
{
m_advance_stop = false;
}
while (m_input.m_line_index < m_input.m_line_read
&& true == CUtility.isspace(m_input.m_line[m_input.m_line_index]))
{
++m_input.m_line_index;
}
if (m_input.m_line_index < m_input.m_line_read)
{
break;
}
}
}
if (CUtility.DEBUG) {
CUtility.ASSERT(m_input.m_line_index <= m_input.m_line_read);
}
while (true)
{
if (false == m_spec.m_in_quote
&& '{' == m_input.m_line[m_input.m_line_index])
{
if (false == expandMacro())
{
break;
}
if (m_input.m_line_index >= m_input.m_line_read)
{
m_spec.m_current_token = EOS;
m_spec.m_lexeme = '\0';
return m_spec.m_current_token;
}
}
else if ('\"' == m_input.m_line[m_input.m_line_index])
{
m_spec.m_in_quote = !m_spec.m_in_quote;
++m_input.m_line_index;
if (m_input.m_line_index >= m_input.m_line_read)
{
m_spec.m_current_token = EOS;
m_spec.m_lexeme = '\0';
return m_spec.m_current_token;
}
}
else
{
break;
}
}
if (m_input.m_line_index > m_input.m_line_read) {
System.out.println("m_input.m_line_index = " + m_input.m_line_index);
System.out.println("m_input.m_line_read = " + m_input.m_line_read);
CUtility.ASSERT(m_input.m_line_index <= m_input.m_line_read);
}
/* Look for backslash, and corresponding
escape sequence. */
if ('\\' == m_input.m_line[m_input.m_line_index])
{
saw_escape = true;
}
else
{
saw_escape = false;
}
if (false == m_spec.m_in_quote)
{
if (false == m_spec.m_in_ccl &&
CUtility.isspace(m_input.m_line[m_input.m_line_index]))
{
/* White space means the end of
the current regular expression. */
m_spec.m_current_token = EOS;
m_spec.m_lexeme = '\0';
return m_spec.m_current_token;
}
/* Process escape sequence, if needed. */
if (saw_escape)
{
m_spec.m_lexeme = expandEscape();
}
else
{
m_spec.m_lexeme = m_input.m_line[m_input.m_line_index];
++m_input.m_line_index;
}
}
else
{
if (saw_escape
&& (m_input.m_line_index + 1) < m_input.m_line_read
&& '\"' == m_input.m_line[m_input.m_line_index + 1])
{
m_spec.m_lexeme = '\"';
m_input.m_line_index = m_input.m_line_index + 2;
}
else
{
m_spec.m_lexeme = m_input.m_line[m_input.m_line_index];
++m_input.m_line_index;
}
}
code = (Integer) m_tokens.get(new Character(m_spec.m_lexeme));
if (m_spec.m_in_quote || true == saw_escape)
{
m_spec.m_current_token = L;
}
else
{
if (null == code)
{
m_spec.m_current_token = L;
}
else
{
m_spec.m_current_token = code.intValue();
}
}
if (CCL_START == m_spec.m_current_token) m_spec.m_in_ccl = true;
if (CCL_END == m_spec.m_current_token) m_spec.m_in_ccl = false;