Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peek regex #779

Merged
merged 26 commits into from Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5493354
Implement \peek_analysis_map_inline:n
Jul 14, 2020
7384c1e
Document \peek_analysis_map_inline:n in the right place
Jul 16, 2020
b660b88
Documentation and internal names
Jul 11, 2020
8b0b01c
Change signature of an auxiliary
Jul 12, 2020
580a4ac
Get/set range of intarray entries
Jul 12, 2020
ab4ce5e
Add regex test file
Jul 12, 2020
cf36ec4
Remove one use of toks in l3regex (for submatch information)
Jul 12, 2020
cd7d2ac
Refactor an auxiliary
Jul 12, 2020
7b9aea8
Reduce constraints on some integers since toks have fewer uses in l3r…
Jul 12, 2020
e099fc2
Add test
Jul 12, 2020
97eaad9
In l3regex keep track of the current token as \l_@@_curr_token_tl
blefloch Jul 17, 2020
0c6fda8
In l3regex, loop through tokens one by one rather than matches
blefloch Jul 17, 2020
0a171b2
Remove further use of toks while matching in l3regex
josephwright Dec 3, 2020
527044c
Use l3tl-build machinery when storing already-seen tokens in l3regex
blefloch Jul 18, 2020
ba2cce8
Internal change to how begin/end anchors are implemented
blefloch Jul 19, 2020
f9f0a45
In l3regex, set \l_@@_max_pos_int as late as possible
blefloch Jul 19, 2020
09f7033
Remove spurious section heading
blefloch Jul 19, 2020
939d60a
Minor code cleanup in l3regex (min_pos)
blefloch Jul 19, 2020
d792e59
Implement \peek_regex:nTF and \peek_regex_remove:nTF
blefloch Jul 20, 2020
cecde34
Update an intarray test file since l3regex uses fewer intarray vars
blefloch Jul 20, 2020
7b4eb6c
Avoid \show in l3regex test file to avoid LuaTeX-specific tlg
blefloch Jul 20, 2020
2856537
Document the code of \peek_regex:nTF and \peek_regex_remove:nTF
blefloch Jul 21, 2020
07c96d3
Implement, document, and test \peek_regex_replace_once:nnTF
blefloch Jul 23, 2020
67fb811
Typo in code doc
blefloch Jul 23, 2020
e9bee86
Rename \peek_regex_remove:nTF to \peek_regex_remove_once:nTF
blefloch Jul 23, 2020
c390337
Track luatexja changes
josephwright Dec 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/testfiles/ctex002.luatex.tlg
Expand Up @@ -3,8 +3,8 @@ Don't change this file in any respect.
(load cache: extra_lmromanslant10-regular.luc)
LaTeX Font Info: Font shape `LTJY3/FandolSong-Regular(0)/m/sl' in size <10.53937> not available
(Font) Font shape `LTJY3/FandolSong-Regular(0)/m/it' tried instead on input line ....
luaotfload | aux : font no 38 (nil) does not define feature vert for script latn with language dflt
luaotfload | aux : font no 38 (nil) does not define feature vrt2 for script latn with language dflt
luaotfload | aux : font no 36 (nil) does not define feature vert for script latn with language dflt
luaotfload | aux : font no 36 (nil) does not define feature vrt2 for script latn with language dflt
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0, direction TLT
.\whatsit4=[]
Expand Down
2 changes: 2 additions & 0 deletions l3kernel/CHANGELOG.md
Expand Up @@ -9,6 +9,8 @@ this project uses date-based 'snapshot' version identifiers.

### Added
- `\peek_analysis_map_inlione:n`
- `\peek_regex:nTF`, `\peek_regex_remove_once:nTF`, and
`\peek_regex_replace_once:nnTF`

