villard 2003/03/25 15:46:10
Modified: java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
xslt20 xpath-grammar.jj xpath-grammar.jjt
XPath.java XPathTreeConstants.java SimpleNode.java
NodeFactory.java DefaultNodeFactory.java
Singletons.java
java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
xslt20 InstanceOfExpr.java Visitor.java
CastableExpr.java
java/xpath_rwapi/src2/org/apache/xpath/datamodel Tag: xslt20
SequenceType.java
java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
CastableExprImpl.java InstanceOfExprImpl.java
ConditionalExprImpl.java
java/xpath_rwapi/src2/org/apache/xpath/test Tag: xslt20
TestSamples.java TestSamples.xml
Added: java/xpath_rwapi/src2/org/apache/xpath/datamodel Tag: xslt20
ItemType.java
java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
SequenceTypeImpl.java
Removed: java/xpath_rwapi/src2/org/apache/xpath/datamodel Tag: xslt20
SingleType.java
Log:
- Implementation of instanceof expression.
- First definition of the SequenceType interface: element, attribute and
atomic type are represented as string.
- add new samples for instanceof constructor
Revision Changes Path
No revision
No revision
1.1.2.3 +9 -65
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jj
Index: xpath-grammar.jj
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jj,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- xpath-grammar.jj 24 Mar 2003 17:35:04 -0000 1.1.2.2
+++ xpath-grammar.jj 25 Mar 2003 23:46:07 -0000 1.1.2.3
@@ -1848,25 +1848,7 @@
{/[EMAIL PROTECTED](jjtree) #InstanceofExpr(> 1) */
try {
/[EMAIL PROTECTED]/
- CastableExpr() (<Instanceof>/[EMAIL PROTECTED](jjtree) #Instanceof( true)
*/
- {
- SimpleNode jjtn001 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTINSTANCEOF);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- }
- try {
-/[EMAIL PROTECTED]//[EMAIL PROTECTED](jjtree)*/
- {
- jjtree.closeNodeScope(jjtn001, true);
- jjtc001 = false;
- }
-/[EMAIL PROTECTED]/{jjtn001.processToken(token);}/[EMAIL PROTECTED](jjtree)*/
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, true);
- }
- }
-/[EMAIL PROTECTED]/ SequenceType())?/[EMAIL PROTECTED](jjtree)*/
+ CastableExpr() (<Instanceof> SequenceType())?/[EMAIL PROTECTED](jjtree)*/
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
@@ -3930,15 +3912,9 @@
/[EMAIL PROTECTED]/
}
-void ItemType() :
-{/[EMAIL PROTECTED](jjtree) ItemType */
- SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTITEMTYPE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/[EMAIL PROTECTED]/}
-{/[EMAIL PROTECTED](jjtree) ItemType */
- try {
-/[EMAIL PROTECTED]/
+void ItemType() :
+{}
+{
(((<ElementType>/[EMAIL PROTECTED](jjtree) #ElementType( true) */
{
SimpleNode jjtn001 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTELEMENTTYPE);
@@ -4119,27 +4095,7 @@
jjtree.closeNodeScope(jjtn010,
true);
}
}
-/[EMAIL PROTECTED]/)/[EMAIL PROTECTED](jjtree)*/
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- throw (RuntimeException)jjte000;
- }
- if (jjte000 instanceof ParseException) {
- throw (ParseException)jjte000;
- }
- throw (Error)jjte000;
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/[EMAIL PROTECTED]/
+/[EMAIL PROTECTED]/)
}
void ElemOrAttrType() :
@@ -4282,15 +4238,9 @@
/[EMAIL PROTECTED]/
}
-void OccurrenceIndicator() :
-{/[EMAIL PROTECTED](jjtree) OccurrenceIndicator */
- SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTOCCURRENCEINDICATOR);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
-/[EMAIL PROTECTED]/}
-{/[EMAIL PROTECTED](jjtree) OccurrenceIndicator */
- try {
-/[EMAIL PROTECTED]/
+void OccurrenceIndicator() :
+{}
+{
[(<Star>/[EMAIL PROTECTED](jjtree) #Star( true) */
{
SimpleNode jjtn001 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTSTAR);
@@ -4363,13 +4313,7 @@
jjtree.closeNodeScope(jjtn004, true);
}
}
-/[EMAIL PROTECTED]/)]/[EMAIL PROTECTED](jjtree)*/
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
- }
-/[EMAIL PROTECTED]/
+/[EMAIL PROTECTED]/)]
}
<START_TAG, END_TAG, ELEMENT_CONTENT, QUOT_ATTRIBUTE_CONTENT,
APOS_ATTRIBUTE_CONTENT>
1.1.2.3 +3 -3
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jjt
Index: xpath-grammar.jjt
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jjt,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- xpath-grammar.jjt 24 Mar 2003 17:35:05 -0000 1.1.2.2
+++ xpath-grammar.jjt 25 Mar 2003 23:46:07 -0000 1.1.2.3
@@ -1139,7 +1139,7 @@
void InstanceofExpr() #InstanceofExpr(> 1) :
{}
{
- CastableExpr() (<Instanceof>{jjtThis.processToken(token);}
#Instanceof(true) SequenceType())?
+ CastableExpr() (<Instanceof> SequenceType())?
}
void CastableExpr() #CastableExpr(> 1) :
@@ -1571,7 +1571,7 @@
((ItemType() OccurrenceIndicator()) |
<Empty>{jjtThis.processToken(token);} #Empty(true))
}
-void ItemType() :
+void ItemType() #void :
{}
{
(((<ElementType>{jjtThis.processToken(token);} #ElementType(true) |
<AttributeType>{jjtThis.processToken(token);} #AttributeType(true))
[ElemOrAttrType()]) | <Node>{jjtThis.processToken(token);} #Node(true) |
<ProcessingInstruction>{jjtThis.processToken(token);}
#ProcessingInstruction(true) | <Comment>{jjtThis.processToken(token);}
#Comment(true) | <Text>{jjtThis.processToken(token);} #Text(true) |
(<Document>{jjtThis.processToken(token);} #Document(true)) |
<Item>{jjtThis.processToken(token);} #Item(true) | AtomicType() |
<Untyped>{jjtThis.processToken(token);} #Untyped(true) |
<AtomicValue>{jjtThis.processToken(token);} #AtomicValue(true))
@@ -1595,7 +1595,7 @@
<QName>{jjtThis.processToken(token);} #QName(true)
}
-void OccurrenceIndicator() :
+void OccurrenceIndicator() #void :
{}
{
[(<Star>{jjtThis.processToken(token);} #Star(true) |
<Multiply>{jjtThis.processToken(token);} #Multiply(true) |
<Plus>{jjtThis.processToken(token);} #Plus(true) |
<QMark>{jjtThis.processToken(token);} #QMark(true))]
1.1.2.3 +114 -160
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPath.java
Index: XPath.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPath.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XPath.java 24 Mar 2003 17:35:05 -0000 1.1.2.2
+++ XPath.java 25 Mar 2003 23:46:07 -0000 1.1.2.3
@@ -1126,18 +1126,6 @@
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case Instanceof:
jj_consume_token(Instanceof);
- SimpleNode jjtn001 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTINSTANCEOF);
- boolean jjtc001 = true;
- jjtree.openNodeScope(jjtn001);
- try {
- jjtree.closeNodeScope(jjtn001, true);
- jjtc001 = false;
- jjtn001.processToken(token);
- } finally {
- if (jjtc001) {
- jjtree.closeNodeScope(jjtn001, true);
- }
- }
SequenceType();
break;
default:
@@ -3599,206 +3587,182 @@
}
final public void ItemType() throws ParseException {
- /[EMAIL PROTECTED](jjtree) ItemType */
- SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTITEMTYPE);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ElementType:
+ case AttributeType:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ElementType:
- case AttributeType:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ElementType:
- jj_consume_token(ElementType);
+ jj_consume_token(ElementType);
SimpleNode jjtn001 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTELEMENTTYPE);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
- try {
+ try {
jjtree.closeNodeScope(jjtn001, true);
jjtc001 = false;
jjtn001.processToken(token);
- } finally {
+ } finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, true);
}
- }
- break;
- case AttributeType:
- jj_consume_token(AttributeType);
+ }
+ break;
+ case AttributeType:
+ jj_consume_token(AttributeType);
SimpleNode jjtn002 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTATTRIBUTETYPE);
boolean jjtc002 = true;
jjtree.openNodeScope(jjtn002);
- try {
+ try {
jjtree.closeNodeScope(jjtn002, true);
jjtc002 = false;
jjtn002.processToken(token);
- } finally {
+ } finally {
if (jjtc002) {
jjtree.closeNodeScope(jjtn002, true);
}
- }
- break;
- default:
- jj_la1[70] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case OfType:
- case QName:
- ElemOrAttrType();
- break;
- default:
- jj_la1[71] = jj_gen;
- ;
}
break;
- case Node:
- jj_consume_token(Node);
+ default:
+ jj_la1[70] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case OfType:
+ case QName:
+ ElemOrAttrType();
+ break;
+ default:
+ jj_la1[71] = jj_gen;
+ ;
+ }
+ break;
+ case Node:
+ jj_consume_token(Node);
SimpleNode jjtn003 = (SimpleNode)SimpleNode.jjtCreate(this, JJTNODE);
boolean jjtc003 = true;
jjtree.openNodeScope(jjtn003);
- try {
+ try {
jjtree.closeNodeScope(jjtn003, true);
jjtc003 = false;
jjtn003.processToken(token);
- } finally {
+ } finally {
if (jjtc003) {
jjtree.closeNodeScope(jjtn003, true);
}
- }
- break;
- case ProcessingInstruction:
- jj_consume_token(ProcessingInstruction);
+ }
+ break;
+ case ProcessingInstruction:
+ jj_consume_token(ProcessingInstruction);
SimpleNode jjtn004 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTPROCESSINGINSTRUCTION);
boolean jjtc004 = true;
jjtree.openNodeScope(jjtn004);
- try {
+ try {
jjtree.closeNodeScope(jjtn004, true);
jjtc004 = false;
jjtn004.processToken(token);
- } finally {
+ } finally {
if (jjtc004) {
jjtree.closeNodeScope(jjtn004, true);
}
- }
- break;
- case Comment:
- jj_consume_token(Comment);
+ }
+ break;
+ case Comment:
+ jj_consume_token(Comment);
SimpleNode jjtn005 = (SimpleNode)SimpleNode.jjtCreate(this, JJTCOMMENT);
boolean
jjtc005 = true;
jjtree.openNodeScope(jjtn005);
- try {
+ try {
jjtree.closeNodeScope(jjtn005, true);
jjtc005 =
false;
jjtn005.processToken(token);
- } finally {
+ } finally {
if
(jjtc005) {
jjtree.closeNodeScope(jjtn005, true);
}
- }
- break;
- case Text:
- jj_consume_token(Text);
+ }
+ break;
+ case Text:
+ jj_consume_token(Text);
SimpleNode jjtn006 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTTEXT);
boolean jjtc006 = true;
jjtree.openNodeScope(jjtn006);
- try {
+ try {
jjtree.closeNodeScope(jjtn006,
true);
jjtc006 = false;
jjtn006.processToken(token);
- } finally {
+ } finally {
if (jjtc006) {
jjtree.closeNodeScope(jjtn006,
true);
}
- }
- break;
- case Document:
- jj_consume_token(Document);
+ }
+ break;
+ case Document:
+ jj_consume_token(Document);
SimpleNode jjtn007 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTDOCUMENT);
boolean jjtc007 = true;
jjtree.openNodeScope(jjtn007);
- try {
+ try {
jjtree.closeNodeScope(jjtn007, true);
jjtc007 = false;
jjtn007.processToken(token);
- } finally {
+ } finally {
if (jjtc007) {
jjtree.closeNodeScope(jjtn007, true);
}
- }
- break;
- case Item:
- jj_consume_token(Item);
+ }
+ break;
+ case Item:
+ jj_consume_token(Item);
SimpleNode jjtn008 = (SimpleNode)SimpleNode.jjtCreate(this, JJTITEM);
boolean jjtc008 = true;
jjtree.openNodeScope(jjtn008);
- try {
+ try {
jjtree.closeNodeScope(jjtn008, true);
jjtc008 = false;
jjtn008.processToken(token);
- } finally {
+ } finally {
if
(jjtc008) {
jjtree.closeNodeScope(jjtn008, true);
}
- }
- break;
- case QName:
- AtomicType();
- break;
- case Untyped:
- jj_consume_token(Untyped);
+ }
+ break;
+ case QName:
+ AtomicType();
+ break;
+ case Untyped:
+ jj_consume_token(Untyped);
SimpleNode
jjtn009 = (SimpleNode)SimpleNode.jjtCreate(this, JJTUNTYPED);
boolean
jjtc009 = true;
jjtree.openNodeScope(jjtn009);
- try {
+ try {
jjtree.closeNodeScope(jjtn009, true);
jjtc009 =
false;
jjtn009.processToken(token);
- } finally {
+ } finally {
if (jjtc009) {
jjtree.closeNodeScope(jjtn009, true);
}
- }
- break;
- case AtomicValue:
- jj_consume_token(AtomicValue);
+ }
+ break;
+ case AtomicValue:
+ jj_consume_token(AtomicValue);
SimpleNode jjtn010 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTATOMICVALUE);
boolean jjtc010 = true;
jjtree.openNodeScope(jjtn010);
- try {
+ try {
jjtree.closeNodeScope(jjtn010,
true);
jjtc010 = false;
jjtn010.processToken(token);
- } finally {
+ } finally {
if (jjtc010) {
jjtree.closeNodeScope(jjtn010,
true);
}
- }
- break;
- default:
- jj_la1[72] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
}
- } catch (Throwable jjte000) {
- if (jjtc000) {
- jjtree.clearNodeScope(jjtn000);
- jjtc000 = false;
- } else {
- jjtree.popNode();
- }
- if (jjte000 instanceof RuntimeException) {
- {if (true) throw (RuntimeException)jjte000;}
- }
- if (jjte000 instanceof ParseException) {
- {if (true) throw (ParseException)jjte000;}
- }
- {if (true) throw (Error)jjte000;}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
}
@@ -3934,91 +3898,81 @@
}
final public void OccurrenceIndicator() throws ParseException {
- /[EMAIL PROTECTED](jjtree) OccurrenceIndicator */
- SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTOCCURRENCEINDICATOR);
- boolean jjtc000 = true;
- jjtree.openNodeScope(jjtn000);
- try {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case Multiply:
+ case Star:
+ case Plus:
+ case QMark:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case Multiply:
case Star:
- case Plus:
- case QMark:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case Star:
- jj_consume_token(Star);
+ jj_consume_token(Star);
SimpleNode jjtn001 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTSTAR);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
- try {
+ try {
jjtree.closeNodeScope(jjtn001, true);
jjtc001 = false;
jjtn001.processToken(token);
- } finally {
+ } finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, true);
}
- }
- break;
- case Multiply:
- jj_consume_token(Multiply);
+ }
+ break;
+ case Multiply:
+ jj_consume_token(Multiply);
SimpleNode jjtn002 = (SimpleNode)SimpleNode.jjtCreate(this, JJTMULTIPLY);
boolean
jjtc002 = true;
jjtree.openNodeScope(jjtn002);
- try {
+ try {
jjtree.closeNodeScope(jjtn002, true);
jjtc002 =
false;
jjtn002.processToken(token);
- } finally {
+ } finally {
if
(jjtc002) {
jjtree.closeNodeScope(jjtn002, true);
}
- }
- break;
- case Plus:
- jj_consume_token(Plus);
+ }
+ break;
+ case Plus:
+ jj_consume_token(Plus);
SimpleNode jjtn003 =
(SimpleNode)SimpleNode.jjtCreate(this, JJTPLUS);
boolean jjtc003 = true;
jjtree.openNodeScope(jjtn003);
- try {
+ try {
jjtree.closeNodeScope(jjtn003,
true);
jjtc003 = false;
jjtn003.processToken(token);
- } finally {
+ } finally {
if (jjtc003) {
jjtree.closeNodeScope(jjtn003,
true);
}
- }
- break;
- case QMark:
- jj_consume_token(QMark);
+ }
+ break;
+ case QMark:
+ jj_consume_token(QMark);
SimpleNode jjtn004 = (SimpleNode)SimpleNode.jjtCreate(this,
JJTQMARK);
boolean jjtc004 = true;
jjtree.openNodeScope(jjtn004);
- try {
+ try {
jjtree.closeNodeScope(jjtn004, true);
jjtc004 = false;
jjtn004.processToken(token);
- } finally {
+ } finally {
if (jjtc004) {
jjtree.closeNodeScope(jjtn004, true);
}
- }
- break;
- default:
- jj_la1[76] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
}
break;
default:
- jj_la1[77] = jj_gen;
- ;
+ jj_la1[76] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- } finally {
- if (jjtc000) {
- jjtree.closeNodeScope(jjtn000, true);
- }
+ break;
+ default:
+ jj_la1[77] = jj_gen;
+ ;
}
}
1.1.2.3 +75 -81
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathTreeConstants.java
Index: XPathTreeConstants.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathTreeConstants.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XPathTreeConstants.java 24 Mar 2003 17:35:05 -0000 1.1.2.2
+++ XPathTreeConstants.java 25 Mar 2003 23:46:08 -0000 1.1.2.3
@@ -33,84 +33,81 @@
public int JJTSATISFIES = 26;
public int JJTIFEXPR = 27;
public int JJTINSTANCEOFEXPR = 28;
- public int JJTINSTANCEOF = 29;
- public int JJTCASTABLEEXPR = 30;
- public int JJTCASTABLE = 31;
- public int JJTCOMPARISONEXPR = 32;
- public int JJTRANGEEXPR = 33;
- public int JJTADDITIVEEXPR = 34;
- public int JJTMULTIPLICATIVEEXPR = 35;
- public int JJTUNARYEXPR = 36;
- public int JJTMINUS = 37;
- public int JJTPLUS = 38;
- public int JJTUNIONEXPR = 39;
- public int JJTINTERSECTEXCEPTEXPR = 40;
- public int JJTPATHEXPR = 41;
- public int JJTSTEPEXPR = 42;
- public int JJTVALIDATEEXPR = 43;
- public int JJTVALIDATELBRACE = 44;
- public int JJTVALIDATECONTEXT = 45;
- public int JJTSLASH = 46;
- public int JJTLBRACEEXPRENCLOSURE = 47;
- public int JJTRBRACE = 48;
- public int JJTCASTEXPR = 49;
- public int JJTCASTAS = 50;
- public int JJTTREATEXPR = 51;
- public int JJTTREATAS = 52;
- public int JJTAXISDESCENDANT = 53;
- public int JJTAXISSELF = 54;
- public int JJTAXISDESCENDANTORSELF = 55;
- public int JJTAXISFOLLOWINGSIBLING = 56;
- public int JJTAXISFOLLOWING = 57;
- public int JJTAXISNAMESPACE = 58;
- public int JJTAXISPARENT = 59;
- public int JJTAXISANCESTOR = 60;
- public int JJTAXISPRECEDINGSIBLING = 61;
- public int JJTAXISPRECEDING = 62;
- public int JJTAXISANCESTORORSELF = 63;
- public int JJTNODETEST = 64;
- public int JJTNAMETEST = 65;
- public int JJTQNAME = 66;
- public int JJTSTAR = 67;
- public int JJTNCNAMECOLONSTAR = 68;
- public int JJTSTARCOLONNCNAME = 69;
- public int JJTPROCESSINGINSTRUCTIONTEST = 70;
- public int JJTCOMMENTTEST = 71;
- public int JJTTEXTTEST = 72;
- public int JJTANYKINDTEST = 73;
- public int JJTDOT = 74;
- public int JJTDOTDOT = 75;
- public int JJTPREDICATES = 76;
- public int JJTINTEGERLITERAL = 77;
- public int JJTDECIMALLITERAL = 78;
- public int JJTDOUBLELITERAL = 79;
- public int JJTFUNCTIONCALL = 80;
- public int JJTSCHEMACONTEXT = 81;
- public int JJTINCONTEXT = 82;
- public int JJTSCHEMAGLOBALCONTEXT = 83;
- public int JJTTYPEQNAME = 84;
- public int JJTSCHEMACONTEXTSTEP = 85;
- public int JJTSINGLETYPE = 86;
- public int JJTQMARK = 87;
- public int JJTSEQUENCETYPE = 88;
- public int JJTEMPTY = 89;
- public int JJTITEMTYPE = 90;
- public int JJTELEMENTTYPE = 91;
- public int JJTATTRIBUTETYPE = 92;
- public int JJTNODE = 93;
- public int JJTPROCESSINGINSTRUCTION = 94;
- public int JJTCOMMENT = 95;
- public int JJTTEXT = 96;
- public int JJTDOCUMENT = 97;
- public int JJTITEM = 98;
- public int JJTUNTYPED = 99;
- public int JJTATOMICVALUE = 100;
- public int JJTELEMORATTRTYPE = 101;
- public int JJTSCHEMATYPE = 102;
- public int JJTOFTYPE = 103;
- public int JJTATOMICTYPE = 104;
- public int JJTOCCURRENCEINDICATOR = 105;
- public int JJTMULTIPLY = 106;
+ public int JJTCASTABLEEXPR = 29;
+ public int JJTCASTABLE = 30;
+ public int JJTCOMPARISONEXPR = 31;
+ public int JJTRANGEEXPR = 32;
+ public int JJTADDITIVEEXPR = 33;
+ public int JJTMULTIPLICATIVEEXPR = 34;
+ public int JJTUNARYEXPR = 35;
+ public int JJTMINUS = 36;
+ public int JJTPLUS = 37;
+ public int JJTUNIONEXPR = 38;
+ public int JJTINTERSECTEXCEPTEXPR = 39;
+ public int JJTPATHEXPR = 40;
+ public int JJTSTEPEXPR = 41;
+ public int JJTVALIDATEEXPR = 42;
+ public int JJTVALIDATELBRACE = 43;
+ public int JJTVALIDATECONTEXT = 44;
+ public int JJTSLASH = 45;
+ public int JJTLBRACEEXPRENCLOSURE = 46;
+ public int JJTRBRACE = 47;
+ public int JJTCASTEXPR = 48;
+ public int JJTCASTAS = 49;
+ public int JJTTREATEXPR = 50;
+ public int JJTTREATAS = 51;
+ public int JJTAXISDESCENDANT = 52;
+ public int JJTAXISSELF = 53;
+ public int JJTAXISDESCENDANTORSELF = 54;
+ public int JJTAXISFOLLOWINGSIBLING = 55;
+ public int JJTAXISFOLLOWING = 56;
+ public int JJTAXISNAMESPACE = 57;
+ public int JJTAXISPARENT = 58;
+ public int JJTAXISANCESTOR = 59;
+ public int JJTAXISPRECEDINGSIBLING = 60;
+ public int JJTAXISPRECEDING = 61;
+ public int JJTAXISANCESTORORSELF = 62;
+ public int JJTNODETEST = 63;
+ public int JJTNAMETEST = 64;
+ public int JJTQNAME = 65;
+ public int JJTSTAR = 66;
+ public int JJTNCNAMECOLONSTAR = 67;
+ public int JJTSTARCOLONNCNAME = 68;
+ public int JJTPROCESSINGINSTRUCTIONTEST = 69;
+ public int JJTCOMMENTTEST = 70;
+ public int JJTTEXTTEST = 71;
+ public int JJTANYKINDTEST = 72;
+ public int JJTDOT = 73;
+ public int JJTDOTDOT = 74;
+ public int JJTPREDICATES = 75;
+ public int JJTINTEGERLITERAL = 76;
+ public int JJTDECIMALLITERAL = 77;
+ public int JJTDOUBLELITERAL = 78;
+ public int JJTFUNCTIONCALL = 79;
+ public int JJTSCHEMACONTEXT = 80;
+ public int JJTINCONTEXT = 81;
+ public int JJTSCHEMAGLOBALCONTEXT = 82;
+ public int JJTTYPEQNAME = 83;
+ public int JJTSCHEMACONTEXTSTEP = 84;
+ public int JJTSINGLETYPE = 85;
+ public int JJTQMARK = 86;
+ public int JJTSEQUENCETYPE = 87;
+ public int JJTEMPTY = 88;
+ public int JJTELEMENTTYPE = 89;
+ public int JJTATTRIBUTETYPE = 90;
+ public int JJTNODE = 91;
+ public int JJTPROCESSINGINSTRUCTION = 92;
+ public int JJTCOMMENT = 93;
+ public int JJTTEXT = 94;
+ public int JJTDOCUMENT = 95;
+ public int JJTITEM = 96;
+ public int JJTUNTYPED = 97;
+ public int JJTATOMICVALUE = 98;
+ public int JJTELEMORATTRTYPE = 99;
+ public int JJTSCHEMATYPE = 100;
+ public int JJTOFTYPE = 101;
+ public int JJTATOMICTYPE = 102;
+ public int JJTMULTIPLY = 103;
public String[] jjtNodeName = {
@@ -143,7 +140,6 @@
"Satisfies",
"IfExpr",
"InstanceofExpr",
- "Instanceof",
"CastableExpr",
"Castable",
"ComparisonExpr",
@@ -204,7 +200,6 @@
"QMark",
"SequenceType",
"Empty",
- "ItemType",
"ElementType",
"AttributeType",
"Node",
@@ -219,7 +214,6 @@
"SchemaType",
"OfType",
"AtomicType",
- "OccurrenceIndicator",
"Multiply",
};
}
1.1.2.3 +113 -38
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/SimpleNode.java
Index: SimpleNode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/SimpleNode.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- SimpleNode.java 24 Mar 2003 17:35:05 -0000 1.1.2.2
+++ SimpleNode.java 25 Mar 2003 23:46:08 -0000 1.1.2.3
@@ -12,9 +12,11 @@
import org.apache.xpath.impl.NameTestImpl;
import org.apache.xpath.impl.OperatorImpl;
import org.apache.xpath.impl.PathExprImpl;
+import org.apache.xpath.impl.SequenceTypeImpl;
import org.apache.xpath.impl.StepExprImpl;
import org.apache.xpath.impl.VariableImpl;
+
/**
* Representation of an XPath AST node.
*/
@@ -48,7 +50,8 @@
}
Node newNode;
- NodeFactory nodeFactory = (p.m_nodeFactory == null) ?
DEFAULT_NODE_FACTORY : p.m_nodeFactory;
+ NodeFactory nodeFactory = (p.m_nodeFactory == null)
+ ? DEFAULT_NODE_FACTORY : p.m_nodeFactory;
switch (id)
{
@@ -62,7 +65,7 @@
break;
- case XPathTreeConstants.JJTPROCESSINGINSTRUCTIONTEST:
+ case XPathTreeConstants.JJTPROCESSINGINSTRUCTIONTEST:
case XPathTreeConstants.JJTCOMMENTTEST:
case XPathTreeConstants.JJTTEXTTEST:
case XPathTreeConstants.JJTANYKINDTEST:
@@ -85,8 +88,6 @@
break;
-
-
case XPathTreeConstants.JJTINTEGERLITERAL:
case XPathTreeConstants.JJTDOUBLELITERAL:
case XPathTreeConstants.JJTSTRINGLITERAL:
@@ -151,9 +152,6 @@
break;
-
-
-
case XPathTreeConstants.JJTPATHEXPR:
newNode = nodeFactory.createPathNode(id);
@@ -164,8 +162,8 @@
break;
- case XPathTreeConstants.JJTEXPRSEQUENCE:
- case XPathTreeConstants.JJTUNARYEXPR:
+ case XPathTreeConstants.JJTEXPRSEQUENCE:
+ case XPathTreeConstants.JJTUNARYEXPR:
case XPathTreeConstants.JJTADDITIVEEXPR:
case XPathTreeConstants.JJTMULTIPLICATIVEEXPR:
case XPathTreeConstants.JJTUNIONEXPR:
@@ -202,6 +200,16 @@
break;
+ case XPathTreeConstants.JJTSEQUENCETYPE:
+ newNode = nodeFactory.createSequenceTypeNode(id);
+
+ if (newNode == null)
+ {
+ newNode = new SequenceTypeImpl(id);
+ }
+
+ break;
+
// The nodes belows are filtered: no customisation possible
case XPathTreeConstants.JJTQNAME:
case XPathTreeConstants.JJTQNAMELPAR:
@@ -264,6 +272,68 @@
// can use a singleton (but children need to be
reinitialized)
break;
+ case XPathTreeConstants.JJTEMPTY:
+ newNode = Singletons.EMPTY;
+
+ break;
+
+
+
+ case XPathTreeConstants.JJTELEMENTTYPE:
+ newNode = Singletons.ELEMENT;
+
+ break;
+
+ case XPathTreeConstants.JJTATTRIBUTETYPE: //92;
+ newNode = Singletons.ATTRIBUTE;
+
+ break;
+
+ case XPathTreeConstants.JJTATOMICTYPE: //104;
+ newNode = Singletons.ATOMIC;
+
+ break;
+
+ case XPathTreeConstants.JJTNODE: //93;
+ newNode = Singletons.NODE;
+
+ break;
+
+ case XPathTreeConstants.JJTPROCESSINGINSTRUCTION: //94;
+ newNode = Singletons.PI;
+
+ break;
+
+ case XPathTreeConstants.JJTCOMMENT: //95;
+ newNode = Singletons.COMMENT;
+
+ break;
+
+ case XPathTreeConstants.JJTTEXT: //96;
+ newNode = Singletons.TEXT;
+
+ break;
+
+ case XPathTreeConstants.JJTDOCUMENT: //97;
+ newNode = Singletons.DOCUMENT;
+
+ break;
+
+ case XPathTreeConstants.JJTITEM: //98;
+ newNode = Singletons.ITEM;
+
+ break;
+
+ case XPathTreeConstants.JJTMULTIPLY: //106;
+ newNode = Singletons.MULTIPLY;
+ break;
+
+ case XPathTreeConstants.JJTQMARK: //107;
+ newNode = Singletons.QMARK;
+ break;
+
+
+
case XPathTreeConstants.JJTROOT:
newNode = Singletons.ROOT;
@@ -355,7 +425,6 @@
case XPathTreeConstants.JJTEVERY:
case XPathTreeConstants.JJTIN:
case XPathTreeConstants.JJTSATISFIES:
- case XPathTreeConstants.JJTINSTANCEOF: //31;
case XPathTreeConstants.JJTINTERSECTEXCEPTEXPR: //37;
case XPathTreeConstants.JJTVALIDATEEXPR: //44;
case XPathTreeConstants.JJTRBRACE: //47;
@@ -364,27 +433,12 @@
case XPathTreeConstants.JJTSCHEMACONTEXT: //84;
case XPathTreeConstants.JJTSCHEMAGLOBALCONTEXT: //85;
case XPathTreeConstants.JJTSCHEMACONTEXTSTEP: //87;
- case XPathTreeConstants.JJTSEQUENCETYPE: //88;
- case XPathTreeConstants.JJTEMPTY: //89;
- case XPathTreeConstants.JJTITEMTYPE: //90;
- case XPathTreeConstants.JJTELEMENTTYPE: //91;
- case XPathTreeConstants.JJTATTRIBUTETYPE: //92;
- case XPathTreeConstants.JJTNODE: //93;
- case XPathTreeConstants.JJTPROCESSINGINSTRUCTION: //94;
- case XPathTreeConstants.JJTCOMMENT: //95;
- case XPathTreeConstants.JJTTEXT: //96;
- case XPathTreeConstants.JJTDOCUMENT: //97;
- case XPathTreeConstants.JJTITEM: //98;
- case XPathTreeConstants.JJTUNTYPED: //99;
+ case XPathTreeConstants.JJTUNTYPED: //99;
case XPathTreeConstants.JJTATOMICVALUE: //100;
case XPathTreeConstants.JJTELEMORATTRTYPE: //101;
case XPathTreeConstants.JJTSCHEMATYPE: //102;
case XPathTreeConstants.JJTOFTYPE: //103;
- case XPathTreeConstants.JJTATOMICTYPE: //104;
- case XPathTreeConstants.JJTOCCURRENCEINDICATOR: //105;
- case XPathTreeConstants.JJTMULTIPLY: //106;
- case XPathTreeConstants.JJTQMARK: //107;
-
+
default:
@@ -437,6 +491,8 @@
/**
* Insert child at the first position
+ *
+ * @param n DOCUMENT ME!
*/
public void jjtInsertChild(Node n)
{
@@ -456,6 +512,8 @@
/**
* Insert children of the given node at the first position
+ *
+ * @param sn DOCUMENT ME!
*/
public void jjtInsertNodeChildren(Node sn)
{
@@ -488,13 +546,27 @@
return (children == null) ? 0 : children.length;
}
- /** Accept the visitor. **/
+ /**
+ * Accept the visitor.
+ *
+ * @param visitor DOCUMENT ME!
+ * @param data DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
public Object jjtAccept(XPathVisitor visitor, Object data)
{
return visitor.visit(this, data);
}
- /** Accept the visitor. **/
+ /**
+ * Accept the visitor.
+ *
+ * @param visitor DOCUMENT ME!
+ * @param data DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
public Object childrenAccept(XPathVisitor visitor, Object data)
{
if (children != null)
@@ -518,6 +590,7 @@
/**
* Method processToken.
+ *
* @param token
*/
public void processToken(Token token)
@@ -525,8 +598,8 @@
}
/**
- *
- */
+ *
+ */
public boolean canBeReduced()
{
return false;
@@ -571,12 +644,14 @@
}
}
}
-
- /**
- * Gets the node as an string
- */
- public void getString(StringBuffer expr, boolean abbreviate)
- {
- }
+ /**
+ * Gets the node as an string
+ *
+ * @param expr DOCUMENT ME!
+ * @param abbreviate DOCUMENT ME!
+ */
+ public void getString(StringBuffer expr, boolean abbreviate)
+ {
+ }
}
1.1.2.2 +9 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/NodeFactory.java
Index: NodeFactory.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/NodeFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- NodeFactory.java 13 Mar 2003 20:28:16 -0000 1.1.2.1
+++ NodeFactory.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -61,6 +61,7 @@
import org.apache.xpath.impl.NameTestImpl;
import org.apache.xpath.impl.OperatorImpl;
import org.apache.xpath.impl.PathExprImpl;
+import org.apache.xpath.impl.SequenceTypeImpl;
import org.apache.xpath.impl.StepExprImpl;
import org.apache.xpath.impl.VariableImpl;
@@ -135,6 +136,14 @@
* @return a new VarName AST node or null.
*/
VariableImpl createVarNameNode(int id);
+
+
+ /**
+ * Creates SequenceType AST node
+ *
+ * @return a new SequenceType AST node or null.
+ */
+ SequenceTypeImpl createSequenceTypeNode(int id);
/**
* Creates a generic AST node for the given tree node ID.
1.1.2.2 +9 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/DefaultNodeFactory.java
Index: DefaultNodeFactory.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/DefaultNodeFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- DefaultNodeFactory.java 13 Mar 2003 20:28:16 -0000 1.1.2.1
+++ DefaultNodeFactory.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -61,6 +61,7 @@
import org.apache.xpath.impl.NameTestImpl;
import org.apache.xpath.impl.OperatorImpl;
import org.apache.xpath.impl.PathExprImpl;
+import org.apache.xpath.impl.SequenceTypeImpl;
import org.apache.xpath.impl.StepExprImpl;
import org.apache.xpath.impl.VariableImpl;
@@ -132,6 +133,14 @@
*/
public VariableImpl createVarNameNode(int id) {
return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.impl.parser.NodeFactory#createSequenceTypeNode(int)
+ */
+ public SequenceTypeImpl createSequenceTypeNode(int id) {
+ return null;
+
}
}
1.1.2.2 +71 -9
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/Singletons.java
Index: Singletons.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/Singletons.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Singletons.java 13 Mar 2003 20:28:16 -0000 1.1.2.1
+++ Singletons.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -77,8 +77,8 @@
protected static final Singletons SLASH = new
Singletons(XPathTreeConstants.JJTSLASH);
/**
- * At singleton
- */
+ * At singleton
+ */
protected static final Singletons AT = new
Singletons(XPathTreeConstants.JJTAT);
/**
@@ -102,7 +102,7 @@
protected static final Singletons MINUS = new
Singletons(XPathTreeConstants.JJTMINUS);
/**
- * Plus singleton
+ * Plus singleton (arithmetic and occurrence indicator)
*/
protected static final Singletons PLUS = new
Singletons(XPathTreeConstants.JJTPLUS);
@@ -115,11 +115,72 @@
* Dot singleton
*/
protected static final Singletons DOT = new
Singletons(XPathTreeConstants.JJTDOT);
+
+ /**
+ * Empty singleton (appear in sequencetype)
+ */
+ protected static final Singletons EMPTY = new
Singletons(XPathTreeConstants.JJTEMPTY);
+
+
+ /**
+ * Element type singleton (appear in sequencetype)
+ */
+ protected static final Singletons ELEMENT = new
Singletons(XPathTreeConstants.JJTELEMENTTYPE);
+
+ /**
+ * Attribute type singleton (appear in sequencetype)
+ */
+ protected static final Singletons ATTRIBUTE = new
Singletons(XPathTreeConstants.JJTATTRIBUTETYPE);
+
+ /**
+ * Atomic type singleton (appear in sequencetype)
+ */
+ protected static final Singletons ATOMIC = new
Singletons(XPathTreeConstants.JJTATOMICTYPE);
+
+ /**
+ * Node type singleton (appear in sequencetype)
+ */
+ protected static final Singletons NODE = new
Singletons(XPathTreeConstants.JJTNODE);
+
+ /**
+ * PI type singleton (appear in sequencetype)
+ */
+ protected static final Singletons PI = new
Singletons(XPathTreeConstants.JJTPROCESSINGINSTRUCTION);
+
+ /**
+ * Comment type singleton (appear in sequencetype)
+ */
+ protected static final Singletons COMMENT = new
Singletons(XPathTreeConstants.JJTCOMMENT);
+
+ /**
+ * Text type singleton (appear in sequencetype)
+ */
+ protected static final Singletons TEXT = new
Singletons(XPathTreeConstants.JJTTEXT);
+
+ /**
+ * Document type singleton (appear in sequencetype)
+ */
+ protected static final Singletons DOCUMENT = new
Singletons(XPathTreeConstants.JJTDOCUMENT);
+
+ /**
+ * Item type singleton (appear in sequencetype)
+ */
+ protected static final Singletons ITEM = new
Singletons(XPathTreeConstants.JJTITEM);
/**
- * Dot kind test singleton
- */
- static final public KindTestImpl DOT_KIND_TEST ;
+ * Multiply occurrence indicator singleton (appear in
sequencetype)
+ */
+ protected static final Singletons MULTIPLY = new
Singletons(XPathTreeConstants.JJTMULTIPLY);
+
+ /**
+ * Question mark occurrence indicator singleton (appear in sequencetype)
+ */
+ protected static final Singletons QMARK = new
Singletons(XPathTreeConstants.JJTQMARK);
+
+ /**
+ * Dot kind test singleton
+ */
+ static final public KindTestImpl DOT_KIND_TEST;
static
{
@@ -128,15 +189,15 @@
SLASHSLASH = new StepExprImpl(StepExpr.AXIS_DESCENDANT_OR_SELF, kt);
- DOT_KIND_TEST = new KindTestImpl();
+ DOT_KIND_TEST = new KindTestImpl();
// well use any kind test for dot, but it's more than
that..
- DOT_KIND_TEST.setKindTest(NodeTest.ANY_KIND_TEST);
-
+ DOT_KIND_TEST.setKindTest(NodeTest.ANY_KIND_TEST);
}
/**
* Constructor for Singletons.
+ *
* @param i
*/
private Singletons(int i)
@@ -146,6 +207,7 @@
/**
* Constructor for Singletons.
+ *
* @param p
* @param i
*/
No revision
No revision
1.1.2.2 +4 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/InstanceOfExpr.java
Index: InstanceOfExpr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/InstanceOfExpr.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- InstanceOfExpr.java 13 Mar 2003 20:28:17 -0000 1.1.2.1
+++ InstanceOfExpr.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -65,12 +65,14 @@
public interface InstanceOfExpr extends Expr {
/**
- *
+ * Gets the sequence type against which the expression is tested on.
+ * @return The sequence type of the 'instance of' expression
*/
SequenceType getSequenceType();
/**
- *
+ * Gets the tested expression
+ * @return The tested expression of the 'instance of' expression
*/
Expr getTestedExpr();
1.1.2.2 +5 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitor.java
Index: Visitor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitor.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Visitor.java 13 Mar 2003 20:28:17 -0000 1.1.2.1
+++ Visitor.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -101,5 +101,10 @@
* @param
*/
boolean visitForOrQuantifiedExpr(ForAndQuantifiedExpr expr);
+
+ /**
+ * Visit instance of expression
+ */
+ boolean visitInstanceOf(InstanceOfExpr expr);
}
1.1.2.2 +2 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/CastableExpr.java
Index: CastableExpr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/CastableExpr.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CastableExpr.java 13 Mar 2003 20:28:17 -0000 1.1.2.1
+++ CastableExpr.java 25 Mar 2003 23:46:08 -0000 1.1.2.2
@@ -55,7 +55,7 @@
*/
package org.apache.xpath.expression;
-import org.apache.xpath.datamodel.SingleType;
+import org.apache.xpath.datamodel.ItemType;
/**
* Represent "castable as" expression.
@@ -67,7 +67,7 @@
/**
*
*/
- SingleType getSingleType();
+ ItemType getSingleType();
/**
*
No revision
No revision
1.1.2.2 +44 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/datamodel/Attic/SequenceType.java
Index: SequenceType.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/datamodel/Attic/SequenceType.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- SequenceType.java 13 Mar 2003 20:28:15 -0000 1.1.2.1
+++ SequenceType.java 25 Mar 2003 23:46:09 -0000 1.1.2.2
@@ -57,8 +57,51 @@
/**
* Marker interface defining a Sequence in the XPath Data Model
- * (as opposed to a SingleType).
+ * (as opposed to a ItemType).
*/
public interface SequenceType {
+ /**
+ * Denote the empty sequence type
+ */
+ final short EMPTY_SEQ = -1;
+
+ /**
+ * Item type constants
+ */
+ final short ELEMENT_ITEM_TYPE = 0;
+ final short ATTRIBUTE_ITEM_TYPE = 1;
+ final short NODE_ITEM_TYPE = 2;
+ final short PI_ITEM_TYPE = 3;
+ final short COMMENT_ITEM_TYPE = 4;
+ final short TEXT_ITEM_TYPE = 5;
+ final short DOCUMENT_ITEM_TYPE = 6;
+ final short ITEM_ITEM_TYPE = 7;
+ final short ATOMIC_ITEM_TYPE = 8;
+
+ /**
+ * Occurrence indicator constants
+ */
+ final short ZERO_OR_MORE = 0;
+ final short ONE_OR_MORE = 1;
+ final short ZERO_OR_ONE = 2;
+ final short ONE = 3;
+
+ /**
+ * Gets the type of xpath values in the sequence
+ * @return short One of the item type constants or EMPTY_TYPE.
+ */
+ short getItemType();
+
+ /**
+ * Gets the occurrence indicator of the item type
+ * @return short One of the occurrence indicator constants or -1 in
case of empty sequence type
+ */
+ short getOccurrenceIndicator();
+
+ /**
+ * Gets the type corresponding of either element or attribute or atomic
item type.
+ * @return String
+ */
+ String getType();
}
No revision
No revision
1.1.2.1 +65 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/datamodel/Attic/ItemType.java
No revision
No revision
1.1.2.2 +2 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastableExprImpl.java
Index: CastableExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastableExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CastableExprImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ CastableExprImpl.java 25 Mar 2003 23:46:09 -0000 1.1.2.2
@@ -55,7 +55,7 @@
*/
package org.apache.xpath.impl;
-import org.apache.xpath.datamodel.SingleType;
+import org.apache.xpath.datamodel.ItemType;
import org.apache.xpath.expression.CastableExpr;
import org.apache.xpath.expression.Expr;
import org.apache.xpath.impl.parser.Node;
@@ -116,7 +116,7 @@
/**
* @see org.apache.xpath.expression.CastableExpr#getSingleType()
*/
- public SingleType getSingleType() {
+ public ItemType getSingleType() {
return null;
}
1.1.2.2 +29 -17
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/InstanceOfExprImpl.java
Index: InstanceOfExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/InstanceOfExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- InstanceOfExprImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ InstanceOfExprImpl.java 25 Mar 2003 23:46:09 -0000 1.1.2.2
@@ -64,7 +64,7 @@
import org.apache.xpath.impl.parser.XPath;
/**
- *
+ * Default implementation of instanceof expression.
*/
public class InstanceOfExprImpl extends ExprImpl implements InstanceOfExpr {
@@ -74,6 +74,8 @@
*/
public InstanceOfExprImpl(int i) {
super(i);
+
+ children = new Node[2];
}
/**
@@ -83,20 +85,33 @@
*/
public InstanceOfExprImpl(XPath p, int i) {
super(p, i);
+
+ children = new Node[2];
+ }
+
+ /**
+ * Constructor for cloning
+ */
+ private InstanceOfExprImpl(InstanceOfExprImpl expr) {
+ super(expr.id);
+
+ children = new Node[2];
+ children[0] = (Node) expr.getTestedExpr().cloneExpression();
+ children[1] = (Node) expr.getSequenceType();
}
/**
* @see org.apache.xpath.expression.InstanceOfExpr#getSequenceType()
*/
public SequenceType getSequenceType() {
- return null;
+ return (SequenceType) children[1];
}
/**
* @see org.apache.xpath.expression.InstanceOfExpr#getTestedExpr()
*/
public Expr getTestedExpr() {
- return null;
+ return (Expr) children[0];
}
/**
@@ -110,20 +125,14 @@
* @see org.apache.xpath.expression.Expr#cloneExpression()
*/
public Expr cloneExpression() {
- return null;
- }
-
- /**
- * @see org.apache.xpath.expression.Expr#getString(boolean)
- */
- public String getString(boolean abbreviate) {
- return null;
+ return new InstanceOfExprImpl(this);
}
/**
* @see org.apache.xpath.expression.Visitable#visited(Visitor)
*/
public void visited(Visitor visitor) {
+ visitor.visitInstanceOf(this);
}
/**
@@ -137,11 +146,14 @@
}
}
- /**
- * @see org.apache.xpath.impl.parser.SimpleNode#canBeReduced()
- */
- public boolean canBeReduced() {
- return children.length == 1; // means that there is no SequenceType
(pos=1)
- }
+
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer,
boolean)
+ */
+ public void getString(StringBuffer expr, boolean abbreviate) {
+ ((ExprImpl) getTestedExpr()).getString(expr, abbreviate);
+ expr.append(" instance of ");
+ ((SimpleNode) getSequenceType()).getString(expr, abbreviate);
+ }
}
1.1.2.3 +1 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ConditionalExprImpl.java
Index: ConditionalExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ConditionalExprImpl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- ConditionalExprImpl.java 24 Mar 2003 17:35:06 -0000 1.1.2.2
+++ ConditionalExprImpl.java 25 Mar 2003 23:46:09 -0000 1.1.2.3
@@ -171,7 +171,7 @@
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
public void visit(Visitor visitor)
- {
+ {
visitor.visitConditional(this);
}
No revision
No revision
1.1.2.1 +294 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/SequenceTypeImpl.java
No revision
No revision
1.1.2.3 +19 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.java
Index: TestSamples.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- TestSamples.java 24 Mar 2003 17:35:06 -0000 1.1.2.2
+++ TestSamples.java 25 Mar 2003 23:46:10 -0000 1.1.2.3
@@ -61,6 +61,7 @@
import org.apache.xpath.expression.ExprContext;
import org.apache.xpath.expression.ExpressionFactory;
import org.apache.xpath.expression.ForAndQuantifiedExpr;
+import org.apache.xpath.expression.InstanceOfExpr;
import org.apache.xpath.expression.Literal;
import org.apache.xpath.expression.NodeTest;
import org.apache.xpath.expression.OperatorExpr;
@@ -216,6 +217,11 @@
{
return false;
}
+
+ public boolean
visitInstanceOf(InstanceOfExpr expr)
+
{
+
return false;
+
}
});
// Simple Evaluation check
@@ -320,6 +326,19 @@
System.err.print(
"Bad external or internal representation: ");
System.err.println(ab + " != " + xpathString);
+
+ tree.dump("|");
+
+
// Produce the raw tree
+
System.err.println("Raw tree is");
+
+
SimpleNode.PRODUCE_RAW_TREE = true;
+
+
parser = new XPath(new StringReader(xpathString));
+
tree = parser.XPath2();
+
tree.dump("|");
+
+
SimpleNode.PRODUCE_RAW_TREE = false;
testOK = false;
}
}
1.1.2.3 +51 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.xml
Index: TestSamples.xml
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.xml,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- TestSamples.xml 24 Mar 2003 17:35:06 -0000 1.1.2.2
+++ TestSamples.xml 25 Mar 2003 23:46:10 -0000 1.1.2.3
@@ -822,6 +822,57 @@
</ast>
</expr>
+ <!-- Instanceof expr -->
+
+ <expr value="$var instance of empty">
+ <ast>
+ <node name="ExprSequence">
+ <node name="InstanceofExpr">
+ <node name="VarName"/>
+ <node name="SequenceType"/>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <expr value="$var instance of processing-instruction">
+ <ast>
+ <node name="ExprSequence">
+ <node name="InstanceofExpr">
+ <node name="VarName"/>
+ <node name="SequenceType"/>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <expr value="$var instance of node+">
+ <ast>
+ <node name="ExprSequence">
+ <node name="InstanceofExpr">
+ <node name="VarName"/>
+ <node name="SequenceType"/>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <expr value="5 instance of xs:integer">
+ <ast>
+ <node name="ExprSequence">
+ <node name="InstanceofExpr">
+ <node name="IntegerLiteral"/>
+ <node name="SequenceType"/>
+ </node>
+ </node>
+ </ast>
+ </expr>
+
+ <!-- Cast expr -->
+
+
+
+ <!-- Castable expr -->
<!-- For expr -->
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
