mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Add file/ConformingCharStream - converts symbols to lowercase to match grammar Add file/ErrorListener
21 lines
397 B
C++
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
|