logginghandler/vendor/github.com/quasilyte/regex/syntax
Marvin Preuss d095180eb4
All checks were successful
continuous-integration/drone/push Build is passing
build: uses go modules for tool handling
2022-01-14 13:51:56 +01:00
..
ast.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
errors.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
go.mod build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
lexer.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
LICENSE build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
operation_string.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
operation.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
parser.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
pos.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
README.md build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
tokenkind_string.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00
utils.go build: uses go modules for tool handling 2022-01-14 13:51:56 +01:00

Package regex/syntax

Package syntax provides regular expressions parser as well as AST definitions.

Rationale

There are several problems with the stdlib regexp/syntax package:

  1. It does several transformations during the parsing that make it hard to do any kind of syntax analysis afterward.

  2. The AST used there is optimized for the compilation and execution inside the regexp package. It's somewhat complicated, especially in a way character ranges are encoded.

  3. It only supports re2 syntax. This parser recognizes most PCRE operations.

  4. It's easier to extend this package than something from the standard library.

This package does almost no assumptions about how generated AST is going to be used so it preserves as much syntax information as possible.

It's easy to write another intermediate representation on top of it. The main function of this package is to convert a textual regexp pattern into a more structured form that can be processed more easily.