Skip to content

Commit a9e7146

Browse files
archive vignettes
Update where easily possible, mark as outdated otherwise.
1 parent b590b8c commit a9e7146

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

vignettes/data_structures.Rmd renamed to vignettes/gsoc_proposal/data_structures.Rmd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ vignette: >
99
%\VignetteEncoding{UTF-8}
1010
---
1111

12-
This vignette illustrates how the core of `styler` currently[1] works,
13-
i.e. how rules are applied to a parse table and how limitations of this
14-
approach can be overcome with a refined approach.
12+
> This vignette is partly outdated since nested structure was implemented
13+
> completely.
14+
15+
This vignette illustrates how the core of `styler` currently^[at commit `e6ddee0f510d3c9e3e22ef68586068fa5c6bc140`] works, i.e. how
16+
rules are applied to a parse table and how limitations of this approach can be
17+
overcome with a refined approach.
1518

1619
Status quo - the flat approach
1720
------------------------------

vignettes/manipulating_nested_parse_data.Rmd renamed to vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,30 @@ vignette: >
88
%\VignetteEngine{knitr::rmarkdown}
99
%\VignetteEncoding{UTF-8}
1010
---
11+
> This vignette is partly outdated since nested structure was implemented
12+
> completely. In particular, the serialization is now done differently.
13+
1114
library("dplyr")
1215
library("purrr")
1316
pkgload::load_all()
1417

15-
This vignette builds on the vignette "Data Structures" and discusses how
16-
to go forward with the nested structure of the parse data. In order to
17-
compute the white space information in a nested data structure, we need
18-
a recursion. We use a [visitor
19-
approach](https://en.wikipedia.org/wiki/Visitor_pattern) to separate the
20-
algorithm (computing white space information) from the object (nested)
21-
data structure. The function `create_filler()` can then be used to add
22-
white space information on every level of nesting within the nested
23-
parse data if applied in combination with the visitor. `visitor()` takes
24-
a object to operate on and a list of functions. Each function is applied
25-
at the current level of nesting before the next level of nesting is
26-
entered.
2718

19+
This vignette builds on the vignette "Data Structures" and discusses how
20+
to go forward with the nested structure of the parse data.
21+
In order to compute the white space information in a nested data structure, we
22+
use a [visitor approach](https://en.wikipedia.org/wiki/Visitor_pattern) to
23+
separate the algorithm (computing white space information and later apply
24+
transformations) from the object (nested data structure).
25+
The function `create_filler()` can then be used to compute current
26+
white space information on every level of nesting within the nested parse data
27+
if applied in combination with the visitor. In the sequel, a parse table at
28+
one level of nesting will be denoted with the term *nest*, which always
29+
represents a complete expression. Our visiting functions `pre_visit()` and `post_visit()` take an object to
30+
operate on and a list of functions. Concretely, the object is the
31+
nested parse table. Each function is applied at each level of
32+
nesting nesting before the next level of nesting is entered. You can find out
33+
more about the visitor on the help file for `visit` (note that this function
34+
is not exported by styler).
2835
pre_visit
2936

3037
## function(pd_nested, funs) {
@@ -43,13 +50,19 @@ entered.
4350
## .init = pd_flat)
4451
## }
4552
## <environment: namespace:styler>
53+
This comes with two advantages.
4654

47-
This comes with two advantages.
4855

56+
* We go through the whole structure only as many times as we call the visitor
57+
(instead of every *_nested() function going through it once, which is more
58+
efficient in terms of speed.
59+
60+
4961
- We don't need a \*\_nested() version of every function we want to
5062
apply to the parse tables, in particular the rules in R/rules.R
51-
- We go through the whole structure only once (instead of every
52-
\*\_nested() function going through it once, which is more efficient
63+
- We go through the whole structure only as many times as we call the visitor
64+
(instead of every
65+
\*\_nested() function going through it once), which is more efficient
5366
in terms of speed.
5467

5568
`create_filler()` was adapted to also initialize indention and

0 commit comments

Comments
 (0)