Package jflex.maven.plugin.jflex
Class LexSimpleAnalyzerUtils
- java.lang.Object
-
- jflex.maven.plugin.jflex.LexSimpleAnalyzerUtils
-
class LexSimpleAnalyzerUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
DEFAULT_NAME
private static int
INCLUDE_DIRECTIVE_ARG_OFFSET
private static java.util.regex.Pattern
INCLUDE_DIRECTIVE_MATCHER
-
Constructor Summary
Constructors Modifier Constructor Description private
LexSimpleAnalyzerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
guessClass(java.lang.String line)
private static java.lang.String
guessIncluded(java.lang.String line)
private static java.util.Set<java.io.File>
guessIncludes(java.io.File file)
Processes a file for%include
directives.private static java.lang.String
guessPackage(java.lang.String line)
(package private) static SpecInfo
guessSpecInfo(java.io.File lexFile)
Guesses package and class name, and%include
files, based on this grammar definition.(package private) static SpecInfo
guessSpecInfo(java.io.Reader lexFileReader, java.io.File lexFile)
Guesses package and class name, and%include
files, based on this grammar definition.(package private) static java.util.Set<java.io.File>
mapFiles(java.util.Set<java.lang.String> set, java.io.File parent)
Resolves path names relative to parent.private static java.util.Set<java.io.File>
nestedIncludes(java.util.Set<java.io.File> seen, java.io.File file)
Recursively processes a file for%include
directives.(package private) static java.util.Set<java.lang.String>
parseIncludes(java.io.Reader fileReader)
Parses input for%include
directives.
-
-
-
Field Detail
-
DEFAULT_NAME
static final java.lang.String DEFAULT_NAME
- See Also:
- Constant Field Values
-
INCLUDE_DIRECTIVE_MATCHER
private static final java.util.regex.Pattern INCLUDE_DIRECTIVE_MATCHER
-
INCLUDE_DIRECTIVE_ARG_OFFSET
private static final int INCLUDE_DIRECTIVE_ARG_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
guessSpecInfo
static SpecInfo guessSpecInfo(java.io.File lexFile) throws java.io.IOException
Guesses package and class name, and%include
files, based on this grammar definition.- Parameters:
lexFile
- the lex spec to process- Returns:
- collected info about this lex spec.
- Throws:
java.io.FileNotFoundException
- if the lex file does not existjava.io.IOException
- when an IO exception occurred while reading a file.
-
guessSpecInfo
static SpecInfo guessSpecInfo(java.io.Reader lexFileReader, java.io.File lexFile) throws java.io.IOException
Guesses package and class name, and%include
files, based on this grammar definition.- Parameters:
lexFileReader
- reader for lex spec to processlexFile
- the lex spec to process, used for relative path name resolution of%incude
s.- Returns:
- collected info about this lex spec.
- Throws:
java.io.IOException
- when an IO exception occurred while processing the reader. Ignores IO errors for%incude
files.
-
guessIncludes
private static java.util.Set<java.io.File> guessIncludes(java.io.File file)
Processes a file for%include
directives.- Parameters:
file
- the lex file to process.- Returns:
- the set of files (recursively) mentioned in
%include
s.
-
nestedIncludes
private static java.util.Set<java.io.File> nestedIncludes(java.util.Set<java.io.File> seen, java.io.File file)
Recursively processes a file for%include
directives.- Parameters:
file
- the file to process; itself assumed to be an%include
or lex file. Path names in the file are relative to the file location.seen
- the set of files seen so far, to avoid following cycles.- Returns:
- the set of files (recursively) mentioned in
%include
s.
-
mapFiles
static java.util.Set<java.io.File> mapFiles(java.util.Set<java.lang.String> set, java.io.File parent)
Resolves path names relative to parent.- Parameters:
set
- a set of relative path namesparent
- the parent file of these path names- Returns:
- the set of files relative to
parent
-
parseIncludes
static java.util.Set<java.lang.String> parseIncludes(java.io.Reader fileReader) throws java.io.IOException
Parses input for%include
directives.- Parameters:
fileReader
- the input- Returns:
- the set of path names mentioned after
%include
directives in the input. - Throws:
java.io.IOException
-
guessClass
@Nullable private static java.lang.String guessClass(java.lang.String line)
-
guessPackage
@Nullable private static java.lang.String guessPackage(java.lang.String line)
-
guessIncluded
@Nullable private static java.lang.String guessIncluded(java.lang.String line)
-
-