pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / queryparser / build.xml
1 <?xml version="1.0"?>
2
3 <!--
4     Licensed to the Apache Software Foundation (ASF) under one or more
5     contributor license agreements.  See the NOTICE file distributed with
6     this work for additional information regarding copyright ownership.
7     The ASF licenses this file to You under the Apache License, Version 2.0
8     the "License"); you may not use this file except in compliance with
9     the License.  You may obtain a copy of the License at
10  
11         http://www.apache.org/licenses/LICENSE-2.0
12  
13     Unless required by applicable law or agreed to in writing, software
14     distributed under the License is distributed on an "AS IS" BASIS,
15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16     See the License for the specific language governing permissions and
17     limitations under the License.
18  -->
19
20 <project name="queryparser" default="default">
21
22   <description>
23     Flexible Query Parser
24   </description>
25
26   <import file="../contrib-build.xml"/>
27  
28   <target name="compile-core" depends="javacc-notice, common.compile-core"/>
29
30   <!--
31     NOTE: see the README.javacc for details on how to fully regenerate the parser
32   -->
33   <target name="javacc" depends="javacc-flexible,javacc-surround"/>
34
35   <target name="javacc-flexible" depends="javacc-check">
36     <delete>
37       <fileset dir="src/java/org/apache/lucene/queryParser/standard/parser" includes="*.java">
38         <containsregexp expression="Generated.*By.*JavaCC"/>
39       </fileset>
40     </delete>
41     <invoke-javacc target="src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj"
42                    outputDir="src/java/org/apache/lucene/queryParser/standard/parser"
43     />
44         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
45                              match="public class ParseException extends Exception"
46                              replace="public class ParseException extends QueryNodeParseException"
47                              flags="g"
48                              byline="false"/>
49         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
50                              match="package org.apache.lucene.queryParser.standard.parser;"
51                              replace="package org.apache.lucene.queryParser.standard.parser;${line.separator}
52 ${line.separator}
53 import org.apache.lucene.messages.Message;${line.separator}
54 import org.apache.lucene.messages.MessageImpl;${line.separator}
55 import org.apache.lucene.queryParser.core.*;${line.separator}
56 import org.apache.lucene.queryParser.core.messages.*;"
57                              flags="g"
58                              byline="false"/>
59         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
60                              match="^  public ParseException\(Token currentTokenVal.*$(\s\s[^}].*\n)*  \}"
61                              replace="  public ParseException(Token currentTokenVal,${line.separator}
62     int[][] expectedTokenSequencesVal, String[] tokenImageVal) {${line.separator}
63     super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(${line.separator}
64     currentTokenVal, expectedTokenSequencesVal, tokenImageVal)));${line.separator}
65     this.currentToken = currentTokenVal;${line.separator}
66     this.expectedTokenSequences = expectedTokenSequencesVal;${line.separator}
67     this.tokenImage = tokenImageVal;${line.separator}
68   }"
69                              flags="gm"
70                              byline="false"/>
71         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
72                              match="^  public ParseException\(String message.*$(\s\s[^}].*\n)*  \}"
73                              replace="  public ParseException(Message message) {${line.separator}
74     super(message);${line.separator}                      
75   }"
76                              flags="gm"
77                              byline="false"/>
78         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
79                              match="^  public ParseException\(\).*$(\s\s[^}].*\n)*  \}"
80                              replace="  public ParseException() {${line.separator}
81     super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, &quot;Error&quot;));${line.separator}
82   }"
83                              flags="gm"
84                              byline="false"/>
85         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
86                              match="^  public String getMessage\(\).*$(\s\s\s\s[^}].*\n)*    \}"
87                              replace="  private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) {${line.separator}
88     String eol = System.getProperty(&quot;line.separator&quot;, &quot;\n&quot;);"
89                              flags="gm"
90                              byline="false"/>
91         <replaceregexp file="src/java/org/apache/lucene/queryParser/standard/parser/ParseException.java"
92                              match="\s*protected String add_escapes.*"
93                              replace="  static private String add_escapes(String str) {"
94                              flags="g"
95                              byline="true"/>
96   </target>
97
98   <target name="javacc-surround" depends="javacc-check" description="generate surround query parser from jj (requires javacc 4.1">
99         <invoke-javacc target="src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj"
100                    outputDir="src/java/org/apache/lucene/queryParser/surround/parser"
101     />
102   </target>
103 </project>