/* Parse a structured stipulation (keyword sstipulation) * @param start index of entry into solving machinery * @return remainder of input token; 0 if parsing failed */ char *ParseStructuredStip(char *tok, slice_index start) { slice_index const root_slice_hook = alloc_proxy_slice(); Side starter; TraceFunctionEntry(__func__); TraceFunctionParam("%s",tok); TraceFunctionParam("%u",root_slice_hook); TraceFunctionParamListEnd(); stipulation_reset(); starter = ParseStructuredStip_starter(tok); if (starter!=no_side) { expression_type type; tok = ReadNextTokStr(); tok = ParseStructuredStip_expression(tok,start,root_slice_hook,&type,0); if (tok==0) tok = ReadNextTokStr(); else if (SLICE_NEXT1(root_slice_hook)!=no_slice) { solving_impose_starter(root_slice_hook,starter); move_effect_journal_do_insert_sstipulation(start,root_slice_hook); } } /* signal to our caller that the stipulation has changed */ SLICE_STARTER(root_slice_hook) = no_side; TraceFunctionExit(__func__); TraceFunctionResult("%s",tok); TraceFunctionResultEnd(); return tok; }
char *ParseStip(char *tok, slice_index start) { slice_index const root_slice_hook = alloc_proxy_slice(); TraceFunctionEntry(__func__); TraceFunctionParam("%s",tok); TraceFunctionParam("%u",start); TraceFunctionParamListEnd(); stipulation_reset(); if (ParsePlay(tok,start,root_slice_hook,play_length_minimum)) { move_effect_journal_do_insert_stipulation(start,root_slice_hook); tok = ReadNextTokStr(); } else dealloc_slices(root_slice_hook); /* signal to our caller that the stipulation has changed */ SLICE_STARTER(root_slice_hook) = no_side; TraceFunctionExit(__func__); TraceFunctionResult("%s",tok); TraceFunctionResultEnd(); return tok; }