2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
10
* http://www.apache.org/licenses/LICENSE-2.0
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
19
* $Id: Pattern.java,v 1.2 2009/12/10 03:18:18 matthewoliver Exp $
22
package org.apache.xalan.xsltc.compiler;
24
import org.apache.xalan.xsltc.compiler.util.ClassGenerator;
25
import org.apache.xalan.xsltc.compiler.util.MethodGenerator;
26
import org.apache.xalan.xsltc.compiler.util.Type;
27
import org.apache.xalan.xsltc.compiler.util.TypeCheckError;
30
* @author Jacek Ambroziak
31
* @author Santiago Pericas-Geertsen
33
public abstract class Pattern extends Expression {
35
* Returns the type of a pattern, which is always a <code>NodeType</code>.
36
* A <code>NodeType</code> has a number of subtypes defined by
37
* <code>NodeType._type</code> corresponding to each type of node.
39
public abstract Type typeCheck(SymbolTable stable) throws TypeCheckError;
42
* Translate this node into JVM bytecodes. Patterns are translated as
43
* boolean expressions with true/false lists. Before calling
44
* <code>translate</code> on a pattern, make sure that the node being
45
* matched is on top of the stack. After calling <code>translate</code>,
46
* make sure to backpatch both true and false lists. True lists are the
47
* default, in the sense that they always <em>"fall through"</em>. If this
48
* is not the intended semantics (e.g., see
49
* {@link org.apache.xalan.xsltc.compiler.AlternativePattern#translate})
50
* then a GOTO must be appended to the instruction list after calling
51
* <code>translate</code>.
53
public abstract void translate(ClassGenerator classGen,
54
MethodGenerator methodGen);
57
* Returns the priority of this pattern (section 5.5 in the XSLT spec).
59
public abstract double getPriority();