|
39 | 39 | <property name="manifest" value="manifest" /> |
40 | 40 |
|
41 | 41 |
|
| 42 | + <!-- properties for the parser generation --> |
| 43 | + <property environment="env" /> |
| 44 | + <property name="parser_path" value="dynamicjava/parser" /> |
| 45 | + <property name="javacc_home" value="${env.JAVACC_HOME}" /> |
| 46 | + <!-- end properties for autocomplete parser generation --> |
| 47 | + |
42 | 48 | <!-- Sets a flag indicating that code dealing with new features since the |
43 | 49 | last stable release should be enabled and testable. |
44 | 50 | Takes effect only after a clean compile --> |
|
115 | 121 | </antcall> |
116 | 122 | </target> |
117 | 123 |
|
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + <!-- targets used to generate the parser for autocompletion --> |
| 128 | + <target name="clean-parser"> |
| 129 | + <delete file="${parser_path}/Parser.java" /> |
| 130 | + <delete file="${parser_path}/ParserConstants.java" /> |
| 131 | + <delete file="${parser_path}/ParserTokenManager.java" /> |
| 132 | + </target> |
| 133 | + |
| 134 | + <!-- based off of fixparser script in parser folder --> |
| 135 | + <target name="generate-parser" depends="init"> |
| 136 | + <javacc target="${parser_path}/grammar.jj" javacchome="${javacc_home}" outputdirectory="${parser_path}" /> |
| 137 | + <echo message="Uncommenting the generics in the Parser.java file" /> |
| 138 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 139 | + <arg line=""s/\/\*</</g"" /> |
| 140 | + <arg line="Parser.java" /> |
| 141 | + </exec> |
| 142 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 143 | + <arg line=""s/>\*\//>/g"" /> |
| 144 | + <arg line="tmpParser1.java" /> |
| 145 | + </exec> |
| 146 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 147 | + <arg line=""s/List name[(]/List<IdentifierToken> name(/"" /> |
| 148 | + <arg line="tmpParser2.java" /> |
| 149 | + </exec> |
| 150 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 151 | + <arg line=""s/List TypeArguments[(]/List<Type> TypeArguments(/"" /> |
| 152 | + <arg line="tmpParser1.java" /> |
| 153 | + </exec> |
| 154 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 155 | + <arg line=""s/List ReferenceTypeNameList[(]/List<? extends ReferenceType> ReferenceTypeNameList(/"" /> |
| 156 | + <arg line="tmpParser2.java" /> |
| 157 | + </exec> |
| 158 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 159 | + <arg line=""s/List localVariableDeclaration[(]/List<Node> localVariableDeclaration(/"" /> |
| 160 | + <arg line="tmpParser1.java" /> |
| 161 | + </exec> |
| 162 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 163 | + <arg line=""s/List nameList[(]/List<List<IdentifierToken>> nameList(/"" /> |
| 164 | + <arg line="tmpParser2.java" /> |
| 165 | + </exec> |
| 166 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 167 | + <arg line=""s/List enumConstants[(]/List<EnumDeclaration.EnumConstant> enumConstants(/"" /> |
| 168 | + <arg line="tmpParser1.java" /> |
| 169 | + </exec> |
| 170 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 171 | + <arg line=""s/List enumBodyDeclarations[(]/List<Node> enumBodyDeclarations(/"" /> |
| 172 | + <arg line="tmpParser2.java" /> |
| 173 | + </exec> |
| 174 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 175 | + <arg line=""s/List topLevelStatement[(]/List<Node> topLevelStatement(/"" /> |
| 176 | + <arg line="tmpParser1.java" /> |
| 177 | + </exec> |
| 178 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 179 | + <arg line=""s/List classBodyDeclaration[(]/List<Node> classBodyDeclaration(/"" /> |
| 180 | + <arg line="tmpParser2.java" /> |
| 181 | + </exec> |
| 182 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 183 | + <arg line=""s/List fieldDeclaration[(]/List<Node> fieldDeclaration(/"" /> |
| 184 | + <arg line="tmpParser1.java" /> |
| 185 | + </exec> |
| 186 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 187 | + <arg line=""s/List formalParameters[(]/List<FormalParameter> formalParameters(/"" /> |
| 188 | + <arg line="tmpParser2.java" /> |
| 189 | + </exec> |
| 190 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 191 | + <arg line=""s/List argumentList[(]/List<Expression> argumentList(/"" /> |
| 192 | + <arg line="tmpParser1.java" /> |
| 193 | + </exec> |
| 194 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 195 | + <arg line=""s/List parseStream[(]/List<Node> parseStream(/"" /> |
| 196 | + <arg line="tmpParser2.java" /> |
| 197 | + </exec> |
| 198 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 199 | + <arg line=""s/List parseCompilationUnit[(]/List<Node> parseCompilationUnit(/"" /> |
| 200 | + <arg line="tmpParser1.java" /> |
| 201 | + </exec> |
| 202 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 203 | + <arg line=""s/List interfaceMemberDeclaration[(]/List<Node> interfaceMemberDeclaration(/"" /> |
| 204 | + <arg line="tmpParser2.java" /> |
| 205 | + </exec> |
| 206 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 207 | + <arg line=""s/List blockStatement[(]/List<Node> blockStatement(/"" /> |
| 208 | + <arg line="tmpParser1.java" /> |
| 209 | + </exec> |
| 210 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 211 | + <arg line=""s/List forInit[(]/List<Node> forInit(/"" /> |
| 212 | + <arg line="tmpParser2.java" /> |
| 213 | + </exec> |
| 214 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser2.java"> |
| 215 | + <arg line=""s/List statementExpressionList[(]/List<Node> statementExpressionList(/"" /> |
| 216 | + <arg line="tmpParser1.java" /> |
| 217 | + </exec> |
| 218 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser1.java"> |
| 219 | + <arg line=""s/Vector/Vector<Object>/g"" /> |
| 220 | + <arg line="tmpParser2.java" /> |
| 221 | + </exec> |
| 222 | + |
| 223 | + <!-- This is a template for the above calls to sed. Replace the #s with the correct values. follow the |
| 224 | + pattern used for the numbering of tmpParser and make sure the output of the last one is the one |
| 225 | + moved and the input of the last one is the one deleted. |
| 226 | + |
| 227 | + <exec executable="sed" dir="${parser_path}" failonerror="true" output="${parser_path}/tmpParser#.java"> |
| 228 | + <arg line=""#"" /> |
| 229 | + <arg line="tmpParser#.java" /> |
| 230 | + </exec> |
| 231 | + --> |
| 232 | + |
| 233 | + <move file="${parser_path}/tmpParser1.java" tofile="${parser_path}/Parser.java" /> |
| 234 | + <delete file="${parser_path}/tmpParser2.java" /> |
| 235 | + </target> |
| 236 | + |
| 237 | + <target name="rebuild-parser" depends="clean, clean-parser, generate-parser, compile" /> |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
118 | 242 | <target name="compile" depends="do-compile"> |
119 | 243 |
|
120 | 244 | <copy todir="${built}"> |
|
0 commit comments