Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21081/src/org/exist/xquery/parser Modified Files: XQueryParserTokenTypes.txt XQueryParserTokenTypes.java XQueryParser.java XQueryTreeParser.java XQueryLexer.java XQuery.g Log Message: * Added support for XQuery pragmas to set serialization and watchdog settings. * org.exist.storage.serializers.Serializer now passes all output to an instance of the Receiver interface instead of a SAX ContentHandler. Receiver resembles SAX, but has methods that are closer to eXist's internal storage. For example, it directly accepts a QName in startElement to avoid unnecessary string allocations. * Fixed various performance leaks in cross-document joins. Index: XQueryTreeParser.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryTreeParser.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** XQueryTreeParser.java 10 Aug 2004 20:27:17 -0000 1.19 --- XQueryTreeParser.java 12 Sep 2004 09:25:18 -0000 1.20 *************** *** 5001,5005 **** _t = _t.getNextSibling(); ! step= new LiteralValue(context, new StringValue(c.getText())); step.setASTNode(c); --- 5001,5007 ---- _t = _t.getNextSibling(); ! StringValue val = new StringValue(c.getText()); ! val.expand(); ! step= new LiteralValue(context, val); step.setASTNode(c); *************** *** 5402,5405 **** --- 5404,5410 ---- "WS", "EXPR_COMMENT", + "PRAGMA", + "PRAGMA_CONTENT", + "PRAGMA_QNAME", "PREDEFINED_ENTITY_REF", "CHAR_REF", Index: XQueryParser.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryParser.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** XQueryParser.java 10 Aug 2004 20:27:16 -0000 1.19 --- XQueryParser.java 12 Sep 2004 09:25:17 -0000 1.20 *************** *** 7036,7039 **** --- 7036,7042 ---- "WS", "EXPR_COMMENT", + "PRAGMA", + "PRAGMA_CONTENT", + "PRAGMA_QNAME", "PREDEFINED_ENTITY_REF", "CHAR_REF", *************** *** 7115,7119 **** data[0]=-16L; data[1]=-18014400656965633L; ! data[2]=70368744177663L; return data; } --- 7118,7122 ---- data[0]=-16L; data[1]=-18014400656965633L; ! data[2]=562949953421311L; return data; } Index: XQueryLexer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryLexer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** XQueryLexer.java 10 Aug 2004 20:27:16 -0000 1.13 --- XQueryLexer.java 12 Sep 2004 09:25:18 -0000 1.14 *************** *** 59,62 **** --- 59,69 ---- protected boolean inAttributeContent= false; protected boolean inComment= false; + + protected XQueryContext context; + + public XQueryLexer(XQueryContext context, Reader in) { + this(in); + this.context = context; + } [...1416 lines suppressed...] --- 5005,5010 ---- return data; } ! public static final BitSet _tokenSet_21 = new BitSet(mk_tokenSet_21()); ! private static final long[] mk_tokenSet_22() { long[] data = new long[2756]; data[1]=576460745995190270L; *************** *** 4880,4884 **** return data; } ! public static final BitSet _tokenSet_20 = new BitSet(mk_tokenSet_20()); } --- 5080,5084 ---- return data; } ! public static final BitSet _tokenSet_22 = new BitSet(mk_tokenSet_22()); } Index: XQuery.g =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQuery.g,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** XQuery.g 18 Aug 2004 20:08:57 -0000 1.24 --- XQuery.g 12 Sep 2004 09:25:18 -0000 1.25 *************** *** 2598,2602 **** options { ! k = 3; testLiterals = false; charVocabulary = '\u0003'..'\uffff'; --- 2598,2602 ---- options { ! k = 4; testLiterals = false; charVocabulary = '\u0003'..'\uffff'; *************** *** 2615,2618 **** --- 2615,2625 ---- protected boolean inAttributeContent= false; protected boolean inComment= false; + + protected XQueryContext context; + + public XQueryLexer(XQueryContext context, Reader in) { + this(in); + this.context = context; + } } *************** *** 2709,2712 **** --- 2716,2747 ---- ; + protected PRAGMA + options { + testLiterals=false; + } + { String content = null; }: + "(::" "pragma" + WS qn:PRAGMA_QNAME WS + ( c:PRAGMA_CONTENT { content = c.getText(); } )? ':' ':' ')' + { + try { + context.addPragma(qn.getText(), content); + } catch(XPathException e) { + throw new RecognitionException(e.getMessage()); + } + } + ; + + protected PRAGMA_CONTENT + : + ( ~( ' ' | '\t' | '\n' | '\r' ) ) + ( CHAR | (':' ~( ':' )) => ':' | (':' ':' ~(')') ) => ':' ':' )+ + ; + + protected PRAGMA_QNAME + : + NCNAME ( ':' NCNAME )? + ; + protected INTEGER_LITERAL : { !(inElementContent || inAttributeContent) }? DIGITS ; *************** *** 2850,2853 **** --- 2885,2891 ---- } | + ( "(::" ) => PRAGMA + { $setType(Token.SKIP); } + | EXPR_COMMENT { $setType(Token.SKIP); } Index: XQueryParserTokenTypes.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryParserTokenTypes.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** XQueryParserTokenTypes.java 10 Aug 2004 20:27:17 -0000 1.10 --- XQueryParserTokenTypes.java 12 Sep 2004 09:25:17 -0000 1.11 *************** *** 188,199 **** int WS = 163; int EXPR_COMMENT = 164; ! int PREDEFINED_ENTITY_REF = 165; ! int CHAR_REF = 166; ! int NEXT_TOKEN = 167; ! int CHAR = 168; ! int BASECHAR = 169; ! int IDEOGRAPHIC = 170; ! int COMBINING_CHAR = 171; ! int DIGIT = 172; ! int EXTENDER = 173; } --- 188,202 ---- int WS = 163; int EXPR_COMMENT = 164; ! int PRAGMA = 165; ! int PRAGMA_CONTENT = 166; ! int PRAGMA_QNAME = 167; ! int PREDEFINED_ENTITY_REF = 168; ! int CHAR_REF = 169; ! int NEXT_TOKEN = 170; ! int CHAR = 171; ! int BASECHAR = 172; ! int IDEOGRAPHIC = 173; ! int COMBINING_CHAR = 174; ! int DIGIT = 175; ! int EXTENDER = 176; } Index: XQueryParserTokenTypes.txt =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryParserTokenTypes.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** XQueryParserTokenTypes.txt 10 Aug 2004 20:27:16 -0000 1.12 --- XQueryParserTokenTypes.txt 12 Sep 2004 09:25:17 -0000 1.13 *************** *** 162,172 **** WS=163 EXPR_COMMENT=164 ! PREDEFINED_ENTITY_REF=165 ! CHAR_REF=166 ! NEXT_TOKEN=167 ! CHAR=168 ! BASECHAR=169 ! IDEOGRAPHIC=170 ! COMBINING_CHAR=171 ! DIGIT=172 ! EXTENDER=173 --- 162,175 ---- WS=163 EXPR_COMMENT=164 ! PRAGMA=165 ! PRAGMA_CONTENT=166 ! PRAGMA_QNAME=167 ! PREDEFINED_ENTITY_REF=168 ! CHAR_REF=169 ! NEXT_TOKEN=170 ! CHAR=171 ! BASECHAR=172 ! IDEOGRAPHIC=173 ! COMBINING_CHAR=174 ! DIGIT=175 ! EXTENDER=176 |