Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Jflex | 523 | 194 | 32 | 2 months ago | 12 | May 03, 2020 | 25 | other | Java | |
The fast scanner generator for Java™ with full Unicode support | ||||||||||
Masscan_to_nmap | 209 | a year ago | Python | |||||||
基于masscan和nmap的快速端口扫描和指纹识别工具,优化版本(获取标题,页面长度,过滤防火墙) | ||||||||||
Go Library Demo | 65 | 2 years ago | Go | |||||||
Go Library / Golang Library | ||||||||||
Lexertl14 | 47 | 21 days ago | 1 | C++ | ||||||
C++14 version of lexertl | ||||||||||
Gplex | 24 | 3 years ago | 1 | other | C# | |||||
GPLEX is a scanner generator which produces lexical scanners written in C# V2 or higher. The input language is similar to the original LEX specification language, but allows full 21-bit Unicode scanners to be specified. | ||||||||||
Hexameter | 14 | 5 years ago | 1 | Python | ||||||
Libraries and command-line tools for metrical analysis of epic Greek hexameter | ||||||||||
Haskdogs | 7 | 8 years ago | 2 | other | Haskell | |||||
Haskell ctags/etags generator | ||||||||||
Annoflex | 5 | 5 years ago | bsd-3-clause | Java | ||||||
An annotation-based code generator for lexical scanners | ||||||||||
Unicode Ranger | 3 | 6 years ago | mit | JavaScript | ||||||
A utility that scans URL contents and returns a unicode-range value! | ||||||||||
Psfisolate | 3 | 4 years ago | C | |||||||
Sample isolation tool for PSF1 files |
JFlex is a lexical analyzer generator (also known as scanner generator) for Java.
JFlex takes as input a specification with a set of regular expressions and corresponding actions. It generates Java source of a lexer that reads input, matches the input against the regular expressions in the spec file, and runs the corresponding action if a regular expression matched. Lexers usually are the first front-end step in compilers, matching keywords, comments, operators, etc, and generating an input token stream for parsers.
JFlex lexers are based on deterministic finite automata (DFAs). They are fast, without expensive backtracking.
For documentation and more information see the JFlex documentation and the wiki.
You need Maven 3.5.2 or later, and JDK 8 or later.
Place grammar files in src/main/flex/
directory.
Extend the project POM build section with the maven-jflex-plugin
<build>
<plugins>
<plugin>
<groupId>de.jflex</groupId>
<artifactId>jflex-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Voilà: Java code is produced in target/generated-sources/
during the generate-sources
phase
(which happens before the compile
phase) and included in the compilation scope.
You need ant, the binary JFlex jar and JDK 8 or later.
Define ant task
<taskdef classname="jflex.anttask.JFlexTask" name="jflex"
classpath="path-to-jflex.jar"/>
Use it
<jflex file="src/grammar/parser.flex" destdir="build/generated/"/>
<javac srcdir="build/generated/" destdir="build/classes/"/>
We provide a jflex rule
load("@jflex_rules//jflex:jflex.bzl", "jflex")
jflex(
name = "", # Choose a rule name
srcs = [], # Add input lex specifications
outputs = [], # List expected generated files
)
See the sample simple BUILD file.
You need the binary jflex jar and JDK 8 or later.
You can also use JFlex directly from the command line:
jflex/bin/jflex src/grammar/parser.flex
Or:
java -jar jflex-full-1.9.0.jar -d output src/grammar/parser.flex
See Build tool plugins.
Have a look at the sample project: simple and other examples.
JFlex is free software, contributions are welcome. See the Contributing page for instructions.
The top level directory of the JFLex git repository contains:
JFlex can be built with Bazel. Migration to Bazel is still work in progress, concerning the test suite, for instance.
You need Bazel.
bazel build //jflex:jflex_bin
This builds bazel-bin/jflex/jflex_bin
, that you can use
bazel-bin/jflex/jflex_bin --info
Or:
bazel run //jflex:jflex_bin -- --info
Build uberjar (aka fatjar aka deploy jar)
bazel build jflex/jflex_bin_deploy.jar
You need JDK 8 or later.
./mvnw install
This generates jflex/target/jflex-full-1.9.1-SNAPSHOT.jar
that you can use, e.g.
java -jar jflex-full-1.9.1-SNAPSHOT.jar --info