Not signed in (Sign In)

Categories

Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorstudoot
    • CommentTimeFeb 15th 2007
     permalink

    Hi – I’ve generated a relatively simple bundle for Windows command/batch files – it includes a relatively simple grammar that conforms to my understanding of CMD syntax (comment lines, keywords, strings, pipes, variables) plus the only useful snippet I could think of – one for a simple ‘for’ statement. Anyway here’s a link (is there some central repository for bundles yet?):

    cmd.itBundle.zip

    PS – as a TextMate user, I like the way Intype’s going…

    • CommentAuthori
    • CommentTimeFeb 15th 2007
     permalink

    Thanks :) I’ll check out the bundle. And to your question, yes, there is a repository for bundles. :)

    • CommentAuthorstudoot
    • CommentTimeFeb 15th 2007
     permalink

    PS – I just realised I’d forgotten about case-insensitivity – that’s what comes of looking at the C grammar as a template. Anyway – I’ve updated the grammar in the zip at teh link in my previous post.

    • CommentAuthori
    • CommentTimeFeb 15th 2007
     permalink
    Mm.. you might want to change this (line 82):

    match: /\~\+\-\|\:\?\/\\\*\>\<\=\$\&\^\%\,\@/

    to a character class. Because that regex matches only this exact string:

    ~+-|:?/\*><=$&^%,@
    • CommentAuthorstudoot
    • CommentTimeFeb 15th 2007
     permalink

    You’re quite right – I’d meant to put ‘|’ between each operator character, then thought about a character class and ended up doing neither – DOH! Fortunately, operators are quite scarce in batch files. However, the operators need a bit more work/thought – the simple fix isn’t really acceptable, as it highlights wildcard patterns as operators – maybe I just leave operator characters plain.

    There’s also an error in the ‘keyword.level1.cmd’ scope – it matches things that should be matched by the keyword.level2.cmd and keyword.level3.cmd scopes.

    • CommentAuthorBen
    • CommentTimeFeb 15th 2007
     permalink

    Yes this is a known bug: Syntax match/capture bug

    It will/should be fixed in the next bugfix release.

    • CommentAuthori
    • CommentTimeFeb 15th 2007
     permalink

    studoot: There’s also an error in the ‘keyword.level1.cmd’ scope – it matches things that should be matched by the keyword.level2.cmd and keyword.level3.cmd scopes.

    This is because your ‘keyword.level1.cmd’ scope’s alternation includes ‘keyword.level2.cmd’ and ‘keyword.level3.cmd’‘s keyword matches. Patterns appearing lower does not override patterns appearing above it. I highlighted it in this post .

    For now, you can just reverse the definition of it, ie, putting level3 before level2 before level1. Oh, and another thing, the “swallow” rule is not supported in Intype.

    Replace:

    swallow = '\\.';

    with:

    patterns: [ { match: /\\./ } ]

    • CommentAuthorBrendonKoz
    • CommentTimeFeb 15th 2007
     permalink

    You know…the last time I tried that swallow switch, it didn’t actually work. Now I’ll have to see if I was just being stupid or if it just isn’t yet implemented once I go on my lunch break here at work. ;)

    Mmmm…soup.

    • CommentAuthorstudoot
    • CommentTimeFeb 15th 2007
     permalink

    idyllrain – sorry, I’ll have to try to be more precise in the future – I meant that there was an error in my syntax, NOT with how Intype was interpreting it :-)

    One other thing – what’s the best source of documentation for grammar contents? I’m just hacking with no real idea of what I’m doing :-) And I’d like to do an Ada bundle (‘cause I do some of that and snippets would be really cool for the verbose syntax constructs in Ada), and I’d like to sort of, well, have a clue before I start!

    •  
      CommentAuthortstrokes
    • CommentTimeFeb 15th 2007
     permalink

    Sutdoot: Here is the converted textmate Ada Bundle.
    This is in a very experimental stage. But you can give it a try. The docs are coming.

    • CommentAuthorstudoot
    • CommentTimeFeb 15th 2007
     permalink
    tstrokes: Excellent - I'll give that a workout and also get some snippets generated.
    • CommentAuthori
    • CommentTimeFeb 15th 2007
     permalink

    studoot: One other thing – what’s the best source of documentation for grammar contents? I’m just hacking with no real idea of what I’m doing :-) And I’d like to do an Ada bundle (‘cause I do some of that and snippets would be really cool for the verbose syntax constructs in Ada), and I’d like to sort of, well, have a clue before I start!

    Personally, I used the Textmate manual. The sections on snippets and language grammars , are particularly useful. You can get by just by using those (until we have a good reference of our own), and keeping in mind Intype’s differences, ie, in variables ($SELECTED_TEXT, $FILE_NAME, $FILE_PATH, $CURRENT_LINE), supported rule keys, and the like.

    • CommentAuthori
    • CommentTimeFeb 15th 2007
     permalink

    BrendonKoz: You know…the last time I tried that swallow switch, it didn’t actually work. Now I’ll have to see if I was just being stupid or if it just isn’t yet implemented once I go on my lunch break here at work. ;) Mmmm…soup.

    Mmm, let us know how it goes… :P

    • CommentAuthorstudoot
    • CommentTimeFeb 16th 2007
     permalink

    tstrokes – I’ve added some snippets for common Ada constructs (array, case, declare, elsif, for, function, if, package, procedure, record, when, while) and modified the Ada grammar (added a variable pattern, changed the numeric pattern to match Ada numeric literal rules) – the updated bundle is here.

    The snippets are all relatively straight forward. The package snippet uses the GNAT convention of ‘package name == filename’ (i.e. a.ads => package a) for the default name.

    •  
      CommentAuthordflock
    • CommentTimeMar 20th 2008
     permalink

    The link to the CMD.bundle at the top of this discussion seems to have disappeared but I managed to pull a corrupted partial copy out of the WayBack Machine

    My copy of zip managed to repair it, and I fixed the

    match: /[~+\-\|:?*&#62;&#60;=$&#38;\^%,\/@\\]/
    name: 'keyword.operator.cmd'
    

    bit on line 81, mentioned above.

    If anyone wants a copy, it’s available here