top | up | prev | next

lexer Namespace

Classes

struct Keyword
class KeywordMap
struct Lexeme
class Lexer
class ParsingException
class ParsingLog
struct Span
struct Token
struct TokenLine
class XmlParsingLog

Functions

void GetColumns(const char32_t* start, const char32_t* end, const Span& externalSpan, int32_t& startCol, int32_t& endCol)
std::string GetEndTokenInfo()
std::u32string GetErrorLines(const char32_t* start, const char32_t* end, const Span& externalSpan)
const char32_t* LineEnd(const char32_t* end, const char32_t* p)
const char32_t* LineStart(const char32_t* start, const char32_t* p)
bool NoWhiteSpaceBetweenTokens(const Token& first, const Token& second)
const char32_t* StrEnd(const char32_t* s) inline
void WriteBeginRuleToLog(Lexer& lexer, const std::u32string& ruleName)
void WriteFailureToLog(Lexer& lexer, const std::u32string& ruleName)
void WriteSuccessToLog(Lexer& lexer, const Span& matchSpan, const std::u32string& ruleName)
std::u32string XmlCharStr(char32_t c)
std::u32string XmlEscape(const std::u32string& s)
std::u32string XmlHexEscape(char32_t c)
LexerFlags operator&(LexerFlags left, LexerFlags right) inline
bool operator<(const Lexeme& left, const Lexeme& right) inline
bool operator==(const Lexeme& left, const Lexeme& right) inline
bool operator==(const Span& left, const Span& right)
LexerFlags operator|(LexerFlags left, LexerFlags right) inline
LexerFlags operator~(LexerFlags flag) inline

Enumerations

enum class LexerFlags

Variables

const int CONTINUE_TOKEN
const int END_TOKEN
const int INVALID_TOKEN

Function Details

GetColumns Function

void soulng::lexer::GetColumns(const char32_t * start, const char32_t * end, const Span & externalSpan, int32_t& startCol, int32_t& endCol)

Definition at line 269 of Lexer.cpp
Declaration at line 117 of Lexer.hpp


GetEndTokenInfo Function

std::string soulng::lexer::GetEndTokenInfo()

Definition at line 16 of Token.cpp :
17 {
18     return "end of file";
19 }


Declaration at line 30 of Token.hpp


GetErrorLines Function

std::u32string soulng::lexer::GetErrorLines(const char32_t * start, const char32_t * end, const Span & externalSpan)

Definition at line 244 of Lexer.cpp
Declaration at line 116 of Lexer.hpp


LineEnd Function

const char32_t * soulng::lexer::LineEnd(const char32_t * end, const char32_t * p)

Definition at line 235 of Lexer.cpp :
236 {
237     while (p != end && *p != '\n' && *p != '\r')
238     {
239         ++p;
240     }
241     return p;
242 }


Called by: soulng::lexer::Lexer::ErrorLines , soulng::lexer::Lexer::ErrorLines , soulng::lexer::Lexer::GetColumns , soulng::lexer::Lexer::RestOfLine


LineStart Function

const char32_t * soulng::lexer::LineStart(const char32_t * start, const char32_t * p)

Definition at line 222 of Lexer.cpp

Called by: soulng::lexer::Lexer::ErrorLines , soulng::lexer::Lexer::ErrorLines , soulng::lexer::Lexer::GetColumns


NoWhiteSpaceBetweenTokens Function

bool soulng::lexer::NoWhiteSpaceBetweenTokens(const Token & first, const Token & second)

Definition at line 10 of Token.cpp :
11 {
12     if (first.match.end == second.match.begin) return true;
13     return false;
14 }


Declaration at line 28 of Token.hpp


StrEnd Function

const char32_t * soulng::lexer::StrEnd(const char32_t * s) inline

Definition at line 10 of Keyword.cpp :
11 {
12     while (*s)
13     {
14         ++s;
15     }
16     return s;
17 }



WriteBeginRuleToLog Function

void soulng::lexer::WriteBeginRuleToLog(Lexer & lexer, const std::u32string& ruleName)

Definition at line 518 of Lexer.cpp :
519 {
520     lexer.Log()->WriteBeginRule(ruleName);
521     lexer.Log()->IncIndent();
522     lexer.Log()->WriteTry(lexer.RestOfLine(lexer.Log()->MaxLineLength()));
523     lexer.Log()->IncIndent();
524 }


Declaration at line 118 of Lexer.hpp

