I coded and tested the following patch.

Would it be ok?

Ciao

Paolo

### Eclipse Workspace Patch 1.0
#P languagetool
Index: 
languagetool-core/src/main/java/org/languagetool/rules/CommaWhitespaceRule.java
===================================================================
--- 
languagetool-core/src/main/java/org/languagetool/rules/CommaWhitespaceRule.java 
    (revision 9815)
+++ 
languagetool-core/src/main/java/org/languagetool/rules/CommaWhitespaceRule.java 
    (working copy)
@@ -100,7 +100,18 @@
               && isNumberOrDot(tokens[i + 1].getToken())) {
             msg = null;
           }
+/* 3607406 + */
+//        }
+        } else if (token.equals(":")) {
+            msg = messages.getString("no_space_before_colon");
+            suggestionText = ":";
+            fixLen = 1;
+        } else if (token.equals(";")) {
+            msg = messages.getString("no_space_before_semicolon");
+            suggestionText = ";";
+            fixLen = 1;
         }
+/* 3607406 - */
       }
       if (msg != null) {
         final int fromPos = tokens[i - 1].getStartPos();
Index: 
languagetool-core/src/main/resources/org/languagetool/MessagesBundle.properties
===================================================================
--- 
languagetool-core/src/main/resources/org/languagetool/MessagesBundle.properties 
    (revision 9815)
+++ 
languagetool-core/src/main/resources/org/languagetool/MessagesBundle.properties 
    (working copy)
@@ -203,6 +203,14 @@
 
 no_space_before_dot = Don't put a space before the full stop
 
+# 3607406 +
+
+no_space_before_colon = Don't put a space before the colon
+
+no_space_before_semicolon = Don't put a space before the semicolon
+
+# 3607406 -
+
 pl = Polish
 
 repetition = Possible typo: you repeated a word




On Apr 5, 2013, at 10:09 AM, R.J. Baars wrote:

> I guess this is language independ, so be fixed in same rule as no space
> before comma.
> 
> Ruud
> 
>> All,
>> 
>> I could fix this bug by coding the following rule within the Italian
>> grammar.xml (I also added a check for semicolon… I know, I could have used
>> a reg_exp :-) ).
>> 
>> The question is, would this be the correct/acceptable way of handling this
>> bug or should it be handled differently (a java rule) and/or for a wider
>> set of languages?
>> 
>> Ciao
>> 
>> Paolo
>> 
>> 
>>              <rulegroup name="spazio prima di : o di ;" id="GR_09_005">
>>                  <rule>
>>                      <pattern>
>>                          <token></token>
>>                          <token spacebefore="yes">:</token>
>>                      </pattern>
>>                              <message>Non lasciare uno spazio prima dei due 
>> punti:
>> <suggestion><match no="1"></match>:</suggestion>.</message>
>>                              <example type="incorrect">Comprammo tanti 
>> <marker>regali :</marker>
>> bambole, libri, vestiti.</example>
>>                              <example type="correct">Comprammo tanti 
>> <marker>regali:</marker>
>> bambole, libri, vestiti.</example>
>>                      </rule>
>>                  <rule>
>>                      <pattern>
>>                          <token></token>
>>                          <token spacebefore="yes">;</token>
>>                      </pattern>
>>                              <message>Non lasciare uno spazio prima del 
>> punto e virgola:
>> <suggestion><match no="1"></match>;</suggestion>.</message>
>>                              <example type="incorrect">Gli venne 
>> <marker>sonno ;</marker> e rimandò
>> all'indomani.</example>
>>                              <example type="correct">Gli venne 
>> <marker>sonno;</marker> e rimandò
>> all'indomani.</example>
>>                      </rule>
>>              </rulegroup>
>> 
>> ------------------------------------------------------------------------------
>> Minimize network downtime and maximize team effectiveness.
>> Reduce network management and security costs.Learn how to hire
>> the most talented Cisco Certified professionals. Visit the
>> Employer Resources Portal
>> http://www.cisco.com/web/learning/employer_resources/index.html_______________________________________________
>> Languagetool-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/languagetool-devel
>> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire 
> the most talented Cisco Certified professionals. Visit the 
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Languagetool-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/languagetool-devel


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Languagetool-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to