Java Code Examples for org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions#isOptimizeCodeQuality()
The following examples show how to use
org.eclipse.xtext.xtext.generator.parser.antlr.AntlrOptions#isOptimizeCodeQuality() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AntlrCodeQualityHelper.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Remove all unnecessary comments from a lexer or parser file */ public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); } return javaContent; }
Example 2
Source File: AntlrCodeQualityHelper.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Remove duplicate bitset declarations to reduce the size of the static initializer but keep the bitsets * that match the given pattern with a normalized name. */ public String removeDuplicateBitsets(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } return removeDuplicateFields(javaContent, followsetPattern, 1, 2, "\\bFOLLOW_\\w+\\b", "FOLLOW_%d", options.getKeptBitSetsPattern(), options.getKeptBitSetName()); }
Example 3
Source File: AntlrCodeQualityHelper.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Remove duplicate bitset declarations to reduce the size of the static initializer but keep the bitsets * that match the given pattern with a normalized name. */ public String removeDuplicateDFAs(String content, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return content; } String newContent = dfaPattern.matcher(content).replaceAll(replacement); newContent = removeDuplicateFields( newContent, dfaStringPattern, 1, 2, "\\bDFA\\d+_\\w+\\b", "dfa_%ds", null, null); newContent = removeDuplicateFields( newContent, dfaUnpackPattern, 1, 2, "\\bDFA\\d+_\\w+\\b", "dfa_%d", null, null); return newContent; }