Gary Fixler wrote: > Thanks for finding that, Phil. Every bit helps me understand this > syntax stuff more. I did search, but didn't find anything, but > imagined someone, somewhen must have typed something up. I hope you > won't feel I'm stepping on your toes. I had looked a few times in the > past, as well, and never found anything. > > I'll have to obligatorily point out a few things not solved in your > code of '03 that are solved in the new stuff I posted (sorry!): thats fine :) what you have is superior, the documentation on the highlighting back in the day was a bit complex for me. > > * you're missing most of the functions (e.g. acos, and fup), though > I'm betting they didn't even exist in '03 :) they were not there > > * you're matching any 'g' followed by any number of any digits. This > will match even things like g5 (no such creature), and g3098238124. > Also, the \d (digit) regex pattern doesn't match a literal '.', > meaning none of the dotted g-codes will be matched (e.g. g59.1), and > it looks like it'll match them even if you end up with something > cuddling it, so e.g. adg40135.23 would match the g40135 portion in the > middle of that, even though it would be a big error to EMC. I was using it with fanuc files > > I tried all manner of simplifying this regex stuff for the g-codes, > but opted in the end to treat them all as whole keywords, in a long > list of g0, g1, etc., and even g00, g01, because some people seem to > like to pad them all to matching 2-digit form. Trying to bring that > down to a fancy one-off pattern that fit the bill for all of these > wildly different, skipping-around numbers was seemingly impossible, > and it would make adding new codes, or even something like a pad-to-3 > system later really complicated. Brute force found its place for me here. same, I never forced the issue much, most of the people at that time were more interested in a highlighter for midnight commander. > > * as above for m-codes > > * line numbers match even if not first, separate, non-whitespace > blocks on line > > * special comments (print, debug, msg, log stuff) aren't treated as > different from usual comments, so they won't stand out, or let you > know you've typed them properly. > > * I'm not sure why you have 2 comment matchers in 2 styles (match, and > region), but both do roughly the same thing. Am I missing something > important here? I think that was just related to trying to figure out how the .vim files worked > > Your version stuff is quite interesting. I have whatever Hardy has > given me, and as such what I presume is about the latest Vim. I tend > to grab the latest of everything, and forget about older versions, > which isn't very Linux-friendly of me. If I get a chance, I'll look > into what makes things viable in certain versions as of 2008. I just > went with the instructions as they are currently in the Vim docs about > how to make a properly formatted syntax file currently. > > I'd like to send this off to Bram Moolenaar, the maintainer (he asks > for them if you make one), but don't feel it's ready, for 2 big reasons: > > 1) this hasn't really been tested by any of us yet, so it's probably > rife with unseen errors (Dave's having trouble already), and gotchas, > and exceptions, and I think your install method is a bit off. the ngc.vim file belongs in the /usr/share/vim/vim71/syntax dir
then your au line belongs in /usr/share/vim/vim71/filetype.vim file I guess a home/user/.vim directory would also work but I never really tried that > > 2) NGC is different for every program that uses it. Everyone has their > own implementation it would seem. I tried loading some of my EMC2 into > a 3D visualizer for NGC, and it failed on just about everything. > Reading NGC from other programs looks like an alien language to me. > Right now I'm presuming EMC2's version of RS274/NGC, but I've really > wanted to point that out in the syntax. E.g. right now I have this in > the syntax file header: > > " Language: RS274/NGC > > > I'd really prefer that to be something along the lines of: > > " Language: RS274/NGC for EMC2 > > or even: > " Language: RS274/NGC for The Enhanced Machine Controller 2 > either of those seem solid to me > > > :) I feel especially this way given that Vim is an international > product. Maybe it would even be turned on via: > > :set syntax=emc2 > > or: > > : set syntax=emc2ngc > > You know, just to really properly define what exactly it is. > > Thanks much for your old code! It's full of things I don't know (like > that \c 'ignore whitespace' character - good stuff), but will now > attempt to. > > -g > > On Sun, Jun 1, 2008 at 9:37 AM, phil <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > found a copy, maybe you can use some of this Gary. > " Vim syntax file > " Language: CNC file > " Maintainer: Phillip Smith <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> > " Last Change: 2003 August 02 > > " For version 5.x: Clear all syntax items > " For version 6.x: Quit when a syntax file was already loaded > > > if version < 600 > syntax clear > elseif exists("b:current_syntax") > finish > endif > > "Things to match > syn keyword parametric sqrt tan sin cot > syn match gcodes "\cg\d\+" > syn match mcodes "\cm\d\+" > syn match linenumbers "\cn\d\+" > syn match parametric "\a#\d\+" > syn match parametric "\*" > syn match ngcComment "^(.*" > syn match ngcComment "\s).*" > syn match parametric "\[" > syn match parametric "\]" > syn region parametrics matchgroup=parametric start=/\[/ end=/\]/ > contains=parametric > syn region ngcComment start=/(/ end=/)/ > syn region xyz start=/\c[xyzrjkht]/ > end=/\d\d\.\d\+\|\d\.\d\+\|\d\+\|\d/ > syn region feed start=/\cf/ > end=/\d\d\.\d\+\|\d\.\d\+\|\d\+\|\d/ > syn region speed start=/\cs/ > end=/\d\d\.\d\+\|\d\.\d\+\|\d\+\|\d/ > > " Define the default highlighting. > " For version 5.7 and earlier: only when not done already > " For version 5.8 and later: only when an item doesn't have > highlighting yet > > if version >= 508 || !exists("did_ngc_syntax_inits") > if version < 508 > let did_ngc_syntax_inits = 1 > command -nargs=+ HiLink hi link <args> > else > command -nargs=+ HiLink hi def link <args> > endif > > > HiLink gcodes Type > HiLink mcodes Identifier > HiLink linenumbers Statement > HiLink parametric Include > HiLink parametrics Include > HiLink xyz Title > HiLink ngcComment Comment > HiLink feed LineNr > HiLink speed LineNr > > delcommand HiLink > endif > > let b:current_syntax = "ngc" > > " vim: ts=8 sw=2 > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > ------------------------------------------------------------------------ > > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
