From 14f6169fcf5c34455c21ca80850eeb5652a85e4a Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 13 Nov 2020 16:55:39 +0000 Subject: Document subset of BNF for regex engine Adding some documentation for my future self. --- scratch/facebook/parsing/regex.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scratch/facebook/parsing/regex.py') diff --git a/scratch/facebook/parsing/regex.py b/scratch/facebook/parsing/regex.py index e0757e1f788f..7fc2ef34e2ff 100644 --- a/scratch/facebook/parsing/regex.py +++ b/scratch/facebook/parsing/regex.py @@ -3,6 +3,16 @@ # - parser # - compiler # ...for regex. +# +# BNF +# expression -> ( char_class | CHAR ) quantifier? ( "|" expression )* +# char_class -> "[" CHAR+ "]" +# quantifier -> "?" | "*" | "+" | "{" INT? "," INT? "}" +# +# Of the numerous things I do not support, here are a few items of which I'm +# aware: +# - alternatives: (a|b) +# - capture groups: (ab)cd from parser import Parser import string -- cgit 1.4.1