SourceFile.hpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.oorexx.org/license.html */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /******************************************************************************/
39 /* REXX Kernel SourceFile.hpp */
40 /* */
41 /* Translater Source Class Definitions */
42 /* */
43 /******************************************************************************/
44 #ifndef Included_RexxSource
45 #define Included_RexxSource
46 
47 #include "SourceLocation.hpp"
48 #include "ListClass.hpp"
49 #include "QueueClass.hpp"
50 #include "StackClass.hpp"
51 #include "Token.hpp"
52 #include "Clause.hpp"
53 #include "SecurityManager.hpp"
54 #include "MethodClass.hpp"
55 
56 class RexxInstruction;
57 class RexxInstructionDo;
58 class RexxInstructionIf;
62 class RoutineClass;
63 class RexxCode;
64 class PackageClass;
65 class ClassDirective;
66 class ExtensionDirective;
67 class RexxActivation;
69 class StackFrameClass;
70 
71 /******************************************************************************/
72 /* Constants used for setting trace */
73 /******************************************************************************/
74 
75 const size_t TRACE_ALL = 'A';
76 const size_t TRACE_COMMANDS = 'C';
77 const size_t TRACE_LABELS = 'L';
78 const size_t TRACE_NORMAL = 'N';
79 const size_t TRACE_FAILURES = 'F';
80 const size_t TRACE_ERRORS = 'E';
81 const size_t TRACE_RESULTS = 'R';
82 const size_t TRACE_INTERMEDIATES = 'I';
83 const size_t TRACE_OFF = 'O';
84 const size_t TRACE_IGNORE = '0';
85 
86 // a mask for accessing just the setting information
87 const size_t TRACE_SETTING_MASK = 0xff;
88 
89 /******************************************************************************/
90 /* Constants used for setting trace interactive debug. These get merged */
91 /* in with the setting value, so they must be > 256 */
92 /******************************************************************************/
93 const int DEBUG_IGNORE = 0x0000;
94 const int DEBUG_ON = 0x0100;
95 const int DEBUG_OFF = 0x0200;
96 const int DEBUG_TOGGLE = 0x0400;
97 const int DEBUG_NOTRACE = 0x0800;
98 
99 // the mask for accessing just the debug flags
100 const size_t TRACE_DEBUG_MASK = 0xff00;
101 
102  /* handy defines to easy coding */
103 #define new_instruction(name, type) this->sourceNewObject(sizeof(RexxInstruction##type), The##type##InstructionBehaviour, KEYWORD_##name)
104 #define new_variable_instruction(name, type, size) this->sourceNewObject(size, The##type##InstructionBehaviour, KEYWORD_##name)
105 
106 #define _interpret 0x00000002 /* this is interpret translation */
107 #define _install 0x00000004 /* installation stuff required */
108 #define reclaimed 0x00000008 /* last clause only partially used */
109 #define reclaim_possible 0x00000020 /* can re-establish source connect */
110 #define no_clause 0x00000040 /* last clause of a block reached */
111 
112  /* builtin function prototype */
114 typedef builtin_func *pbuiltin; /* pointer to a builtin function */
115 
116 /**
117  * A class for intializing the keyword tables.
118  */
120 public:
121  inline KeywordEntry(const char *n, int code)
122  {
123  name = n;
124  length = strlen(name);
125  keyword_code = code;
126  }
127 
128  const char *name; /* keyword name */
129  size_t length; /* keyword name length */
130  int keyword_code; /* translated keyword code */
131 };
132 
134  friend class RexxActivation;
135  public:
136  void *operator new(size_t);
137  inline void *operator new(size_t size, void *ptr) {return ptr;}
138  inline void operator delete(void *) { ; }
139  inline void operator delete(void *, void *) { ; }
141  RexxSource(RexxString *programname, RexxBuffer *source_buffer);
142  RexxSource(RexxString *programname, const char *data, size_t length);
143  RexxSource(RexxString *programname);
144  inline RexxSource(RESTORETYPE restoreType) { ; };
145  void setIsBlock(bool b) {isBlock = b;}
146  bool getIsBlock() {return isBlock;}
147  void initBuffered(RexxBuffer *);
148  void initFile();
149  void extractNameInformation();
150  bool reconnect();
151  void setReconnect();
152  void setBufferedSource(RexxBuffer *newSource) { this->initBuffered(newSource); }
153  void interpretLine(size_t);
154  void adjustLine(size_t, size_t);
155  void comment();
156  void needVariable(RexxToken *);
158  bool terminator(int, RexxObject *);
159  static int resolveKeyword(RexxString *token, KeywordEntry *Table, int Table_Size);
160  static int subKeyword(RexxToken *);
161  static int keyword(RexxToken *);
162  static int builtin(RexxToken *);
163  static size_t resolveBuiltin(RexxString *);
164  static int condition(RexxToken *);
165  static int parseOption(RexxToken *);
166  static int keyDirective(RexxToken *);
167  static int subDirective(RexxToken *);
168  static int precedence(RexxToken *);
169  void nextLine();
170  void position(size_t, size_t);
171  void live(size_t);
172  void liveGeneral(int reason);
173  void flatten(RexxEnvelope *);
174  size_t sourceSize();
175  RexxString *get(size_t);
176  void nextClause();
179  RexxString *traceBack(RexxActivation *, SourceLocation &, size_t, bool);
180  RexxString *extract(SourceLocation &, bool=false);
184  void endLocation(SourceLocation &);
185  bool nextSpecial(unsigned int, SourceLocation &, bool advance=true);
186  unsigned int locateToken(RexxToken *);
187  void globalSetup();
188  RexxString *packLiteral(size_t, size_t, int);
192  void checkDirective(int errorCode);
193  bool hasBody();
195  void cleanup();
196  void mergeRequired(RexxSource *);
201  void inheritSourceContext(RexxSource *source);
210  void install();
212  void resolveDependencies();
213  void directive();
214  void routineDirective();
215  void requiresDirective();
216  void libraryDirective(RexxString *name, RexxToken *token);
217  void methodDirective();
218  void classDirective();
219  void extensionDirective();
220  void attributeDirective();
221  void constantDirective();
222  void optionsDirective();
223  void decodeExternalMethod(RexxString *methodName, RexxString *externalSpec, RexxString *&library, RexxString *&procedure);
224  RexxMethod *createNativeMethod(RexxString *name, RexxString *library, RexxString *procedure);
225  void createMethod(RexxString *name, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod, bool isAttribute);
226  void createAttributeGetterMethod(RexxString *name, RexxVariableBase *retriever, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod);
227  void createAttributeSetterMethod(RexxString *name, RexxVariableBase *retriever, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod);
229  void createAbstractMethod(RexxString *name, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod, bool isAttribute);
230  void checkDuplicateMethod(RexxString *name, bool classMethod, int errorMsg);
231  void addMethod(RexxString *name, RexxMethod *method, bool classMethod);
238  void expose(RexxString *);
242  void addClause(RexxInstruction *);
245  void setGuard();
246  RexxArray *getGuard();
247  void addBlock(void);
252  RexxObject *expression(int);
255  void argList(RexxToken *, int, bool, size_t &, size_t &);
256  /*RexxArray* */ void argArray(RexxToken *, int, bool, RexxArray* &, RexxArray* &);
257  RexxObject *function(RexxToken *, RexxToken *, int);
260  RexxToken *getToken(int, int);
261  RexxObject *message(RexxObject *, bool, int);
265  RexxObject *subTerm(int);
266  void pushTerm(RexxObject *);
267  void pushSubTerm(RexxObject *);
268  RexxObject *popTerm();
270  RexxObject *popNTerms(size_t);
271  void isExposeValid();
273  void errorCleanup();
274  void error(int);
275  void error(int, RexxObject *);
276  void error(int, RexxObject *, RexxObject *);
277  void error(int, RexxObject *, RexxObject *, RexxObject *);
278  void error(int errorcode, SourceLocation &location, RexxArray *subs);
279  void errorLine(int, RexxInstruction *);
280  void errorPosition(int, SourceLocation);
281  void errorToken(int, RexxToken *);
282  void blockError(RexxInstruction *);
284  static bool parseTraceSetting(RexxString *, size_t &, size_t &, char &);
285  static RexxString *formatTraceSetting(size_t source);
286  size_t processVariableList(int);
287  RexxObject *parseConditional(int *, int);
288  RexxObject *parseLogical(RexxToken *first, int terminators);
289 
290  bool terminator(int, RexxToken *);
291  bool isTraceable();
292  inline bool isInterpret() { return (flags & _interpret) != 0; }
293 
294  inline bool needsInstallation() { return (this->flags&_install) != 0; }
295  inline void install(RexxActivation *activation) { if (needsInstallation()) this->processInstall(activation); };
296  inline void addReference(RexxObject *reference) { this->calls->addLast(reference); }
297  inline void pushDo(RexxInstruction *i) { this->control->pushRexx((RexxObject *)i); }
298  inline RexxInstruction *popDo() { return (RexxInstruction *)(this->control->pullRexx()); };
299  inline RexxInstruction *topDo() { return (RexxInstruction *)(this->control->peek()); };
300  void setProgramName(RexxString *name);
301  inline RexxString *getProgramName() { return this->programName; }
302  inline RexxString *getProgramDirectory() { return this->programDirectory; }
303  inline RexxString *getProgramExtension() { return this->programExtension; }
304  inline RexxString *getProgramFile() { return this->programFile; }
305  inline RexxDirectory *getMethods() { return this->methods; };
306  inline RexxDirectory *getRoutines() { return this->routines; };
307  inline void pushOperator(RexxToken *operatorToken) { this->operators->pushRexx((RexxObject *)operatorToken); };
308  inline RexxToken *popOperator() { return (RexxToken *)(this->operators->pullRexx()); };
309  inline RexxToken *topOperator() { return (RexxToken *)(this->operators->peek()); };
310  inline void reclaimClause() { this->flags |= reclaimed; };
311  inline bool atEnd(void) { return (!(this->flags&reclaimed) && (this->line_number > (this->line_count))); };
312 
313  inline RexxToken *nextToken() { return clause->next(); }
314  inline RexxToken *nextReal() { return clause->nextRealToken(); }
315  inline void previousToken() { clause->previous(); }
316  inline void firstToken() { clause->firstToken(); }
317  inline void trimClause() { clause->trim(); }
318  inline size_t markPosition() { return clause->mark(); }
319  inline void resetPosition(size_t p) { clause->reset(p); }
320  inline void syntaxError(int errorcode, RexxInstruction *i) { this->errorLine(errorcode, i); }
321  inline void blockSyntaxError(RexxInstruction *i) { this->blockError(i); }
322  inline void syntaxErrorAt(int errorcode, RexxToken *token) { this->errorPosition(errorcode, token->getLocation()); }
323  inline void syntaxErrorAt(int errorcode, SourceLocation token_location) { this->errorPosition(errorcode, token_location); }
324  inline void syntaxError(int errorcode, RexxObject *a1) { this->error(errorcode, a1); }
325  inline void syntaxError(int errorcode, RexxObject *a1, RexxObject *a2) { this->error(errorcode, a1, a2); }
326  inline void syntaxError(int errorcode, RexxObject *a1, RexxObject *a2, RexxObject *a3) { this->error(errorcode, a1, a2, a3); }
327  inline void syntaxError(int errorcode, RexxToken *token) { this->errorToken(errorcode, token); }
328  inline void syntaxError(int errorcode) { this->error(errorcode); }
329  inline bool isInternalCode() { return this->isOldSpace(); }
331 
351  RexxInstruction *ifNew(int);
376  void holdObject(RexxObject *object) { this->holdstack->push(object);};
377  void saveObject(RexxObject *object) { this->savelist->put(object, object); };
378  void removeObj(RexxObject *object) { if (object != OREF_NULL) this->savelist->remove(object); };
379  void setSecurityManager(RexxObject *manager) { OrefSet(this, this->securityManager, new SecurityManager(manager)); }
381 
384  inline void setLocalRoutines(RexxDirectory *r) { routines = r; }
386 
387  static inline bool isSymbolCharacter(codepoint_t ch)
388  {
389  // The anding is necessary to keep characters > 0x7F from being
390  // treated as negative numbers and returning bogus values.
391  return characterTable[((unsigned int)ch) & 0xff] != 0;
392  }
393 
394  static inline int translateChar(codepoint_t ch)
395  {
396  // The anding is necessary to keep characters > 0x7F from being
397  // treated as negative numbers and returning bogus values.
398  return characterTable[((unsigned int)ch) & 0xff];
399  }
400 
401  void addInstalledClass(RexxString *name, RexxClass *classObject, bool publicClass);
402  void addInstalledRoutine(RexxString *name, RoutineClass *routineObject, bool publicRoutine);
403 
412  size_t getDigits() { return digits; }
413  bool getForm() { return form; }
414  size_t getFuzz() { return fuzz; }
415  size_t getTraceSetting() { return traceSetting; }
416  size_t getTraceFlags() { return traceFlags; }
420 
421  static pbuiltin builtinTable[]; /* table of builtin function stubs */
422 
423  static const size_t TRACE_ALL = 'A';
424  static const size_t TRACE_COMMANDS = 'C';
425  static const size_t TRACE_LABELS = 'L';
426  static const size_t TRACE_NORMAL = 'N';
427  static const size_t TRACE_FAILURES = 'F';
428  static const size_t TRACE_ERRORS = 'E';
429  static const size_t TRACE_RESULTS = 'R';
430  static const size_t TRACE_INTERMEDIATES = 'I';
431  static const size_t TRACE_OFF = 'O';
432  static const size_t TRACE_IGNORE = '0';
433 
434  static const size_t DEFAULT_TRACE_SETTING = TRACE_NORMAL;
435 
436 // a mask for accessing just the setting information
437  static const size_t TRACE_SETTING_MASK = 0xff;
438 
439 /******************************************************************************/
440 /* static constants used for setting trace interactive debug. These get merged */
441 /* in with the setting value, so they must be > 256 */
442 /******************************************************************************/
443  static const size_t DEBUG_IGNORE = 0x0000;
444  static const size_t DEBUG_ON = 0x0100;
445  static const size_t DEBUG_OFF = 0x0200;
446  static const size_t DEBUG_TOGGLE = 0x0400;
447  static const size_t DEBUG_NOTRACE = 0x0800;
448 
449 // the mask for accessing just the debug flags
450  static const size_t TRACE_DEBUG_MASK = 0xff00;
451 
452 protected:
453 
454  size_t flags; /* parsing flags */
455  RexxArray *sourceArray; /* source lines for this code */
456  RexxString *programName; /* name of the source program */
457  RexxString *programDirectory; // the directory location of the program (used for resolving calls)
458  RexxString *programFile; // just the file name of the program
459  RexxString *programExtension; // optional program extension
460  SecurityManager *securityManager; /* source execution time security */
461  const char *current; /* current working line */
462  RexxClause *clause; /* current clause being created */
463  SourceLocation clauseLocation; // current clause location for errors
464  RexxBuffer *sourceBuffer; /* contiguous buffered source */
465  RexxBuffer *sourceIndices; /* line locations within buffer */
466  size_t current_length; /* length of current line */
467  size_t line_count; /* size of source array */
468  size_t line_number; /* current line position */
469  size_t line_offset; /* current offset with in the line */
470  size_t line_adjust; /* INTERPRET/sourceLiteral adjustment*/
472 
473  RexxCode *initCode; // the initialization code
474  /* start of directives section */
475  RexxList *loadedPackages; // packages imported by this package
476  PackageClass *package; // our package wrapper
477  RexxSource *parentSource; // a parent source context environment;
478  bool isBlock; // true if the current source has been created from a RexxBlock
479  RexxDirectory *routines; /* routines found on directives */
480  RexxDirectory *public_routines; /* PUBLIC routines directive routines*/
481  RexxList *libraries; // packages requiring loading
482  RexxList *requires; /* requires directives */
483  RexxList *classes; /* classes found on directives */
484  RexxList *extensions; /* extensions found on directives */
485  /* all public installed classes */
487  RexxDirectory *installed_classes; /* entire list of installed classes */
488  RexxDirectory *merged_public_classes;/* entire merged set of classes */
489  /* all public required routines */
491  RexxDirectory *methods; /* methods found on directives */
492 
493  size_t digits; /* numeric digits setting */
494  size_t fuzz; /* numeric fuzz setting */
495  bool form; /* numeric form setting */
496  size_t traceSetting; // the package trace setting
497  size_t traceFlags; // version optimized for quick setting at startup
498  bool enableCommands; // are commands enabled ?
499  bool enableMacrospace; // is macrospace enabled ?
500  intptr_t reserved1; // some reserved values for compatible expansion
501  intptr_t reserved2; // some reserved values for compatible expansion
502  intptr_t reserved3; // some reserved values for compatible expansion
503  intptr_t reserved4; // some reserved values for compatible expansion
504 
505  /* start of global parsing section */
506 
507  RexxIdentityTable *savelist; /* saved objects */
508  RexxStack *holdstack; /* stack for holding temporaries */
509  RexxDirectory *literals; /* root of associated literal list */
510  RexxList *sourceLiterals; /* root of associated source literal list */
511  RexxDirectory *strings; /* common pool of created strings */
512  RexxQueue *control; /* queue of control structures */
513  RexxQueue *terms; /* stack of expression terms */
514  RexxQueue *subTerms; /* stack for arguments lists, et al. */
515  RexxQueue *namedSubTerms; /* stack for named arguments lists */
516  RexxQueue *operators; /* stack of expression terms */
517  RexxDirectory *class_dependencies; /* dependencies between classes */
518  ClassDirective *active_class; /* currently active ::CLASS directive*/
519  ExtensionDirective *active_extension;/* currently active ::EXTENSION directive*/
520 
521  /* start of block parsing section */
522 
523  RexxInstruction *first; /* first instruction of parse tree */
524  RexxInstruction *last; /* last instruction of parse tree */
525  RexxInstruction *currentInstruction; /* current "protected" instruction */
526  RexxDirectory *variables; /* root of associated variable list */
527  RexxDirectory *labels; /* root of associated label list */
528  RexxIdentityTable *guard_variables; /* exposed variables in guard list */
529  RexxDirectory *exposed_variables; /* root of exposed variables list */
530  RexxList *calls; /* root of call list */
531  size_t currentstack; /* current expression stack depth */
532  size_t maxstack; /* maximum stack depth */
533  size_t variableindex; /* current variable index slot */
534 
535 
536 
537  // Tables of different keywords using in various contexts.
545 
546  // table of character values
547  static int characterTable[];
548 };
549 #endif
AccessFlag
Definition: MethodClass.hpp:73
GuardFlag
Definition: MethodClass.hpp:59
ProtectedFlag
Definition: MethodClass.hpp:66
RESTORETYPE
Definition: ObjectClass.hpp:82
#define OREF_NULL
Definition: RexxCore.h:61
#define OrefSet(o, r, v)
Definition: RexxCore.h:101
bool isMethod(RexxObject *o)
Definition: RexxCore.h:288
const size_t TRACE_OFF
Definition: SourceFile.hpp:83
const size_t TRACE_DEBUG_MASK
Definition: SourceFile.hpp:100
#define reclaimed
Definition: SourceFile.hpp:108
#define _install
Definition: SourceFile.hpp:107
const size_t TRACE_ALL
Definition: SourceFile.hpp:75
#define _interpret
Definition: SourceFile.hpp:106
const size_t TRACE_LABELS
Definition: SourceFile.hpp:77
const size_t TRACE_NORMAL
Definition: SourceFile.hpp:78
const size_t TRACE_IGNORE
Definition: SourceFile.hpp:84
const int DEBUG_IGNORE
Definition: SourceFile.hpp:93
const int DEBUG_ON
Definition: SourceFile.hpp:94
builtin_func * pbuiltin
Definition: SourceFile.hpp:114
const size_t TRACE_SETTING_MASK
Definition: SourceFile.hpp:87
const int DEBUG_NOTRACE
Definition: SourceFile.hpp:97
const int DEBUG_OFF
Definition: SourceFile.hpp:95
const size_t TRACE_INTERMEDIATES
Definition: SourceFile.hpp:82
const size_t TRACE_ERRORS
Definition: SourceFile.hpp:80
const size_t TRACE_RESULTS
Definition: SourceFile.hpp:81
RexxObject * builtin_func(RexxActivation *, RexxObject **, size_t, size_t, RexxExpressionStack *)
Definition: SourceFile.hpp:113
const int DEBUG_TOGGLE
Definition: SourceFile.hpp:96
const size_t TRACE_COMMANDS
Definition: SourceFile.hpp:76
const size_t TRACE_FAILURES
Definition: SourceFile.hpp:79
Definition: SourceFile.hpp:119
const char * name
Definition: SourceFile.hpp:128
size_t length
Definition: SourceFile.hpp:129
KeywordEntry(const char *n, int code)
Definition: SourceFile.hpp:121
int keyword_code
Definition: SourceFile.hpp:130
RexxActivity * activity
RexxVariableBase * retriever(RexxString *)
size_t mark()
Definition: Clause.hpp:76
void reset(size_t position)
Definition: Clause.hpp:77
void trim()
Definition: Clause.cpp:116
void previous()
Definition: Clause.hpp:74
RexxToken * nextRealToken()
Definition: Clause.cpp:177
void firstToken()
Definition: Clause.hpp:71
RexxToken * next()
Definition: Clause.hpp:75
virtual RexxObject * put(RexxObject *, RexxObject *)
virtual RexxObject * remove(RexxObject *key)
void addLast(RexxObject *value)
Definition: ListClass.cpp:455
RexxObject * peek()
Definition: QueueClass.cpp:317
RexxObject * pushRexx(RexxObject *)
Definition: QueueClass.cpp:78
RexxObject * pullRexx()
Definition: QueueClass.cpp:64
RexxInstruction * loopNew()
RexxQueue * subTerms
Definition: SourceFile.hpp:514
RexxDirectory * getImportedClasses()
Definition: SourceFile.hpp:406
RexxStemVariable * addStem(RexxString *)
RexxDirectory * literals
Definition: SourceFile.hpp:509
RexxDirectory * class_dependencies
Definition: SourceFile.hpp:517
void resetPosition(size_t p)
Definition: SourceFile.hpp:319
RexxObject * subExpression(int)
static const size_t TRACE_COMMANDS
Definition: SourceFile.hpp:424
void pushDo(RexxInstruction *i)
Definition: SourceFile.hpp:297
void syntaxErrorAt(int errorcode, SourceLocation token_location)
Definition: SourceFile.hpp:323
static size_t resolveBuiltin(RexxString *)
static int condition(RexxToken *)
void createConstantGetterMethod(RexxString *name, RexxObject *value)
void addBlock(void)
void install()
PackageClass * loadRequires(RexxActivity *activity, RexxString *target)
static const size_t TRACE_ERRORS
Definition: SourceFile.hpp:428
RexxToken * sourceNextToken(RexxToken *)
Definition: Scanner.cpp:688
RexxList * sourceLiterals
Definition: SourceFile.hpp:510
static pbuiltin builtinTable[]
Definition: SourceFile.hpp:421
RexxDirectory * getPublicRoutines()
Definition: SourceFile.hpp:383
void setBufferedSource(RexxBuffer *newSource)
Definition: SourceFile.hpp:152
RexxToken * popOperator()
Definition: SourceFile.hpp:308
static KeywordEntry subKeywords[]
Definition: SourceFile.hpp:540
static int subDirective(RexxToken *)
RexxInstruction * labelNew()
void decodeExternalMethod(RexxString *methodName, RexxString *externalSpec, RexxString *&library, RexxString *&procedure)
static int keyDirective(RexxToken *)
RexxDirectory * public_routines
Definition: SourceFile.hpp:480
RexxObject * parseLogical(RexxToken *first, int terminators)
RexxCode * translateBlock(RexxDirectory *)
RexxInstruction * forwardNew()
static const size_t TRACE_INTERMEDIATES
Definition: SourceFile.hpp:430
RexxDirectory * getLocalRoutines()
Definition: SourceFile.hpp:382
intptr_t reserved2
Definition: SourceFile.hpp:501
void createAttributeGetterMethod(RexxString *name, RexxVariableBase *retriever, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod)
size_t line_adjust
Definition: SourceFile.hpp:470
bool getIsBlock()
Definition: SourceFile.hpp:146
RexxInstruction * traceNew()
static const size_t TRACE_SETTING_MASK
Definition: SourceFile.hpp:437
RexxObject * collectionMessage(RexxToken *, RexxObject *, int)
void extensionDirective()
bool getEnableCommands()
Definition: SourceFile.hpp:418
RexxInstruction * ifNew(int)
unsigned int locateToken(RexxToken *)
Definition: Scanner.cpp:291
void previousToken()
Definition: SourceFile.hpp:315
RexxString * programDirectory
Definition: SourceFile.hpp:457
void addClause(RexxInstruction *)
PackageClass * package
Definition: SourceFile.hpp:476
static KeywordEntry directives[]
Definition: SourceFile.hpp:538
RexxQueue * terms
Definition: SourceFile.hpp:513
RexxClause * clause
Definition: SourceFile.hpp:462
static int precedence(RexxToken *)
Definition: Scanner.cpp:53
RexxString * programExtension
Definition: SourceFile.hpp:459
RexxDirectory * getInstalledPublicRoutines()
Definition: SourceFile.hpp:408
void argList(RexxToken *, int, bool, size_t &, size_t &)
RexxCode * interpret(RexxString *, RexxDirectory *, size_t, RexxActivation *)
RexxMethod * createNativeMethod(RexxString *name, RexxString *library, RexxString *procedure)
RexxDirectory * getDefinedMethods()
Definition: SourceFile.hpp:410
void resolveDependencies()
RexxToken * nextToken()
Definition: SourceFile.hpp:313
RexxObject * expression(int)
void setGuard()
RexxString * getProgramName()
Definition: SourceFile.hpp:301
void setSecurityManager(RexxObject *manager)
Definition: SourceFile.hpp:379
bool reconnect()
Definition: SourceFile.cpp:344
RexxInstruction * messageAssignmentNew(RexxExpressionMessage *, RexxObject *)
void startLocation(SourceLocation &)
Definition: Scanner.cpp:201
void checkDuplicateMethod(RexxString *name, bool classMethod, int errorMsg)
void extractNameInformation()
Definition: SourceFile.cpp:318
bool getForm()
Definition: SourceFile.hpp:413
RexxInstruction * exitNew()
void directive()
RexxString * traceBack(RexxActivation *, SourceLocation &, size_t, bool)
RexxInstruction * findLabel(RexxString *)
RexxInstruction * topDo()
Definition: SourceFile.hpp:299
RexxInstruction * exposeNew()
void flatten(RexxEnvelope *)
Definition: SourceFile.cpp:716
RexxSource * parentSource
Definition: SourceFile.hpp:477
RexxInstruction * instruction()
static int subKeyword(RexxToken *)
RexxObject * fullSubExpression(int)
RexxDirectory * getInstalledPublicClasses()
Definition: SourceFile.hpp:405
RexxCode * initCode
Definition: SourceFile.hpp:473
void createAbstractMethod(RexxString *name, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod, bool isAttribute)
void syntaxError(int errorcode, RexxInstruction *i)
Definition: SourceFile.hpp:320
RexxObject * popNTerms(size_t)
RexxString * resolveProgramName(RexxActivity *activity, RexxString *name)
void syntaxError(int errorcode, RexxObject *a1)
Definition: SourceFile.hpp:324
RexxString * programName
Definition: SourceFile.hpp:456
RexxString * programFile
Definition: SourceFile.hpp:458
RoutineClass * findPublicRoutine(RexxString *)
RexxInstruction * elseNew(RexxToken *)
RexxInstruction * raiseNew()
void install(RexxActivation *activation)
Definition: SourceFile.hpp:295
size_t line_number
Definition: SourceFile.hpp:468
RexxInstruction * createLoop()
size_t getDigits()
Definition: SourceFile.hpp:412
RexxObject * messageSubterm(int)
SourceLocation clauseLocation
Definition: SourceFile.hpp:463
void constantDirective()
RexxInstruction * assignmentNew(RexxToken *)
RexxArray * extractSource()
RexxList * classes
Definition: SourceFile.hpp:483
RexxToken * getToken(int, int)
RexxObject * messageTerm()
RexxToken * sourceLiteral(size_t, SourceLocation)
Definition: Scanner.cpp:653
RexxObject * subTerm(int)
static const size_t TRACE_LABELS
Definition: SourceFile.hpp:425
RexxInstruction * messageAssignmentOpNew(RexxExpressionMessage *, RexxToken *, RexxObject *)
void addLabel(RexxInstruction *, RexxString *)
size_t flags
Definition: SourceFile.hpp:454
static bool isSymbolCharacter(codepoint_t ch)
Definition: SourceFile.hpp:387
RexxVariableBase * getRetriever(RexxString *)
RexxDirectory * getMethods()
Definition: SourceFile.hpp:305
size_t variableindex
Definition: SourceFile.hpp:533
ExtensionDirective * active_extension
Definition: SourceFile.hpp:519
void pushOperator(RexxToken *operatorToken)
Definition: SourceFile.hpp:307
RexxObject * functionCallMessage(RexxToken *, RexxObject *, int)
void globalSetup()
void libraryDirective(RexxString *name, RexxToken *token)
ClassDirective * active_class
Definition: SourceFile.hpp:518
RexxObject * toss(RexxObject *)
void syntaxErrorAt(int errorcode, RexxToken *token)
Definition: SourceFile.hpp:322
void errorLine(int, RexxInstruction *)
RexxInstruction * signalNew()
RexxObject * parseConditional(int *, int)
RexxInstruction * leaveNew(int)
RexxActivation * interpret_activation
Definition: SourceFile.hpp:471
size_t line_count
Definition: SourceFile.hpp:467
static int resolveKeyword(RexxString *token, KeywordEntry *Table, int Table_Size)
RexxInstruction * addressNew()
static KeywordEntry parseOptions[]
Definition: SourceFile.hpp:543
RexxCompoundVariable * addCompound(RexxString *)
RexxDirectory * getRoutines()
Definition: SourceFile.hpp:306
void firstToken()
Definition: SourceFile.hpp:316
RexxInstruction * numericNew()
void addReference(RexxObject *reference)
Definition: SourceFile.hpp:296
SecurityManager * getSecurityManager()
Definition: SourceFile.hpp:380
SecurityManager * securityManager
Definition: SourceFile.hpp:460
void endLocation(SourceLocation &)
Definition: Scanner.cpp:211
void createAttributeSetterMethod(RexxString *name, RexxVariableBase *retriever, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod)
size_t traceFlags
Definition: SourceFile.hpp:497
RexxInstruction * upperNew()
StackFrameClass * createStackFrame()
bool hasBody()
static KeywordEntry keywordInstructions[]
Definition: SourceFile.hpp:539
size_t current_length
Definition: SourceFile.hpp:466
static KeywordEntry subDirectives[]
Definition: SourceFile.hpp:544
size_t getTraceFlags()
Definition: SourceFile.hpp:416
void pushSubTerm(RexxObject *)
RexxCode * translate(RexxDirectory *)
RexxInstruction * endNew()
RexxCode * generateCode(bool isMethod)
void syntaxError(int errorcode)
Definition: SourceFile.hpp:328
void addInstalledRoutine(RexxString *name, RoutineClass *routineObject, bool publicRoutine)
void routineDirective()
RexxObject * constantLogicalExpression()
void isExposeValid()
size_t line_offset
Definition: SourceFile.hpp:469
void comment()
Definition: Scanner.cpp:246
size_t getFuzz()
Definition: SourceFile.hpp:414
void cleanup()
static const size_t DEBUG_ON
Definition: SourceFile.hpp:444
void removeObj(RexxObject *object)
Definition: SourceFile.hpp:378
RexxList * loadedPackages
Definition: SourceFile.hpp:475
RexxDirectory * strings
Definition: SourceFile.hpp:511
RexxList * requires
Definition: SourceFile.hpp:482
RexxInstruction * parseNew(int)
void blockSyntaxError(RexxInstruction *i)
Definition: SourceFile.hpp:321
RexxObject * popTerm()
void errorToken(int, RexxToken *)
RexxInstruction * instructionNew(int)
void argArray(RexxToken *, int, bool, RexxArray *&, RexxArray *&)
void methodDirective()
RexxArray * getGuard()
static RexxString * formatTraceSetting(size_t source)
RexxInstruction * useNew()
RexxInstruction * thenNew(RexxToken *, RexxInstructionIf *)
RexxCode * interpretMethod(RexxDirectory *, RexxActivation *)
RexxToken * topOperator()
Definition: SourceFile.hpp:309
static KeywordEntry builtinFunctions[]
Definition: SourceFile.hpp:541
void liveGeneral(int reason)
Definition: SourceFile.cpp:642
RexxInstruction * returnNew()
RexxInstruction * createDoLoop()
RexxString * getProgramFile()
Definition: SourceFile.hpp:304
void RexxInstructionForwardCreate(RexxInstructionForward *)
bool nextSpecial(unsigned int, SourceLocation &, bool advance=true)
Definition: Scanner.cpp:221
RexxArray * sourceArray
Definition: SourceFile.hpp:455
RoutineClass * findRoutine(RexxString *)
void syntaxError(int errorcode, RexxObject *a1, RexxObject *a2, RexxObject *a3)
Definition: SourceFile.hpp:326
RexxInstruction * dropNew()
static const size_t TRACE_IGNORE
Definition: SourceFile.hpp:432
void position(size_t, size_t)
Definition: SourceFile.cpp:518
RexxQueue * operators
Definition: SourceFile.hpp:516
static const size_t DEBUG_OFF
Definition: SourceFile.hpp:445
static KeywordEntry conditionKeywords[]
Definition: SourceFile.hpp:542
void blockError(RexxInstruction *)
RexxInstruction * optionsNew()
void adjustLine(size_t, size_t)
Definition: SourceFile.cpp:365
void expose(RexxString *)
RexxInstruction * messageNew(RexxExpressionMessage *)
RexxInstruction * replyNew()
void createMethod(RexxString *name, bool classMethod, AccessFlag privateMethod, ProtectedFlag protectedMethod, GuardFlag guardedMethod, bool isAttribute)
RexxString * commonString(RexxString *)
void setPublicRoutines(RexxDirectory *r)
Definition: SourceFile.hpp:385
RexxInstruction * popDo()
Definition: SourceFile.hpp:298
RexxSource(RexxString *, RexxArray *)
Definition: SourceFile.cpp:113
void addInstalledClass(RexxString *name, RexxClass *classObject, bool publicClass)
void errorCleanup()
void syntaxError(int errorcode, RexxObject *a1, RexxObject *a2)
Definition: SourceFile.hpp:325
RexxQueue * control
Definition: SourceFile.hpp:512
void classDirective()
RexxInstruction * interpretNew()
intptr_t reserved4
Definition: SourceFile.hpp:503
RexxString * getProgramExtension()
Definition: SourceFile.hpp:303
void initFile()
Definition: SourceFile.cpp:275
RexxInstruction * sourceNewObject(size_t, RexxBehaviour *, int)
RexxString * extract(SourceLocation &, bool=false)
size_t processVariableList(int)
RexxClass * findPublicClass(RexxString *name)
static int builtin(RexxToken *)
RexxString * getProgramDirectory()
Definition: SourceFile.hpp:302
RexxObject * constantExpression()
RexxInstruction * doNew()
PackageClass * getPackage()
void errorPosition(int, SourceLocation)
RexxDirectory * variables
Definition: SourceFile.hpp:526
bool isInterpret()
Definition: SourceFile.hpp:292
RexxInstruction * commandNew()
bool atEnd(void)
Definition: SourceFile.hpp:311
size_t sourceSize()
Definition: SourceFile.cpp:783
void error(int)
RexxDirectory * getInstalledRoutines()
Definition: SourceFile.hpp:407
size_t maxstack
Definition: SourceFile.hpp:532
void pushTerm(RexxObject *)
bool needsInstallation()
Definition: SourceFile.hpp:294
static const size_t TRACE_NORMAL
Definition: SourceFile.hpp:426
RexxInstruction * nopNew()
size_t getTraceSetting()
Definition: SourceFile.hpp:415
void holdObject(RexxObject *object)
Definition: SourceFile.hpp:376
RexxList * libraries
Definition: SourceFile.hpp:481
void addMethod(RexxString *name, RexxMethod *method, bool classMethod)
void live(size_t)
Definition: SourceFile.cpp:589
const char * current
Definition: SourceFile.hpp:461
RexxObject * message(RexxObject *, bool, int)
RexxObject * variableOrMessageTerm()
void optionsDirective()
void mergeRequired(RexxSource *)
bool isInternalCode()
Definition: SourceFile.hpp:329
size_t traceSetting
Definition: SourceFile.hpp:496
RexxDirectory * getImportedRoutines()
Definition: SourceFile.hpp:409
RexxDirectory * installed_classes
Definition: SourceFile.hpp:487
void initBuffered(RexxBuffer *)
Definition: SourceFile.cpp:181
void setIsBlock(bool b)
Definition: SourceFile.hpp:145
RexxInstruction * first
Definition: SourceFile.hpp:523
RexxString * getTrace()
Definition: SourceFile.hpp:417
RexxSource(RESTORETYPE restoreType)
Definition: SourceFile.hpp:144
RexxInstruction * queueNew(int)
RexxInstruction * sayNew()
RexxToken * nextReal()
Definition: SourceFile.hpp:314
RexxString * packLiteral(size_t, size_t, int)
Definition: Scanner.cpp:429
void setProgramName(RexxString *name)
Definition: SourceFile.cpp:338
RexxInstruction * assignmentOpNew(RexxToken *, RexxToken *)
RexxObject * popSubTerm()
void saveObject(RexxObject *object)
Definition: SourceFile.hpp:377
void setLocalRoutines(RexxDirectory *r)
Definition: SourceFile.hpp:384
void setReconnect()
Definition: SourceFile.cpp:357
RexxVariableBase * addVariable(RexxString *)
static const size_t TRACE_RESULTS
Definition: SourceFile.hpp:429
RexxDirectory * methods
Definition: SourceFile.hpp:491
void needVariableOrDotSymbol(RexxToken *)
Definition: SourceFile.cpp:403
RexxIdentityTable * guard_variables
Definition: SourceFile.hpp:528
bool isTraceable()
Definition: SourceFile.cpp:801
RexxDirectory * installed_public_classes
Definition: SourceFile.hpp:486
void checkDirective(int errorCode)
intptr_t reserved1
Definition: SourceFile.hpp:500
void processInstall(RexxActivation *)
RexxIdentityTable * savelist
Definition: SourceFile.hpp:507
void inheritSourceContext(RexxSource *source)
RexxInstruction * last
Definition: SourceFile.hpp:524
size_t fuzz
Definition: SourceFile.hpp:494
RexxInstruction * otherwiseNew(RexxToken *)
RexxInstruction * currentInstruction
Definition: SourceFile.hpp:525
RexxDirectory * getInstalledClasses()
Definition: SourceFile.hpp:404
void trimClause()
Definition: SourceFile.hpp:317
RexxClass * findInstalledClass(RexxString *name)
size_t currentstack
Definition: SourceFile.hpp:531
void nextClause()
Definition: SourceFile.cpp:936
void flushControl(RexxInstruction *)
RexxDirectory * merged_public_classes
Definition: SourceFile.hpp:488
static const size_t TRACE_OFF
Definition: SourceFile.hpp:431
RexxList * getPackages()
Definition: SourceFile.hpp:411
RexxBuffer * sourceBuffer
Definition: SourceFile.hpp:464
RexxString * get(size_t)
Definition: SourceFile.cpp:815
RexxDirectory * merged_public_routines
Definition: SourceFile.hpp:490
RexxDirectory * exposed_variables
Definition: SourceFile.hpp:529
intptr_t reserved3
Definition: SourceFile.hpp:502
RexxInstruction * guardNew()
RexxInstruction * endIfNew(RexxInstructionIf *)
static int parseOption(RexxToken *)
void interpretLine(size_t)
static const size_t TRACE_DEBUG_MASK
Definition: SourceFile.hpp:450
static const size_t DEBUG_NOTRACE
Definition: SourceFile.hpp:447
bool enableMacrospace
Definition: SourceFile.hpp:499
RexxObject * parenExpression(RexxToken *)
void attributeDirective()
bool getEnableMacrospace()
Definition: SourceFile.hpp:419
static int translateChar(codepoint_t ch)
Definition: SourceFile.hpp:394
RexxQueue * namedSubTerms
Definition: SourceFile.hpp:515
RexxArray * words(RexxString *)
RexxClass * findClass(RexxString *)
RexxStack * holdstack
Definition: SourceFile.hpp:508
static int characterTable[]
Definition: SourceFile.hpp:547
static const size_t DEBUG_IGNORE
Definition: SourceFile.hpp:443
void needVariable(RexxToken *)
Definition: SourceFile.cpp:382
RexxObject * addText(RexxToken *)
bool terminator(int, RexxObject *)
static const size_t TRACE_ALL
Definition: SourceFile.hpp:423
RexxList * calls
Definition: SourceFile.hpp:530
void syntaxError(int errorcode, RexxToken *token)
Definition: SourceFile.hpp:327
static bool parseTraceSetting(RexxString *, size_t &, size_t &, char &)
size_t digits
Definition: SourceFile.hpp:493
void reclaimClause()
Definition: SourceFile.hpp:310
void nextLine()
Definition: SourceFile.cpp:504
void addPackage(PackageClass *package)
RexxList * extensions
Definition: SourceFile.hpp:484
static const size_t DEFAULT_TRACE_SETTING
Definition: SourceFile.hpp:434
static const size_t DEBUG_TOGGLE
Definition: SourceFile.hpp:446
RexxDirectory * labels
Definition: SourceFile.hpp:527
static int keyword(RexxToken *)
RoutineClass * findLocalRoutine(RexxString *)
bool enableCommands
Definition: SourceFile.hpp:498
void requiresDirective()
RexxInstruction * procedureNew()
size_t markPosition()
Definition: SourceFile.hpp:318
RexxDirectory * routines
Definition: SourceFile.hpp:479
static const size_t TRACE_FAILURES
Definition: SourceFile.hpp:427
RexxInstruction * selectNew()
RexxInstruction * callNew()
RexxBuffer * sourceIndices
Definition: SourceFile.hpp:465
RexxObject * push(RexxObject *obj)
Definition: StackClass.hpp:63
const SourceLocation & getLocation()
Definition: Token.hpp:443
ssize_t codepoint_t
Definition: rexx.h:232
INT_PTR intptr_t