### Unchanged
- Extend `\text_expand:n` to cover `\@protected@testopt`
Expand Down
45 changes: 45 additions & 0 deletions l3kernel/l3intarray.dtx
Expand Up @@ -461,6 +461,51 @@
% \end{macro}
% \end{macro}
%
% \begin{macro}[rEXP]{\__kernel_intarray_range_to_clist:Nnn, \@@_range_to_clist:ww}
% Loop through part of the array.
% \begin{macrocode}
\cs_new:Npn \__kernel_intarray_range_to_clist:Nnn #1#2#3
{
\exp_last_unbraced:Nf \use_none:n
{
\exp_after:wN \@@_range_to_clist:ww
\int_value:w \int_eval:w #2 \exp_after:wN ;
\int_value:w \int_eval:w #3 ;
#1 \prg_break_point:
}
}
\cs_new:Npn \@@_range_to_clist:ww #1 ; #2 ; #3
{
\if_int_compare:w #1 > #2 \exp_stop_f:
\prg_break:n
\fi:
, \__kernel_intarray_item:Nn #3 {#1}
\exp_after:wN \@@_range_to_clist:ww
\int_value:w \int_eval:w #1 + \c_one_int ; #2 ; #3
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\__kernel_intarray_gset_range_from_clist:Nnn, \@@_gset_range:Nw}
% Loop through part of the array.
% \begin{macrocode}
\cs_new_protected:Npn \__kernel_intarray_gset_range_from_clist:Nnn #1#2#3
{
\int_set:Nn \l_@@_loop_int {#2}
\@@_gset_range:Nw #1 #3 , , \prg_break_point:
}
\cs_new_protected:Npn \@@_gset_range:Nw #1 #2 ,
{
\if_catcode:w \scan_stop: \tl_to_str:n {#2} \scan_stop:
\prg_break:n
\fi:
\__kernel_intarray_gset:Nnn #1 \l_@@_loop_int {#2}
\int_incr:N \l_@@_loop_int
\@@_gset_range:Nw #1
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\intarray_show:N, \intarray_show:c, \intarray_log:N, \intarray_log:c}
% Convert the list to a comma list (with spaces after each comma)
% \begin{macrocode}
Expand Down
25 changes: 25 additions & 0 deletions l3kernel/l3kernel-functions.dtx
Expand Up @@ -207,6 +207,31 @@
% the \cs{intarray_count:N}, lest a low-level \TeX{} error occur.
% \end{function}
%
% \begin{function}[rEXP, added = 2020-07-12]{\__kernel_intarray_range_to_clist:Nnn}
% \begin{syntax}
% \cs{__kernel_intarray_range_to_clist:Nnn} \meta{intarray~var} \Arg{start index} \Arg{end index}
% \end{syntax}
% Converts to integer denotations separated by commas the entries of
% the \meta{intarray} from positions \meta{start index} to \meta{end
% index} included. The \meta{start index} and \meta{end index} must
% be suitable for a direct assignment to a \TeX{} count register, must
% be between $1$ and the \cs{intarray_count:N}, and be suitably
% ordered. All tokens have category code other.
% \end{function}
%
% \begin{function}[added = 2020-07-12]{\__kernel_intarray_gset_range_from_clist:Nnn}
% \begin{syntax}
% \cs{__kernel_intarray_gset_range_from_clist:Nnn} \meta{intarray~var} \Arg{start index} \Arg{integer clist}
% \end{syntax}
% Stores the entries of the \meta{clist} as entries of the
% \meta{intarray~var} starting from the \meta{start index}, upwards.
% This is done without any bound checking. The \meta{start index} and
% all entries of the \meta{integer comma list} (which do not undergo
% space trimming and brace stripping as in normal clist mappings) must
% be suitable for a direct assignment to a \TeX{} count register. An
% empty entry may stop the loop.
% \end{function}
%
% \begin{function}{\__kernel_ior_open:Nn, \__kernel_ior_open:No}
% \begin{syntax}
% \cs{__kernel_ior_open:Nn} \meta{stream} \Arg{file name}
Expand Down