/*

 HyPhy - Hypothesis Testing Using Phylogenies.

 Copyright (C) 1997-now
 Core Developers:
 Sergei L Kosakovsky Pond (spond@ucsd.edu)
 Art FY Poon    (apoon42@uwo.ca)
 Steven Weaver (sweaver@ucsd.edu)

 Module Developers:
 Lance Hepler (nlhepler@gmail.com)
 Martin Smith (martin.audacis@gmail.com)

 Significant contributions from:
 Spencer V Muse (muse@stat.ncsu.edu)
 Simon DW Frost (sdf22@cam.ac.uk)

 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:

 The above copyright notice and this permission notice shall be included
 in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef     __FORMULAPARSINGCONTEXT__
#define     __FORMULAPARSINGCONTEXT__

#include "hy_strings.h"

class _VariableContainer; // forward declaration

class _FormulaParsingContext {
  
private:

    long                 assignment_ref_id;
    char                 assignment_ref_type;
    bool                 is_volatile;
    bool                 in_assignment;
    char                 allow_template;
        /*
            if not '\0' (default), will permit variable IDs to contain this character
            useful for parsing 'ReplicateConstraint' type expressions
        */
    bool                 build_complex_objects;
    
        /*
            this controls whether or not
            [matrix, TBD] and dictionary constant are built in place (default)
            or deferred (is false)

        */
    _String            * err_msg;
    _VariableContainer const * formula_scope;

public:
        _FormulaParsingContext (_String* = nil, _VariableContainer const* = nil);
        bool&       isVolatile (void)                   { return is_volatile; }
        bool&       inAssignment (void)                 { return in_assignment;}
        bool&       buildComplexObjects (void)          { return build_complex_objects;}
        long&       assignmentRefID (void)              { return assignment_ref_id; }
        char&       assignmentRefType (void)            { return assignment_ref_type;}
        char&       allowTemplate (void)                { return allow_template;}
        _String*    errMsg (void)                       { return err_msg; }
        _VariableContainer const* formulaScope (void)         { return formula_scope; }
        void        setScope (_String const* scope);
        _String const     contextualizeRef (_String&);
};


#endif
