For simplicity, assume you would like to add a directive of the form:
CSRD$ VARRANGE var,lb,ub
With this directive, you intend for users to be able to indicate the range a variable can have, i.e., lb <= var <= ub.
Files you will have to create:
Files you will have to modify:
parser_csrd_range[ParserContext &context]
"VARRANGE directive"
: <<
Put any delcarations needed for this rule here.
>>
"VARRANGE"
Using the grammar rules, you can follow the "CSRD$ VARRANGE".
"@"
<<
s = &context.s_next;
s is the statement the assertion will be attached to. You can also attach it to a do-loop statement, (i.e., require that the directive directly preceed a do-loop statement.)
>>
;
enum AssertionType {
...
AS_VARRANGE,
...
Add the assertion to AssertType.
... #pragma implementation "AssertRange.h" ... #include "AssertRange.h" ...Add the pragma and include the appropriate header file, just as the existing assertions. Also implement the constructors, destructor, print, listable_clone, operator= and clone methods (see other assertions.)
void generate_csrd_range_directive( Statement &s, Assertion &ap );
// generate a CSRD$ VARRANGE directive
...
void
Directive::generate_csrd_directive( Statement &s )
{
...
case AS_VARRANGE:
generate_csrd_range_directive( s, iter.current() );
break;
...
}
Add the case to the "generate_csrd_directive" method.