Skip to content

Commit

Permalink
#14 \ebnf_square and \ebnf_brackets work
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 11, 2023
1 parent 9d1a640 commit e977747
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions naive-ebnf.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,15 @@
\regex_replace_all:nnN { ([^\ ])'([^\ ]) } {\1\\textquotesingle{}\2} \ebnf_tmp%
\regex_replace_all:nnN { ([^\ ])\|([^\ ]) } {\1\\textbar{}\2} \ebnf_tmp%
%
\regex_replace_all:nnN { \{\ ([^\}\{]+?)\ \} }%
{\c{ebnf@repetition}{\1}} \ebnf_tmp%
\regex_replace_all:nnN { \(\ ([^)(]+?)\ \) }%
{\c{ebnf@grouping}{\1}} \ebnf_tmp%
\regex_replace_all:nnN { \[\ ([^\]\[]+?)\ \] }%
{\c{ebnf@optional}{\1}} \ebnf_tmp%
\cs_new:Npn\ebnf_curled{\regex_replace_all:nnNT { \{\ ([^\}\{]+?)\ \} }%
{\c{ebnf@repetition}{\1}} \ebnf_tmp \ebnf_curled}%
\ebnf_curled%
\cs_new:Npn\ebnf_brackets{\regex_replace_all:nnNT { \(\ ([^)(]+?)\ \) }%
{\c{ebnf@grouping}{\1}} \ebnf_tmp \ebnf_brackets}%
\ebnf_brackets%
\cs_new:Npn\ebnf_squares{\regex_replace_all:nnNT { \[\ ([^\]\[]+?)\ \] }%
{\c{ebnf@optional}{\1}} \ebnf_tmp \ebnf_squares}%
\ebnf_squares%
\regex_replace_all:nnN { (<[^>]+?>\ :=) }%
{\c{makebox}[#1][r]{\1}} \ebnf_tmp%
\regex_replace_all:nnN { <(.+?)> }%
Expand Down

0 comments on commit e977747

Please sign in to comment.