(CommandList children: [ (FuncDef name: k_script_build body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_VERSION) op: Equal rhs: {(DQ (1.0.0))} spids: [29] ) ] spids: [27] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_DESCRIPTION) op: Equal rhs: { (DQ ( 'Process shell source (.) statements into absolute references or inline the script' ) ) } spids: [37] ) ] spids: [35] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:KOALEPHANT_TOOL_OPTIONS) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(EOT)} here_end_span_id: 70 stdin_parts: [ ('Options:\n') ('\n') ( ' -c, --cd change to the input file directory before building\n' ) ( ' -f, --file file the source to read. If not specified, defaults to stdin\n' ) ( ' -o, --output file the file to write to. If not specified, defaults to stdout\n' ) ( ' -d, --define var=val define simple replacements to be performed while processing e.g. LIB_PATH=/foo\n' ) ( ' -i, --inline, --static path dir or file path to explicitly inline. Can be specified multiple times\n' ) ( ' -l, --link, --dynamic path=abs dir or file path to explicitly link to. Can be specified multiple times\n' ) ( ' -r, --report process input and report all discovered inclusions\n' ) ( ' -x, --executable mark the resulting file (if not stdout) executable\n' ) (' -h, --help show this help\n') (' -v, --version show the version\n') ( ' -V, --verbose show verbose output\n' ) (' -D, --debug show debug output\n') ( ' -q, --quiet suppress all output except errors\n' ) ('\n') ] ) ] ) ] ) left_token: <Left_CommandSub '$('> spids: [47 72] ) ) } spids: [45] ) ] spids: [43] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:FIND_SOURCE_LINES) op: Equal rhs: { (DQ ('s/^') (Lit_Other '\\') ('s*') (Lit_Other '\\') ('. (.*)/K_SCRIPT_BUILD_REPORT') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (1/p) ) } spids: [78] ) ] spids: [76] ) (Assignment keyword: Assign_Readonly pairs: [(assign_pair lhs:(LhsName name:FIND_SOURCE_LINES) op:Equal spids:[92])] spids: [90] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:FIX_NEWLINES) op: Equal rhs: {(SQ <'$a\\\\'>)} spids: [98] ) ] spids: [96] ) (Assignment keyword: Assign_Readonly pairs: [(assign_pair lhs:(LhsName name:FIX_NEWLINES) op:Equal spids:[106])] spids: [104] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:infile) op:Equal rhs:{(/dev/stdin)} spids:[112])] spids: [110] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:outfile) op: Equal rhs: {(/dev/stdout)} spids: [118] ) ] spids: [116] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:executable) op:Equal rhs:{(false)} spids:[125])] spids: [123] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:report) op:Equal rhs:{(false)} spids:[132])] spids: [130] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:changeDir) op:Equal rhs:{(false)} spids:[138])] spids: [136] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:changeDirPath) op:Equal rhs:{(DQ )} spids:[144])] spids: [142] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:sourcePaths) op:Equal rhs:{(DQ )} spids:[152])] spids: [150] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:definitions) op:Equal rhs:{(DQ )} spids:[159])] spids: [157] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:newline) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(printf)} {(SQ <'\\n '>)})]) left_token: <Left_CommandSub '$('> spids: [169 175] ) ) } spids: [167] ) ] spids: [165] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:newline) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name newline> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(' ')}) spids: [181 185] ) ) } spids: [179] ) ] spids: [179] ) (C {(.)} {(./shell-script-library.lib.sh)}) (SimpleCommand words: [{(k_log_level)} {(${ VSub_Name KOALEPHANT_LOG_LEVEL_NOTICE)}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (FuncDef name: add_source_path body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:type) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [217] ) ] spids: [215] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [225] ) ] spids: [223] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:value) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 3> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(EmptyPart)}) spids: [235 238] ) ) } spids: [233] ) ] spids: [231] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:sep) op:Equal rhs:{(DQ )} spids:[244])] spids: [242] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name sourcePaths))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sep) op: Equal rhs: {(DQ (Lit_Other '\\') (n))} spids: [267] ) ] spids: [267] ) ] spids: [16777215 264] ) ] spids: [16777215 274] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sourcePaths) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(printf)} {(DQ ('%s') (${ VSub_Name sep) ('%s#%s#%s'))} {(DQ (${ VSub_Name sourcePaths))} {(DQ (${ VSub_Name type))} {(DQ (${ VSub_Name source))} {(DQ (${ VSub_Name value))} ) ] ) left_token: <Left_CommandSub '$('> spids: [280 314] ) ) } spids: [278] ) ] spids: [278] ) ] spids: [212] ) spids: [208 211] ) (FuncDef name: add_dynamic_mapping body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:find) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [331] ) ] spids: [329] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:target) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [339] ) ] spids: [337] ) (C {(k_log_info)} { (DQ ("Adding dynamic mapping for '") (${ VSub_Name find) ("' => '") (${ VSub_Name target) ("'") ) } ) (C {(add_source_path)} {(dynamic)} {(DQ (${ VSub_Name find))} {(DQ (${ VSub_Name target))} ) ] spids: [326] ) spids: [322 325] ) (FuncDef name: add_static_path body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:path) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [391] ) ] spids: [389] ) (C {(k_log_info)} {(DQ ("Adding static path for '") (${ VSub_Name path) ("'"))}) (C {(add_source_path)} {(static)} {(DQ (${ VSub_Name path))}) ] spids: [386] ) spids: [382 385] ) (FuncDef name: add_definition body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:definition) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [433] ) ] spids: [431] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:value) op: Equal rhs: {(DQ ($ VSub_Number '$2'))} spids: [441] ) ] spids: [439] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:sep) op:Equal rhs:{(DQ )} spids:[449])] spids: [447] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name definitions))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sep) op: Equal rhs: {(DQ (Lit_Other '\\') (n))} spids: [472] ) ] spids: [472] ) ] spids: [16777215 469] ) ] spids: [16777215 479] ) (C {(k_log_info)} { (DQ ("Adding definition for '") (${ VSub_Name definition) ("' with value '") (${ VSub_Name value) ("'") ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:definitions) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(printf)} {(DQ ('%s') (${ VSub_Name sep) ('%s %s'))} {(DQ (${ VSub_Name definitions))} {(DQ ($ VSub_Name '$definition'))} {(DQ (${ VSub_Name value))} ) ] ) left_token: <Left_CommandSub '$('> spids: [501 527] ) ) } spids: [499] ) ] spids: [499] ) ] spids: [428] ) spids: [424 427] ) (FuncDef name: get_definition_pattern body: (BraceGroup children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name definitions))}) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (SimpleCommand words: [{(read)} {(-r)} {(key)} {(value)}] more_env: [(env_pair name:IFS val:{(DQ (' '))} spids:[554])] ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name key))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [(ControlFlow token:<ControlFlow_Continue continue>)] spids: [16777215 586] ) ] spids: [16777215 592] ) (C {(k_log_debug)} { (DQ ("Using definition: '") (${ VSub_Name key) ("' = '") (${ VSub_Name value) ("'") ) } ) (C {(printf)} { (DQ ('s#([^A-Za-z0-9_])%s([^A-Za-z0-9_])#') (EscapedLiteralPart token: <Lit_EscapedChar '\\\\'> ) (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ('1%s') (EscapedLiteralPart token: <Lit_EscapedChar '\\\\'> ) (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ('2#g; ') ) } {(DQ (${ VSub_Name key))} {(DQ (${ VSub_Name value))} ) ] spids: [568 635] ) ) ] negated: F ) ] spids: [539] ) spids: [535 538] ) (FuncDef name: get_include_pattern body: (BraceGroup children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name sourcePaths))}) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (SimpleCommand words: [{(read)} {(-r)} {(type)} {(source)} {(value)}] more_env: [(env_pair name:IFS val:{(DQ ('#'))} spids:[661])] ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Case to_match: {(DQ (${ VSub_Name type))} arms: [ (case_arm pat_list: [{(dynamic)}] action: [ (C {(printf)} {(DQ ('s#%s#%s#g; '))} { (DQ ('^(') (Lit_Other '\\') ('s*') (Lit_Other '\\') (.) (Lit_Other '\\') ('s+)([') (Lit_Other '\\') ("'") (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (']?)(') (CommandSubPart command_list: (CommandList children: [ (C {(escape_sed_pattern)} {(DQ (${ VSub_Name source))} ) ] ) left_token: <Left_CommandSub '$('> spids: [713 721] ) (')(.*') (Lit_Other '\\') (2) (Lit_Other '\\') ('s*)') (EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) ) } { (DQ (Lit_Other '\\') (1) (Lit_Other '\\') (2) (CommandSubPart command_list: (CommandList children: [ (C {(escape_sed_replacement)} {(DQ (${ VSub_Name value))} ) ] ) left_token: <Left_CommandSub '$('> spids: [735 743] ) (Lit_Other '\\') (4) ) } ) ] spids: [691 692 749 16777215] ) (case_arm pat_list: [{(static)}] action: [ (C {(printf)} {(DQ ('s#%s#%s#g; '))} { (DQ ('^(') (Lit_Other '\\') ('s*)') (Lit_Other '\\') (.) (Lit_Other '\\') ('s+([') (Lit_Other '\\') ("'") (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (']?)(') (CommandSubPart command_list: (CommandList children: [ (C {(glob_to_sed)} {(${ VSub_Name source)}) ] ) left_token: <Left_CommandSub '$('> spids: [775 781] ) (')') (Lit_Other '\\') (2) (Lit_Other '\\') ('s*') (Lit_Other '$') ) } {(DQ (K_SCRIPT_BUILD_INCLUDE) (Lit_Other '\\') (1) (Lit_Other '\\') (3))} ) ] spids: [753 754 799 16777215] ) ] spids: [680 688 803] ) ] spids: [677 806] ) ) ] negated: F ) ] spids: [646] ) spids: [642 645] ) (FuncDef name: glob_to_sed body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:pattern) op: Equal rhs: {(DQ )} spids: [822] ) ] spids: [820] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:sep) op: Equal rhs: {(DQ ('|'))} spids: [829] ) ] spids: [827] ) (C {(k_log_debug)} {(DQ ("Converting glob pattern to sed: '") ($ VSub_At '$@') ("'"))} ) (ForEach iter_name: file iter_words: [{(DQ ($ VSub_At '$@'))}] do_arg_iter: F body: (DoGroup children: [ (C {(k_log_debug)} {(DQ ("Checking file exists: '") (${ VSub_Name file) ("'"))} ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-e)} {(DQ (${ VSub_Name file))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pattern) op: Equal rhs: { (DQ (${ VSub_Name pattern) (CommandSubPart command_list: (CommandList children: [ (C {(escape_sed_pattern)} {(DQ (${ VSub_Name file))} ) ] ) left_token: <Left_CommandSub '$('> spids: [892 900] ) (${ VSub_Name sep) ) } spids: [887] ) ] spids: [887] ) ] spids: [16777215 884] ) ] spids: [16777215 907] ) ] spids: [855 910] ) spids: [849 853] ) (C {(printf)} {(DQ ('%s'))} { (DQ (BracedVarSub token: <VSub_Name pattern> suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(${ VSub_Name sep)}) spids: [921 927] ) ) } ) ] spids: [817] ) spids: [813 816] ) (FuncDef name: escape_sed_pattern body: (BraceGroup children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Number 1))}) (C {(sed)} {(-e)} {(SQ <'s/[]\\/$*.^\\|[()?+{}]/\\\\&/g'>)}) ] negated: F ) ] spids: [939] ) spids: [935 938] ) (FuncDef name: escape_sed_replacement body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:delimiter) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /)} ) spids: [976 980] ) ) } spids: [974] ) ] spids: [972] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} { (BracedVarSub token: <VSub_Name delimiter> prefix_op: VSub_Pound spids: [989 992] ) } {(-ne)} {(1)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(k_log_alert)} { (DQ ('Error, pattern delimiter must be exactly one character: ') (${ VSub_Name delimiter) ) } ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(2)} ) ] spids: [16777215 1001] ) ] spids: [16777215 1019] ) (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Number 1))}) (C {(sed)} {(-e)} { (DQ ('s/[') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (${ VSub_Name delimiter) (Lit_Other '\\') ('&]/') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (EscapedLiteralPart token: <Lit_EscapedChar '\\\\'> ) ('&/g') ) } ) ] negated: F ) ] spids: [969] ) spids: [965 968] ) (FuncDef name: process_stream body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:pattern) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [1065] ) ] spids: [1063] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:parentPrefix) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(EmptyPart)}) spids: [1075 1078] ) ) } spids: [1073] ) ] spids: [1071] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-ge)} {(2)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [(C {(shift)} {(2)})] spids: [16777215 1095] ) ] else_action: [(C {(shift)})] spids: [1103 1109] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:sedOpts) op: Equal rhs: {(DQ ($ VSub_Star '$*'))} spids: [1114] ) ] spids: [1112] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:defPattern) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(get_definition_pattern)})] ) left_token: <Left_CommandSub '$('> spids: [1125 1127] ) ) } spids: [1123] ) ] spids: [1121] ) (C {(k_log_debug)} { (DQ ("Processing stream using pattern: '") (${ VSub_Name pattern) ("', definition pattern: '") (${ VSub_Name defPattern) ("'") ) } ) (Pipeline children: [ (C {(sed)} {(-E)} {(${ VSub_Name sedOpts)} {(-e)} {(DQ (${ VSub_Name FIX_NEWLINES))} {(-e)} {(DQ (${ VSub_Name defPattern))} {(-e)} {(DQ ('s/^/') (${ VSub_Name parentPrefix) (/g))} {(-e)} {(DQ (${ VSub_Name pattern))} ) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (SimpleCommand words: [{(read)} {(-r)} {(line)}] more_env: [(env_pair name:IFS val:{(EmptyPart)} spids:[1194])] ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:prefix) op: Equal rhs: {(DQ (${ VSub_Name parentPrefix))} spids: [1208] ) ] spids: [1206] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:includeFile) op: Equal rhs: {(DQ )} spids: [1218] ) ] spids: [1216] ) (Case to_match: {(DQ (${ VSub_Name line))} arms: [ (case_arm pat_list: [{(K_SCRIPT_BUILD_INCLUDE) (Lit_Other '*')}] action: [ (C {(k_log_debug)} {(DQ ("Processing 'include' line: '") (${ VSub_Name line))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:line) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_string_remove_start)} {(DQ (K_SCRIPT_BUILD_INCLUDE))} {(DQ (${ VSub_Name line))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1253 1265] ) ) } spids: [1251] ) ] spids: [1251] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:trimmed) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_string_trim)} {(DQ (${ VSub_Name line))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1271 1279] ) ) } spids: [1269] ) ] spids: [1269] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:prefix) op: Equal rhs: { (DQ (${ VSub_Name prefix) (CommandSubPart command_list: (CommandList children: [ (C {(k_string_remove_end)} {(DQ (${ VSub_Name trimmed))} {(DQ (${ VSub_Name line))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1288 1302] ) ) } spids: [1283] ) ] spids: [1283] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:includeFile) op: Equal rhs: {(DQ (${ VSub_Name trimmed))} spids: [1306] ) ] spids: [1306] ) ] spids: [1235 1238 1314 16777215] ) (case_arm pat_list: [{(K_SCRIPT_BUILD_REPORT) (Lit_Other '*')}] action: [ (C {(k_log_debug)} {(DQ ("Processing 'report' line: '") (${ VSub_Name line))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:line) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_string_remove_start)} {(DQ (K_SCRIPT_BUILD_REPORT))} {(DQ (${ VSub_Name line))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1336 1348] ) ) } spids: [1334] ) ] spids: [1334] ) (C {(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name line))} ) ] spids: [1318 1321 1367 16777215] ) ] spids: [1224 1232 1370] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name includeFile))} {(Lit_Other ']')} ) (C {(Lit_Other '[')} {(-f)} {(DQ (${ VSub_Name includeFile))} {(Lit_Other ']')} ) ] ) terminator: <Op_Semi ';'> ) ] action: [ (C {(k_log_debug)} { (DQ ("Including file: '") (${ VSub_Name includeFile) ("'")) } ) (C {(printf)} { (DQ (${ VSub_Name prefix) ('#K_SCRIPT_BUILD: include(%s)') (Lit_Other '\\') (n) ) } {(DQ (${ VSub_Name includeFile))} ) (SimpleCommand words: [ {(process_stream)} {(DQ (${ VSub_Name pattern))} {(DQ (${ VSub_Name prefix))} {(${ VSub_Name sedOpts)} ] redirects: [ (Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ (${ VSub_Name includeFile))} ) ] ) ] spids: [16777215 1403] ) ] else_action: [ (C {(k_log_debug)} {(DQ ("Regular line: '") (${ VSub_Name line) ("'"))} ) (C {(printf)} {(DQ ('%s') (Lit_Other '\\') (n))} {(DQ (${ VSub_Name line))} ) ] spids: [1462 1491] ) ] spids: [1203 1494] ) ) ] negated: F ) ] spids: [1060] ) spids: [1056 1059] ) (FuncDef name: handle_changedir body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name changeDir)} {(Lit_Other '=')} {(true)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ (${ VSub_Name changeDirPath))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(DQ (${ VSub_Name infile))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:changeDirPath) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_fs_dirname)} {(DQ (${ VSub_Name infile))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1564 1572] ) ) } spids: [1562] ) ] spids: [1562] ) ] spids: [16777215 1559] ) ] else_action: [ (C {(k_log_err)} { (DQ ( 'No directory given to -c/--cd and no -f/--file specified' ) ) } ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(2)} ) ] spids: [1576 1591] ) ] spids: [16777215 1541] ) ] spids: [16777215 1594] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(DQ (${ VSub_Name infile))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:infile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_fs_resolve)} {(DQ (${ VSub_Name infile))}) ] ) left_token: <Left_CommandSub '$('> spids: [1619 1627] ) ) } spids: [1617] ) ] spids: [1617] ) ] spids: [16777215 1614] ) ] spids: [16777215 1631] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name outfile))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:outfile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_fs_resolve)} {(DQ (${ VSub_Name outfile))} ) ] ) left_token: <Left_CommandSub '$('> spids: [1655 1663] ) ) } spids: [1653] ) ] spids: [1653] ) ] spids: [16777215 1650] ) ] spids: [16777215 1667] ) (C {(cd)} {(DQ (${ VSub_Name changeDirPath))}) ] spids: [16777215 1523] ) ] spids: [16777215 1680] ) ] spids: [1505] ) spids: [1501 1504] ) (FuncDef name: handle_executable body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name executable)} {(Lit_Other '=')} {(true)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(DQ (${ VSub_Name outfile))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(chmod)} {(Lit_Other '+') (x)} {(DQ (${ VSub_Name outfile))}) ] spids: [16777215 1727] ) ] else_action: [ (C {(k_log_err)} {(DQ ('Cannot set executable bit when output is stdout'))} ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(2)} ) ] spids: [1742 1757] ) ] spids: [16777215 1709] ) ] spids: [16777215 1760] ) ] spids: [1691] ) spids: [1687 1690] ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:tmpVal) op:Equal spids:[1769])] spids: [1767] ) (WhileUntil keyword: <KW_While while> cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(-h)} {(--help)}] action: [(C {(k_usage)}) (ControlFlow token:<ControlFlow_Exit exit>)] spids: [1798 1801 1810 16777215] ) (case_arm pat_list: [{(-c)} {(--cd)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:changeDir) op: Equal rhs: {(true)} spids: [1820] ) ] spids: [1820] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:changeDirPath) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_optional_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [1826 1832] ) ) } spids: [1824] ) ] spids: [1824] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name changeDirPath))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [(C {(shift)})] spids: [16777215 1851] ) ] spids: [16777215 1857] ) (C {(shift)}) ] spids: [1814 1817 1864 16777215] ) (case_arm pat_list: [{(-f)} {(--file)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:infile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [1876 1882] ) ) } spids: [1874] ) ] spids: [1874] ) (C {(shift)} {(2)}) ] spids: [1868 1871 1891 16777215] ) (case_arm pat_list: [{(-d)} {(--define)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tmpVal) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [1903 1909] ) ) } spids: [1901] ) ] spids: [1901] ) (C {(add_definition)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name tmpVal))}) (C {(cut)} {(-d)} {(Lit_Other '=')} {(-f)} {(1)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1916 1936] ) ) } { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name tmpVal))}) (C {(cut)} {(-d)} {(Lit_Other '=')} {(-f)} {(2)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [1940 1960] ) ) } ) (C {(shift)} {(2)}) ] spids: [1895 1898 1969 16777215] ) (case_arm pat_list: [{(-o)} {(--output)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:outfile) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [1981 1987] ) ) } spids: [1979] ) ] spids: [1979] ) (C {(shift)} {(2)}) ] spids: [1973 1976 1996 16777215] ) (case_arm pat_list: [{(-i)} {(--inline)} {(--static)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tmpVal) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_optional_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [2010 2016] ) ) } spids: [2008] ) ] spids: [2008] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-n)} {(DQ (${ VSub_Name tmpVal))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(add_static_path)} {(DQ (${ VSub_Name tmpVal))}) (C {(shift)} {(2)}) ] spids: [16777215 2035] ) ] else_action: [(C {(add_static_path)} {(DQ ('./*'))}) (C {(shift)})] spids: [2052 2065] ) ] spids: [2000 2005 2068 16777215] ) (case_arm pat_list: [{(-l)} {(--link)} {(--dynamic)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tmpVal) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(k_option_requires_arg)} {(DQ ($ VSub_At '$@'))}) ] ) left_token: <Left_CommandSub '$('> spids: [2082 2088] ) ) } spids: [2080] ) ] spids: [2080] ) (C {(add_dynamic_mapping)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name tmpVal))}) (C {(cut)} {(-d)} {(Lit_Other '=')} {(-f)} {(1)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [2095 2115] ) ) } { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ (${ VSub_Name tmpVal))}) (C {(cut)} {(-d)} {(Lit_Other '=')} {(-f)} {(2)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [2119 2139] ) ) } ) (C {(shift)} {(2)}) ] spids: [2072 2077 2148 16777215] ) (case_arm pat_list: [{(-r)} {(--report)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:report) op: Equal rhs: {(true)} spids: [2158] ) ] spids: [2158] ) (C {(shift)}) ] spids: [2152 2155 2165 16777215] ) (case_arm pat_list: [{(-x)} {(--exec)} {(--executable)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:executable) op: Equal rhs: {(true)} spids: [2177] ) ] spids: [2177] ) (C {(shift)}) ] spids: [2169 2174 2184 16777215] ) (case_arm pat_list: [{(-v)} {(--version)}] action: [(C {(k_version)}) (ControlFlow token:<ControlFlow_Exit exit>)] spids: [2188 2191 2200 16777215] ) (case_arm pat_list: [{(-V)} {(--verbose)}] action: [ (SimpleCommand words: [{(k_log_level)} {(${ VSub_Name KOALEPHANT_LOG_LEVEL_INFO)}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (C {(shift)}) ] spids: [2204 2207 2224 16777215] ) (case_arm pat_list: [{(-D)} {(--debug)}] action: [ (SimpleCommand words: [{(k_log_level)} {(${ VSub_Name KOALEPHANT_LOG_LEVEL_DEBUG)}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (C {(shift)}) ] spids: [2228 2231 2248 16777215] ) (case_arm pat_list: [{(-q)} {(--quiet)}] action: [ (SimpleCommand words: [{(k_log_level)} {(${ VSub_Name KOALEPHANT_LOG_LEVEL_ERR)}] redirects: [ (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (C {(shift)}) ] spids: [2252 2255 2272 16777215] ) (case_arm pat_list: [{(--)}] action: [(C {(shift)}) (ControlFlow token:<ControlFlow_Break break>)] spids: [2276 2277 2286 16777215] ) (case_arm pat_list: [{(-) (Lit_Other '*')}] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Unknown option: ') (${ VSub_Number 1))}] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (C {(k_usage)}) (ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [2290 2292 2316 16777215] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [2320 2321 2327 16777215] ) ] spids: [1788 1794 2330] ) ] spids: [1785 2333] ) ) (C {(handle_changedir)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name report)} {(Lit_Other '=')} {(true)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(process_stream)} {(DQ (${ VSub_Name FIND_SOURCE_LINES))} {(DQ )} {(-n)}] redirects: [ (Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ (${ VSub_Name infile))} ) (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name outfile))} ) ] ) (ControlFlow token:<ControlFlow_Return return>) ] spids: [16777215 2356] ) ] spids: [16777215 2392] ) (SimpleCommand words: [ {(process_stream)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(get_include_pattern)})]) left_token: <Left_CommandSub '$('> spids: [2399 2401] ) ) } ] redirects: [ (Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ (${ VSub_Name infile))} ) (Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name outfile))} ) ] ) (C {(handle_executable)}) ] spids: [23] ) spids: [19 22] ) (C {(k_script_build)} {(DQ ($ VSub_At '$@'))}) ] )