Skip to content

Commit

Permalink
LibCMake: Treat block, endblock and return as control keywords
Browse files Browse the repository at this point in the history
I missed these before because they weren't mentioned on the language
description page of the CMake manual.
  • Loading branch information
AtkinsSJ authored and awesomekling committed Mar 5, 2023
1 parent ca2b030 commit 6319274
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Userland/Libraries/LibCMake/Token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Optional<ControlKeywordType> control_keyword_from_string(StringView value)
return ControlKeywordType::Break;
if (value.equals_ignoring_case("continue"sv))
return ControlKeywordType::Continue;
if (value.equals_ignoring_case("return"sv))
return ControlKeywordType::Return;
if (value.equals_ignoring_case("macro"sv))
return ControlKeywordType::Macro;
if (value.equals_ignoring_case("endmacro"sv))
Expand All @@ -38,6 +40,10 @@ Optional<ControlKeywordType> control_keyword_from_string(StringView value)
return ControlKeywordType::Function;
if (value.equals_ignoring_case("endfunction"sv))
return ControlKeywordType::EndFunction;
if (value.equals_ignoring_case("block"sv))
return ControlKeywordType::Block;
if (value.equals_ignoring_case("endblock"sv))
return ControlKeywordType::EndBlock;
return {};
}

Expand Down
3 changes: 3 additions & 0 deletions Userland/Libraries/LibCMake/Token.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ enum class ControlKeywordType {
EndWhile,
Break,
Continue,
Return,
Macro,
EndMacro,
Function,
EndFunction,
Block,
EndBlock,
};

struct Token {
Expand Down

0 comments on commit 6319274

Please sign in to comment.