(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:agendafile) op: Equal rhs: {(DQ ($ VSub_Name '$HOME') (/.agenda))} spids: [8] ) ] spids: [8] ) (FuncDef name: isDayName body: (BraceGroup children: [ (Case to_match: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [29 45] ) } arms: [ (case_arm pat_list: [ {(sun) (Lit_Other '*')} {(mon) (Lit_Other '*')} {(tue) (Lit_Other '*')} {(wed) (Lit_Other '*')} {(thu) (Lit_Other '*')} {(fri) (Lit_Other '*')} {(sat) (Lit_Other '*')} ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:retval) op:Equal rhs:{(0)} spids:[72])] spids: [72] ) ] spids: [50 70 75 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:retval) op:Equal rhs:{(1)} spids:[82])] spids: [82] ) ] spids: [78 80 85 16777215] ) ] spids: [27 47 88] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_Name '$retval')} ) ] spids: [19] ) spids: [15 18] ) (FuncDef name: isMonthName body: (BraceGroup children: [ (Case to_match: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [107 123] ) } arms: [ (case_arm pat_list: [ {(jan) (Lit_Other '*')} {(feb) (Lit_Other '*')} {(mar) (Lit_Other '*')} {(apr) (Lit_Other '*')} {(may) (Lit_Other '*')} {(jun) (Lit_Other '*')} ] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [129 146 152 16777215] ) (case_arm pat_list: [ {(jul) (Lit_Other '*')} {(aug) (Lit_Other '*')} {(sep) (Lit_Other '*')} {(oct) (Lit_Other '*')} {(nov) (Lit_Other '*')} {(dec) (Lit_Other '*')} ] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [155 172 178 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})] spids: [181 183 189 16777215] ) ] spids: [105 125 192] ) ] spids: [102] ) spids: [98 101] ) (FuncDef name: normalize body: (BraceGroup children: [ (Pipeline children: [ (C {(/bin/echo)} {(-n)} {($ VSub_Number '$1')}) (C {(cut)} {(-c1)}) (C {(tr)} {(SQ <'[[:lower:]]'>)} {(SQ <'[[:upper:]]'>)}) ] negated: F ) (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(cut)} {(-c2-3)}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: F ) ] spids: [201] ) spids: [197 200] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-w)} {($ VSub_Name '$HOME')} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ($ VSub_Number '$0') (': cannot write in your home directory (') ($ VSub_Name '$HOME') (')') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[284])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 272] ) ] spids: [16777215 292] ) (C {(echo)} {(DQ ('Agenda: The Unix Reminder Service'))}) (C {(/bin/echo)} {(-n)} {(DQ ('Date of event (day mon, day month year, or dayname): '))}) (C {(read)} {(word1)} {(word2)} {(word3)} {(junk)}) (If arms: [ (if_arm cond: [(Sentence child:(C {(isDayName)} {($ VSub_Name '$word1')}) terminator:<Op_Semi ';'>)] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$word2'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ('Bad dayname format: just specify the day name by itself.'))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[356])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 347] ) ] spids: [16777215 365] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(normalize)} {($ VSub_Name '$word1')})] ) left_token: <Left_CommandSub '$('> spids: [370 374] ) ) } spids: [368] ) ] spids: [368] ) ] spids: [16777215 328] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$word2'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad dayname format: unknown day name specified'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[405])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 396] ) ] spids: [16777215 414] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$word1')}) (C {(sed)} {(SQ <'s/[[:digit:]]//g'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [427 437] ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: please specify day first, by day number'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[453])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 444] ) ] spids: [16777215 462] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$word1'))} {(-lt)} {(1)} {(-o)} {(DQ ($ VSub_Name '$word1'))} {(-gt)} {(31)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: day number can only be in range 1-31'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[501])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 492] ) ] spids: [16777215 510] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(isMonthName)} {(DQ ($ VSub_Name '$word2'))})] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: unknown month name specified.'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[535])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 526] ) ] spids: [16777215 544] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:word2) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(normalize)} {($ VSub_Name '$word2')})] ) left_token: <Left_CommandSub '$('> spids: [550 554] ) ) } spids: [548] ) ] spids: [548] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$word3'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: {(DQ ($ VSub_Name '$word1') ($ VSub_Name '$word2'))} spids: [576] ) ] spids: [576] ) ] spids: [16777215 573] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$word3')}) (C {(sed)} {(SQ <'s/[[:digit:]]//g'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [595 605] ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: third field should be year.'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[621])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 612] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$word3')} {(-lt)} {(2000)} {(-o)} {($ VSub_Name '$word3')} {(-gt)} {(2500)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: year value should be 2000-2500'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[661])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [630 652] ) ] spids: [16777215 670] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: {(DQ ($ VSub_Name '$word1') ($ VSub_Name '$word2') ($ VSub_Name '$word3'))} spids: [673] ) ] spids: [673] ) ] spids: [583 681] ) ] spids: [378 683] ) (C {(/bin/echo)} {(-n)} {(DQ ('One-line description: '))}) (C {(read)} {(description)}) (SimpleCommand words: [ {(echo)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [(C {(echo)} {($ VSub_Name '$date')}) (C {(sed)} {(SQ <'s/ //g'>)})] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [707 717] ) ('|') ($ VSub_Name '$description') ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: 16777215 arg_word: {($ VSub_Name '$agendafile')} spids: [722] ) ] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )