On Thu, Jul 17, 2014 at 2:49 PM, Dominique Pellé <dominique.pe...@gmail.com>
wrote:

> Daniel Naber <daniel.na...@languagetool.org> wrote:
>
> On 2014-07-17 10:52, Dominique Pellé wrote:
>>
>> > I glanced at the Polish grammar.xml, but I could not find such rules.
>>
>> Sorry, I guess my grep command was wrong and I actually found <match>
>> outside the exception element.
>>
>> > cvc-complex-type.2.4.d: Invalid content was found starting with
>> > element 'match'. No child element is expected at this point.
>>
>> I think this answers the original question: it's not supposed to work.
>> You might try to patch it anyway of course, if it doesn't add a lot of
>> complexity.
>>
>
> Hi Daniel
>
> I'm not sure how to fix it without spending time studying
> the code. But I found a workaround anyway by replacing...
>
> <token regexp="yes">vue?s?<exception>\2</exception></token>
>
> ... with...
>
> <and>
>
>   <token regexp="yes">vue?s?</token>
>   <token negate="yes"><match no="1"/></token>
>  </and>
>
> I just committed in git (French rule VU_DE_MES_YEUX_VU).
>
> By the way, I also had to use <match no="1"/>
> instead of <match no="2"/>.   This is confusing
> to me.  It seems that <match no="..."/> counts tokens
> sometimes from 0  (in fact I can see some <match no="0"/>
> in some rules) and sometimes from 1!?  Is this explained
> anywhere
>

Answering to myself as I found the link explaining
how token are numbered with <match no="..."/>.

=== BEGIN QUOTE  http://wiki.languagetool.org/development-overview ===
[...] matches are numbered from zero, so it's <match no="0"/> [...]

A similar mechanism can be used in suggestions, however there are
more features, and tokens are numbered from 1 (for compatibility
with the older notation \1 for the first matched token).
=== END QUOTE ===

So indeed, depending on what <match no="..."/> is used for,
tokens are numbered from 0 or from 1. Confusing, but at least
I understand it now and it's documented.

Regards
Dominique
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to