[Git][java-team/maven-jflex-plugin][upstream] New upstream version 1.8.2
Markus Koschany (@apo)
gitlab at salsa.debian.org
Fri Nov 19 23:38:06 GMT 2021
Markus Koschany pushed to branch upstream at Debian Java Maintainers / maven-jflex-plugin
Commits:
7ac5bf81 by Markus Koschany at 2021-11-19T23:37:11+01:00
New upstream version 1.8.2
- - - - -
18 changed files:
- README.md
- pom.xml
- − src/main/java/de/jflex/plugin/maven/LexSimpleAnalyzer.java
- src/main/java/de/jflex/plugin/maven/JFlexMojo.java → src/main/java/jflex/maven/plugin/jflex/JFlexMojo.java
- + src/main/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerUtils.java
- src/main/java/de/jflex/plugin/maven/ClassInfo.java → src/main/java/jflex/maven/plugin/jflex/SpecInfo.java
- − src/site/apt/changelog.apt
- + src/site/markdown/usage.md
- + src/site/site.xml
- src/test/java/de/jflex/plugin/maven/JFlexMojoTest.java → src/test/java/jflex/maven/plugin/jflex/JFlexMojoTest.java
- + src/test/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerUtilsTest.java
- src/test/java/de/jflex/plugin/maven/ClassInfoTest.java → src/test/java/jflex/maven/plugin/jflex/SpecInfoTest.java
- + src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/code.flexh
- + src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/include/nested.flexh
- src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/preprocessor.jflex
- + src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/rules.flexh
- src/test/projects/single-dir-test/src/main/jflex/preprocessor.jflex
- src/test/projects/single-file-test/src/main/jflex/preprocessor.jflex
Changes:
=====================================
README.md
=====================================
@@ -5,6 +5,7 @@ This directory contains the sources of the JFlex Maven plugin.
Maven <http://maven.apache.org> is a software project management, dependency
management and build tool. This plugin makes JFlex available in maven.
+See [Usage with Maven](https://github.com/jflex-de/jflex#usage-with-maven)
## Contents ##
=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
<parent>
<groupId>de.jflex</groupId>
<artifactId>jflex-parent</artifactId>
- <version>1.7.0</version>
+ <version>1.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>jflex-maven-plugin</artifactId>
@@ -78,8 +78,13 @@
</build>
<dependencies>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ <version>3.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>de.jflex</groupId>
@@ -97,7 +102,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
- <version>3.5</version>
+ <version>3.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -112,5 +117,32 @@
<version>3.3.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.truth</groupId>
+ <artifactId>truth</artifactId>
+ <version>0.42</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <id>empty</id>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
=====================================
src/main/java/de/jflex/plugin/maven/LexSimpleAnalyzer.java deleted
=====================================
@@ -1,81 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * JFlex Maven3 plugin *
- * Copyright (c) 2007-2017 Régis Décamps <decamps at users.sf.net> *
- * Credit goes to the authors of the ant task. *
- * All rights reserved. *
- * *
- * License: BSD *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-package de.jflex.plugin.maven;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.LineNumberReader;
-
-/**
- * @author Rafal Mantiuk (Rafal.Mantiuk at bellstream.pl)
- * @author Gerwin Klein (lsf at jflex.de)
- */
-class LexSimpleAnalyzer {
- static final String DEFAULT_NAME = "Yylex";
-
- /**
- * Guesses the package and class name, based on this grammar definition. Does not override the
- * Mojo configuration if it exist.
- *
- * @return The name of the java code to generate.
- * @throws FileNotFoundException if the lex file does not exist
- * @throws IOException when an IO exception occurred while reading a file.
- */
- static ClassInfo guessPackageAndClass(File lexFile) throws IOException {
- assert lexFile.isAbsolute() : lexFile;
-
- try (LineNumberReader reader = new LineNumberReader(new FileReader(lexFile))) {
- ClassInfo classInfo = new ClassInfo();
- while (classInfo.className == null || classInfo.packageName == null) {
- String line = reader.readLine();
- if (line == null) {
- break;
- }
-
- guessPackage(classInfo, line);
- guessClass(classInfo, line);
- }
-
- if (classInfo.className == null) {
- classInfo.className = DEFAULT_NAME;
- }
- return classInfo;
- }
- }
-
- private static void guessClass(ClassInfo classInfo, String line) {
- if (classInfo.className == null) {
- int index = line.indexOf("%class");
- if (index >= 0) {
- index += 6;
-
- classInfo.className = line.substring(index);
- classInfo.className = classInfo.className.trim();
- }
- }
- }
-
- private static void guessPackage(ClassInfo classInfo, String line) {
- if (classInfo.packageName == null) {
- int index = line.indexOf("package");
- if (index >= 0) {
- index += 7;
-
- int end = line.indexOf(';', index);
- if (end >= index) {
- classInfo.packageName = line.substring(index, end);
- classInfo.packageName = classInfo.packageName.trim();
- }
- }
- }
- }
-}
=====================================
src/main/java/de/jflex/plugin/maven/JFlexMojo.java → src/main/java/jflex/maven/plugin/jflex/JFlexMojo.java
=====================================
@@ -6,18 +6,25 @@
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-package de.jflex.plugin.maven;
+package jflex.maven.plugin.jflex;
+import static com.google.common.base.Strings.isNullOrEmpty;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.io.Files;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
-import jflex.Main;
-import jflex.Options;
-import org.apache.commons.io.FileUtils;
+import java.util.Objects;
+import java.util.Set;
+import jflex.core.OptionUtils;
+import jflex.generator.LexGenerator;
+import jflex.option.Options;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -45,7 +52,7 @@ public class JFlexMojo extends AbstractMojo {
* List of grammar definitions to run the JFlex parser generator on. Each path may either specify
* a single grammar file or a directory. Directories will be recursively scanned for files with
* one of the following extensions: ".jflex", ".flex", ".jlex" or ".lex". By default, all files in
- * <code>src/main/jflex</code> will be processed.
+ * {@code src/main/jflex} will be processed.
*
* @see #SRC_MAIN_JFLEX
*/
@@ -88,7 +95,7 @@ public class JFlexMojo extends AbstractMojo {
@Parameter(defaultValue = "false")
private boolean jlex;
- /** The generation method to use for the scanner. The only valid value is <code>pack</code>. */
+ /** The generation method to use for the scanner. The only valid value is {@code pack}. */
@Parameter(defaultValue = "pack")
private String generationMethod = "pack"; // NOPMD
@@ -163,18 +170,18 @@ public class JFlexMojo extends AbstractMojo {
* @throws MojoFailureException if the file is not found.
* @throws MojoExecutionException if file could not be parsed
*/
- @SuppressWarnings("unchecked")
private void parseLexDefinition(File lexDefinition)
throws MojoFailureException, MojoExecutionException {
assert lexDefinition.isAbsolute() : lexDefinition;
if (lexDefinition.isDirectory()) {
// recursively process files contained within
- String[] extensions = {"jflex", "jlex", "lex", "flex"};
getLog().debug("Processing lexer files found in " + lexDefinition);
- Iterator<File> fileIterator = FileUtils.iterateFiles(lexDefinition, extensions, true);
- while (fileIterator.hasNext()) {
- File lexFile = fileIterator.next();
+ FluentIterable<File> files =
+ Files.fileTreeTraverser()
+ .preOrderTraversal(lexDefinition)
+ .filter(new ExtensionPredicate("jflex", "jlex", "lex", "flex"));
+ for (File lexFile : files) {
parseLexFile(lexFile);
}
} else {
@@ -186,64 +193,68 @@ public class JFlexMojo extends AbstractMojo {
assert lexFile.isAbsolute() : lexFile;
getLog().debug("Generating Java code from " + lexFile.getName());
- ClassInfo classInfo;
- try {
- classInfo = LexSimpleAnalyzer.guessPackageAndClass(lexFile);
- } catch (FileNotFoundException e) {
- throw new MojoFailureException(e.getMessage(), e);
- } catch (IOException e) {
- classInfo = new ClassInfo();
- classInfo.className = LexSimpleAnalyzer.DEFAULT_NAME;
- classInfo.packageName = null; // NOPMD
- }
+ SpecInfo specInfo = findSpecInfo(lexFile);
checkParameters(lexFile);
// set destination directory
- File generatedFile = new File(outputDirectory, classInfo.getOutputFilename());
+ File generatedFile = new File(outputDirectory, specInfo.getOutputFilename());
// generate only if needs to
- if (lexFile.lastModified() - generatedFile.lastModified() <= this.staleMillis) {
+ long generatedLastModified = generatedFile.lastModified();
+ if (lexFile.lastModified() - generatedLastModified <= this.staleMillis
+ && latestModified(specInfo.includedFiles) - generatedLastModified <= this.staleMillis) {
getLog().info(" " + generatedFile.getName() + " is up to date.");
getLog().debug("StaleMillis = " + staleMillis + "ms");
return;
}
// set options. Very strange that JFlex expects this in a static way..
- Options.setDefaults();
- Options.setDir(generatedFile.getParentFile());
+ OptionUtils.setDefaultOptions();
+ OptionUtils.setDir(generatedFile.getParentFile());
+ Options.setRootDirectory(project.getBasedir());
Options.dump = dump;
Options.verbose = verbose;
Options.unused_warning = unusedWarning;
Options.dot = dot;
Options.legacy_dot = legacyDot;
if (skeleton != null) {
- Options.setSkeleton(skeleton);
+ OptionUtils.setSkeleton(skeleton);
}
Options.jlex = jlex;
Options.no_minimize = !minimize; // NOPMD
Options.no_backup = !backup; // NOPMD
- if (!"pack".equals(generationMethod)) {
+ if (!Objects.equals("pack", generationMethod)) {
throw new MojoExecutionException("Illegal generation method: " + generationMethod);
}
- if (!"".equals(encodingName)) {
+ if (!isNullOrEmpty(encodingName)) {
try {
- Options.setEncoding(encodingName);
+ OptionUtils.setEncoding(encodingName);
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage());
}
}
try {
- Main.generate(lexFile);
+ new LexGenerator(lexFile).generate();
getLog().info(" generated " + generatedFile);
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
+ private SpecInfo findSpecInfo(File lexFile) throws MojoFailureException {
+ try {
+ return LexSimpleAnalyzerUtils.guessSpecInfo(lexFile);
+ } catch (FileNotFoundException e) {
+ throw new MojoFailureException(e.getMessage(), e);
+ } catch (IOException e) {
+ return new SpecInfo(LexSimpleAnalyzerUtils.DEFAULT_NAME, /*packageName=*/ "");
+ }
+ }
+
/**
* Check parameter lexFile.
*
@@ -255,7 +266,8 @@ public class JFlexMojo extends AbstractMojo {
private void checkParameters(File lexFile) throws MojoExecutionException {
if (lexFile == null) {
throw new MojoExecutionException(
- "<lexDefinition> is empty. Please define input file with <lexDefinition>input.jflex</lexDefinition>");
+ "<lexDefinition> is empty. Please define input file with"
+ + " <lexDefinition>input.jflex</lexDefinition>");
}
if (!lexFile.isFile()) {
throw new MojoExecutionException("Input file does not exist: " + lexFile);
@@ -277,4 +289,36 @@ public class JFlexMojo extends AbstractMojo {
}
return new File(this.project.getBasedir().getAbsolutePath(), path.getPath());
}
+
+ /**
+ * Determines the highest {@link File#lastModified()} value among the specified {@code
+ * includedFiles}, which are resolved relative to the specified {@code parent} directory.
+ *
+ * @return the latest value -- or 0 if the list is empty, if no files exist, or if I/O exceptions
+ * prevent getting any values
+ */
+ private static long latestModified(Set<File> includedFiles) {
+ long result = 0;
+ for (File file : includedFiles) {
+ result = Math.max(file.lastModified(), result);
+ }
+ return result;
+ }
+
+ static class ExtensionPredicate implements Predicate<File> {
+ final ImmutableSet<String> extensions;
+
+ ExtensionPredicate(ImmutableSet<String> extensions) {
+ this.extensions = extensions;
+ }
+
+ ExtensionPredicate(String... extensions) {
+ this(ImmutableSet.copyOf(extensions));
+ }
+
+ @Override
+ public boolean apply(File file) {
+ return extensions.contains(Files.getFileExtension(file.getName()));
+ }
+ }
}
=====================================
src/main/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerUtils.java
=====================================
@@ -0,0 +1,191 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * JFlex Maven3 plugin *
+ * Copyright (c) 2007-2017 Régis Décamps <decamps at users.sf.net> *
+ * Credit goes to the authors of the ant task. *
+ * All rights reserved. *
+ * *
+ * License: BSD *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+package jflex.maven.plugin.jflex;
+
+import com.google.common.io.Files;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import javax.annotation.Nullable;
+
+/**
+ * @author Rafal Mantiuk (Rafal.Mantiuk at bellstream.pl)
+ * @author Gerwin Klein (lsf at jflex.de)
+ * @author Régis Décamps
+ * @author Chris Fraire (cfraire at me.com)
+ */
+class LexSimpleAnalyzerUtils {
+
+ static final String DEFAULT_NAME = "Yylex";
+
+ private static final Pattern INCLUDE_DIRECTIVE_MATCHER = Pattern.compile("^\\s*%include\\s+(.+)");
+ private static final int INCLUDE_DIRECTIVE_ARG_OFFSET = 1;
+
+ /**
+ * Guesses package and class name, and {@code %include} files, based on this grammar definition.
+ *
+ * @param lexFile the lex spec to process
+ * @return collected info about this lex spec.
+ * @throws FileNotFoundException if the lex file does not exist
+ * @throws IOException when an IO exception occurred while reading a file.
+ */
+ static SpecInfo guessSpecInfo(File lexFile) throws IOException {
+ Reader lexFileReader = Files.newReader(lexFile, StandardCharsets.UTF_8);
+ return guessSpecInfo(lexFileReader, lexFile);
+ }
+
+ /**
+ * Guesses package and class name, and {@code %include} files, based on this grammar definition.
+ *
+ * @param lexFileReader reader for lex spec to process
+ * @param lexFile the lex spec to process, used for relative path name resolution of {@code
+ * %incude}s.
+ * @return collected info about this lex spec.
+ * @throws IOException when an IO exception occurred while processing the reader. Ignores IO
+ * errors for {@code %incude} files.
+ */
+ static SpecInfo guessSpecInfo(Reader lexFileReader, File lexFile) throws IOException {
+ try (LineNumberReader reader = new LineNumberReader(lexFileReader)) {
+ String className = null;
+ String packageName = null;
+ while (className == null || packageName == null) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ if (packageName == null) {
+ packageName = guessPackage(line);
+ }
+ if (className == null) {
+ className = guessClass(line);
+ }
+ }
+
+ if (className == null) {
+ className = DEFAULT_NAME;
+ }
+ return new SpecInfo(className, packageName, guessIncludes(lexFile));
+ }
+ }
+
+ /**
+ * Processes a file for {@code %include} directives.
+ *
+ * @param file the lex file to process.
+ * @return the set of files (recursively) mentioned in {@code %include}s.
+ */
+ private static Set<File> guessIncludes(File file) {
+ return nestedIncludes(new HashSet<>(), file);
+ }
+
+ /**
+ * Recursively processes a file for {@code %include} directives.
+ *
+ * @param file the file to process; itself assumed to be an {@code %include} or lex file. Path
+ * names in the file are relative to the file location.
+ * @param seen the set of files seen so far, to avoid following cycles..
+ * @return the set of files (recursively) mentioned in {@code %include}s.
+ */
+ private static Set<File> nestedIncludes(Set<File> seen, File file) {
+ Set<File> includedFiles = new HashSet<>();
+ Set<File> newSeen = new HashSet<>(seen);
+ try {
+ Reader reader = Files.newReader(file, StandardCharsets.UTF_8);
+ Set<File> newFiles = mapFiles(parseIncludes(reader), file.getParentFile());
+ newFiles.removeAll(seen);
+ newSeen.addAll(newFiles);
+ includedFiles.addAll(newFiles);
+ Set<File> nested =
+ newFiles.stream()
+ .flatMap(f -> nestedIncludes(newSeen, f).stream())
+ .collect(Collectors.toSet());
+ includedFiles.addAll(nested);
+ } catch (IOException e) {
+ // silently ignore IO exceptions in include file processing
+ }
+ return includedFiles;
+ }
+
+ /**
+ * Resolves path names relative to parent.
+ *
+ * @param set a set of relative path names
+ * @param parent the parent file of these path names
+ * @return the set of files relative to {@code parent}
+ */
+ static Set<File> mapFiles(Set<String> set, File parent) {
+ return set.stream().map(s -> new File(parent, s)).collect(Collectors.toSet());
+ }
+
+ /**
+ * Parses input for {@code %include} directives.
+ *
+ * @param fileReader the input
+ * @return the set of path names mentioned after {@code %include} directives in the input.
+ */
+ static Set<String> parseIncludes(Reader fileReader) throws IOException {
+ Set<String> includedFiles = new HashSet<>();
+ try (LineNumberReader reader = new LineNumberReader(fileReader)) {
+ String line = reader.readLine();
+ while (line != null) {
+ String includedFile = guessIncluded(line);
+ if (includedFile != null) {
+ includedFiles.add(includedFile);
+ }
+ line = reader.readLine();
+ }
+ }
+ return includedFiles;
+ }
+
+ @Nullable
+ private static String guessClass(String line) {
+ int index = line.indexOf("%class");
+ if (index > -1) {
+ index += "%class".length();
+ return line.substring(index).trim();
+ }
+ return null;
+ }
+
+ @Nullable
+ private static String guessPackage(String line) {
+ int index = line.trim().indexOf("package");
+ if (index == 0) {
+ index += "package".length();
+
+ int end = line.indexOf(';', index);
+ if (end >= index) {
+ return line.substring(index, end).trim();
+ }
+ }
+
+ return null;
+ }
+
+ @Nullable
+ private static String guessIncluded(String line) {
+ Matcher matcher = INCLUDE_DIRECTIVE_MATCHER.matcher(line);
+ if (matcher.find()) {
+ return matcher.group(INCLUDE_DIRECTIVE_ARG_OFFSET).trim();
+ }
+ return null;
+ }
+
+ private LexSimpleAnalyzerUtils() {}
+}
=====================================
src/main/java/de/jflex/plugin/maven/ClassInfo.java → src/main/java/jflex/maven/plugin/jflex/SpecInfo.java
=====================================
@@ -6,13 +6,55 @@
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-package de.jflex.plugin.maven;
+package jflex.maven.plugin.jflex;
+import com.google.common.base.Strings;
import java.io.File;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+import javax.annotation.Nullable;
-class ClassInfo {
- String className = null;
- String packageName = null;
+class SpecInfo {
+
+ /** name of the generated class */
+ final String className;
+
+ /** dot-separated package name. Empty string for the default package. */
+ final String packageName;
+
+ /** set of files recursively included from the lex spec */
+ final Set<File> includedFiles;
+
+ SpecInfo(String className, @Nullable String packageName) {
+ this(className, packageName, Collections.emptySet());
+ }
+
+ SpecInfo(String className, @Nullable String packageName, Set<File> includedFiles) {
+ this.className = className;
+ this.packageName = Strings.nullToEmpty(packageName);
+ this.includedFiles = new HashSet<>(includedFiles);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof SpecInfo)) {
+ return false;
+ }
+ SpecInfo other = (SpecInfo) obj;
+ return Objects.equals(className, other.className)
+ && Objects.equals(packageName, other.packageName)
+ && Objects.equals(includedFiles, other.includedFiles);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(className, packageName, includedFiles);
+ }
/**
* Returns the (relative) path name of the java source code file that corresponds to the class.
@@ -22,10 +64,8 @@ class ClassInfo {
* @return Name of the java file.
*/
String getOutputFilename() {
- String packageDir = "";
- if (packageName != null) {
- packageDir += packageName.replace('.', File.separatorChar);
- }
+ // TODO(regisd) Use PackageUtil
+ String packageDir = packageName.replace('.', File.separatorChar);
if (packageDir.length() > 0) {
packageDir += File.separatorChar;
}
=====================================
src/site/apt/changelog.apt deleted
=====================================
@@ -1,107 +0,0 @@
- ---------
- Changelog
- ---------
-
-Latest version
-
-* Version 1.7.0
-
- * Relies on JFlex 1.7.0
-
- * Requires Java 7
-
- * Requires Maven 3
-
- * New option 'enconding' to set lexer spec encoding
-
-* Version 1.6.1
-
- * Relies on JFlex 1.6.1
-
- * New option `unusedWarning` that controls whether to warn about unused
- macros or not.
-
- * New option `dump` that is more verbose than `verbose`
-
- * Option `verbose` set to same verbosity level as command line
-
- * Added m2e plugin configuration for Eclipse
-
- * Development moved to github
-
-
-Recent versions
-
-* Version 1.6.0
-
- * Relies on JFlex 1.6.0
-
- * changed inputStreamCtor default to false
-
-
-* Version 1.5.0
-
- * Changed name from maven-jflex-plugin to jflex-maven-plugin
-
- * Switched license from GPL to BSD
-
- * Relies on JFlex 1.5.0
-
- * Requires Java 5
-
- * Changed package from org.codehaus.mojo.jlex to de.jflex.plugin.maven..
-
-
-* Version 1.4.3-r1
-
- * Java 1.3 bytecode
-
- * Relies on JFlex 1.4.3
-
-* Version 1.4.2-r1
-
- * Java 1.3 bytecode
-
- * Relies on JFlex 1.4.2
-
-
-* Version 0.3
-
- * Java 1.4 bytecode
-
- * relies on JFlex 1.4.1
-
- * new option staleMillis
-
- * more reports on site
-
- * code improvements
-
-
-Alpha versions
-
-* Version 0.2
-
- * Java 5 bytecode
-
- * new options added: generationMethod, minimize, backup
-
- * enhanced documentation
-
- * many code improvements
-
- ** use file comparison, prefer available functionality from File
- class to avoid manual string twiddling
-
- ** fix testInit(): the generated file size depends on the platform
- (because of how new lines are encoded)
-
- ** improve unit test with AbstractMojoTestCase
-
- * changed package from de.jflex.maven.plugin to org.codehaus.maven.plugin
-
-* Version 0.1
-
- * Java 5 bytecode
-
- * Generates Java code from lex files, using JFlex 1.4.1
\ No newline at end of file
=====================================
src/site/markdown/usage.md
=====================================
@@ -0,0 +1 @@
+../../../../docs/md/maven-plugin.md
\ No newline at end of file
=====================================
src/site/site.xml
=====================================
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+ <body>
+ <menu name="Overview">
+ <item name="Usage" href="usage.html"/>
+ </menu>
+ <menu name="Examples">
+ <item name="Simple Maven project" href="https://github.com/jflex-de/jflex/tree/master/jflex/examples/simple"/>
+ <item name="Simple grammar" href="http://jflex.de/manual.html#Example"/>
+ <item name="More grammars" href="https://github.com/jflex-de/jflex/wiki/External-JFlex-Grammars"/>
+ </menu>
+
+ </body>
+
+</project>
\ No newline at end of file
=====================================
src/test/java/de/jflex/plugin/maven/JFlexMojoTest.java → src/test/java/jflex/maven/plugin/jflex/JFlexMojoTest.java
=====================================
@@ -6,10 +6,12 @@
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-package de.jflex.plugin.maven;
+package jflex.maven.plugin.jflex;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+import com.google.common.base.Predicate;
import java.io.File;
import java.io.IOException;
import org.apache.maven.plugin.testing.MojoRule;
@@ -46,8 +48,9 @@ public class JFlexMojoTest {
String actualResDir = testResources.getBasedir("single-file-test").getAbsolutePath();
String expectedSuffix =
"/jflex-maven-plugin/target/test-projects/JFlexMojoTest_testTestResources_single-file-test";
- assertTrue(
- actualResDir + " ends with " + expectedSuffix, actualResDir.endsWith(expectedSuffix));
+ assertWithMessage(actualResDir + " ends with " + expectedSuffix)
+ .that(actualResDir.endsWith(expectedSuffix))
+ .isTrue();
}
/** Tests configuration with a single input file. */
@@ -57,7 +60,7 @@ public class JFlexMojoTest {
mojo.execute();
File produced = getExpectedOutputFile(mojo);
- assertTrue("produced file is a file: " + produced, produced.isFile());
+ assertWithMessage("produced file is a file: " + produced).that(produced.isFile()).isTrue();
long size = produced.length();
/*
@@ -66,7 +69,9 @@ public class JFlexMojoTest {
* Windows platform ("\r\n") than on a Unix platform ("\n").
*/
boolean correctSize = (size > 26624) && (size < 36696);
- assertTrue("size of produced file between 26k and 36k. Actual is " + size, correctSize);
+ assertWithMessage("size of produced file between 26k and 36k. Actual is " + size)
+ .that(correctSize)
+ .isTrue();
}
/** Tests configuration with a single input directory. */
@@ -76,7 +81,7 @@ public class JFlexMojoTest {
mojo.execute();
File produced = getExpectedOutputFile(mojo);
- assertTrue("produced file is a file: " + produced, produced.isFile());
+ assertWithMessage("produced file is a file: " + produced).that(produced.isFile()).isTrue();
}
/** Tests configuration with a single input directory containing sub directories. */
@@ -86,7 +91,16 @@ public class JFlexMojoTest {
mojo.execute();
File produced = getExpectedOutputFile(mojo);
- assertTrue("produced file is a file: " + produced, produced.isFile());
+ assertWithMessage("produced file is a file: " + produced).that(produced.isFile()).isTrue();
+ }
+
+ @Test
+ public void extensionPredicate() {
+ Predicate<File> predicate = new JFlexMojo.ExtensionPredicate("bar", "baz");
+ assertThat(predicate.apply(new File("/tmp/foo.bar"))).isTrue();
+ assertThat(predicate.apply(new File("/tmp/foo.baz"))).isTrue();
+ assertThat(predicate.apply(new File("/tmp/foo.bar.too"))).isFalse();
+ assertThat(predicate.apply(new File("/tmp/foo.blahblahbar"))).isFalse();
}
/**
=====================================
src/test/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerUtilsTest.java
=====================================
@@ -0,0 +1,115 @@
+package jflex.maven.plugin.jflex;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Set;
+import org.junit.Test;
+
+/** Test for {@link LexSimpleAnalyzerUtils}. */
+public class LexSimpleAnalyzerUtilsTest {
+
+ @Test
+ public void guessPackageAndClass_givenClass_defaultPackage() throws Exception {
+ String lex =
+ "\n"
+ + "%%\n"
+ + "\n"
+ + "%public\n"
+ + "%class Foo\n"
+ + "\n"
+ + "%apiprivate\n"
+ + "%int\n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + "[^] { /* no action */ }\n";
+ assertThat(guessPackageAndClass(lex)).isEqualTo(new SpecInfo("Foo", null));
+ }
+
+ @Test
+ public void guessPackageAndClass_defaultClass_defaultPackage() throws Exception {
+ String lex =
+ "\n"
+ + "%%\n"
+ + "\n"
+ + "%public\n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + "^\"hello\"$ { System.out.println(\"hello\"); }\n"
+ + "\n";
+ assertThat(guessPackageAndClass(lex)).isEqualTo(new SpecInfo("Yylex", null));
+ }
+
+ @Test
+ public void guessPackageAndClass_defaultClass_hintPackage() throws Exception {
+ String lex =
+ "\n"
+ + "package org.example;\n"
+ + "\n"
+ + "import java.io.File;\n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + "%final\n"
+ + "%public\n"
+ + "\n";
+ assertThat(guessPackageAndClass(lex)).isEqualTo(new SpecInfo("Yylex", "org.example"));
+ }
+
+ /**
+ * Tests that a random "package" string doesn't mislead JFlex in finding a package name.
+ *
+ * <p>See <a href="https://github.com/jflex-de/jflex/issues/104">issue #104</a>.
+ */
+ @Test
+ public void guessPackageAndClass_defaultClass_misleadingPackage() throws Exception {
+ String lex =
+ "\n"
+ + "%%\n"
+ + "\n"
+ + "%public\n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + "<YYINITIAL> {"
+ + " \"package\" { return symbol(PACKAGE); }\n"
+ + " \"private\" { return symbol(PRIVATE); }"
+ + "}\n"
+ + "\n";
+ assertThat(guessPackageAndClass(lex)).isEqualTo(new SpecInfo("Yylex", null));
+ }
+
+ @Test
+ public void parseIncludedFiles() throws Exception {
+ String lex =
+ "\n"
+ + "package org.example;\n"
+ + "\n"
+ + "import java.io.File;\n"
+ + "\n"
+ + "\t%include base.lexh\t \n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + " %include two.lexh \n"
+ + "\n"
+ + "%%\n"
+ + "\n"
+ + "%include three.lexh\t \n"
+ + " %include three.lexh\n";
+ assertThat(parseIncludes(lex)).containsExactly("base.lexh", "two.lexh", "three.lexh");
+ }
+
+ private Set<String> parseIncludes(String lex) throws IOException {
+ return LexSimpleAnalyzerUtils.parseIncludes(new StringReader(lex));
+ }
+
+ private SpecInfo guessPackageAndClass(String lex) throws IOException {
+ // dummy file should throw IOException in %include parsing and be ignored
+ return LexSimpleAnalyzerUtils.guessSpecInfo(new StringReader(lex), new File(""));
+ }
+}
=====================================
src/test/java/de/jflex/plugin/maven/ClassInfoTest.java → src/test/java/jflex/maven/plugin/jflex/SpecInfoTest.java
=====================================
@@ -6,19 +6,23 @@
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-package de.jflex.plugin.maven;
+package jflex.maven.plugin.jflex;
-import static org.junit.Assert.assertEquals;
+import static com.google.common.truth.Truth.assertThat;
import java.io.File;
import org.junit.Test;
-public class ClassInfoTest {
+public class SpecInfoTest {
@Test
public void testGetOutputFilename() {
- ClassInfo clazz = new ClassInfo();
- clazz.className = "Bar";
- clazz.packageName = "org.foo";
- assertEquals(new File("org/foo/Bar.java"), new File(clazz.getOutputFilename()));
+ SpecInfo clazz = new SpecInfo("Bar", "org.foo");
+ assertThat(new File(clazz.getOutputFilename())).isEqualTo(new File("org/foo/Bar.java"));
+ }
+
+ @Test
+ public void testGetOutputFilename_defaultPackage() {
+ SpecInfo clazz = new SpecInfo("Bar", null);
+ assertThat(new File(clazz.getOutputFilename())).isEqualTo(new File("Bar.java"));
}
}
=====================================
src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/code.flexh
=====================================
@@ -0,0 +1,19 @@
+/* code included in the constructor */
+%init{
+ allowHTML = Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_HTML);
+ yybegin(NORMAL);
+ states.add(Integer.valueOf(yystate()));
+%init}
+
+/* code called after parsing is completed */
+%eofval{
+ StringBuffer output = new StringBuffer();
+ if (StringUtils.hasText(this.templateString)) {
+ // FIXME - this leaves unparsed text
+ output.append(this.templateString);
+ this.templateString = "";
+ }
+ return (output.length() == 0) ? null : output.toString();
+%eofval}
+
+%include include/nested.flexh
=====================================
src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/include/nested.flexh
=====================================
@@ -0,0 +1,7 @@
+/* code copied verbatim into the generated .java file */
+%{
+ protected static WikiLogger logger = WikiLogger.getLogger(JAMWikiPreProcessor.class.getName());
+ protected boolean allowHTML = false;
+ protected int templateCharCount = 0;
+ protected String templateString = "";
+%}
=====================================
src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/preprocessor.jflex
=====================================
@@ -18,31 +18,7 @@ import org.springframework.util.StringUtils;
%unicode
%ignorecase
-/* code included in the constructor */
-%init{
- allowHTML = Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_HTML);
- yybegin(NORMAL);
- states.add(new Integer(yystate()));
-%init}
-
-/* code called after parsing is completed */
-%eofval{
- StringBuffer output = new StringBuffer();
- if (StringUtils.hasText(this.templateString)) {
- // FIXME - this leaves unparsed text
- output.append(this.templateString);
- this.templateString = "";
- }
- return (output.length() == 0) ? null : output.toString();
-%eofval}
-
-/* code copied verbatim into the generated .java file */
-%{
- protected static WikiLogger logger = WikiLogger.getLogger(JAMWikiPreProcessor.class.getName());
- protected boolean allowHTML = false;
- protected int templateCharCount = 0;
- protected String templateString = "";
-%}
+%include code.flexh
/* character expressions */
newline = ((\r\n) | (\n))
@@ -82,170 +58,4 @@ wikisignature = ([~]{3,5})
%%
-/* ----- nowiki ----- */
-
-<WIKIPRE, PRE, NORMAL>{nowiki} {
- logger.finer("nowiki: " + yytext() + " (" + yystate() + ")");
- WikiNowikiTag parserTag = new WikiNowikiTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-/* ----- pre ----- */
-
-<NORMAL>{htmlprestart} {
- logger.finer("htmlprestart: " + yytext() + " (" + yystate() + ")");
- if (allowHTML) {
- beginState(PRE);
- }
- HtmlPreTag parserTag = new HtmlPreTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-<PRE>{htmlpreend} {
- logger.finer("htmlpreend: " + yytext() + " (" + yystate() + ")");
- // state only changes to pre if allowHTML is true, so no need to check here
- endState();
- HtmlPreTag parserTag = new HtmlPreTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-<NORMAL, WIKIPRE>^{wikiprestart} {
- logger.finer("wikiprestart: " + yytext() + " (" + yystate() + ")");
- // rollback the one non-pre character so it can be processed
- yypushback(yytext().length() - 1);
- if (yystate() != WIKIPRE) {
- beginState(WIKIPRE);
- }
- return yytext();
-}
-
-<WIKIPRE>^{wikipreend} {
- logger.finer("wikipreend: " + yytext() + " (" + yystate() + ")");
- endState();
- // rollback the one non-pre character so it can be processed
- yypushback(1);
- return yytext();
-}
-
-/* ----- templates ----- */
-
-<NORMAL, TEMPLATE>{templatestart} {
- logger.finer("templatestart: " + yytext() + " (" + yystate() + ")");
- String raw = yytext();
- if (!Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_TEMPLATES)) {
- return yytext();
- }
- this.templateString += raw;
- this.templateCharCount += 2;
- if (yystate() != TEMPLATE) {
- beginState(TEMPLATE);
- }
- return "";
-}
-
-<TEMPLATE>{templateendchar} {
- logger.finer("templateendchar: " + yytext() + " (" + yystate() + ")");
- String raw = yytext();
- this.templateString += raw;
- this.templateCharCount -= raw.length();
- if (this.templateCharCount == 0) {
- endState();
- String value = new String(this.templateString);
- this.templateString = "";
- TemplateTag parserTag = new TemplateTag();
- return this.parseToken(value, parserTag);
- }
- return "";
-}
-
-<TEMPLATE>{templatestartchar} {
- logger.finer("templatestartchar: " + yytext() + " (" + yystate() + ")");
- String raw = yytext();
- this.templateString += raw;
- this.templateCharCount += raw.length();
- if (this.templateString.equals("{{{")) {
- // param, not a template
- this.templateCharCount = 0;
- endState();
- String value = new String(this.templateString);
- this.templateString = "";
- return value;
- }
- return "";
-}
-
-<NORMAL>{templateparam} {
- logger.finer("templateparam: " + yytext() + " (" + yystate() + ")");
- String raw = yytext();
- return raw;
-}
-
-<TEMPLATE>{whitespace} {
- // no need to log this
- String raw = yytext();
- this.templateString += raw;
- return "";
-}
-
-<TEMPLATE>. {
- // no need to log this
- String raw = yytext();
- this.templateString += raw;
- return "";
-}
-
-<NORMAL, TEMPLATE>{includeonly} {
- logger.finer("includeonly: " + yytext() + " (" + yystate() + ")");
- IncludeOnlyTag parserTag = new IncludeOnlyTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-<NORMAL, TEMPLATE>{noinclude} {
- logger.finer("noinclude: " + yytext() + " (" + yystate() + ")");
- NoIncludeTag parserTag = new NoIncludeTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-/* ----- wiki links ----- */
-
-<NORMAL>{imagelinkcaption} {
- logger.finer("imagelinkcaption: " + yytext() + " (" + yystate() + ")");
- WikiLinkTag parserTag = new WikiLinkTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-<NORMAL>{wikilink} {
- logger.finer("wikilink: " + yytext() + " (" + yystate() + ")");
- WikiLinkTag parserTag = new WikiLinkTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-/* ----- signatures ----- */
-
-<NORMAL>{wikisignature} {
- logger.finer("wikisignature: " + yytext() + " (" + yystate() + ")");
- WikiSignatureTag parserTag = new WikiSignatureTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-/* ----- comments ----- */
-
-<NORMAL>{htmlcomment} {
- logger.finer("htmlcomment: " + yytext() + " (" + yystate() + ")");
- HtmlCommentTag parserTag = new HtmlCommentTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-/* ----- other ----- */
-
-<WIKIPRE, PRE, NORMAL>{whitespace} {
- // no need to log this
- CharacterTag parserTag = new CharacterTag();
- return this.parseToken(yytext(), parserTag);
-}
-
-<WIKIPRE, PRE, NORMAL>. {
- // no need to log this
- CharacterTag parserTag = new CharacterTag();
- return this.parseToken(yytext(), parserTag);
-}
+%include ./rules.flexh
=====================================
src/test/projects/recursion-test/src/main/jflex/org/jamwiki/parser/jflex/rules.flexh
=====================================
@@ -0,0 +1,167 @@
+/* ----- nowiki ----- */
+
+<WIKIPRE, PRE, NORMAL>{nowiki} {
+ logger.finer("nowiki: " + yytext() + " (" + yystate() + ")");
+ WikiNowikiTag parserTag = new WikiNowikiTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+/* ----- pre ----- */
+
+<NORMAL>{htmlprestart} {
+ logger.finer("htmlprestart: " + yytext() + " (" + yystate() + ")");
+ if (allowHTML) {
+ beginState(PRE);
+ }
+ HtmlPreTag parserTag = new HtmlPreTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+<PRE>{htmlpreend} {
+ logger.finer("htmlpreend: " + yytext() + " (" + yystate() + ")");
+ // state only changes to pre if allowHTML is true, so no need to check here
+ endState();
+ HtmlPreTag parserTag = new HtmlPreTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+<NORMAL, WIKIPRE>^{wikiprestart} {
+ logger.finer("wikiprestart: " + yytext() + " (" + yystate() + ")");
+ // rollback the one non-pre character so it can be processed
+ yypushback(yytext().length() - 1);
+ if (yystate() != WIKIPRE) {
+ beginState(WIKIPRE);
+ }
+ return yytext();
+}
+
+<WIKIPRE>^{wikipreend} {
+ logger.finer("wikipreend: " + yytext() + " (" + yystate() + ")");
+ endState();
+ // rollback the one non-pre character so it can be processed
+ yypushback(1);
+ return yytext();
+}
+
+/* ----- templates ----- */
+
+<NORMAL, TEMPLATE>{templatestart} {
+ logger.finer("templatestart: " + yytext() + " (" + yystate() + ")");
+ String raw = yytext();
+ if (!Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_TEMPLATES)) {
+ return yytext();
+ }
+ this.templateString += raw;
+ this.templateCharCount += 2;
+ if (yystate() != TEMPLATE) {
+ beginState(TEMPLATE);
+ }
+ return "";
+}
+
+<TEMPLATE>{templateendchar} {
+ logger.finer("templateendchar: " + yytext() + " (" + yystate() + ")");
+ String raw = yytext();
+ this.templateString += raw;
+ this.templateCharCount -= raw.length();
+ if (this.templateCharCount == 0) {
+ endState();
+ String value = new String(this.templateString);
+ this.templateString = "";
+ TemplateTag parserTag = new TemplateTag();
+ return this.parseToken(value, parserTag);
+ }
+ return "";
+}
+
+<TEMPLATE>{templatestartchar} {
+ logger.finer("templatestartchar: " + yytext() + " (" + yystate() + ")");
+ String raw = yytext();
+ this.templateString += raw;
+ this.templateCharCount += raw.length();
+ if (this.templateString.equals("{{{")) {
+ // param, not a template
+ this.templateCharCount = 0;
+ endState();
+ String value = new String(this.templateString);
+ this.templateString = "";
+ return value;
+ }
+ return "";
+}
+
+<NORMAL>{templateparam} {
+ logger.finer("templateparam: " + yytext() + " (" + yystate() + ")");
+ String raw = yytext();
+ return raw;
+}
+
+<TEMPLATE>{whitespace} {
+ // no need to log this
+ String raw = yytext();
+ this.templateString += raw;
+ return "";
+}
+
+<TEMPLATE>. {
+ // no need to log this
+ String raw = yytext();
+ this.templateString += raw;
+ return "";
+}
+
+<NORMAL, TEMPLATE>{includeonly} {
+ logger.finer("includeonly: " + yytext() + " (" + yystate() + ")");
+ IncludeOnlyTag parserTag = new IncludeOnlyTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+<NORMAL, TEMPLATE>{noinclude} {
+ logger.finer("noinclude: " + yytext() + " (" + yystate() + ")");
+ NoIncludeTag parserTag = new NoIncludeTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+/* ----- wiki links ----- */
+
+<NORMAL>{imagelinkcaption} {
+ logger.finer("imagelinkcaption: " + yytext() + " (" + yystate() + ")");
+ WikiLinkTag parserTag = new WikiLinkTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+<NORMAL>{wikilink} {
+ logger.finer("wikilink: " + yytext() + " (" + yystate() + ")");
+ WikiLinkTag parserTag = new WikiLinkTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+/* ----- signatures ----- */
+
+<NORMAL>{wikisignature} {
+ logger.finer("wikisignature: " + yytext() + " (" + yystate() + ")");
+ WikiSignatureTag parserTag = new WikiSignatureTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+/* ----- comments ----- */
+
+<NORMAL>{htmlcomment} {
+ logger.finer("htmlcomment: " + yytext() + " (" + yystate() + ")");
+ HtmlCommentTag parserTag = new HtmlCommentTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+/* ----- other ----- */
+
+<WIKIPRE, PRE, NORMAL>{whitespace} {
+ // no need to log this
+ CharacterTag parserTag = new CharacterTag();
+ return this.parseToken(yytext(), parserTag);
+}
+
+<WIKIPRE, PRE, NORMAL>. {
+ // no need to log this
+ CharacterTag parserTag = new CharacterTag();
+ return this.parseToken(yytext(), parserTag);
+}
=====================================
src/test/projects/single-dir-test/src/main/jflex/preprocessor.jflex
=====================================
@@ -22,7 +22,7 @@ import org.springframework.util.StringUtils;
%init{
allowHTML = Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_HTML);
yybegin(NORMAL);
- states.add(new Integer(yystate()));
+ states.add(Integer.valueOf(yystate()));
%init}
/* code called after parsing is completed */
=====================================
src/test/projects/single-file-test/src/main/jflex/preprocessor.jflex
=====================================
@@ -22,7 +22,7 @@ import org.springframework.util.StringUtils;
%init{
allowHTML = Environment.getBooleanValue(Environment.PROP_PARSER_ALLOW_HTML);
yybegin(NORMAL);
- states.add(new Integer(yystate()));
+ states.add(Integer.valueOf(yystate()));
%init}
/* code called after parsing is completed */
View it on GitLab: https://salsa.debian.org/java-team/maven-jflex-plugin/-/commit/7ac5bf819e790eb7a43ee27a68e9ff6d65b74c6d
--
View it on GitLab: https://salsa.debian.org/java-team/maven-jflex-plugin/-/commit/7ac5bf819e790eb7a43ee27a68e9ff6d65b74c6d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20211119/ea4762f7/attachment.htm>
More information about the pkg-java-commits
mailing list