The first message on https://forums.livecode.com/viewtopic.php?f=7&t=35686 shows what the nodes look like when first analyzed. I have to manually untangled them using the code for moving the nodes that I posted there.
I would love to see an algorithm to layout the nodes automatically to remove the crossings of the dependency lines. The manual move part of this problem is solved - now I’m looking for intelligent sorting and moving.
Suggestions?
Parsing scripts for comments
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Parsing scripts for comments
Hello Stam,
Behind the scene, what makes sense is that we must catch strings
to be able to match comments without false positives.
Then the only way, AFAIK is to redirect strings patterns and comments patterns in 2 different slots.
This is doable by using back references in the replacement text.
Now, getting rid off all comments is as simple as that:
Code: Select all
on fun aStr, aComment
if aStr is not empty then return aStr
return empty
end fun
....
if sunnYreplace( T, rex, "?{ fun \1 \2 }", newTxt) then
put newTxt into fld "Fout"
else
put "no match: " into fld "Fout"
end if
Happy coding,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: Parsing scripts for comments
Thanks once again Thierry.
I was thinking I’d need to put the text into a container, delete all text within quotes then do a regex search for all the different comment structures... by as usual you put it much more elegantly and succinctly!
Re: Parsing scripts for comments
and after a long sleep and a nice coffee, I end up with this one-liner.
Still the same regex.
Code: Select all
-- Parsing scripts for comments
if sunnYreplace( fld "IN", rex, "\1", newTxt) then \
put newTxt into fld "OUT"
and coming back later open up our mind...
Kind regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!