[TxMt] Grammar ?bug? - incompatible TM 1.5 grammar issue

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Apr 9 17:25:15 UTC 2014


Hi,
[sorry, a bit complicated]

my bundle "R Console (Rdaemon)" ships with a grammar called "LaTeX Rdaemon" which works under TM 1.5 without problems but under TM 2.0 it fails partially.

It a bit complicated that's why a bit background information:
This grammar allows the users to write a normal LaTeX document with an interactive R Console running inside of the LaTeX document. [a kind of interactive Sweaving]

Here a minimal tex example:
-------
% Preamble (fold)

\documentclass[11pt]{article}  
\usepackage{blindtext}
\usepackage{verbatim}
\newenvironment{Rdaemon}{\comment}{\endcomment} % R code invisible

\begin{document}

\section{First section}

\blindtext

\begin{Rdaemon}
> runif(10,min=0,max=1) 
\end{Rdaemon}

\section{Second Section}
\blindtext

\end{document}
-------

Everything between \begin{Rdaemon} and \end{Rdaemon} should controlled by the "R Console (Rdaemon)" bundle scope: 'source.rd.console' and its output will be syntax highlighted via 'source.r' which works under TM 2.0.

If I place the caret after "runif(10,min=0,max=1)" and press ENTER "runif(10,min=0,max=1)" will be sent to R und the result will be inserted like:

-------
...
\blindtext

\begin{Rdaemon}
> runif(10,min=0,max=1) 
 [1] 0.482648455 0.874794168 0.904718875 0.585969825 0.859514066 0.865195652 0.003995807 0.904800528
 [9] 0.918498771 0.158369060
> 
\end{Rdaemon}

\section{Second Section}
...
-------

Fine, but for some reasons in TM 2.0 the end tag "\end{Rdaemon}" isn't recognized. I looked into that and it seems to me that the grammar definition of 'source.rd.console.prompt' in "R Console (Rdaemon)" "eats" the entire rest of the tex document:

{	name = 'source.rd.console.prompt';
	begin = '^[>+:] ';
	end = '\n\z';
	beginCaptures = { 0 = { name = 'keyword.other.embedded.rd.console'; }; };
	patterns = ( { include = 'source.r'; } );
},

[well at least it's my finding ;)]

Correct:



but in TM 2.0 it looks like:



Is anyone out there who can help me fixing it?

Thanks a lot,
Hans

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20140409/424bf1e3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: correct.png
Type: image/png
Size: 37386 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20140409/424bf1e3/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: incorrect.png
Type: image/png
Size: 42061 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20140409/424bf1e3/attachment-0003.png>


More information about the textmate mailing list