Forums

cobra -correct-source [was: cobra -correct-case]

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

cobra -correct-source [was: cobra -correct-case]

Postby Charles » Sat Nov 08, 2008 7:02 pm

This option was renamed to -correct-source on 2008-12-25.
See cobra -h for docs.


Cobra is case-sensitive, but now there is a new -correct-case option which will correct the case of types. This means that Cobra writes your source code back with the correction. If you can then set your editor to automatically reload modified files, this should work quite smoothly.

For example, given this source file:
# Customer.cobra

class Customer

get name from var as string

The Cobra compiler will write it back with "String" in place of "string". Same for "object", "point", etc. This only happens if Cobra can locate the capitalized version and if -correct-case was used.

Automatic correction can be used in any situation that is unambiguous. Over time, we can extend this to handle CompoundNames, types in expressions, method names, etc.

If you have any feedback, let me know.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: cobra -correct-case

Postby Charles » Wed Nov 12, 2008 12:37 am

I have expanded this to cover generic types and qualified types:

-- list<of String> ==> List<of String>
-- system.Object ==> System.Object

I've been using this with UltraEdit configured to autoload changed files. It's pretty cool seeing the source code corrected with no errors, warnings or effort!
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: cobra -correct-case

Postby Charles » Fri Dec 26, 2008 12:28 am

I have changed the name to -correct-source with options: none, case, all

The idea is that there will be additional types of corrections in the future and you may wish to specify some and not others.

"cobra -correct-source MyProg.cobra" by itself is equivalent to "cobra -correct-source:all MyProg.cobra"
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 41 guests