Parser Class Reference

#include <parser.h>

+ Inheritance diagram for Parser:

Public Member Functions

ScripterExport Parser ()
 
ScripterExport Parser (CharStream *errout)
 
ScripterExport Parser (HashTable *scope)
 
ScripterExport Parser (CharStream *errout, HashTable *scope)
 
void init ()
 
ScripterExport Valuecompile (CharStream *stream)
 
ScripterExport Valuecompile_factor (CharStream *stream)
 
ScripterExport Valuecompile_all (CharStream *stream)
 
void collect ()
 
void gc_trace ()
 
Valuesingle_expr (Value *stream)
 
Valuesingle_factor (Value *stream)
 
Valuecompound_expr (Value *stream)
 
Valuecompile_macro_script (Value *stream, MacroID id)
 
bool parse_rollout_for_edit (CharStream *source_stream, IVisualMSForm *form, Value *filename=NULL)
 
Valuecompile_attributes (MSCustAttribDef *cad, CharStream *stream, Class_ID *attribID=NULL)
 
bool token_must_be (lex_token wanted_token)
 
bool next_token_must_be (lex_token wanted_token)
 
bool next_token_must_be_name (Value *wanted_name)
 
void back_track (void)
 
void back_track_factor (Value *fac)
 
bool white_space (MaxSDK::Util::Char &c)
 
void check_for_EOL (const MaxSDK::Util::Char &c)
 
void flush_EO_expr (void)
 
void reset ()
 
MaxSDK::Util::Char get_char ()
 
void unget_char (const MaxSDK::Util::Char &c)
 
void flush_to_eobuf ()
 
Valueget_string (const MaxSDK::Util::Char &delim)
 
Valueget_path_name ()
 
Valueget_name_thunk (Value *name, BOOL make_new)
 
Valueget_name_thunk (Value *name, BOOL make_new, BOOL forceGlobal)
 
lex_token get_punct (const MaxSDK::Util::Char &c)
 
lex_token get_token (void)
 
lex_token get_path_token (void)
 
int get_max_command (Value *&code)
 
Valueadd_event_handler (HashTable *handlers, BOOL item_based=TRUE, IVisualMSForm *form=NULL)
 
Valueadd_event_handler (HashTable *handlers, Value *owner, BOOL item_based=TRUE, IVisualMSForm *form=NULL)
 
void add_tool_local (const MCHAR *var, MouseTool *tool, int &local_count, ScopedValueTempArray &local_inits)
 
void add_plugin_local (const MCHAR *var, MSPluginClass *plugin, int &local_count, ScopedValueTempArray &local_inits, BOOL constant=FALSE)
 
void add_rollout_control (ScopedValueTempArray &controls, int control_index, Rollout *rollout, IVisualMSForm *form=NULL)
 
void add_rcmenu_item (ScopedValueTempArray &items, int &item_count, RCMenu *menu, BOOL subMenu=FALSE)
 
void open_include_file (const MaxSDK::Util::Char &c)
 
void check_for_const_lvalue (Value *&lval)
 
Valueoptimize_return (Value *expr)
 
Valuesource_position_wrap (Value *code)
 
Valuesource_position_wrap (Value *code, unsigned int last_token_end, unsigned int last_token_end_line)
 
void insert_resource (Value *resourceID, CharStream *resourceSource)
 
Valueexpr_seq (lex_token delimiter)
 
Valuevector_literal ()
 
Valueindex_or_vector ()
 
Valuehash_literals ()
 
Valuearray_literal ()
 
Valuebit_array_literal ()
 
Valuefactor ()
 
Valueproperty_index_array ()
 
Valuecoercion ()
 
Valuederef_expr ()
 
Valuefunction_call ()
 
Valuepower_expr ()
 
Valueuminus_expr ()
 
Valueterm ()
 
Valueplus_expr ()
 
Valuecompare_expr ()
 
Valuenot_expr ()
 
Valueand_expr ()
 
Valuesimple_expr ()
 
Valuevariable_declaration ()
 
Valuecontext_expr ()
 
Valuechange_handler ()
 
Valuefunction (const MCHAR *name, short flags=0)
 
Valuefunction_def ()
 
Valuemapped_fn_def ()
 
Valuemax_command ()
 
Valuehandler_def ()
 
Valuestruct_body (Value *name)
 
Valuestruct_def ()
 
Valuetry_catch ()
 
