Annotation of parser3/src/types/pa_junction.h, revision 1.8
1.2 paf 1: /** @file
2: Parser: Junction class decl.
3:
1.7 paf 4: Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
1.2 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
6: */
7:
8: #ifndef PA_JUNCTION_H
9: #define PA_JUNCTION_H
10:
1.8 ! misha 11: static const char * const IDENT_JUNCTION_H="$Date: 2005/08/09 08:14:53 $";
1.2 paf 12:
13:
14: #include "pa_string.h"
15: #include "pa_array.h"
16: #include "pa_exception.h"
17: #include "pa_operation.h"
18: #include "pa_value.h"
19:
20: /** \b junction is some code joined with context of it's evaluation.
21:
22: there are code-junctions and method-junctions
23: - code-junctions are used when some parameter passed in cury brackets
24: - method-junctions used in ^method[] calls or $method references
25:
26: Junctions register themselves in method_frame [if any] for consequent invalidation.
27: This prevents evaluation of junctions in outdated context
28:
29: To stop situations like this:
30: @code
31: @main[]
32: ^method1[]
33: ^method2[]
34:
35: @method1[]
36: $junction{
37: some code
38: }
39:
40: @method2[]
41: ^junction[]
42: @endcode
43:
44: On wcontext[most dynamic context of all] scope exit (WContext::~WContext()) got cleaned -
45: Junction::wcontext becomes WContext.fparent (if any),
46: or Junction::method_frame becomes 0 (if no parent), which later in Request::process triggers exception
47:
48: parent changing helps ^switch implementation to remain simple
49: */
1.6 paf 50: class Junction {
1.2 paf 51: public:
52:
1.5 paf 53: /// Code-Junction constructor
54: Junction(Value& aself,
1.2 paf 55: const Method* amethod,
56: VMethodFrame* amethod_frame,
57: Value* arcontext,
58: WContext* awcontext,
59: ArrayOperation* acode);
60:
1.5 paf 61: /// Method-Junction or Getter-Junction constructor
62: Junction(Value& aself,
63: const Method* amethod,
1.8 ! misha 64: bool ais_getter=false,
! 65: String* aauto_name=0
! 66: ): self(aself),
1.5 paf 67: method(amethod),
1.8 ! misha 68: is_getter(ais_getter),
! 69: auto_name(aauto_name)
! 70: {}
1.5 paf 71:
72:
1.2 paf 73: void reattach(WContext *new_wcontext);
74:
75: /// always present
76: Value& self;
77: //@{
78: /// @name either these // so called 'method-junction'
79: const Method* method;
80: //@}
81: //@{
82: /// @name or these are present // so called 'code-junction'
83: VMethodFrame* method_frame;
84: Value* rcontext;
85: WContext* wcontext;
86: ArrayOperation* code;
1.5 paf 87: //@}
88: //@{
89: bool is_getter;
1.2 paf 90: //@}
1.8 ! misha 91: //@{
! 92: String* auto_name;
! 93: //@{
1.2 paf 94: };
95:
96: #endif
E-mail: