Community
Participate
Working Groups
The OQL parser is built using the javacc compiler compiler from the OQLParser.jj file. This has been done in the past, and the generated java files have been checked into SVN, and have then been modified. If we ever need to change the .jj file then we need a process for doing that can generate java files with the modifications. 1.Document process - e.g. run javacc, reformat files, merge changes from existing version 2.Apply more of the changes to the .jj file to minimise fixups 3.Have automatic process for applying fixups 3.If no changes required, then run javacc as part of build
I have written an ant file which runs javacc, then fix up the generated code: <!-- javacc converts backslash to a unicode escape, which works but looks messy, so reverse it --> <replaceregex pattern="u005c" replace="" flags="g" /> <!-- avoid problems with the Turkish locale with toUpperCase --> <replaceregex pattern="toUpperCase\(\)" replace="toUpperCase\(Locale.ENGLISH\)" flags="g" /> <!-- internationalize the missing return message --> <replaceregex pattern='"Missing return statement in function"' replace="Messages.OQLParser_Missing_return_statement_in_function" flags="g" /> <!-- avoid warnings by adding suppressWarnings --> <replaceregex pattern="public class OQLParser" replace='@SuppressWarnings({"nls", "unused"}) \0' /> <!-- remove semicolon on its own --> <replaceregex pattern="^\s*;$" replace="" /> The generated code then needs to be reformatted into the project conventions and the imports organized. The differences then are quite small.
The smallest differences are when using javacc 4.1 Changes made to generate files: OQLParser.java Added copyright header Added @SuppressWarnings("serial") to LookaheadSuccess Added @SuppressWarnings("unchecked") to some methods which don't use generics (javacc 5.0 will fix this) OQLParserConstants.java Added copyright header Added @SuppressWarnings("nls") to public interface OQLParserConstants OQLParserTokenManager.java Added copyright header Added some @SuppressWarnings("cast") Added some @SuppressWarnings("unused") ParseException.java Added copyright header Added @SuppressWarnings( { "serial", "nls" }) to ParseException SimpleCharStream.java Added copyright header Added @SuppressWarnings("unused") to getTabSize(int i) Changed JavaCC - OriginalChecksum=5a86e00a0b941ec037f0713e69ba91c3 (do not edit this line) Token.java Added copyright header Added @SuppressWarnings( { "serial", "nls" }) to TokenMgrError Added @SuppressWarnings("unused") to some methods Changed JavaCC - OriginalChecksum=c1af33c36aa1c949195f80d1cbfbfd9a (do not edit this line) We should check in versions of these files generated by a reproducible process with javacc 4.1 then move up to javacc 5.0
Build instructions are now here: http://wiki.eclipse.org/index.php?title=MemoryAnalyzer/Contributor_Reference#Build_OQL_Parser_using_JavaCC