Valuetool_body (Value *name)
 
Valuetool_def ()
 
Valuercmenu_body (Value *name)
 
Valuercmenu_def ()
 
void plugin_paramblock (MSPluginClass *plugin, Array *pblock_defs, HashTable *handlers, int base_refno)
 
Valueplugin_def ()
 
Valueattributes_body (MSCustAttribDef *cad, Array *remap_param_names)
 
Valueattributes_def (MSCustAttribDef *cad=NULL, Class_ID *attribID=NULL)
 
Valuemacro_script (MacroID mid=UNDEFINED_MACRO)
 
Valuerollout_body (Value *name, lex_token type=t_rollout, IVisualMSForm *form=NULL)
 
Valueutility_def ()
 
Valuerollout_def ()
 
Valueexit_expr ()
 
Valuecontinue_expr ()
 
Valuereturn_expr ()
 
Valuefor_expr ()
 
Valuedo_expr ()
 
Valuewhile_expr ()
 
Valuecase_expr ()
 
Valueif_expr ()
 
Valueassign_expr ()
 
Valueexpr ()
 
Valuetop_level_expr ()
 
Valuefunction (const MCHAR *name, Value *owner, short flags=0)
 
- Public Member Functions inherited from Value
virtual ScripterExport BOOL is_kind_of (ValueMetaClass *c)
 
virtual ScripterExport ValueMetaClasslocal_base_class ()
 
virtual Valueeval ()
 
virtual Valueeval_no_wrapper ()
 
virtual ScripterExport Valueapply (Value **arglist, int count, CallContext *cc=NULL)
 
virtual ScripterExport Valueapply_no_alloc_frame (Value **arglist, int count, CallContext *cc=NULL)
 
virtual void export_to_scripter ()
 
virtual Valuemap (node_map &m)
 
virtual Valuemap_path (PathName *path, node_map &m)
 
virtual Valuefind_first (BOOL(*test_fn)(INode *node, int level, const void *arg), const void *test_arg)
 
virtual Valueget_path (PathName *path)
 
virtual ScripterExport void sprin1 (CharStream *stream)
 
virtual ScripterExport void sprint (CharStream *stream)
 
virtual void prin1 ()
 
virtual void print ()
 
virtual ScripterExport Class_ID get_max_class_id ()
 
virtual ScripterExport Valuedelete_vf (Value **arglist, int arg_count)
 
virtual ScripterExport ValueclearSelection_vf (Value **arglist, int arg_count)
 
virtual float to_float ()
 
virtual double to_double ()
 
virtual const MCHARto_string ()
 
virtual MSTR to_mstr ()
 
virtual MSTR to_filename ()
 
virtual int to_int ()
 
virtual INT64 to_int64 ()
 
virtual INT_PTR to_intptr ()
 
virtual BOOL to_bool ()
 
virtual BitArrayto_bitarray ()
 
virtual Point4 to_point4 ()
 
virtual Point3 to_point3 ()
 
virtual Point2 to_point2 ()
 
virtual AColor to_acolor ()
 
virtual COLORREF to_colorref ()
 
virtual INodeto_node ()
 
virtual Ray to_ray ()
 
virtual Interval to_interval ()
 
virtual Quat to_quat ()
 
virtual AngAxis to_angaxis ()
 
virtual Matrix3to_matrix3 ()
 
virtual float * to_eulerangles ()
 
virtual Mtlto_mtl ()
 
virtual Texmapto_texmap ()
 
virtual MtlBaseto_mtlbase ()
 
virtual Modifierto_modifier ()
 
virtual TimeValue to_timevalue ()
 
virtual Controlto_controller ()
 
virtual Atmosphericto_atmospheric ()
 
virtual Effectto_effect ()
 
virtual IMultiPassCameraEffectto_mpassCamEffect ()
 
virtual ShadowTypeto_shadowtype ()
 
virtual FilterKernelto_filter ()
 
virtual INodeto_rootnode ()
 
virtual ITrackViewNodeto_trackviewnode ()
 
virtual NURBSIndependentPointto_nurbsindependentpoint ()
 
virtual NURBSPointto_nurbspoint ()
 
virtual NURBSObjectto_nurbsobject ()
 
virtual NURBSControlVertexto_nurbscontrolvertex ()
 
virtual NURBSCurveto_nurbscurve ()
 
virtual NURBSCVCurveto_nurbscvcurve ()
 
