Skip to content

Commit 6ba6c42

Browse files
committed
Only inspect expressions for now
For `inspect` statements, we'll need to repeat the `if constexpr` rigamarole
1 parent dcf482c commit 6ba6c42

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

source/lex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ auto lex_line(
728728
//G
729729
//G floating-point-literal:
730730
//G digit { ' | digit }* . digit { ' | digit }*
731-
//GTODO TODO: full grammar
731+
//GTODO full grammar
732732
//G
733733
else if (is_digit(line[i])) {
734734
auto j = 1;

source/parse.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ class parser
19491949
// it doesn't destabilize any regression tests
19501950
)
19511951
{
1952-
error("expression-statement does not end with semicolon");
1952+
error("expected ; at end of statement");
19531953
return {};
19541954
}
19551955
if (curr().type() == lexeme::Semicolon) {
@@ -2267,6 +2267,14 @@ class parser
22672267
return {};
22682268
}
22692269

2270+
if (!is_expression) {
2271+
errors.emplace_back(
2272+
curr().position(),
2273+
"(temporary alpha limitation) cppfront is still learning 'inspect' - only inspect expressions are currently supported"
2274+
);
2275+
return {};
2276+
}
2277+
22702278
auto n = std::make_unique<inspect_expression_node>();
22712279
n->identifier = &curr();
22722280
next();

0 commit comments

Comments
 (0)