I am using Textmate with some macro functions to create a CSV file. Sadly I have to do it manually cos the original file had no kind of persistent pattern to define a structure.
Each like has 2 values separated by commas. Each record is separated by a series of dots "."
So for example
....................................................................... This is value 1,"This is value 2 More of value2 More of value2" ........................................................................
I would like to see "This is value 1" in one color and the rest of the string including the quotes in the following lines in another color.
I am trying to make sense of the rules/language grammar in textmate. What language is it? Any help would be greatly appreciated.
text-ed wrote:
I am trying to make sense of the rules/language grammar in textmate. What language is it? Any help would be greatly appreciated.
I tried comprehending that a while ago.. still cant comprehend it. Guess Its only for high funda programmers. Butttt.... with some trial and error came up with this..,
Try this
1. Create a language and name it something like MyCSV 2. Then edit the language so that it has these changes
{ scopeName = 'text.html.csv'; fileTypes = ( ); foldingStartMarker = '/**|{\s*$'; foldingStopMarker = '**/|^\s*}'; patterns = ( { name = 'keyword.control.untitled'; match = '^.+,'; }, { name = 'string.quoted.double.untitled'; begin = '"'; end = '"'; patterns = ( { name = 'constant.character.escape.untitled'; match = '".+$\n'; }, ); }, ); }
3. Set the language association of the CSV file opened in TM to "MyCSV" 4. Value 1 will be Blue and value 2 will be Green.
I dont know if thats the way to do it, but sure it will work !
HTH