virtual NURBSSurfaceto_nurbssurface ()
 
virtual NURBSTexturePointto_nurbstexturepoint ()
 
virtual NURBSSetto_nurbsset ()
 
virtual ReferenceTargetto_reftarg ()
 
virtual Meshto_mesh ()
 
virtual BezierShapeto_beziershape ()
 
virtual Thunkto_thunk ()
 
virtual void to_fpvalue (FPValue &v)
 
virtual Rendererto_renderer ()
 
virtual Box2to_box2 ()
 
virtual NURBSTextureSurfaceto_nurbstexturesurface ()
 
virtual NURBSDisplayto_nurbsdisplay ()
 
virtual TessApproxto_tessapprox ()
 
virtual Valuewiden_to (Value *arg, Value **arg_list)
 
virtual BOOL comparable (Value *arg)
 
virtual BOOL special_case_compare (Value *arg, bool &specialCaseCompareResult)
 
virtual ScripterExport Valuedeep_copy (HashTable *remapper)
 
virtual BOOL is_const ()
 
virtual ScripterExport Valueget_property (Value **arg_list, int count)
 
virtual ScripterExport Valueset_property (Value **arg_list, int count)
 
ScripterExport Value_get_property (Value *prop)
 
virtual ScripterExport Value_set_property (Value *prop, Value *val)
 
virtual Valueget_container_property (Value *prop, Value *cur_prop)
 
virtual Valueset_container_property (Value *prop, Value *val, Value *cur_prop)
 
virtual BOOL _is_collection ()
 
virtual BOOL _is_charstream ()
 
virtual BOOL _is_rolloutcontrol ()
 
virtual BOOL _is_rolloutthunk ()
 
virtual BOOL _is_function ()
 
virtual BOOL _is_selection ()
 
virtual BOOL _is_thunk ()
 
virtual BOOL _is_indirect_thunk ()
 
virtual SelectionIteratorselection_iterator ()
 
virtual ScripterExport IOResult Save (ISave *isave)
 
virtual void drop_MAX_refs ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
ScripterExport Valuemake_heap_permanent ()
 
ScripterExport Valuemake_heap_static ()
 
ScripterExport Valueget_heap_ptr ()
 
ScripterExport Valueget_stack_heap_ptr ()
 
ScripterExport Valuemigrate_to_heap ()
 
ScripterExport Valueget_live_ptr ()
 
- Public Member Functions inherited from Collectable
ScripterExport Collectable ()
 
virtual ScripterExport ~Collectable ()
 
ScripterExport voidoperator new (size_t sz, char flag)
 
ScripterExport voidoperator new (size_t sz)
 
ScripterExport void operator delete (void *val)
 
ScripterExport void operator delete (void *val, char flag)
 
ScripterExport bool derives_from_Animatable ()
 
virtual BOOL derives_from_MAXWrapper ()
 
ScripterExport void make_collectable ()
 
void make_permanent ()
 
void make_static ()
 
int is_marked ()
 
int is_not_marked ()
 
int is_garbage ()
 
int is_permanent ()
 
void mark_in_use ()
 
void unmark_in_use ()
 
int has_heap_copy ()
 
int is_in_heap ()
 
int is_on_stack ()
 

Static Public Member Functions

static void setup ()
 
static bool should_source_position_wrap (Value *code)
 
- Static Public Member Functions inherited from Collectable
static ScripterExport void for_all_values (void(*map_fn)(Value *val), ValueMapper *mapper=NULL, ValueMetaClass *c=NULL)
 
static void mark ()
 
static void sweep ()
 
static void setup (size_t)
 
static ScripterExport void gc ()
 
static void coalesce_free_list ()
 
static void close_down ()
 
static void drop_maxwrapper_refs ()
 
static ScripterExport void push_alloc_stack_frame ()
 
static ScripterExport void pop_alloc_stack_frame ()
 
static ScripterExport ULONGLONG get_num_values_created ()
 
static ScripterExport bool validate_value_linkages ()
 

Public Attributes

CharStreamsource
 
lex_token token
 
Valuetoken_value
 
bool at_EOL
 
bool back_tracked
 
bool EOL_at_back_track
 
bool quoted_level_name
 
bool spaced
 
bool space_before
 
bool space_after
 
bool throws_ok
 
bool in_macroscript
 
bool no_free_refs
 
bool no_stack_refs
 
bool dotted_names_ok
 
