47 C_SourcePos(std::string_view source,
unsigned line,
unsigned col)
noexcept;
52template<
class T,
template<
class>
class C_Ptr>
65 operator C_Ptr<T>&() {
return m_attr; }
68 operator T2*()
const {
return dynamic_cast<T2*
>(
get()); }
74template<
class T,
template<
class>
class C_Ptr>
102 virtual std::string_view
setSource(std::string_view src) = 0;
105template<
class F_Pred>
120 m_parser.add(token, line, col, unownedAttr);
122 std::string_view
setSource(std::string_view src)
override
124 return m_parser.setSource(src);
131 const F_Pred m_ignore;
134template<T_LexID IGNORED>
140 static bool predicate(
T_LexID token) {
return token == IGNORED; }
143template<
class T_Data>
requires (!std::is_base_of_v<I_LexAttr,T_Data>)
148 using value_type = std::remove_cv_t<std::remove_reference_t<T_Data>>;
154 template<
class...T_Args>
163 C_IntegerLex(std::string_view numstr,
int _radix)
noexcept;
166 auto radix() const noexcept {
return m_radix; }
167 auto &
str() const noexcept {
return m_numStr; }
168 template<
class T>
requires std::is_arithmetic_v<T>
171 const auto t = value_();
172 const auto ret =
static_cast<T
>(t);
174 throw std::runtime_error{
"Cast overflow " + std::to_string(ret) +
" != " + std::to_string(t)};
182 std::string m_numStr;
186 long long value_()
const;
192bool operator==(
const C_SourcePos &a,
const C_SourcePos &b)
noexcept;
194bool operator<(
const C_SourcePos &a,
const C_SourcePos &b)
noexcept;
200void addAsHex(std::string &dst, uint32_t utf32);
217template<
class T,
class...T_Args>
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)
std::shared_ptr< const I_LexAttr > m_attr
C_LexInfoT(C_LexInfoT &another)
std::shared_ptr< const I_LexAttr > & m_lval
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