1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
// Copyright (C) 1995 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.
// Contents: Definition of class EquationParser
//
// Principal Author: Roger Needham
//
// Status: in progress
//
// Revision History:
//
#ifndef _EQUATIONPARSER_H_
#define _EQUATIONPARSER_H_
#include "PresentationParser.h"
// The grammar for an equation (see the Word grammar):
//
// <equation> ::= '(' <generator list>('|' | ';' | ':')<word>('='<word>)? ')'
//
// It seems expedient to require the end user to enter equations in a way
// similar to presentations, so that the existing parsers can be used.
//---------------------------------------------------------------------------//
//-------------------------- EquationParser ---------------------------------//
//---------------------------------------------------------------------------//
class EquationParser : protected PresentationParser
{
public:
/////////////////////////////////////////////////////////////////////////
// //
// Constructors: //
// //
/////////////////////////////////////////////////////////////////////////
EquationParser(istream &istr) : PresentationParser(istr) { }
// Initialize the parser with the istream from which to read.
// Destructor supplied by compiler.
// The following two methods should be redefined
virtual Word parseRelator( const VectorOf<Chars>&, Chars& );
virtual void getToken( );
/////////////////////////////////////////////////////////////////////////
// //
// Parsing Methods: //
// //
/////////////////////////////////////////////////////////////////////////
Word parseEquation( const VectorOf<Chars>& names,
VectorOf<Chars>& new_names,
Chars& errMesg
);
// Reads an equation and returns it as a word. The new vector of print
// names (generators first, then variables) is returned in new_names.
// As usual, if there is a parse error, the description is returned in
// errMesg.
};
#endif
|