bool ignore_string_escapes
 
bool mzp_names
 
bool in_attributes_def
 
HashTablecurrent_scope
 
int parm_count
 
int keyparm_count
 
int local_count
 
int frame_index
 
int frame_level
 
int expr_level
 
CharStreamstdout_stream
 
Valuelookahead_factor
 
MCHAR line_buf [256]
 
MCHARline_buf_p
 
CharStreamsource_capture
 
int ungetch_count
 
Tab< CharStream * > src_stack
 
Tab< CharStream * > src_capture_stack
 
MaxSDK::Array< ParserSourceData > src_parser_data_stack
 
Tab< intsrc_stack_encryption_keys
 
int tok_start
 
int last_tok_end
 
int tok_start_line
 
int last_tok_end_line
 
int prev_last_tok_end
 
int prev_last_tok_end_line
 
int next_last_tok_end
 
int next_last_tok_end_line
 
CodeBlockcode_block
 
int code_block_level
 
int current_y
 
int bottom_y
 
int group_num
 
int eol_whitespace_start
 
int eol_whitespace_end
 
- Public Attributes inherited from Value
ValueMetaClasstag
 
- Public Attributes inherited from Collectable
Collectablenext
 
Collectableprev
 
byte flags
 
byte flags2
 
short flags3
 

Static Public Attributes

static Tab< rollout_controlrollout_controls
 
static MCHARtoken_names []
 
- Static Public Attributes inherited from Collectable
static CRITICAL_SECTION heap_update
 
static Collectablecollectable_list
 
static Collectablepermanent_list
 
static free_memfree_list [GC_NUM_SUBLISTS]
 
static size_t heap_allocated
 
static size_t heap_size
 
static ScripterExport collectable_state state
 
static ScripterExport bool fullCollectNextHoldFlush
 
static bool gc_light
 
static bool in_gc
 
static HANDLE hGCCompletedEvent
 

Protected Member Functions

const MaxSDK::Util::CharAppendCharToLineBuf (const MaxSDK::Util::Char &c)
 

Constructor & Destructor Documentation

ScripterExport Parser ( CharStream errout,
HashTable scope 
)

Member Function Documentation

void init ( )
ScripterExport Value* compile ( CharStream stream)
ScripterExport Value* compile_factor ( CharStream stream)
ScripterExport Value* compile_all ( CharStream stream)
static void setup ( )
static
void collect ( )
virtual

Implements Collectable.

void gc_trace ( )
virtual

Reimplemented from Collectable.

