You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Mario Juric <mj...@unsilo.ai> on 2018/10/02 09:31:34 UTC
Ruta syntax check of missing ";" after rule statement
Hi Peter,
It occasionally happens that developers forgets the semicolon “;” after a Ruta rule statement, e.g.
MyAnnotation { -> CREATE(SomeAnnotation)}; <——
We believe to remember that the Ruta engine previously produced syntax errors in this case, but this doesn’t appear to happen anymore, so we ended up wasting some time on tracking this down, because the rule actions didn’t fire. It’s easy to overlook a detail like that when we don’t have any syntax highlighting in IDEA, which is our preferred IDE. Shouldn’t it produce a syntax error, or is there some reasons to just skip the statements without it?
We are using Ruta version 2.6.1.
Cheers,
Mario
Re: Ruta syntax check of missing ";" after rule statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi Mario,
this is actually not restricted to the condition action part. You can of
course have rules without actions where the same applies.
We have a strict convention concerning the indentation. If a rule covers
several lines, the new line has to be indented. This makes it easier to
see if a semicolon is missing, especially if someone else wrote the rules.
MyType1
MyType2;
vs
MyType1
MyType2;
Best,
Peter
Am 05.10.2018 um 08:42 schrieb Mario Juric:
> Hi Peter,
>
> I think I understand the conflict, although I never considered this possibility since we never used the rules in this way as illustrated by your first example. We always had the constraint and action part at the end of the rules followed by semicolon and never in between, but I can see why it might be difficult to determine a syntax error in this case. I therefore have no suggestions for improving the situation, since it would generally be impossible to determine whether such a rule makes semantic sense or not. However, now that we are aware of it we might stand a better change to spot the problem earlier. Thanks for the feedback :)
>
>
> Best Regards,
>
> Mario Juric
> Head of Research & Development
> UNSILO.ai <http://unsilo.ai/>
> mobile: +45 3082 4100
> skype: mario.juric.dk
>
>
>
>
>
>
>
>
>
>
>
>
>> On 3 Oct 2018, at 15:50 , Peter Klügl <pe...@averbis.com> wrote:
>>
>> Hi Mario,
>>
>>
>> hmm, the question is how Ruta should detect that a rule actually should ends. There are no semantics on whitespaces and line breaks.
>>
>>
>> Ruta should complain with a syntax error if the semicolon is missing and there is no valid stuff afterwards.
>>
>>
>> An example:
>>
>>
>> MyAnnotation { -> CREATE(SomeAnnotation)}
>>
>> Document{-> MyType};
>>
>> <EOF>
>>
>>
>> This is a valid script, but the rule will never match and the CREATE will never be executed. It's actually one rule with two rule element.
>>
>>
>> MyAnnotation { -> CREATE(SomeAnnotation)}
>>
>> <EOF>
>>
>> ... or ...
>>
>> MyAnnotation { -> CREATE(SomeAnnotation)}
>>
>> DECLARE MyType;
>>
>>
>> This is not a valid script and a syntax error should be reported.
>>
>>
>>
>> I normally find the missing semicolons quite easily with the Explain View in the Ruta IDE, which is unfortunately only available for Eclispe.
>>
>>
>> I have right now no idea how our situation can be improved. Do you have a proposal?
>>
>>
>> Best,
>>
>>
>> Peter
>>
>>
>> Am 02.10.2018 um 11:31 schrieb Mario Juric:
>>> Hi Peter,
>>>
>>> It occasionally happens that developers forgets the semicolon “;” after a Ruta rule statement, e.g.
>>>
>>> MyAnnotation { -> CREATE(SomeAnnotation)}; <——
>>>
>>> We believe to remember that the Ruta engine previously produced syntax errors in this case, but this doesn’t appear to happen anymore, so we ended up wasting some time on tracking this down, because the rule actions didn’t fire. It’s easy to overlook a detail like that when we don’t have any syntax highlighting in IDEA, which is our preferred IDE. Shouldn’t it produce a syntax error, or is there some reasons to just skip the statements without it?
>>>
>>> We are using Ruta version 2.6.1.
>>>
>>> Cheers,
>>> Mario
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>> --
>> Peter Klügl
>> R&D Text Mining/Machine Learning
>>
>> Averbis GmbH
>> Tennenbacher Str. 11
>> 79106 Freiburg
>> Germany
>>
>> Fon: +49 761 708 394 0
>> Fax: +49 761 708 394 10
>> Email: peter.kluegl@averbis.com
>> Web: https://averbis.com
>>
>> Headquarters: Freiburg im Breisgau
>> Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
>> Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó
>>
>
--
Peter Klügl
R&D Text Mining/Machine Learning
Averbis GmbH
Tennenbacher Str. 11
79106 Freiburg
Germany
Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email: peter.kluegl@averbis.com
Web: https://averbis.com
Headquarters: Freiburg im Breisgau
Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó
Re: Ruta syntax check of missing ";" after rule statement
Posted by Mario Juric <mj...@unsilo.ai>.
Hi Peter,
I think I understand the conflict, although I never considered this possibility since we never used the rules in this way as illustrated by your first example. We always had the constraint and action part at the end of the rules followed by semicolon and never in between, but I can see why it might be difficult to determine a syntax error in this case. I therefore have no suggestions for improving the situation, since it would generally be impossible to determine whether such a rule makes semantic sense or not. However, now that we are aware of it we might stand a better change to spot the problem earlier. Thanks for the feedback :)
Best Regards,
Mario Juric
Head of Research & Development
UNSILO.ai <http://unsilo.ai/>
mobile: +45 3082 4100
skype: mario.juric.dk
> On 3 Oct 2018, at 15:50 , Peter Klügl <pe...@averbis.com> wrote:
>
> Hi Mario,
>
>
> hmm, the question is how Ruta should detect that a rule actually should ends. There are no semantics on whitespaces and line breaks.
>
>
> Ruta should complain with a syntax error if the semicolon is missing and there is no valid stuff afterwards.
>
>
> An example:
>
>
> MyAnnotation { -> CREATE(SomeAnnotation)}
>
> Document{-> MyType};
>
> <EOF>
>
>
> This is a valid script, but the rule will never match and the CREATE will never be executed. It's actually one rule with two rule element.
>
>
> MyAnnotation { -> CREATE(SomeAnnotation)}
>
> <EOF>
>
> ... or ...
>
> MyAnnotation { -> CREATE(SomeAnnotation)}
>
> DECLARE MyType;
>
>
> This is not a valid script and a syntax error should be reported.
>
>
>
> I normally find the missing semicolons quite easily with the Explain View in the Ruta IDE, which is unfortunately only available for Eclispe.
>
>
> I have right now no idea how our situation can be improved. Do you have a proposal?
>
>
> Best,
>
>
> Peter
>
>
> Am 02.10.2018 um 11:31 schrieb Mario Juric:
>> Hi Peter,
>>
>> It occasionally happens that developers forgets the semicolon “;” after a Ruta rule statement, e.g.
>>
>> MyAnnotation { -> CREATE(SomeAnnotation)}; <——
>>
>> We believe to remember that the Ruta engine previously produced syntax errors in this case, but this doesn’t appear to happen anymore, so we ended up wasting some time on tracking this down, because the rule actions didn’t fire. It’s easy to overlook a detail like that when we don’t have any syntax highlighting in IDEA, which is our preferred IDE. Shouldn’t it produce a syntax error, or is there some reasons to just skip the statements without it?
>>
>> We are using Ruta version 2.6.1.
>>
>> Cheers,
>> Mario
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> Peter Klügl
> R&D Text Mining/Machine Learning
>
> Averbis GmbH
> Tennenbacher Str. 11
> 79106 Freiburg
> Germany
>
> Fon: +49 761 708 394 0
> Fax: +49 761 708 394 10
> Email: peter.kluegl@averbis.com
> Web: https://averbis.com
>
> Headquarters: Freiburg im Breisgau
> Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
> Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó
>
Re: Ruta syntax check of missing ";" after rule statement
Posted by Peter Klügl <pe...@averbis.com>.
Hi Mario,
hmm, the question is how Ruta should detect that a rule actually should
ends. There are no semantics on whitespaces and line breaks.
Ruta should complain with a syntax error if the semicolon is missing and
there is no valid stuff afterwards.
An example:
MyAnnotation { -> CREATE(SomeAnnotation)}
Document{-> MyType};
<EOF>
This is a valid script, but the rule will never match and the CREATE
will never be executed. It's actually one rule with two rule element.
MyAnnotation { -> CREATE(SomeAnnotation)}
<EOF>
... or ...
MyAnnotation { -> CREATE(SomeAnnotation)}
DECLARE MyType;
This is not a valid script and a syntax error should be reported.
I normally find the missing semicolons quite easily with the Explain
View in the Ruta IDE, which is unfortunately only available for Eclispe.
I have right now no idea how our situation can be improved. Do you have
a proposal?
Best,
Peter
Am 02.10.2018 um 11:31 schrieb Mario Juric:
> Hi Peter,
>
> It occasionally happens that developers forgets the semicolon “;” after a Ruta rule statement, e.g.
>
> MyAnnotation { -> CREATE(SomeAnnotation)}; <——
>
> We believe to remember that the Ruta engine previously produced syntax errors in this case, but this doesn’t appear to happen anymore, so we ended up wasting some time on tracking this down, because the rule actions didn’t fire. It’s easy to overlook a detail like that when we don’t have any syntax highlighting in IDEA, which is our preferred IDE. Shouldn’t it produce a syntax error, or is there some reasons to just skip the statements without it?
>
> We are using Ruta version 2.6.1.
>
> Cheers,
> Mario
>
>
>
>
>
>
>
>
>
>
>
>
>
--
Peter Klügl
R&D Text Mining/Machine Learning
Averbis GmbH
Tennenbacher Str. 11
79106 Freiburg
Germany
Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email: peter.kluegl@averbis.com
Web: https://averbis.com
Headquarters: Freiburg im Breisgau
Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó