Forums

Official Cobra grammar

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Official Cobra grammar

Postby didrik » Mon Jan 14, 2013 10:00 am

Hi,

I would like to add support for the remaining keywords (or most of them, at least) to the TextMate bundle posted under "Editor Support".
However, in order to do it properly, it would be nice to know the context of each of the keywords.

Is there an official Cobra grammar available anywhere?

I apologize if it is already easily located — I just can't seem to find it!
didrik
 
Posts: 2

Re: Official Cobra grammar

Postby hopscc » Tue Jan 15, 2013 1:26 am

Theres no formal grammar document. :(

This page Keywords is the best keyword reference we have outside the source code.
It has all the keywords in alpha order and a link to the code file.

If you follow that page then the KeywordSpecs 'View Online' link to the keywords file/class you can look for the
rawSpecs property - List ( about a page or so down) which gives a table of the keywords and some indication of their use and what they're for though not the full grammatical context...

If thats insufficient then the only other recourse is to walk through the CobraParser.cobra source following the recursive descent code.
( that will be 100% correct by definition)

Perhaps slightly less onerous is to look at the wiki doc (From 'wiki:LanguageTopics' under 'Program Structure') and pick the keywords from the doc/grammar descriptions for each construct/statement there ....
Its possible the doc there is not 100% complete/correct though :) and you might find it difficult to pick the keywords out easily rapidly for your purposes.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Official Cobra grammar

Postby didrik » Tue Jan 15, 2013 12:45 pm

Thank you. I must say that I am a bit surprised that there is no formal grammar, but I guess I will manage without it. :)

While looking at the CobraParser source, I found a property called validIsNames, in which the keyword readonly is listed. (line 830 in CobraParser.cobra)
A bit surprised, as readonly is not specified as a keyword in any of the other resources you specify, I tried to compile it — it works.

Is this keyword planned for removal later, or is it just a mistake that it isn't mentioned elsewhere?
didrik
 
Posts: 2

Re: Official Cobra grammar

Postby hopscc » Tue Jan 15, 2013 3:34 pm

Its probably that it has been added since the doc on isnames/access modifiers was done
or the code run that emitted the keywords list was run

readonly support is relatively recent in comparison to some of the other items....
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Official Cobra grammar

Postby hopscc » Tue Jan 15, 2013 3:47 pm

Actually that omission is definitely a doc lag/issue and
its probably a bug that its not listed in the keywords table with the rest of the isNames modifiers

I'll open a ticket and a patch for it - Thanx - well spotted.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Official Cobra grammar

Postby hopscc » Tue Jan 15, 2013 4:08 pm

So noted on ticket:313.
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Official Cobra grammar

Postby nerdzero » Tue Jul 09, 2013 5:07 pm

Man, I'm finishing up tooltips in the MD/XS addin and am trying to include the grammar in the tooltip for keywords and I am really wishing we had the grammar all in one place right about now :)
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: Official Cobra grammar

Postby Charles » Tue Jul 09, 2013 5:26 pm

Sorry, I'm still on "partial types" and then "parser recovery" after that.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Official Cobra grammar

Postby nerdzero » Tue Jul 09, 2013 5:39 pm

Heh, yeah for sure those are higher priority. This doesn't even have to be done by you. I mean, the info is available, just not in one place...but I'm lazy.
nerdzero
 
Posts: 286
Location: Chicago, IL


Return to Discussion

Who is online

Users browsing this forum: No registered users and 28 guests