STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::script::anonymous_namespace{Parser.cpp}::Parser Struct Reference
Collaboration diagram for fsw::script::anonymous_namespace{Parser.cpp}::Parser:
[legend]

Classes

struct  EDepth

Public Member Functions

 Parser (const std::vector< Token > &t)
const Token & cur () const
bool at (Tok k) const
const Token & advance ()
void fail (Diag code, const Token &t, std::string msg)
bool expect (Tok k, Diag code, const char *what)
int32_t addExpr (Expr e)
int32_t addStmt (Stmt s)
int32_t internVar (const std::string &name)
int32_t addSlug (const Token &t, Ns ns)
std::pair< int32_t, int32_t > parseBlockBody ()
 Parse statements until DEDENT/EOF, appending indices to block_items; returns [begin,end).
std::pair< int32_t, int32_t > parseIndentedBlock ()
 : NEWLINE INDENT stmt+ DEDENT
int32_t parseStatement ()
int32_t parseIf ()
int32_t parseWhile ()
bool blockHasDelay (int32_t begin, int32_t end) const
int32_t parseSimple ()
int32_t parseDelay (const Token &name)
int32_t parseExpr ()
int32_t parseOr ()
int32_t parseAnd ()
int32_t parseNot ()
int32_t parseComparison ()
int32_t parseSum ()
int32_t parseTerm ()
int32_t parseUnary ()
int32_t parsePrimary ()
void run ()

Public Attributes

const std::vector< Token > & toks
ParseResult out
size_t p = 0
bool failed = false
uint32_t depth = 0
std::set< std::string > assigned
 Variables assigned somewhere at or before the current point, for use-before-assign.
uint32_t edepth = 0

Detailed Description

Definition at line 142 of file Parser.cpp.

Constructor & Destructor Documentation

◆ Parser()

fsw::script::anonymous_namespace{Parser.cpp}::Parser::Parser ( const std::vector< Token > & t)
inlineexplicit

Definition at line 154 of file Parser.cpp.

References toks.

Referenced by fsw::script::anonymous_namespace{Parser.cpp}::Parser::EDepth::EDepth().

Member Function Documentation

◆ addExpr()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::addExpr ( Expr e)
inline

Definition at line 186 of file Parser.cpp.

References out.

Referenced by parseAnd(), parseComparison(), parseNot(), parseOr(), parsePrimary(), parseSum(), parseTerm(), and parseUnary().

◆ addSlug()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::addSlug ( const Token & t,
Ns ns )
inline

Definition at line 202 of file Parser.cpp.

References out.

Referenced by parsePrimary(), and parseSimple().

◆ addStmt()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::addStmt ( Stmt s)
inline

Definition at line 190 of file Parser.cpp.

References out.

Referenced by parseDelay(), parseIf(), parseSimple(), and parseWhile().

◆ advance()

const Token & fsw::script::anonymous_namespace{Parser.cpp}::Parser::advance ( )
inline

◆ at()

bool fsw::script::anonymous_namespace{Parser.cpp}::Parser::at ( Tok k) const
inline

Definition at line 160 of file Parser.cpp.

References cur().

◆ blockHasDelay()

bool fsw::script::anonymous_namespace{Parser.cpp}::Parser::blockHasDelay ( int32_t begin,
int32_t end ) const
inline

◆ cur()

const Token & fsw::script::anonymous_namespace{Parser.cpp}::Parser::cur ( ) const
inline

Definition at line 157 of file Parser.cpp.

References p, and toks.

Referenced by at(), expect(), parseComparison(), parseExpr(), parseIndentedBlock(), parsePrimary(), parseSimple(), parseStatement(), and run().

◆ expect()

bool fsw::script::anonymous_namespace{Parser.cpp}::Parser::expect ( Tok k,
Diag code,
const char * what )
inline

Definition at line 177 of file Parser.cpp.

References advance(), at(), cur(), fail(), and fsw::script::tok_name().

Referenced by parseDelay(), parseIndentedBlock(), parsePrimary(), and parseSimple().

◆ fail()

void fsw::script::anonymous_namespace{Parser.cpp}::Parser::fail ( Diag code,
const Token & t,
std::string msg )
inline

◆ internVar()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::internVar ( const std::string & name)
inline

Definition at line 194 of file Parser.cpp.

References out.

Referenced by parsePrimary(), and parseSimple().

◆ parseAnd()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseAnd ( )
inline

◆ parseBlockBody()

std::pair< int32_t, int32_t > fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseBlockBody ( )
inline

Parse statements until DEDENT/EOF, appending indices to block_items; returns [begin,end).

Definition at line 210 of file Parser.cpp.

References at(), begin(), fsw::script::Dedent, fsw::script::Eof, failed, out, and parseStatement().

Referenced by parseIndentedBlock(), and run().

◆ parseComparison()

◆ parseDelay()

◆ parseExpr()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseExpr ( )
inline

◆ parseIf()

◆ parseIndentedBlock()

std::pair< int32_t, int32_t > fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseIndentedBlock ( )
inline

◆ parseNot()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseNot ( )
inline

◆ parseOr()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseOr ( )
inline

◆ parsePrimary()

◆ parseSimple()

◆ parseStatement()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseStatement ( )
inline

◆ parseSum()

◆ parseTerm()

◆ parseUnary()

int32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::parseUnary ( )
inline

◆ parseWhile()

◆ run()

void fsw::script::anonymous_namespace{Parser.cpp}::Parser::run ( )
inline

Member Data Documentation

◆ assigned

std::set<std::string> fsw::script::anonymous_namespace{Parser.cpp}::Parser::assigned

Variables assigned somewhere at or before the current point, for use-before-assign.

Deliberately flow-insensitive: a variable first assigned inside an if counts as assigned afterwards. Being stricter would reject readable scripts; being looser would let a NaN reach a comparison that decides whether a valve opens.

Definition at line 152 of file Parser.cpp.

Referenced by parsePrimary(), and parseSimple().

◆ depth

◆ edepth

uint32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::edepth = 0

Definition at line 493 of file Parser.cpp.

Referenced by parseExpr(), and parsePrimary().

◆ failed

bool fsw::script::anonymous_namespace{Parser.cpp}::Parser::failed = false

◆ out

◆ p

size_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::p = 0

Definition at line 145 of file Parser.cpp.

Referenced by advance(), and cur().

◆ toks

const std::vector<Token>& fsw::script::anonymous_namespace{Parser.cpp}::Parser::toks

Definition at line 143 of file Parser.cpp.

Referenced by advance(), cur(), and Parser().


The documentation for this struct was generated from the following file:
  • daq-server/diablo_server/lib/src/script/Parser.cpp