[rules-dev] Long DSL lines
Tihomir Surdilovic
tsurdilo at redhat.com
Mon Dec 6 15:42:29 EST 2010
Was thinking of something like this:
declare dsl ApplicantValidity
mapTo : invalidAgeDSLRule
when : Applicant is younger than $age
then : Applicant is not valid
mapTo: validAgeDSLRule
when : Applicant is older than $age
then : Applicant is valid
end
rule invalidAgeDSLRule
when
$a : Applicant( $age : age < ? )
then
$a.setValid( false );
end
rule validAgeDSLRule
when
$a : Applicant( $age : age > ? )
then
$a.setValid( true );
end
would be following declaring new facts somewhat and you can benefit from
any attributes set on the dsl mapTo rules as well ...any thoughts ??
Thanks.
On 12/6/10 3:09 PM, Wolfgang Laun wrote:
> Well, it won't give you a proper line number for an error that's
> somewhere within a single range of \-escaped
> newlines, but I reinsert the "stolen" newlines at the earliest
> possible moment. This ensures that line numbers
> in error messages are correct w.r.t. the start of a logical line.
>
> -W
>
>
> On 6 December 2010 21:00, Michael Neale <michael.neale at gmail.com
> <mailto:michael.neale at gmail.com>> wrote:
>
> only objection I would have is that the error numbers in the
> expanded syntax (should there be compile errors) would not line up
> with the source (which makes it slightly more annoying than it
> already is to sort out).
>
> But as this thread goes on, perhaps some more holistic thought to
> what we want DSLv2 to be like is in order.
>
>
> On Sun, Dec 5, 2010 at 5:33 AM, Wolfgang Laun
> <wolfgang.laun at gmail.com <mailto:wolfgang.laun at gmail.com>> wrote:
>
> Currently each entry must be a single line of text. This
> results in long lines, especially on the RHS.
>
> I have experimentally inserted a transformation of the DSL
> text (in DSLTokenizedMappingFile)
> which converts '\'+EOL on the fly to a space. (The passed-in
> reader is read into a buffer, '\'+EOL
> is translated to space, and EOLs are inserted later to
> readjust the line number.) In a text editor,
> I can now write, e.g.,
>
> then][][Bb]ook the customer for the flight=\
> $f.setAvailable( $f.getAvailable() - 1 );\
> update( $f ); \
> Booking booking = new Booking(); \
> booking.setCustomer( $r.getCustomer() ); \
> booking.setFlight( $f ); \
> insert( booking );
>
> Of course, the DSL editor will not preserve this, but future
> development might provide more
> convenient editing there, too.
>
> Any objections?
> -W
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org <mailto:rules-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
>
> --
> Michael D Neale
> home: www.michaelneale.net <http://www.michaelneale.net>
> blog: michaelneale.blogspot.com <http://michaelneale.blogspot.com>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org <mailto:rules-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20101206/f9949451/attachment.html
More information about the rules-dev
mailing list