Skip to content

Commit

Permalink
Detect and highlight the fakeroot keyword
Browse files Browse the repository at this point in the history
The fakeroot keyword might appear in front of shell and bitbake python
functions.

The parser/lexer rules have been updated and the tokens will be
highlighted as keywords by the syntax highlighter.

Signed-off-by: Florian Bezdeka <[email protected]>
  • Loading branch information
fbezdeka committed Jul 30, 2024
1 parent bdd6334 commit 89f335a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ bitbakeFile ::= item_*
private item_ ::= (variable|bbFunction|bbStatement|keyword|COMMENT|CRLF)
variable ::= (EXPORT? KEY OVERRIDE* OPERATOR VALUE)
bbFunction ::= (bbBashFunction | bbPyFunction | bbDefPyFunction)
bbBashFunction ::= (BB_FUNCTION_NAME OVERRIDE* LB RB LBB FB+ RBB)
bbPyFunction ::= (PYTHON (BB_FUNCTION_NAME OVERRIDE*)? LB RB LBB FB+ RBB)
bbBashFunction ::= (FAKEROOT? BB_FUNCTION_NAME OVERRIDE* LB RB LBB FB+ RBB)
bbPyFunction ::= (FAKEROOT? PYTHON (BB_FUNCTION_NAME OVERRIDE*)? LB RB LBB FB+ RBB)
bbDefPyFunction ::= (DEF BB_FUNCTION_NAME LB bbDefParam* RB LBB FB+ RBB)
bbDefParam ::= (BB_FUNCTION_NAME COMMA?)+
keyword ::= (INHERIT|INCLUDE|REQUIRE|EXPORT) INCLUDE_REST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ FN_TOKEN=({FN_NAME} {BROKEN_OVERRIDE}*)

<FUNCTION_NAME> {
"python" { return BitBakeTypes.PYTHON; }
"fakeroot" { return BitBakeTypes.FAKEROOT; }
"(" { return BitBakeTypes.LB; }
")" { return BitBakeTypes.RB; }
"{" { yybegin(FUNCTION_VALUE); return BitBakeTypes.LBB; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
return KEYWORD_KEYS;
} else if (tokenType.equals(BitBakeTypes.OVERRIDE)) {
return KEYWORD_KEYS;
} else if (tokenType.equals(BitBakeTypes.FAKEROOT)) {
return KEYWORD_KEYS;
} else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
return BAD_CHAR_KEYS;
} else {
Expand Down

0 comments on commit 89f335a

Please sign in to comment.