[TxMt] language grammars
sam aaron
sam.maillists at googlemail.com
Sun Oct 8 17:07:11 UTC 2006
Hi there,
I'm working on a particular form of yaml (called Feedback) which I'm
using as a way of marking up suggestions for documentation. It's still
in very early days (say, about 3 hours), but I'm having trouble
writing my own language grammar for it.
An example Feedback file currently looks like this:
thesis_author: chris
version: 1
commenter: sam
errata:
6:
para: 1
comments:
- suggestion: "_in which there are no jobs_, what are jobs?
Wouldn't it be simpler to just say that DynaSOAr (oh the pain of mixed
case acronyms!) only consists of services?"
para: 2
comments:
- query: "If you're capitalising Web service with capital W,
lower case s, why is 'Web Service Provider' all uppercase?"
- typo: "_who's responsibility is to recieve..._ should be
whose, and receive. Does LyX still not have a spell-checker? :-("
- typo: "_dynmaically_ should be dynamically"
- suggestion: "_The ability to dynmaically deploy services in
response to consumer requests without interruption to the invocation
gives considerable scope for different deployment patterns._ This
sentence needs breaking down."
This document describes some comments on paragraphs 1 and 2 of page 6
of chris's thesis. As you can see, there are currently three types of
comment, a query, suggestion and typo.
I would like the file to have all the features of yaml (inheriting
from the lovely yaml bundle), yet override certain things. I want
everything between underscores to be italicised (although this will
probably change due to code_variables), and I want the different types
of comment to be understood by the language grammar separately. I also
want certain keywords to be understood.
Attempting to implement these, I came up with the following:
{ scopeName = 'source.yaml.feedback';
fileTypes = ( 'feedback' );
patterns = (
{ name = 'markup.italic.feedback';
begin = '_';
end = '_';
},
{ name = 'keyword.control.feedback.suggestion';
begin = '- suggestion: "';
end = '"';
patterns = (
{ name = 'keyword.operator.feedback';
match = 'suggestion';
}
);
},
{ include = 'source.yaml'; },
);
}
However, I didn't get the behaviour I wanted. Nothing seems to be in
italics, the suggestion keyword is scoped as
'keyword.control.feedback.suggestion', and 'source.yaml.feedback'
only. There's no mention of 'keyword.operator.feedback'.
Is there anything obvious that I seem to be doing incorrectly? How is
it possible to get a bunch of characters to be scoped with different
names. I want to be able to write something like:
{ name = 'keyword.control.feedback';
match = '\b(suggestion|query|typo|technical)\b';
},
I'm sorry if I'm being a numpty with this!
Thanks in advance of any help,
Sam Aaron
More information about the textmate
mailing list