Calls: soulng::lexer::Lexer::Log , soulng::lexer::Lexer::RestOfLine , soulng::lexer::ParsingLog::IncIndent , soulng::lexer::ParsingLog::MaxLineLength , soulng::lexer::ParsingLog::WriteBeginRule , soulng::lexer::ParsingLog::WriteTry


WriteFailureToLog Function

void soulng::lexer::WriteFailureToLog(Lexer & lexer, const std::u32string& ruleName)

Definition at line 534 of Lexer.cpp :
535 {
536     lexer.Log()->DecIndent();
537     lexer.Log()->WriteFail();
538     lexer.Log()->DecIndent();
539     lexer.Log()->WriteEndRule(ruleName);
540 }


Declaration at line 120 of Lexer.hpp

Calls: soulng::lexer::Lexer::Log , soulng::lexer::ParsingLog::DecIndent , soulng::lexer::ParsingLog::WriteEndRule , soulng::lexer::ParsingLog::WriteFail


WriteSuccessToLog Function

void soulng::lexer::WriteSuccessToLog(Lexer & lexer, const Span & matchSpan, const std::u32string& ruleName)

Definition at line 526 of Lexer.cpp :
527 {
528     lexer.Log()->DecIndent();
529     lexer.Log()->WriteSuccess(lexer.GetMatch(matchSpan));
530     lexer.Log()->DecIndent();
531     lexer.Log()->WriteEndRule(ruleName);
532 }


Declaration at line 119 of Lexer.hpp

Calls: soulng::lexer::Lexer::GetMatch , soulng::lexer::Lexer::Log , soulng::lexer::ParsingLog::DecIndent , soulng::lexer::ParsingLog::WriteEndRule , soulng::lexer::ParsingLog::WriteSuccess


XmlCharStr Function

std::u32string soulng::lexer::XmlCharStr(char32_t c)

Definition at line 23 of XmlParsingLog.cpp
Declaration at line 32 of XmlParsingLog.hpp


XmlEscape Function

std::u32string soulng::lexer::XmlEscape(const std::u32string& s)

Definition at line 52 of XmlParsingLog.cpp :
 53 {
 54     std::u32string result;
 55     result.reserve(2 * s.length());
 56     std::u32string::const_iterator e = s.end();
 57     for (std::u32string::const_iterator i = s.begin(); i != e; ++i)
 58     {
 59         result.append(XmlCharStr(*i));
 60     }
 61     return result;
 62 }


Declaration at line 33 of XmlParsingLog.hpp

Called by: soulng::lexer::XmlParsingLog::WriteElement


XmlHexEscape Function

std::u32string soulng::lexer::XmlHexEscape(char32_t c)

Definition at line 16 of XmlParsingLog.cpp :
 17 {
 18     std::stringstream s;
 19     s << "&#x" << std::hex << (unsigned int)c << ";";
 20     return ToUtf32(s.str());
 21 }


Declaration at line 31 of XmlParsingLog.hpp


operator& Function

LexerFlags soulng::lexer::operator&(LexerFlags left, LexerFlags right) inline

Definition at line 30 of Lexer.hpp :
 31 {
 32     return static_cast<LexerFlags>(static_cast<int8_t>(left) & static_cast<int8_t>(right));
 33 }



operator< Function

bool soulng::lexer::operator<(const Lexeme & left, const Lexeme & right) inline

Definition at line 36 of Lexeme.hpp


operator== Function

bool soulng::lexer::operator==(const Lexeme & left, const Lexeme & right) inline

Definition at line 22 of Lexeme.hpp


operator== Function

bool soulng::lexer::operator==(const Span & left, const Span & right)

Definition at line 10 of Span.cpp :
11 {
12     return left.fileIndex == right.fileIndex && left.line == right.line && left.start == right.start && left.end == right.end;
13 }


Declaration at line 24 of Span.hpp


operator| Function

LexerFlags soulng::lexer::operator|(LexerFlags left, LexerFlags right) inline

Definition at line 25 of Lexer.hpp :
 26 {
 27     return static_cast<LexerFlags>(static_cast<int8_t>(left) | static_cast<int8_t>(right));
 28 }



operator~ Function

LexerFlags soulng::lexer::operator~(LexerFlags flag) inline

Definition at line 35 of Lexer.hpp :
 36 {
 37     return static_cast<LexerFlags>(~static_cast<int8_t>(flag));
 38 }



top | up | prev | next