Skip to content

bkiers/pcre-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCRE parser

An ANTLR 4 grammar and parser for PCRE (Perl Compatible Regular Expressions).

To generate the parser classes, do a mvn clean install and then do something like this:

import nl.bigo.pcreparser.*;

// ...

String regex = "((.)\\1+ (?<YEAR>(?:19|20)\\d{2})) [^]-x]\\x";

PCRELexer lexer = new PCRELexer(CharStreams.fromString(regex));
PCREParser parser = new PCREParser(new CommonTokenStream(lexer));
ParseTree tree = parser.pcre();

// ...

To print an ASCII tree of the generated parse tree, see the Main class.

About

An ANTLR 4 grammar for PCRE

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published