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.StringDEFAULT_NAMEprivate static intINCLUDE_DIRECTIVE_ARG_OFFSETprivate static java.util.regex.PatternINCLUDE_DIRECTIVE_MATCHER
-
Constructor Summary
Constructors Modifier Constructor Description privateLexSimpleAnalyzerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringguessClass(java.lang.String line)private static java.lang.StringguessIncluded(java.lang.String line)private static java.util.Set<java.io.File>guessIncludes(java.io.File file)Processes a file for%includedirectives.private static java.lang.StringguessPackage(java.lang.String line)(package private) static SpecInfoguessSpecInfo(java.io.File lexFile)Guesses package and class name, and%includefiles, based on this grammar definition.(package private) static SpecInfoguessSpecInfo(java.io.Reader lexFileReader, java.io.File lexFile)Guesses package and class name, and%includefiles, 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%includedirectives.(package private) static java.util.Set<java.lang.String>parseIncludes(java.io.Reader fileReader)Parses input for%includedirectives.
-
-
-
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%includefiles, 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%includefiles, 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%incudes.- Returns:
- collected info about this lex spec.
- Throws:
java.io.IOException- when an IO exception occurred while processing the reader. Ignores IO errors for%incudefiles.
-
guessIncludes
private static java.util.Set<java.io.File> guessIncludes(java.io.File file)
Processes a file for%includedirectives.- Parameters:
file- the lex file to process.- Returns:
- the set of files (recursively) mentioned in
%includes.
-
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%includedirectives.- Parameters:
file- the file to process; itself assumed to be an%includeor 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
%includes.
-
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.IOExceptionParses input for%includedirectives.- Parameters:
fileReader- the input- Returns:
- the set of path names mentioned after
%includedirectives 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)
-
-