PDA

View Full Version : Extending DW CS3 Assistance - CodeColoring.xml


Spadrick
02-06-2015, 04:43 PM
Good afternoon everyone;

I have an issue that is on the verge of snapping my brain in two, I sincerely hope that someone can shed some light on it for me.

I have set up Boolean as a custom language (AND OR NOT + - ^ * ") in the MMDocumentTypes.xml, Colors.xml and Extensions.txt (.bool), and I am trying to get color and mild validation (wrong colors appearing on error or uneven brackets) into CodeColoring.xml, and I have it half working. I believe that it is a nesting error, but I can't troubleshoot it anymore or my eyes are going to start bleeding.

As it stands now, I have quotes turning the containing word and the quotes green when they are paired up correctly, and each odd quote turning red to signify error (this is optimal for me), but I would like parenthesis/brackets to act the same way, and they simply do not. I fear that this edit is getting out of my purview and ability.

Here is my CodeColoring.xml code:

<scheme MMString:name="Boolean/scheme/name" id="Boolean" doctypes="Boolean" priority="1">
<ignoreCase>No</ignoreCase>
<ignoreTags>Yes</ignoreTags>
<stringStart MMString:name="CodeColor_JavaString/stringStart/name" id="CodeColor_JavaString"><![CDATA[(]]></stringStart>
<stringEnd><![CDATA[)]]></stringEnd>
<stringStart MMString:name="CodeColor_JavaString/stringStart/name" id="CodeColor_JavaString"><![CDATA["]]></stringStart>
<stringEnd><![CDATA["]]></stringEnd>
<idChar1>_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ</idChar1>
<idCharRest MMString:name="CodeColoring/CodeColoring/CodeColor_Identifier" id="CodeColor_JavaIdentifier">_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV WXYZ0123456789</idCharRest>
<keywords MMString:name="CodeColoring/CodeColoring/CodeColor_BooleanPositive/keywords/name" id="CodeColor_BooleanPositive">
<keyword>AND</keyword>
<keyword>+</keyword>
</keywords>
<keywords MMString:name="CodeColoring/CodeColoring/CodeColor_BooleanOr/keywords/name" id="CodeColor_BooleanOr">
<keyword>OR</keyword>
<keyword>NEAR</keyword>
</keywords>
<keywords MMString:name="CodeColoring/CodeColoring/CodeColor_BooleanNegative/keywords/name" id="CodeColor_BooleanNegative">
<keyword>NOT</keyword>
<keyword>-</keyword>
</keywords>
<keywords MMString:name="CodeColoring/CodeColoring/CodeColor_BooleanOperators/keywords/name" id="CodeColor_BooleanOperators">
<keyword>^</keyword>
<keyword>*</keyword>
<keyword>~</keyword>
</keywords>
<keywords MMString:name="CodeColoring/CodeColoring/CodeColor_BooleanQuotes/keywords/name" id="CodeColor_BooleanQuotes">
<keyword>"</keyword>
<keyword>(</keyword>
<keyword>)</keyword>
</keywords>

So I have deduced that the quotes in stringStart and stringEnd are being colored green by the CodeColor_JavaString id when they are in pairs, and being colored red when not in pairs by id CodeColor_BooleanQuotes in the <KEYWORDS> strings.

Pairing brackets the same way does not produce the same result. This code displays a boolean string like this:

welcome OR intro OR beginning AND ("something for nothing" OR "development for fun")" With the brackets and the extra quote showing in RED, the quotes inside the bracket and the words inside the quotes GREEN. I want the brackets, quotes inside the brackets, and words inside the quotes to be green, and extra brackets and extra quotes showing as red (CodeColor_BooleanQuotes).

I hope this is an adequate example and that my issue is clear. My purpose is to use DW to make dealing with three-page boolean strings every day much much simpler.

Any help. I am in your debt.

Adam

Spadrick
02-06-2015, 07:52 PM
In addition to the above, I have found that the above code turns brackets and items in brackets green when there are no quotation marks next to the brackets. So: (something AND something) appears green as it should, but ("something" AND "something") shows red brackets and green "something"s.