[TxMt] Re: Grammar Questions

Jeremy Whitlock jcscoobyrs at gmail.com
Mon Oct 21 17:31:08 UTC 2013


Hello all,
    One more question about inheritance.  I see that the JavaScript grammar
has "comment.block.html.js" as a group.  While it's invalid, as you can't
have XML/HTML comments in JavaScript code even for embedded script content,
it does bring up this question:

* Who owns extensions to inherited grammars, the embedding grammar (HTML)
or the embedded grammar (JavaScript)?  (To answer this, assume that the
group above is legit.  I'd expect HTML to provide this extension to the
JavaScript grammar but what I'm seeing is that the JavaScript grammar has
to know it can be embedded by HTML and to provide the HTML extensions.)

Take care,

Jeremy


On Mon, Oct 21, 2013 at 11:27 AM, Jeremy Whitlock <jcscoobyrs at gmail.com>wrote:

> Hello all,
>     I've been cleaning up the JavaScript grammar and as I get started on
> this next round of cleanups, I've run into some inconsistencies in the
> grammar that have led to the following questions:
>
> * When adding a language specific implementation of a grammar group, like
> comment.block for JavaScript, should the name of the group be comment.block
> (expected) or comment.block.js (What's there now)?  (I can't tell if I use
> the name that corresponds with the root group, comment.block, or if I add
> the language name to the end like comment.block.js.)
>
> * Is there a way to have certain grammar features enabled based on the
> existence, or lack of, a certain "enabler" in the file?  (For example,
> JavaScript has a strict mode to mark extra words as keywords due to
> potential plans for supporting them as keywords in the future.  That being
> said, if you have "use strict;" in your file, certain keywords should be
> scoped that wouldn't be otherwise *and* variable names with those keywords
> should be marked as invalid.)
>
> * Why isn't 'null' treated as a constant like undefined/Infinity/NaN?
>  Right now it's constant.language.null.js but I'd expect it to be
> constant.language.js.
>
> These questions, while specifically about JavaScript's implementation, are
> really general questions about naming, feature enablement and what defines
> when you break away from root groups and define your own groups.  Any help
> would be appreciated.
>
> --
> Take care,
>
> Jeremy Whitlock (@whitlockjc on Twitter)
> http://www.thoughtspark.org
>



-- 
Take care,

Jeremy Whitlock (@whitlockjc on Twitter)
http://www.thoughtspark.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20131021/04c1f9c3/attachment.html>


More information about the textmate mailing list