|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
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 |
Definition at line 142 of file Parser.cpp.
|
inlineexplicit |
Definition at line 154 of file Parser.cpp.
References toks.
Referenced by fsw::script::anonymous_namespace{Parser.cpp}::Parser::EDepth::EDepth().
|
inline |
Definition at line 186 of file Parser.cpp.
References out.
Referenced by parseAnd(), parseComparison(), parseNot(), parseOr(), parsePrimary(), parseSum(), parseTerm(), and parseUnary().
|
inline |
Definition at line 202 of file Parser.cpp.
References out.
Referenced by parsePrimary(), and parseSimple().
|
inline |
Definition at line 190 of file Parser.cpp.
References out.
Referenced by parseDelay(), parseIf(), parseSimple(), and parseWhile().
|
inline |
Definition at line 163 of file Parser.cpp.
Referenced by expect(), parseAnd(), parseComparison(), parseDelay(), parseIf(), parseIndentedBlock(), parseNot(), parseOr(), parsePrimary(), parseSimple(), parseSum(), parseTerm(), parseUnary(), parseWhile(), and run().
|
inline |
Definition at line 160 of file Parser.cpp.
References cur().
|
inline |
Definition at line 349 of file Parser.cpp.
References begin(), blockHasDelay(), fsw::script::Stmt::body_begin, fsw::script::Stmt::body_end, fsw::script::Delay, fsw::script::Stmt::else_begin, fsw::script::Stmt::else_end, end(), fsw::script::If, fsw::script::Stmt::kind, out, and fsw::script::While.
Referenced by blockHasDelay(), and parseWhile().
|
inline |
Definition at line 157 of file Parser.cpp.
Referenced by at(), expect(), parseComparison(), parseExpr(), parseIndentedBlock(), parsePrimary(), parseSimple(), parseStatement(), and run().
|
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().
|
inline |
Definition at line 170 of file Parser.cpp.
Referenced by expect(), parseComparison(), parseDelay(), parseExpr(), parseIndentedBlock(), parsePrimary(), parseSimple(), parseStatement(), parseTerm(), parseWhile(), and run().
|
inline |
Definition at line 194 of file Parser.cpp.
References out.
Referenced by parsePrimary(), and parseSimple().
|
inline |
Definition at line 533 of file Parser.cpp.
References addExpr(), advance(), fsw::script::And, at(), fsw::script::Binary, fsw::script::Expr::col, failed, fsw::script::Expr::kind, fsw::script::KwAnd, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Expr::op, parseNot(), fsw::script::Expr::rhs, and rhs.
Referenced by parseOr().
|
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().
|
inline |
Definition at line 569 of file Parser.cpp.
References addExpr(), advance(), fsw::script::Binary, fsw::script::ChainedComparison, fsw::script::Expr::col, cur(), fsw::script::Eq, fsw::script::EqEq, fail(), failed, fsw::script::Ge, fsw::script::Gt, fsw::script::Expr::kind, fsw::script::Le, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Lt, fsw::script::Ne, fsw::script::Expr::op, parseSum(), fsw::script::Expr::rhs, and rhs.
Referenced by parseNot().
|
inline |
Definition at line 462 of file Parser.cpp.
References addStmt(), advance(), fsw::script::Stmt::col, fsw::script::Delay, fsw::script::DelayNotPositive, expect(), fsw::script::ExpectedNewline, fsw::script::ExpectedRParen, fsw::script::Stmt::expr, fail(), failed, fsw::script::Expr::kind, fsw::script::Stmt::kind, fsw::script::Stmt::line, fsw::script::Newline, fsw::script::Number, fsw::script::Expr::number, out, parseExpr(), and fsw::script::RParen.
Referenced by parseSimple().
|
inline |
Definition at line 504 of file Parser.cpp.
References cur(), edepth, fsw::script::ExprTooDeep, fail(), g, fsw::script::kMaxExprDepth, and parseOr().
Referenced by parseDelay(), parseIf(), parsePrimary(), parseSimple(), and parseWhile().
|
inline |
Definition at line 279 of file Parser.cpp.
References addStmt(), advance(), at(), begin(), fsw::script::Stmt::body_begin, fsw::script::Stmt::body_end, fsw::script::Stmt::col, fsw::script::Token::col, fsw::script::Stmt::else_begin, fsw::script::Stmt::else_end, fsw::script::Stmt::expr, failed, fsw::script::If, fsw::script::Stmt::kind, fsw::script::KwElif, fsw::script::KwElse, fsw::script::Stmt::line, fsw::script::Token::line, out, parseExpr(), parseIf(), and parseIndentedBlock().
Referenced by parseIf(), and parseStatement().
|
inline |
: NEWLINE INDENT stmt+ DEDENT
Definition at line 227 of file Parser.cpp.
References advance(), at(), fsw::script::Colon, cur(), fsw::script::Dedent, depth, expect(), fsw::script::ExpectedBlock, fsw::script::ExpectedColon, fsw::script::ExpectedNewline, fail(), failed, fsw::script::Indent, fsw::script::kMaxNestingDepth, fsw::script::Newline, out, parseBlockBody(), and fsw::script::TooDeep.
Referenced by parseIf(), and parseWhile().
|
inline |
Definition at line 552 of file Parser.cpp.
References addExpr(), advance(), at(), fsw::script::Expr::col, failed, fsw::script::Expr::kind, fsw::script::KwNot, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Not, fsw::script::Expr::op, parseComparison(), parseNot(), and fsw::script::Unary.
Referenced by parseAnd(), and parseNot().
|
inline |
Definition at line 514 of file Parser.cpp.
References addExpr(), advance(), at(), fsw::script::Binary, fsw::script::Expr::col, failed, fsw::script::Expr::kind, fsw::script::KwOr, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Expr::op, fsw::script::Or, parseAnd(), fsw::script::Expr::rhs, and rhs.
Referenced by parseExpr().
|
inline |
Definition at line 707 of file Parser.cpp.
References addExpr(), addSlug(), advance(), assigned, at(), fsw::script::CallNotAStatement, fsw::script::Expr::col, cur(), edepth, fsw::script::Elapsed, expect(), fsw::script::ExpectedExpr, fsw::script::ExpectedLParen, fsw::script::ExpectedName, fsw::script::ExpectedRParen, fsw::script::ExprTooDeep, fail(), failed, g, fsw::script::Ident, internVar(), fsw::script::anonymous_namespace{Parser.cpp}::isBuiltin(), fsw::script::anonymous_namespace{Parser.cpp}::kElapsed, fsw::script::Expr::kind, fsw::script::kMaxExprDepth, fsw::script::anonymous_namespace{Parser.cpp}::kPressure, fsw::script::Expr::line, fsw::script::LParen, fsw::script::Number, fsw::script::Expr::number, parseExpr(), fsw::script::Pressure, fsw::script::PtSensor, fsw::script::RParen, fsw::script::Expr::slug, fsw::script::tok_name(), fsw::script::UnknownCall, fsw::script::Var, fsw::script::Expr::var, and fsw::script::VarUsedBeforeAssign.
Referenced by parseUnary().
|
inline |
Definition at line 369 of file Parser.cpp.
References fsw::script::Actuator, addSlug(), addStmt(), advance(), fsw::script::Assign, assigned, fsw::script::AssignToCall, at(), fsw::script::CallNotAStatement, fsw::script::CloseValve, fsw::script::Stmt::col, cur(), expect(), fsw::script::ExpectedLParen, fsw::script::ExpectedName, fsw::script::ExpectedNewline, fsw::script::ExpectedRParen, fsw::script::Stmt::expr, fail(), failed, fsw::script::Ident, internVar(), fsw::script::anonymous_namespace{Parser.cpp}::isBuiltin(), fsw::script::anonymous_namespace{Parser.cpp}::kCloseValve, fsw::script::anonymous_namespace{Parser.cpp}::kDelay, fsw::script::anonymous_namespace{Parser.cpp}::kElapsed, fsw::script::Stmt::kind, fsw::script::kMaxVariables, fsw::script::anonymous_namespace{Parser.cpp}::kOpenValve, fsw::script::anonymous_namespace{Parser.cpp}::kPressure, fsw::script::anonymous_namespace{Parser.cpp}::kTransitionTo, fsw::script::Stmt::line, fsw::script::LParen, fsw::script::Newline, fsw::script::ns_name(), fsw::script::OpenValve, out, parseDelay(), parseExpr(), fsw::script::RParen, fsw::script::Stmt::slug, fsw::script::State, fsw::script::Token::text, fsw::script::tok_name(), fsw::script::TooManyVariables, fsw::script::TransitionTo, fsw::script::UnknownCall, and fsw::script::Stmt::var.
Referenced by parseStatement().
|
inline |
Definition at line 262 of file Parser.cpp.
References at(), cur(), fail(), fsw::script::Indent, fsw::script::kMaxStatements, fsw::script::KwIf, fsw::script::KwWhile, out, parseIf(), parseSimple(), parseWhile(), fsw::script::TooManyStatements, and fsw::script::UnexpectedIndent.
Referenced by parseBlockBody().
|
inline |
Definition at line 628 of file Parser.cpp.
References fsw::script::Add, addExpr(), advance(), at(), fsw::script::Binary, fsw::script::Expr::col, failed, fsw::script::Expr::kind, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Minus, fsw::script::Expr::op, parseTerm(), fsw::script::Plus, fsw::script::Expr::rhs, rhs, and fsw::script::Sub.
Referenced by parseComparison().
|
inline |
Definition at line 648 of file Parser.cpp.
References addExpr(), advance(), at(), fsw::script::Binary, fsw::script::Expr::col, fsw::script::Div, fsw::script::DivideByZeroLiteral, fail(), failed, fsw::script::Expr::kind, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Mul, fsw::script::Number, fsw::script::Expr::op, out, parseUnary(), r, fsw::script::Expr::rhs, rhs, fsw::script::Slash, and fsw::script::Star.
Referenced by parseSum().
|
inline |
Definition at line 675 of file Parser.cpp.
References addExpr(), advance(), at(), fsw::script::Expr::col, failed, fsw::script::Expr::kind, fsw::script::Expr::lhs, fsw::script::Expr::line, fsw::script::Minus, fsw::script::Neg, fsw::script::Number, fsw::script::Expr::op, out, parsePrimary(), parseUnary(), and fsw::script::Unary.
Referenced by parseTerm(), and parseUnary().
|
inline |
Definition at line 318 of file Parser.cpp.
References addStmt(), advance(), blockHasDelay(), fsw::script::Stmt::body_begin, fsw::script::Stmt::body_end, fsw::script::Stmt::col, fsw::script::Token::col, fsw::script::Stmt::expr, fail(), failed, fsw::script::Stmt::kind, fsw::script::Stmt::line, fsw::script::Token::line, fsw::script::LoopWithoutDelay, parseExpr(), parseIndentedBlock(), and fsw::script::While.
Referenced by parseStatement().
|
inline |
Definition at line 794 of file Parser.cpp.
References advance(), at(), cur(), fsw::script::Eof, fsw::script::ExpectedNewline, fail(), failed, fsw::script::Newline, out, parseBlockBody(), and fsw::script::tok_name().
| 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().
| uint32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::depth = 0 |
Definition at line 147 of file Parser.cpp.
Referenced by feedtwin.vessels.geometry.Head::area_filled(), feedtwin.vessels.geometry.Head::cross_section(), parseIndentedBlock(), feedtwin.vessels.geometry.Head::volume(), and feedtwin.vessels.geometry.Head::volume_filled().
| uint32_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::edepth = 0 |
Definition at line 493 of file Parser.cpp.
Referenced by parseExpr(), and parsePrimary().
| bool fsw::script::anonymous_namespace{Parser.cpp}::Parser::failed = false |
Definition at line 146 of file Parser.cpp.
Referenced by test_ota_flash.Results::check(), fail(), parseAnd(), parseBlockBody(), parseComparison(), parseDelay(), parseIf(), parseIndentedBlock(), parseNot(), parseOr(), parsePrimary(), parseSimple(), parseSum(), parseTerm(), parseUnary(), parseWhile(), and run().
| ParseResult fsw::script::anonymous_namespace{Parser.cpp}::Parser::out |
Definition at line 144 of file Parser.cpp.
Referenced by addExpr(), addSlug(), addStmt(), blockHasDelay(), fail(), internVar(), parseBlockBody(), parseDelay(), parseIf(), parseIndentedBlock(), parseSimple(), parseStatement(), parseTerm(), parseUnary(), run(), test_injector_layout.TestOldFlatDesigns::test_calls_out_the_thin_lox_web(), test_injector_layout.TestChannels::test_channel_flow_area_is_reported_against_the_orifices(), test_injector_layout.TestOldFlatDesigns::test_crams_every_element_onto_a_circle_narrower_than_the_throat(), test_injector_layout.TestChannels::test_drawn_passages_start_on_the_flank_and_end_on_the_floor(), test_injector_layout.TestChannels::test_flat_floor_leaves_an_acute_inlet_lip_and_no_short_wall_rule(), test_injector_layout.TestChannels::test_lands_between_are_what_is_left(), test_injector_layout.TestOldFlatDesigns::test_leaves_no_room_at_the_axis(), test_injector_layout.TestChannels::test_numbers_as_drawn(), test_injector_layout.TestChannels::test_passage_runs_its_L_over_d_to_the_channel_floor(), test_injector_layout.TestEnvelope::test_sleeve_from_the_requirements(), test_injector_layout.TestOldFlatDesigns::test_sp8089_included_angle(), and test_injector_layout.TestChannels::test_the_section_dimensions_each_channel_and_its_hole_axis_meets_it().
| size_t fsw::script::anonymous_namespace{Parser.cpp}::Parser::p = 0 |
Definition at line 145 of file Parser.cpp.
| const std::vector<Token>& fsw::script::anonymous_namespace{Parser.cpp}::Parser::toks |
Definition at line 143 of file Parser.cpp.