ParseTarget.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 ParseTarget.hpp */
40 /* */
41 /* Primitive PARSE instruction parsing target Class Definitions */
42 /* */
43 /******************************************************************************/
44 #ifndef Included_RexxInstructionTarget
45 #define Included_RexxInstructionTarget
46 
47 #define PARSE_UPPER 1 /* Uppercase parsed string */
48 #define PARSE_LOWER 2 /* Lowercase parsed string */
49 #define PARSE_CASELESS 1 /* do case insensitive searches */
50 
51 class RexxTarget {
52  public:
53  inline void *operator new(size_t size, void *ptr) {return ptr;};
54  inline RexxTarget() { ; }
55  inline RexxTarget (RESTORETYPE restoreType) { ; };
56  void init (RexxObject *, RexxObject **, size_t, size_t, bool, RexxActivation *, RexxExpressionStack *);
57  void next(RexxActivation *);
58  void moveToEnd();
59  void forward(stringsize_t);
61  void absolute(stringsize_t);
62  void backward(stringsize_t);
64  void search(RexxString *);
65  void caselessSearch(RexxString *);
68  void skipRemainder() { this->subcurrent = this->end; /* eat the remainder piece */ }
69  void skipWord();
70 
71  RexxString * string; /* parsed string */
72  RexxObject **arglist; /* argument list for PARSE ARG */
73  RexxExpressionStack *stack; // context expression stack (used for anchoring values for GC).
74  size_t stackTop; // top location of the epxression stack
75  size_t argcount;
76  stringsizeC_t start; /* start of substring */
77  stringsizeC_t end; /* end of the substring */
78  stringsizeC_t string_length; /* length of the string */
79  stringsizeC_t pattern_end; /* end of matched pattern */
80  stringsizeC_t pattern_start; /* start of matched pattern */
81  stringsizeC_t subcurrent; /* current location for word parse */
82  size_t next_argument; /* next PARSE ARG argument */
83  size_t translate; /* string translation flag */
84 };
85 #endif
RESTORETYPE
Definition: ObjectClass.hpp:80
void search(RexxString *)
void backward(stringsize_t)
RexxString * string
Definition: ParseTarget.hpp:71
stringsizeC_t start
Definition: ParseTarget.hpp:76
stringsizeC_t end
Definition: ParseTarget.hpp:77
void absolute(stringsize_t)
void backwardLength(stringsize_t)
RexxString * getWord()
stringsizeC_t subcurrent
Definition: ParseTarget.hpp:81
stringsizeC_t pattern_end
Definition: ParseTarget.hpp:79
void init(RexxObject *, RexxObject **, size_t, size_t, bool, RexxActivation *, RexxExpressionStack *)
Definition: ParseTarget.cpp:52
void skipRemainder()
Definition: ParseTarget.hpp:68
size_t stackTop
Definition: ParseTarget.hpp:74
RexxTarget(RESTORETYPE restoreType)
Definition: ParseTarget.hpp:55
RexxString * remainder()
stringsizeC_t string_length
Definition: ParseTarget.hpp:78
size_t argcount
Definition: ParseTarget.hpp:75
size_t next_argument
Definition: ParseTarget.hpp:82
void forwardLength(stringsize_t)
RexxObject ** arglist
Definition: ParseTarget.hpp:72
void caselessSearch(RexxString *)
void forward(stringsize_t)
size_t translate
Definition: ParseTarget.hpp:83
RexxExpressionStack * stack
Definition: ParseTarget.hpp:73
void next(RexxActivation *)
Definition: ParseTarget.cpp:74
void moveToEnd()
stringsizeC_t pattern_start
Definition: ParseTarget.hpp:80
void skipWord()
stringsize_t stringsizeC_t
Definition: rexx.h:241
size_t stringsize_t
Definition: rexx.h:228