KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xpath > internal > compiler > OpCodes


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: OpCodes.java,v 1.9 2004/02/17 04:32:48 minchau Exp $
18  */

19 package com.sun.org.apache.xpath.internal.compiler;
20
21 /**
22  * Operations codes for XPath.
23  *
24  * Code for the descriptions of the operations codes:
25  * [UPPER CASE] indicates a literal value,
26  * [lower case] is a description of a value,
27  * ([length] always indicates the length of the operation,
28  * including the operations code and the length integer.)
29  * {UPPER CASE} indicates the given production,
30  * {description} is the description of a new production,
31  * (For instance, {boolean expression} means some expression
32  * that should be resolved to a boolean.)
33  * * means that it occurs zero or more times,
34  * + means that it occurs one or more times,
35  * ? means that it is optional.
36  *
37  * returns: indicates what the production should return.
38  */

39 public class OpCodes
40 {
41
42   /**
43    * [ENDOP]
44    * Some operators may like to have a terminator.
45    * @xsl.usage advanced
46    */

47   public static final int ENDOP = -1;
48
49   /**
50    * [EMPTY]
51    * Empty slot to indicate NULL.
52    */

53   public static final int EMPTY = -2;
54
55   /**
56    * [ELEMWILDCARD]
57    * Means ELEMWILDCARD ("*"), used instead
58    * of string index in some places.
59    * @xsl.usage advanced
60    */

61   public static final int ELEMWILDCARD = -3;
62
63   /**
64    * [OP_XPATH]
65    * [length]
66    * {expression}
67    *
68    * returns:
69    * XNodeSet
70    * XNumber
71    * XString
72    * XBoolean
73    * XRTree
74    * XObject
75    * @xsl.usage advanced
76    */

77   public static final int OP_XPATH = 1;
78
79   /**
80    * [OP_OR]
81    * [length]
82    * {boolean expression}
83    * {boolean expression}
84    *
85    * returns:
86    * XBoolean
87    * @xsl.usage advanced
88    */

89   public static final int OP_OR = 2;
90
91   /**
92    * [OP_AND]
93    * [length]
94    * {boolean expression}
95    * {boolean expression}
96    *
97    * returns:
98    * XBoolean
99    * @xsl.usage advanced
100    */

101   public static final int OP_AND = 3;
102
103   /**
104    * [OP_NOTEQUALS]
105    * [length]
106    * {expression}
107    * {expression}
108    *
109    * returns:
110    * XBoolean
111    * @xsl.usage advanced
112    */

113   public static final int OP_NOTEQUALS = 4;
114
115   /**
116    * [OP_EQUALS]
117    * [length]
118    * {expression}
119    * {expression}
120    *
121    * returns:
122    * XBoolean
123    * @xsl.usage advanced
124    */

125   public static final int OP_EQUALS = 5;
126
127   /**
128    * [OP_LTE] (less-than-or-equals)
129    * [length]
130    * {number expression}
131    * {number expression}
132    *
133    * returns:
134    * XBoolean
135    * @xsl.usage advanced
136    */

137   public static final int OP_LTE = 6;
138
139   /**
140    * [OP_LT] (less-than)
141    * [length]
142    * {number expression}
143    * {number expression}
144    *
145    * returns:
146    * XBoolean
147    * @xsl.usage advanced
148    */

149   public static final int OP_LT = 7;
150
151   /**
152    * [OP_GTE] (greater-than-or-equals)
153    * [length]
154    * {number expression}
155    * {number expression}
156    *
157    * returns:
158    * XBoolean
159    * @xsl.usage advanced
160    */

161   public static final int OP_GTE = 8;
162
163   /**
164    * [OP_GT] (greater-than)
165    * [length]
166    * {number expression}
167    * {number expression}
168    *
169    * returns:
170    * XBoolean
171    * @xsl.usage advanced
172    */

173   public static final int OP_GT = 9;
174
175   /**
176    * [OP_PLUS]
177    * [length]
178    * {number expression}
179    * {number expression}
180    *
181    * returns:
182    * XNumber
183    * @xsl.usage advanced
184    */

185   public static final int OP_PLUS = 10;
186
187   /**
188    * [OP_MINUS]
189    * [length]
190    * {number expression}
191    * {number expression}
192    *
193    * returns:
194    * XNumber
195    * @xsl.usage advanced
196    */

197   public static final int OP_MINUS = 11;
198
199   /**
200    * [OP_MULT]
201    * [length]
202    * {number expression}
203    * {number expression}
204    *
205    * returns:
206    * XNumber
207    * @xsl.usage advanced
208    */

209   public static final int OP_MULT = 12;
210
211   /**
212    * [OP_DIV]
213    * [length]
214    * {number expression}
215    * {number expression}
216    *
217    * returns:
218    * XNumber
219    * @xsl.usage advanced
220    */

221   public static final int OP_DIV = 13;
222
223   /**
224    * [OP_MOD]
225    * [length]
226    * {number expression}
227    * {number expression}
228    *
229    * returns:
230    * XNumber
231    * @xsl.usage advanced
232    */

233   public static final int OP_MOD = 14;
234
235   /**
236    * [OP_QUO]
237    * [length]
238    * {number expression}
239    * {number expression}
240    *
241    * returns:
242    * XNumber
243    * @xsl.usage advanced
244    */

245   public static final int OP_QUO = 15;
246
247   /**
248    * [OP_NEG]
249    * [length]
250    * {number expression}
251    *
252    * returns:
253    * XNumber
254    * @xsl.usage advanced
255    */

256   public static final int OP_NEG = 16;
257
258   /**
259    * [OP_STRING] (cast operation)
260    * [length]
261    * {expression}
262    *
263    * returns:
264    * XString
265    * @xsl.usage advanced
266    */

267   public static final int OP_STRING = 17;
268
269   /**
270    * [OP_BOOL] (cast operation)
271    * [length]
272    * {expression}
273    *
274    * returns:
275    * XBoolean
276    * @xsl.usage advanced
277    */

278   public static final int OP_BOOL = 18;
279
280   /**
281    * [OP_NUMBER] (cast operation)
282    * [length]
283    * {expression}
284    *
285    * returns:
286    * XBoolean
287    * @xsl.usage advanced
288    */

289   public static final int OP_NUMBER = 19;
290
291   /**
292    * [OP_UNION]
293    * [length]
294    * {PathExpr}+
295    *
296    * returns:
297    * XNodeSet
298    * @xsl.usage advanced
299    */

300   public static final int OP_UNION = 20;
301
302   /**
303    * [OP_LITERAL]
304    * [3]
305    * [index to token]
306    *
307    * returns:
308    * XString
309    * @xsl.usage advanced
310    */

311   public static final int OP_LITERAL = 21;
312
313   /** The low opcode for nodesets, needed by getFirstPredicateOpPos and
314    * getNextStepPos. */

315   static final int FIRST_NODESET_OP = 22;
316
317   /**
318    * [OP_VARIABLE]
319    * [4]
320    * [index to namespace token, or EMPTY]
321    * [index to function name token]
322    *
323    * returns:
324    * XString
325    * @xsl.usage advanced
326    */

327   public static final int OP_VARIABLE = 22;
328
329   /**
330    * [OP_GROUP]
331    * [length]
332    * {expression}
333    *
334    * returns:
335    * XNodeSet
336    * XNumber
337    * XString
338    * XBoolean
339    * XRTree
340    * XObject
341    * @xsl.usage advanced
342    */

343   public static final int OP_GROUP = 23;
344
345   /**
346    * [OP_EXTFUNCTION] (Extension function.)
347    * [length]
348    * [index to namespace token]
349    * [index to function name token]
350    * {OP_ARGUMENT}
351    *
352    * returns:
353    * XNodeSet
354    * XNumber
355    * XString
356    * XBoolean
357    * XRTree
358    * XObject
359    * @xsl.usage advanced
360    */

361   public static final int OP_EXTFUNCTION = 24;
362
363   /**
364    * [OP_FUNCTION]
365    * [length]
366    * [FUNC_name]
367    * {OP_ARGUMENT}
368    * [ENDOP]
369    *
370    * returns:
371    * XNodeSet
372    * XNumber
373    * XString
374    * XBoolean
375    * XRTree
376    * XObject
377    * @xsl.usage advanced
378    */

379   public static final int OP_FUNCTION = 25;
380
381   /** The last opcode for stuff that can be a nodeset. */
382   static final int LAST_NODESET_OP = 25;
383
384   /**
385    * [OP_ARGUMENT] (Function argument.)
386    * [length]
387    * {expression}
388    *
389    * returns:
390    * XNodeSet
391    * XNumber
392    * XString
393    * XBoolean
394    * XRTree
395    * XObject
396    * @xsl.usage advanced
397    */

398   public static final int OP_ARGUMENT = 26;
399
400   /**
401    * [OP_NUMBERLIT] (Number literal.)
402    * [3]
403    * [index to token]
404    *
405    * returns:
406    * XString
407    * @xsl.usage advanced
408    */

409   public static final int OP_NUMBERLIT = 27;
410
411   /**
412    * [OP_LOCATIONPATH]
413    * [length]
414    * {FROM_stepType}
415    * | {function}
416    * {predicate}
417    * [ENDOP]
418    *
419    * (Note that element and attribute namespaces and
420    * names can be wildcarded '*'.)
421    *
422    * returns:
423    * XNodeSet
424    * @xsl.usage advanced
425    */

426   public static final int OP_LOCATIONPATH = 28;
427
428   // public static final int LOCATIONPATHEX_MASK = 0x0000FFFF;
429
// public static final int LOCATIONPATHEX_ISSIMPLE = 0x00010000;
430
// public static final int OP_LOCATIONPATH_EX = (28 | 0x00010000);
431

432   /**
433    * [OP_PREDICATE]
434    * [length]
435    * {expression}
436    * [ENDOP] (For safety)
437    *
438    * returns:
439    * XBoolean or XNumber
440    * @xsl.usage advanced
441    */

442   public static final int OP_PREDICATE = 29;
443
444   /**
445    * [OP_MATCHPATTERN]
446    * [length]
447    * {PathExpr}+
448    *
449    * returns:
450    * XNodeSet
451    * @xsl.usage advanced
452    */

453   public static final int OP_MATCHPATTERN = 30;
454
455   /**
456    * [OP_LOCATIONPATHPATTERN]
457    * [length]
458    * {FROM_stepType}
459    * | {function}{predicate}
460    * [ENDOP]
461    * returns:
462    * XNodeSet
463    * @xsl.usage advanced
464    */

465   public static final int OP_LOCATIONPATHPATTERN = 31;
466
467   /**
468    * [NODETYPE_COMMENT]
469    * No size or arguments.
470    * Note: must not overlap function OP number!
471    *
472    * returns:
473    * XBoolean
474    * @xsl.usage advanced
475    */

476   public static final int NODETYPE_COMMENT = 1030;
477
478   /**
479    * [NODETYPE_TEXT]
480    * No size or arguments.
481    * Note: must not overlap function OP number!
482    *
483    * returns:
484    * XBoolean
485    * @xsl.usage advanced
486    */

487   public static final int NODETYPE_TEXT = 1031;
488
489   /**
490    * [NODETYPE_PI]
491    * [index to token]
492    * Note: must not overlap function OP number!
493    *
494    * returns:
495    * XBoolean
496    * @xsl.usage advanced
497    */

498   public static final int NODETYPE_PI = 1032;
499
500   /**
501    * [NODETYPE_NODE]
502    * No size or arguments.
503    * Note: must not overlap function OP number!
504    *
505    * returns:
506    * XBoolean
507    * @xsl.usage advanced
508    */

509   public static final int NODETYPE_NODE = 1033;
510
511   /**
512    * [NODENAME]
513    * [index to ns token or EMPTY]
514    * [index to name token]
515    *
516    * returns:
517    * XBoolean
518    * @xsl.usage advanced
519    */

520   public static final int NODENAME = 34;
521
522   /**
523    * [NODETYPE_ROOT]
524    * No size or arguments.
525    *
526    * returns:
527    * XBoolean
528    * @xsl.usage advanced
529    */

530   public static final int NODETYPE_ROOT = 35;
531
532   /**
533    * [NODETYPE_ANY]
534    * No size or arguments.
535    *
536    * returns:
537    * XBoolean
538    * @xsl.usage advanced
539    */

540   public static final int NODETYPE_ANYELEMENT = 36;
541
542   /**
543    * [NODETYPE_ANY]
544    * No size or arguments.
545    *
546    * returns:
547    * XBoolean
548    * @xsl.usage advanced
549    */

550   public static final int NODETYPE_FUNCTEST = 1034;
551
552   /**
553    * [FROM_stepType]
554    * [length, including predicates]
555    * [length of just the step, without the predicates]
556    * {node test}
557    * {predicates}?
558    *
559    * returns:
560    * XBoolean
561    * @xsl.usage advanced
562    */

563   public static final int AXES_START_TYPES = 37;
564
565   /** ancestor axes opcode. */
566   public static final int FROM_ANCESTORS = 37;
567
568   /** ancestor-or-self axes opcode. */
569   public static final int FROM_ANCESTORS_OR_SELF = 38;
570
571   /** attribute axes opcode. */
572   public static final int FROM_ATTRIBUTES = 39;
573
574   /** children axes opcode. */
575   public static final int FROM_CHILDREN = 40;
576
577   /** descendants axes opcode. */
578   public static final int FROM_DESCENDANTS = 41;
579
580   /** descendants-of-self axes opcode. */
581   public static final int FROM_DESCENDANTS_OR_SELF = 42;
582
583   /** following axes opcode. */
584   public static final int FROM_FOLLOWING = 43;
585
586   /** following-siblings axes opcode. */
587   public static final int FROM_FOLLOWING_SIBLINGS = 44;
588
589   /** parent axes opcode. */
590   public static final int FROM_PARENT = 45;
591
592   /** preceding axes opcode. */
593   public static final int FROM_PRECEDING = 46;
594
595   /** preceding-sibling axes opcode. */
596   public static final int FROM_PRECEDING_SIBLINGS = 47;
597
598   /** self axes opcode. */
599   public static final int FROM_SELF = 48;
600
601   /** namespace axes opcode. */
602   public static final int FROM_NAMESPACE = 49;
603
604   /** '/' axes opcode. */
605   public static final int FROM_ROOT = 50;
606
607   /**
608    * For match patterns.
609    * @xsl.usage advanced
610    */

611   public static final int MATCH_ATTRIBUTE = 51;
612
613   /**
614    * For match patterns.
615    * @xsl.usage advanced
616    */

617   public static final int MATCH_ANY_ANCESTOR = 52;
618
619   /**
620    * For match patterns.
621    * @xsl.usage advanced
622    */

623   public static final int MATCH_IMMEDIATE_ANCESTOR = 53;
624
625   /** The end of the axes types. */
626   public static final int AXES_END_TYPES = 53;
627
628   /** The next free ID. Please keep this up to date. */
629   private static final int NEXT_FREE_ID = 99;
630 }
631
Popular Tags