undefined section: << >> referenced from: @shadow arithmetic_operator.rb

6 views
Skip to first unread message

thyrsus

unread,
Oct 25, 2008, 2:54:14 AM10/25/08
to leo-editor
Folks who don't use leo don't feel the need to avoid having << and >>
on the same line.

Could there be an escape mechanism to represent those in
the .leo_shadow file?

Do the .leo_shadow files escape "@string" that might occur in the
originals?

- Stephen

thyrsus

unread,
Oct 25, 2008, 1:05:11 PM10/25/08
to leo-editor
Spurious sentinels get escaped with a preceding sentinel
#@verbatim

How much damage would I cause if I changed the meaning from "ignore
apparent following sentinel" to "append the following line verbatim to
the node body text"? Perhaps I could even introduce a directive
@verbatim that would cause leo to ignore both apparent directives and
section references in the immediately following line, implemented in
the .leo file by the #@verbatim sentinel. I've no idea how difficult
this will be.

- Stephen

Edward K. Ream

unread,
Oct 26, 2008, 7:29:46 AM10/26/08
to leo-e...@googlegroups.com
On Sat, Oct 25, 2008 at 1:54 AM, thyrsus <ssch...@acm.org> wrote:
>
> Folks who don't use leo don't feel the need to avoid having << and >>
> on the same line.
>
> Could there be an escape mechanism to represent those in
> the .leo_shadow file?

The only "escape" mechanism is that g.angleBrackets(s) will return s
surrounded by '<<' and '>>'.

I assume you mean that Leo's read and write code would provide a way
of saying, "ignore what looks like a section reference in this line
(or piece of code)".

Sorry, but that can never happen. More than 10 years ago now, when I
first discovered noweb and decided to base Leo's LP syntax on noweb, I
made an explicit decision not to support any of noweb's escape
conventions. This was based on my experience of trying to support
escape conventions in @root trees. It's a nightmare. I have never
once regretted this decision.

Edward

Daniel Clark

unread,
Oct 27, 2008, 9:46:54 PM10/27/08
to leo-e...@googlegroups.com
Edward K. Ream wrote:

So if I want to @shadow a file that has lines like:

cat << EOF >> cdebootstrap/suites

I'm just screwed? This is a pretty common idiom in shell scripts, and
would pretty much stop me from using Leo as my main editor, as I've been
intending on doing (or more likely cause me to do some awful
site-specific hack).

IMHO a better way of dealing with this would be to allow the user to
control the redefinition of "special" noweb characters, either
per-document, per-node, and/or in myLeoSettings.leo - e.g. I would think
pretty much zero languages that would be upset by '<<<' and '>>>' or
something like that (sort of similar to how python's """ operator is
usually pretty safe).

This is how a lot of template languages, that often have similar issues
with clashing with the syntax of the documents they are being used to
template, work - e.g.
http://www.cheetahtemplate.org/docs/users_guide_html_multipage/parserInstructions.compiler-settings.html

Cheers,
--
Daniel JB Clark | Sys Admin, Free Software Foundation
pobox.com/~dclark | http://www.fsf.org/about/staff#danny

signature.asc

Edward K. Ream

unread,
Oct 28, 2008, 7:46:10 AM10/28/08
to leo-e...@googlegroups.com
On Mon, Oct 27, 2008 at 8:46 PM, Daniel Clark <dcl...@pobox.com> wrote:

> So if I want to @shadow a file that has lines like:
>
> cat << EOF >> cdebootstrap/suites
>
> I'm just screwed?

You have several options, including:

1. Use @shadow and revise code to avoid << and >> on the same line.

2. Use @noref for "problematic" files.

3. Use one of several Leo plugins to manage script files. Consider
the read_only_nodes or at_folder plugins:
http://webpages.charter.net/edreamleo/plugins.html#nodes

Note: using some kind of escape mechanism for << and >> implies having
the ability to change (if only slightly) the contents of the file. If
you can do that, option 1 applies. If not, options 2 and 3 apply.

Edward

P.S. Longer term, some extensions to Leo could be considered.

A. Stephen suggests extending the role of the @verbatim *sentinel*.
An @verbatim *directive* would, unless I am mistaken, create an
@@verbatim sentinel. This could probably be made to work cleanly,
though it would imply significant changes to Leo's fundamental
read/write code.

But in your use case, it's not clear to me that adding @verbatim
directives would be preferable to putting << and >> on separate
lines...

B. Something like @shadow-noref, could have exactly the same read
logic as @shadow, and the same write logic as @noref. This would give
you an "escape" that applies to an entire file.

The @shadow algorithm will work with regardless of the meaning of '<<'
and '>>'. In fact, the fundamental @shadow algorithm knows nothing
about Leo section references or markup. It does know about sentinels,
but in a minimalist way. In fact this "lack of knowledge" is what
makes @shadow work so well. Bernhard Mulder's algorithm is pure
genius.

I am not eager to do either A or B, but I am not ruling them out completely.

EKR

Reply all
Reply to author
Forward
0 new messages