Value* single_expr ( Value stream)
Value* single_factor ( Value stream)
Value* compound_expr ( Value stream)
Value* compile_macro_script ( Value stream,
MacroID  id 
)
bool parse_rollout_for_edit ( CharStream source_stream,
IVisualMSForm form,
Value filename = NULL 
)
Value* compile_attributes ( MSCustAttribDef cad,
CharStream stream,
Class_ID attribID = NULL 
)
bool token_must_be ( lex_token  wanted_token)
bool next_token_must_be ( lex_token  wanted_token)
bool next_token_must_be_name ( Value wanted_name)
void back_track ( void  )
void back_track_factor ( Value fac)
bool white_space ( MaxSDK::Util::Char c)
void check_for_EOL ( const MaxSDK::Util::Char c)
void flush_EO_expr ( void  )
void reset ( )
MaxSDK::Util::Char get_char ( )
void unget_char ( const MaxSDK::Util::Char c)
void flush_to_eobuf ( )
Value* get_string ( const MaxSDK::Util::Char delim)
Value* get_path_name ( )
Value* get_name_thunk ( Value name,
BOOL  make_new 
)
Value* get_name_thunk ( Value name,
BOOL  make_new,
BOOL  forceGlobal 
)
lex_token get_punct ( const MaxSDK::Util::Char c)
lex_token get_token ( void  )
lex_token get_path_token ( void  )
int get_max_command ( Value *&  code)
Value* add_event_handler ( HashTable handlers,
BOOL  item_based = TRUE,
IVisualMSForm form = NULL 
)
Value* add_event_handler ( HashTable handlers,
Value owner,
BOOL  item_based = TRUE,
IVisualMSForm form = NULL 
)
void add_tool_local ( const MCHAR var,
MouseTool tool,
int local_count,
ScopedValueTempArray local_inits 
)
void add_plugin_local ( const MCHAR var,
MSPluginClass *  plugin,
int local_count,
ScopedValueTempArray local_inits,
BOOL  constant = FALSE 
)
void add_rollout_control ( ScopedValueTempArray controls,
int  control_index,
Rollout rollout,
IVisualMSForm form = NULL 
)
void add_rcmenu_item ( ScopedValueTempArray items,
int item_count,
RCMenu menu,
BOOL  subMenu = FALSE 
)
void open_include_file ( const MaxSDK::Util::Char c)
void check_for_const_lvalue ( Value *&  lval)
Value* optimize_return ( Value expr)
static bool should_source_position_wrap ( Value code)
static
Value* source_position_wrap ( Value code)
Value* source_position_wrap ( Value code,
unsigned int  last_token_end,
unsigned int  last_token_end_line 
)
void insert_resource ( Value resourceID,
CharStream resourceSource 
)
Value* expr_seq ( lex_token  delimiter)
Value* vector_literal ( )
Value* index_or_vector ( )
Value* hash_literals ( )
Value* array_literal ( )
Value* bit_array_literal ( )
Value* factor ( )
Value* property_index_array ( )
Value* coercion ( )
Value* deref_expr ( )
Value* function_call ( )
Value* power_expr ( )
Value* uminus_expr ( )
Value* term ( )
Value* plus_expr ( )
Value* compare_expr ( )
Value* not_expr ( )
Value* and_expr ( )
Value* simple_expr ( )
Value* variable_declaration ( )
Value* context_expr ( )
Value* change_handler ( )
Value* function ( const MCHAR name,
short  flags = 0 
)
Value* function_def ( )
Value* mapped_fn_def ( )
Value* max_command ( )
Value* handler_def ( )
Value* struct_body ( Value name)
Value* struct_def ( )
Value* try_catch ( )
Value* tool_body ( Value name)
Value* tool_def ( )
Value* rcmenu_body ( Value name)
Value* rcmenu_def ( )
void plugin_paramblock ( MSPluginClass *  plugin,
Array *  pblock_defs,
HashTable handlers,
int  base_refno 
)
Value* plugin_def ( )
Value* attributes_body ( MSCustAttribDef cad,
Array *  remap_param_names 
)
Value* attributes_def ( MSCustAttribDef cad = NULL,
Class_ID attribID = NULL 
)
Value* macro_script ( MacroID  mid = UNDEFINED_MACRO)
Value* rollout_body ( Value name,
lex_token  type = t_rollout,
IVisualMSForm form = NULL 
)
Value* utility_def ( )
Value* rollout_def ( )
Value* exit_expr ( )
Value* continue_expr ( )
Value* return_expr ( )
Value* for_expr ( )
Value* do_expr ( )
Value* while_expr ( )
Value* case_expr ( )
Value* if_expr ( )
Value* assign_expr ( )
Value* expr ( )
Value* top_level_expr ( )
Value* function ( const MCHAR name,
Value owner,
short  flags = 0 
)
const MaxSDK::Util::Char& AppendCharToLineBuf ( const MaxSDK::Util::Char c)
protected

Member Data Documentation

Tab<rollout_control> rollout_controls
static
MCHAR* token_names[]
static
CharStream* source
lex_token token
Value* token_value
bool at_EOL
bool back_tracked
bool EOL_at_back_track
bool quoted_level_name
bool spaced
bool space_before
bool space_after
bool throws_ok
bool in_macroscript
bool no_free_refs
bool no_stack_refs
bool dotted_names_ok
bool ignore_string_escapes
bool mzp_names
bool in_attributes_def
HashTable* current_scope
int parm_count
int keyparm_count
int local_count
int frame_index
int frame_level
int expr_level
CharStream* stdout_stream
Value* lookahead_factor
MCHAR line_buf[256]
MCHAR* line_buf_p
CharStream* source_capture
int ungetch_count
Tab<CharStream*> src_stack
Tab<CharStream*> src_capture_stack
MaxSDK::Array<ParserSourceData> src_parser_data_stack
Tab<int> src_stack_encryption_keys
int tok_start
int last_tok_end
int tok_start_line
int last_tok_end_line
int prev_last_tok_end
int prev_last_tok_end_line
int next_last_tok_end
int next_last_tok_end_line
CodeBlock* code_block
int code_block_level
int current_y
int bottom_y
int group_num
int eol_whitespace_start
int eol_whitespace_end