Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 283214 | Differences between
and this patch

Collapse All | Expand All

(-)grammars/xpath.cup (-9 / +62 lines)
Lines 13-19 Link Here
13
13
14
package org.eclipse.wst.xml.xpath2.processor.internal;
14
package org.eclipse.wst.xml.xpath2.processor.internal;
15
15
16
import java.math.BigDecimal;
17
import java.math.BigInteger;
16
import java.util.*;
18
import java.util.*;
19
import org.eclipse.wst.xml.xpath2.processor.ast.XPath;
17
import org.eclipse.wst.xml.xpath2.processor.internal.ast.*;
20
import org.eclipse.wst.xml.xpath2.processor.internal.ast.*;
18
import org.eclipse.wst.xml.xpath2.processor.internal.types.*;
21
import org.eclipse.wst.xml.xpath2.processor.internal.types.*;
19
22
Lines 56-61 Link Here
56
terminal String AND, OR;
59
terminal String AND, OR;
57
terminal EMPTY, ITEM, NODE, DOCUMENT_NODE, TEXT, COMMENT;
60
terminal EMPTY, ITEM, NODE, DOCUMENT_NODE, TEXT, COMMENT;
58
terminal PROCESSING_INSTRUCTION, SCHEMA_ATTRIBUTE, ELEMENT, SCHEMA_ELEMENT;
61
terminal PROCESSING_INSTRUCTION, SCHEMA_ATTRIBUTE, ELEMENT, SCHEMA_ELEMENT;
62
// Unused in XPath 2, but reserved for compatibility with XQuery
63
terminal TYPESWITCH;
59
64
60
terminal BigInteger INTEGER;
65
terminal BigInteger INTEGER;
61
terminal Double DOUBLE;
66
terminal Double DOUBLE;
Lines 63-69 Link Here
63
terminal String STRING, NCNAME;
68
terminal String STRING, NCNAME;
64
69
65
70
66
non terminal String Prefix, LocalPart, NCName;
71
non terminal String Prefix, LocalPart, NCName, UnqualifiedNCName, UnqualifiedLocalPart;
67
non terminal StringLiteral StringLiteral;
72
non terminal StringLiteral StringLiteral;
68
non terminal QName ElementDeclaration, ElementNameOrWildcard, TypeName, ElementName;
73
non terminal QName ElementDeclaration, ElementNameOrWildcard, TypeName, ElementName;
69
non terminal QName AttributeDeclaration, AttribNameOrWildcard, AttributeName;
74
non terminal QName AttributeDeclaration, AttribNameOrWildcard, AttributeName;
Lines 630-639 Link Here
630
635
631
TypeName              ::= QName:n {: RESULT = n; :};
636
TypeName              ::= QName:n {: RESULT = n; :};
632
637
633
IntegerLiteral        ::= INTEGER:i {: RESULT = new IntegerLiteral(i.intValue()); :};
638
IntegerLiteral        ::= INTEGER:i {: RESULT = new IntegerLiteral(i); :};
634
   
639
   
635
DecimalLiteral        ::= DECIMAL:d 
640
DecimalLiteral        ::= DECIMAL:d 
636
			    {: RESULT = new DecimalLiteral(d.doubleValue()); :}
641
			    {: RESULT = new DecimalLiteral(d); :}
637
			;    
642
			;    
638
643
639
DoubleLiteral         ::= DOUBLE:d
644
DoubleLiteral         ::= DOUBLE:d
Lines 644-661 Link Here
644
649
645
VarName               ::= QName:n {: RESULT = n; :};
650
VarName               ::= QName:n {: RESULT = n; :};
646
651
647
QName                 ::= LocalPart:l {: RESULT = new QName(l); :}
652
QName                 ::= UnqualifiedLocalPart:l {: RESULT = new QName(l); :}
648
                        | Prefix:p COLON LocalPart:l {: RESULT = new QName(p,l); :}
653
                        | Prefix:p COLON LocalPart:l {: RESULT = new QName(p,l); :}
649
654
						;
650
			// XXX hack to get empty working for now...
651
			// for fn:empty at least
