moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
395 stars 26 forks source link

fix prefix argument! #39

Closed moodymudskipper closed 3 years ago

moodymudskipper commented 3 years ago

looks like it's broken.

Should work with prefix = "#", prefix = "##", prefix = "#]"

moodymudskipper commented 3 years ago

It works fine for "normal" use, but some weirdness happens comments are found in a call, for instance :

test <- function(){
  # a
  identity({
    # b
    1
  })
}
flow::flow_view(test, prefix = "#")

And this will fail

test <- function(){
  # a
  identity(
    # b
    1
  )
}
flow::flow_view(test, prefix = "#")
#> Error in str2lang(src): <text>:5:5: unexpected numeric constant
#> 4: `#`("# b")
#> 5:     1
#>        ^
moodymudskipper commented 3 years ago

Thus the feature is not really broken, it's just a wrong use of header comments, but we should either have an explicit error, or just ignore the improper header comments, I prefer the latter.

moodymudskipper commented 3 years ago

The latter case's ultimate test case is :

test <- function(){
  # a
  c(
    # b
    # c
    1,
    # d
    # e
    2
    # f
    # g
    ,3
    # h
    # i
  )
}
moodymudskipper commented 3 years ago

closed by https://github.com/moodymudskipper/flow/commit/f090f0dd455046bde997c2fe1df0ed94ceb524ab and https://github.com/moodymudskipper/flow/commit/c874349b094814eb54b62934d62e4700c5376505

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.