polserver/pol-core/bscript/compiler/file/ConformingCharStream.cpp
Eric Swanson 303665bcd8
Add error listener, and convert lexer symbols to lowercase (#216)
Add file/ConformingCharStream - converts symbols to lowercase to match grammar

Add file/ErrorListener
2020-08-14 03:28:37 -07:00

21 lines
397 B
C++

#include "ConformingCharStream.h"
#include <cctype>
namespace Pol::Bscript::Compiler
{
size_t ConformingCharStream::LA( ssize_t i )
{
size_t c = stream->LA( i );
if ( c == CharStream::EOF )
{
return c;
}
if ( c < 128 ) // to avoid std::tolower "undefined behavior"
return std::tolower( static_cast<unsigned char>( c ) );
return c;
}
} // namespace Pol::Bscript::Compiler