652
			| Prefix:p COLON EMPTY {: RESULT = new QName(p, "empty"); :}
653
			;
654
655
655
Prefix                ::= NCName:n {: RESULT = n; :};
656
Prefix                ::= NCName:n {: RESULT = n; :};
656
657
657
LocalPart             ::= NCName:n {: RESULT = n; :};
658
LocalPart             ::= NCName:n {: RESULT = n; :};
658
659
660
UnqualifiedLocalPart  ::= UnqualifiedNCName:n {: RESULT = n; :};
661
659
NCName                ::= NCNAME:n {: RESULT = n; :} |
662
NCName                ::= NCNAME:n {: RESULT = n; :} |
660
						  TO:n	   {: RESULT = new String("to"); :} |
663
						  TO:n	   {: RESULT = new String("to"); :} |
661
						  CHILD:n  {: RESULT = new String("child"); :} |
664
						  CHILD:n  {: RESULT = new String("child"); :} |
Lines 693-697 Link Here
693
						  OR:n {: RESULT = new String("or"); :} |
696
						  OR:n {: RESULT = new String("or"); :} |
694
						  DIV:n {: RESULT = new String("div"); :} |
697
						  DIV:n {: RESULT = new String("div"); :} |
695
						  IDIV:n {: RESULT = new String("idiv"); :} |
698
						  IDIV:n {: RESULT = new String("idiv"); :} |
699
						  COMMENT:n {: RESULT = new String("comment"); :} |
700
						  DOCUMENT_NODE:n {: RESULT = new String("document-node"); :} |
701
						  ELEMENT:n {: RESULT = new String("element"); :} |
702
						  EMPTY:n {: RESULT = new String("empty"); :} |
703
						  ITEM:n {: RESULT = new String("item"); :} |
704
						  NODE:n {: RESULT = new String("node"); :} |
705
						  PROCESSING_INSTRUCTION:n {: RESULT = new String("processing-instruction"); :} |
706
						  SCHEMA_ATTRIBUTE:n {: RESULT = new String("schema-attribute"); :} |
707
						  SCHEMA_ELEMENT:n {: RESULT = new String("schema-element"); :} |
708
						  TEXT:n {: RESULT = new String("text"); :} |
709
						  TYPESWITCH:n {: RESULT = new String("typeswitch"); :} |
710
						  MOD:n {: RESULT = new String("mod"); :}
711
			; 
712
713
UnqualifiedNCName     ::= NCNAME:n {: RESULT = n; :} |
714
						  TO:n	   {: RESULT = new String("to"); :} |
715
						  CHILD:n  {: RESULT = new String("child"); :} |
716
						  DESCENDANT:n {: RESULT = new String("descendant"); :} |
717
						  SELF:n {: RESULT = new String("self"); :} |
718
						  DESCENDANT_OR_SELF:n {: RESULT = new String("descendant-of-self"); :} |
719
						  FOLLOWING_SIBLING:n {: RESULT = new String("following-sibling"); :} |
720
						  FOLLOWING:n {: RESULT = new String("following"); :} |
721
						  NAMESPACE:n {: RESULT = new String("namespace"); :} |
722
						  PARENT:n {: RESULT = new String("parent"); :} |
723
						  ANCESTOR:n {: RESULT = new String("ancestor"); :} |
724
						  PRECEDING_SIBLING:n {: RESULT  = new String("preceding-sibling"); :} |
725
						  PRECEDING:n {: RESULT = new String("preceding"); :} |
726
						  ANCESTOR_OR_SELF:n {: RESULT = new String("ancestor-or-self"); :} |
727
						  UNION:n {: RESULT = new String("union"); :} |
728
						  INTERSECT:n {: RESULT = new String("intersect"); :} |
729
						  EXCEPT:n {: RESULT = new String("except"); :} |
730
						  INSTANCE:n {: RESULT = new String("instance"); :} |
731
						  OF:n {: RESULT = new String("of"); :} |
732
						  TREAT:n {: RESULT = new String("as"); :} |
733
						  CASTABLE:n {: RESULT = new String("castable"); :} |
734
						  CAST:n {: RESULT = new String("cast"); :} |
