Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_re2::Prog::Inst Class Reference

Public Member Functions

 Inst (const Inst &)=default
Inst & operator= (const Inst &)=default
void InitAlt (uint32_t out, uint32_t out1)
void InitByteRange (int lo, int hi, int foldcase, uint32_t out)
void InitCapture (int cap, uint32_t out)
void InitEmptyWidth (EmptyOp empty, uint32_t out)
void InitMatch (int id)
void InitNop (uint32_t out)
void InitFail ()
int id (Prog *p)
InstOp opcode ()
int last ()
int out ()
int out1 ()
int cap ()
int lo ()
int hi ()
int foldcase ()
int hint ()
int match_id ()
EmptyOp empty ()
bool greedy (Prog *p)
bool Matches (int c)
std::string Dump ()

Static Public Attributes

static const int kMaxInst = (1<<28) - 1

Private Member Functions

void set_opcode (InstOp opcode)
void set_last ()
void set_out (int out)
void set_out_opcode (int out, InstOp opcode)

Private Attributes

uint32_t out_opcode_
union { 
   uint32_t   out1_ 
   int32_t   cap_ 
   int32_t   match_id_ 
   struct { 
      uint8_t   lo_ 
      uint8_t   hi_ 
      uint16_t   hint_foldcase_ 
   }   byte_range
   EmptyOp   empty_ 
}; 

Friends

class Compiler
struct PatchList
class Prog

Member Function Documentation

◆ InitAlt()

void duckdb_re2::Prog::Inst::InitAlt ( uint32_t out,
uint32_t out1 )
470415 {
470416 DCHECK_EQ(out_opcode_, 0);
470417 set_out_opcode(out, kInstAlt);
470418 out1_ = out1;
470419}

◆ InitByteRange()

void duckdb_re2::Prog::Inst::InitByteRange ( int lo,
int hi,
int foldcase,
uint32_t out )
470421 {
470422 DCHECK_EQ(out_opcode_, 0);
470423 set_out_opcode(out, kInstByteRange);
470424 byte_range.lo_ = lo & 0xFF;
470425 byte_range.hi_ = hi & 0xFF;
470426 byte_range.hint_foldcase_ = foldcase&1;
470427}

◆ InitCapture()

void duckdb_re2::Prog::Inst::InitCapture ( int cap,
uint32_t out )
470429 {
470430 DCHECK_EQ(out_opcode_, 0);
470431 set_out_opcode(out, kInstCapture);
470432 cap_ = cap;
470433}

◆ InitEmptyWidth()

void duckdb_re2::Prog::Inst::InitEmptyWidth ( EmptyOp empty,
uint32_t out )
470435 {
470436 DCHECK_EQ(out_opcode_, 0);
470437 set_out_opcode(out, kInstEmptyWidth);
470438 empty_ = empty;
470439}

◆ InitMatch()

void duckdb_re2::Prog::Inst::InitMatch ( int id)
470441 {
470442 DCHECK_EQ(out_opcode_, 0);
470443 set_opcode(kInstMatch);
470444 match_id_ = id;
470445}

◆ InitNop()

void duckdb_re2::Prog::Inst::InitNop ( uint32_t out)
470447 {
470448 DCHECK_EQ(out_opcode_, 0);
470449 set_opcode(kInstNop);
470450}

◆ InitFail()

void duckdb_re2::Prog::Inst::InitFail ( )
470452 {
470453 DCHECK_EQ(out_opcode_, 0);
470454 set_opcode(kInstFail);
470455}

◆ id()

int duckdb_re2::Prog::Inst::id ( Prog * p)
inline
459849{ return static_cast<int>(this - p->inst_.data()); }

◆ opcode()

InstOp duckdb_re2::Prog::Inst::opcode ( )
inline
459850{ return static_cast<InstOp>(out_opcode_&7); }

◆ last()

int duckdb_re2::Prog::Inst::last ( )
inline
459851{ return (out_opcode_>>3)&1; }

◆ out()

int duckdb_re2::Prog::Inst::out ( )
inline
459852{ return out_opcode_>>4; }

◆ out1()

int duckdb_re2::Prog::Inst::out1 ( )
inline
459853{ DCHECK(opcode() == kInstAlt || opcode() == kInstAltMatch); return out1_; }

