Re: [code] Need advice for snippet.

From: Mitchell <m.att.foicica.com>
Date: Tue, 19 Jan 2016 11:32:58 -0500 (EST)

Hi Michael,

On Tue, 19 Jan 2016, Michael Richter wrote:

> I'm trying to make a snippet to give me some standardized format for Prolog
> predicates. The snippet looks like this:
>
> %%! %1(NAME)(%2(ARGUMENTS)) is %3{det,semidet,failure,nondet,multi}
> %%
> %% %4(DESCRIPTION)
> %1(%2) :-
> %0
>
> The problem is the second-to-last line. "%1(%2)" expands into just the
> contents of "%2" and nothing else. "%1 (%2)" expands as expected, but this
> is, unfortunately, a syntax error in Prolog. How would I go about getting
> what I want such that if "%1" is "foo" and "%2" is "Bar" I'll generate
> "foo(Bar) :-" in that second-to-last line?

You need to escape the parenthesis after '%1' because it is being
interpreted as a placeholder instead of a mirror:

   '%1%(%2)'

(Note you do not need to escape the closing parenthesis).

HOWEVER, there is a bug in handling those kinds of escapes that I have
just committed a fix for[1]. It will be in the next nightly.

Cheers,
Mitchell

[1]: http://foicica.com/hg/textadept/rev/804166eb0af6

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 19 Jan 2016 - 11:32:58 EST

This archive was generated by hypermail 2.2.0 : Wed 20 Jan 2016 - 06:36:09 EST