Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

unroll.h File Reference

#include <string>

Go to the source code of this file.

Functions

const string & unroll (const char *rec, const char *dict)
 Unroll the scenario record in a string of mode symbols. More...


Detailed Description

MASS project: header file for unroll.cpp

The module implements the text parser for "unrolling" the MASS scenario records. The record is the string where the different modes follow after each other as "A+B" and different sequences of modes of an arbitrary length are repeated a certain amount of times as "20*(A+B)". The idea of implementation of this module comes from the "calculator" program by Bjarne Stroustrup (see "Jazyk Programmirovanija C++", 3rd edition, Moscow, Binom, 2001, p. 147).


Function Documentation

const string& unroll const char *    rec,
const char *    dict
 

Unroll the scenario record in a string of mode symbols.

Parameters:
rec  scenario record
dict  "dictionary": a list of allowed mode symbols to reject the erroneous input. Case sensitive.
Returns:
string which is an exact sequence in which the planned modes will be started
The allowed operators are
  • "+" addition for adding the modes or the sequences of modes. Addition of numbers or numbers and modes is not allowed;
  • "*" multiplication - for repeating the sequences or modes many times. Defined only for integer numbers or modes/sequences and integer numbers, in arbitrary order.
  • "(...)" for grouping the modes in sequences, with arbitrary degree of enclosure.
Only the integer numbers are allowed for multiplication. Spaces are allowed in a record.

Example:

                string scenario = unroll("2*(A+3*B+C)","ABC") ;
        
returns "ABBBCABBBC".


Generated on Wed Jan 16 00:40:06 2002 for MASS Software by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001