function [S1,S2,next_op] = BR_getNEGargs(s)
% BR_getNEGargs - returns the arguments to top-level ~ operator in s
% On input:
%     s (string): logical string
% On output:
%     S1 (string): first arg of (S1=S2)
%     S2 (string): second arg of (S1=S2)
% Call:
%     [S1,S2] = BR_getNEGargs(s)
% Author:
%     T. Henderson
%     UU
%     Fall 2018
%

NEG_OP = '~';
AND_OP = '^';
OR_OP = 'v';

S1 = [];
S2 = [];
next_op = [];
sp = s(3:end-1);

if BR_isNEGop(sp)
    S1 = sp;
    next_op = NEG_OP;
    return
end

if BR_isANDop(sp)
    [S1,S2] = BR_getANDargs(sp);
    next_op = AND_OP;
    return
end

if BR_isORop(sp)
    [S1,S2] = BR_getORargs(sp);
    next_op = OR_OP;
    return
end
