@@ -3,8 +3,10 @@ mod types;
33
44use alloc:: vec:: IntoIter ;
55
6- use types:: KeywordParsing ;
6+ use types:: controlflow:: ControlFlowKeyword ;
7+ use types:: { KeywordParsing , PushInNode as _} ;
78
9+ use super :: parse_content:: parse_block;
810use super :: state:: ParsingState ;
911use super :: tree:: node:: Ast ;
1012use crate :: errors:: api:: CompileError ;
@@ -14,18 +16,15 @@ use crate::Location;
1416#[ allow( clippy:: todo, reason = "not yet implemented" ) ]
1517pub fn handle_keyword (
1618 keyword : Keyword ,
17- _current : & mut Ast ,
18- _p_state : & mut ParsingState ,
19- _tokens : & mut IntoIter < Token > ,
20- _location : Location ,
19+ current : & mut Ast ,
20+ p_state : & mut ParsingState ,
21+ tokens : & mut IntoIter < Token > ,
22+ location : Location ,
2123) -> Result < ( ) , CompileError > {
22- let case_context = true ; // node.is_in_case_context();
23- match KeywordParsing :: from ( ( keyword, case_context) ) {
24- KeywordParsing :: Nullptr => todo ! ( ) ,
25- KeywordParsing :: False => todo ! ( ) ,
26- KeywordParsing :: True => todo ! ( ) ,
27- KeywordParsing :: CtrlFlow ( _) => todo ! ( ) ,
28- KeywordParsing :: Attr ( _) => todo ! ( ) ,
29- KeywordParsing :: Func ( _) => todo ! ( ) ,
30- }
24+ let case_context = ControlFlowKeyword :: is_in_case_context ( current) ;
25+ let parsed_keyword = KeywordParsing :: from ( ( keyword, case_context) ) ;
26+ parsed_keyword
27+ . push_in_node ( current)
28+ . map_err ( |msg| location. into_error ( msg) ) ?;
29+ parse_block ( tokens, p_state, current)
3130}
0 commit comments