46 C_SourcePos(std::string_view source,
unsigned line,
unsigned col)
noexcept;
51template<
class T,
template<
class>
class C_Ptr>
64 operator C_Ptr<T>&() {
return m_attr; }
67 operator T2*()
const {
return dynamic_cast<T2*
>(
get()); }
73template<
class T,
template<
class>
class C_Ptr>
101 virtual std::string_view
setSource(std::string_view src) = 0;
104template<
class F_Pred>
119 m_parser.
add(token, line, col, unownedAttr);
121 std::string_view
setSource(std::string_view src)
override
130 const F_Pred m_ignore;
133template<T_LexID IGNORED>
139 static bool predicate(
T_LexID token) {
return token == IGNORED; }
142template<
class T_Data>
requires (!std::is_base_of_v<I_LexAttr,T_Data>)
147 using value_type = std::remove_cv_t<std::remove_reference_t<T_Data>>;
153 template<
class...T_Args>
154 explicit constexpr C_LexDataT(T_Args&&...args): m_data(std::forward<T_Args>(args)...) {}
162 C_IntegerLex(std::string_view numstr,
int _radix)
noexcept;
165 auto radix() const noexcept {
return m_radix; }
166 auto &
str() const noexcept {
return m_numStr; }
167 template<
class T>
requires std::is_arithmetic_v<T>
170 const auto t = value_();
171 const auto ret =
static_cast<T
>(t);
181 std::string m_numStr;
185 long long value_()
const;
191bool operator==(
const C_SourcePos &a,
const C_SourcePos &b)
noexcept;
193bool operator<(
const C_SourcePos &a,
const C_SourcePos &b)
noexcept;
199void addAsHex(std::string &dst, uint32_t utf32);
216template<
class T,
class...T_Args>
#define RUNTIME_ERROR(fmtStr,...)
Wrap FILE(DATE)#__LINE__ FUNCTION: msg into std::runtime_error.
C_IntegerLex(std::string_view numstr, int _radix) noexcept
auto & str() const noexcept
auto radix() const noexcept
constexpr C_ScreenerNo(I_Parser &parser)
C_Screener(I_Parser &parser, F_Pred &&ignore)
void add(T_LexID token, unsigned line, unsigned col, I_LexAttr *unownedAttr) override
std::string_view setSource(std::string_view src) override
THE common namespace of bux library.
bool operator==(const C_SourcePos &a, const C_SourcePos &b) noexcept
Equivalence relation.
auto createLex(const T &t)
constinit const uint32_t MIN_TOKEN_ID
bool operator<(const C_SourcePos &a, const C_SourcePos &b) noexcept
Partial relation.
std::string asciiLiteral(uint32_t utf32)
void addAsHex(std::string &dst, uint32_t ch32)
Render any copyable "type" token attribute on the fly.
std::remove_cv_t< std::remove_reference_t< T_Data > > value_type
constexpr C_LexDataT(T_Args &&...args)
C_LexInfoT & operator=(C_LexInfoT &another)
C_LexInfoT(C_LexInfoT &another)
void operator=(C_LexInfoT< T2, C_Ptr > &rval) const
C_RetLvalT(C_Ptr< T > &lval)
std::string_view m_Source
C_SourcePos & operator=(const C_SourcePos &a)=default
C_SourcePos(const C_SourcePos &a)=default
virtual void add(T_LexID token, unsigned line, unsigned col, I_LexAttr *unownedAttr)=0
virtual std::string_view setSource(std::string_view src)=0
virtual ~I_Parser()=default