On Jan 31, 9:53 am, "Edward K. Ream" <[email protected]> wrote:

> Thanks.  That will help.  No doubt the problem is the code that
> calculates the path to be created.  This can get complicated,
> especially on Windows.

OMG.  After an hour of tracing I have found the problem.  It is this
@path statement:

@path: C:\Dokumente und Einstellungen\VR\Eigene Dateien\Tools\Leo

This specifies the following path:

: C:\Dokumente und Einstellungen\VR\Eigene Dateien\Tools\Leo

Notice the two leading characters: ':' and ' '.  This is indeed an
invalid path!!

This is *so* easy to miss.  Both you and I did so repeatedly.

But how is Leo supposed to deal with this hard-to-find error?

The detection of the @path directive happens in get_directives using a
regex.  When the regex succeeds, we could look for unexpected
characters after the Leo directive: in this case the colon. We could
solve this problem (I think), by adding \s to the regex in
compute_directives_re.  That is, change:

     aList = ['^...@%s' % z for z in globalDirectiveList if z !=
'others']

to:

    aList = ['^...@%s\s' % z for z in globalDirectiveList if z !=
'others']

If we do this, there is no way to give a warning about the ':'
disabling the directive.

We could give a warning if we *don't* change the regex, but that won't
work for two reasons:

1. [Livable] If we give an warning, that warning will occur many
times.  There is no easy way to avoid those complications.  But this
issue is moot, because...

2. [Intolerable] The warning would be given for valid Python
decorators, such as @pathx(!!).  We can not allow this.

So it looks like the best solution as follows:

- I'll change the regex so that g. get_directives will *silently*
ignore anything that looks like a Leo directive but that "doesn't end
well".

- I'll change Leo's qt and tk syntax colorer so that directives must
end properly.

I think this will be an effective solution.  The syntax colorer will
provide a better clue that something is amiss, and strange @path
directives will not cause confusion.

Ah, the existential pleasures of engineering :-)  You gotta love this
stuff.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to