735
						  IS:n {: RESULT = new String("is"); :} |
736
						  FOR:n {: RESULT = new String("for"); :} |
737
						  IN:n {: RESULT = new String("in"); :} |
738
						  RETURN:n {: RESULT = new String("return"); :} |
739
						  SATISFIES:n {: RESULT = new String("satisfies"); :} |
740
						  SOME:n {: RESULT = new String("some"); :} |
741
						  EVERY:n {: RESULT = new String("every"); :} |
742
						  THEN:n {: RESULT = new String("then"); :} |
743
						  ELSE:n {: RESULT = new String("else"); :} |
744
						  AND:n {: RESULT = new String("and"); :} |
745
						  OR:n {: RESULT = new String("or"); :} |
746
						  DIV:n {: RESULT = new String("div"); :} |
747
						  IDIV:n {: RESULT = new String("idiv"); :} |
696
						  MOD:n {: RESULT = new String("mod"); :}
748
						  MOD:n {: RESULT = new String("mod"); :}
697
			; 
749
			; 
750
			
(-)grammars/xpath.lex (-1 / +1 lines)
Lines 152-158 Link Here
152
"schema\-attribute"		{ return symbol(XpathSym.SCHEMA_ATTRIBUTE); }
152
"schema\-attribute"		{ return symbol(XpathSym.SCHEMA_ATTRIBUTE); }
153
"element"			{ return symbol(XpathSym.ELEMENT); }
153
"element"			{ return symbol(XpathSym.ELEMENT); }
154
"schema\-element"		{ return symbol(XpathSym.SCHEMA_ELEMENT); }
154
"schema\-element"		{ return symbol(XpathSym.SCHEMA_ELEMENT); }
155
155
"typeswitch"        { return symbol(XpathSym.TYPESWITCH); }
156
156
157
{StringLiteral}		{
157
{StringLiteral}		{
158
				// get rid of quotes
158
				// get rid of quotes
(-)build.xml (-3 / +12 lines)
Lines 1-16 Link Here
1
<project name="proj1" default="generate_parser" basedir=".">
1
<project name="proj1" default="generate_parser" basedir=".">
2
    <property name="src" location="${basedir}"/>   
2
    <property name="src" location="${basedir}"/>   
3
    <property name="cupJar" location="/home/dcarver/eclipse3.5/xsltworkspace/org.eclipse.wst.xml.xpath2.processor/lib/javacup10.jar"/>
3
    <property name="cupJar" location="${basedir}/lib/javacup10.jar"/>
4
    <description>
4
    <description>
5
    Build File for Compiler Project
5
    Build File for Compiler Project
6
</description>
6
</description>
7
7
8
	<taskdef classname="JFlex.anttask.JFlexTask" name="jflex" />
8
	<taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="${basedir}/lib/JFlex.jar" />
9
9
10
	<target name="generate_parser">
10
	<target name="generate_parser">
11
		<jflex file="grammars/xpath.lex" destdir="grammars/generated"/>
11
		<jflex file="grammars/xpath.lex" destdir="grammars/generated"/>
12
	    <java jar="${cupJar}" input="grammars/xpath.cup" fork="true" failonerror="true">
12
	    <java jar="${cupJar}" input="grammars/xpath.cup" output="${basedir}/state-dump.txt" fork="true" failonerror="true">
13
	    	<arg value="-parser"/>
14
	    	<arg value="XPathCup"/>
15
	    	<arg value="-symbols"/>
16
	    	<arg value="XpathSym"/>
17
	    	<arg value="-package"/>
18
	    	<arg value="org.eclipse.wst.xml.xpath2.processor.internal"/>
19
	    	<arg value="-dump_states"/>    	
13
	    </java>
20
	    </java>
21
		<copyfile dest="${basedir}/src/org/eclipse/wst/xml/xpath2/processor/internal/XPathCup.java" src="XPathCup.java"/>
22
		<copyfile dest="${basedir}/src/org/eclipse/wst/xml/xpath2/processor/internal/XpathSym.java" src="XpathSym.java"/>
14
	</target>
23
	</target>
15
24
16
</project>
25
</project>

Return to bug 283214