◆ cap()

int duckdb_re2::Prog::Inst::cap ( )
inline
459854{ DCHECK_EQ(opcode(), kInstCapture); return cap_; }

◆ lo()

int duckdb_re2::Prog::Inst::lo ( )
inline
459855{ DCHECK_EQ(opcode(), kInstByteRange); return byte_range.lo_; }

◆ hi()

int duckdb_re2::Prog::Inst::hi ( )
inline
459856{ DCHECK_EQ(opcode(), kInstByteRange); return byte_range.hi_; }

◆ foldcase()

int duckdb_re2::Prog::Inst::foldcase ( )
inline
459857{ DCHECK_EQ(opcode(), kInstByteRange); return byte_range.hint_foldcase_&1; }

◆ hint()

int duckdb_re2::Prog::Inst::hint ( )
inline
459858{ DCHECK_EQ(opcode(), kInstByteRange); return byte_range.hint_foldcase_>>1; }

◆ match_id()

int duckdb_re2::Prog::Inst::match_id ( )
inline
459859{ DCHECK_EQ(opcode(), kInstMatch); return match_id_; }

◆ empty()

EmptyOp duckdb_re2::Prog::Inst::empty ( )
inline
459860{ DCHECK_EQ(opcode(), kInstEmptyWidth); return empty_; }

◆ greedy()

bool duckdb_re2::Prog::Inst::greedy ( Prog * p)
inline
459862 {
459863 DCHECK_EQ(opcode(), kInstAltMatch);
459864 return p->inst(out())->opcode() == kInstByteRange ||
459865 (p->inst(out())->opcode() == kInstNop &&
459866 p->inst(p->inst(out())->out())->opcode() == kInstByteRange);
459867 }

◆ Matches()

bool duckdb_re2::Prog::Inst::Matches ( int c)
inline
459870 {
459871 DCHECK_EQ(opcode(), kInstByteRange);
459872 if (foldcase() && 'A' <= c && c <= 'Z')
459873 c += 'a' - 'A';
459874 return byte_range.lo_ <= c && c <= byte_range.hi_;
459875 }

◆ Dump()

std::string duckdb_re2::Prog::Inst::Dump ( )
470457 {
470458 switch (opcode()) {
470459 default:
470460 return StringPrintf("opcode %d", static_cast<int>(opcode()));
470461
470462 case kInstAlt:
470463 return StringPrintf("alt -> %d | %d", out(), out1_);
470464
470465 case kInstAltMatch:
470466 return StringPrintf("altmatch -> %d | %d", out(), out1_);
470467
470468 case kInstByteRange:
470469 return StringPrintf("byte%s [%02x-%02x] %d -> %d",
470470 foldcase() ? "/i" : "",
470471 byte_range.lo_, byte_range.hi_, hint(), out());
470472
470473 case kInstCapture:
470474 return StringPrintf("capture %d -> %d", cap_, out());
470475
470476 case kInstEmptyWidth:
470477 return StringPrintf("emptywidth %#x -> %d",
470478 static_cast<int>(empty_), out());
470479
470480 case kInstMatch:
470481 return StringPrintf("match! %d", match_id());
470482
470483 case kInstNop:
470484 return StringPrintf("nop -> %d", out());
470485
470486 case kInstFail:
470487 return StringPrintf("fail");
470488 }
470489}

◆ set_opcode()

void duckdb_re2::Prog::Inst::set_opcode ( InstOp opcode)
inlineprivate
459885 {
459886 out_opcode_ = (out()<<4) | (last()<<3) | opcode;
459887 }

◆ set_last()

void duckdb_re2::Prog::Inst::set_last ( )
inlineprivate
459889 {
459890 out_opcode_ = (out()<<4) | (1<<3) | opcode();
459891 }

◆ set_out()

void duckdb_re2::Prog::Inst::set_out ( int out)
inlineprivate
459893 {
459894 out_opcode_ = (out<<4) | (last()<<3) | opcode();
459895 }

◆ set_out_opcode()

void duckdb_re2::Prog::Inst::set_out_opcode ( int out,
InstOp opcode )
inlineprivate
459897 {
459898 out_opcode_ = (out<<4) | (last()<<3) | opcode;
459899 }

The documentation for this class was generated from the following file: