You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alfred Reibenschuh (JIRA)" <ji...@apache.org> on 2012/06/28 12:07:43 UTC

[jira] [Created] (JEXL-133) String matching Operator short-hand inspired by CSS3

Alfred Reibenschuh created JEXL-133:
---------------------------------------

             Summary: String matching Operator short-hand inspired by CSS3
                 Key: JEXL-133
                 URL: https://issues.apache.org/jira/browse/JEXL-133
             Project: Commons JEXL
          Issue Type: Improvement
    Affects Versions: 2.1.1
            Reporter: Alfred Reibenschuh
            Priority: Trivial


like the perl inspired shorthand "=~", css3 also has some nice shorthands 

http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors

for "startsWith" the shorthand could be "expr1 ^= expr2"
for "endsWith" the shorthand could be "expr1 $= expr2"

it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Alfred Reibenschuh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alfred Reibenschuh reopened JEXL-133:
-------------------------------------


hmm and what about the inverse ? "!^" and "!$" ?
                
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403133#comment-13403133 ] 

Henri Biestro commented on JEXL-133:
------------------------------------

Good idea.
For coherence, it might be better to name them '=^' and '=$' (since the matching operator is '=~').
And generalize the 'start with' and 'ends with' for any ordered sequence (Object[], List<?>...).

The following test (in Jexl3) exhibits the intended behavior on String.
{code}
    public void test133() throws Exception {
        JexlEngine jexl = new Engine();
        JexlScript script;
        Object result;
        script = jexl.createScript("x =^ 'foo'", "x");
        result = script.execute(null, "foobar");
        assertEquals(Boolean.TRUE, result);
        result = script.execute(null, "barfoo");
        assertEquals(Boolean.FALSE, result);
        script = jexl.createScript("x =$ 'foo'", "x");
        result = script.execute(null, "foobar");
        assertEquals(Boolean.FALSE, result);
        result = script.execute(null, "barfoo");
        assertEquals(Boolean.TRUE, result);
    }
{code}
                
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Alfred Reibenschuh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421004#comment-13421004 ] 

Alfred Reibenschuh edited comment on JEXL-133 at 7/23/12 10:43 PM:
-------------------------------------------------------------------

hmm and what about the inverse ? !^ and !$ ?
                
      was (Author: alfredreibenschuh):
    hmm and what about the inverse ? "!^" and "!$" ?
                  
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro resolved JEXL-133.
--------------------------------

    Resolution: Fixed


Added 'not startsWith' (^!) and 'not endsWith' (!$) operators

src/main/java/org/apache/commons/jexl3/internal/Debugger.java
src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
src/main/java/org/apache/commons/jexl3/parser/JexlNode.java
src/main/java/org/apache/commons/jexl3/parser/JexlParser.java
src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
src/main/java/org/apache/commons/jexl3/parser/ParserVisitor.java
src/site/xdoc/changes.xml
src/site/xdoc/reference/syntax.xml
src/test/java/org/apache/commons/jexl3/ArithmeticOperatorTest.java

Committed revision 1367576.
Revision: 1367576
Author  : henrib
Date    : Jul 31, 2012 4:30:43 PM
JEXL-133:
                
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro resolved JEXL-133.
--------------------------------

    Resolution: Fixed

Added the '=^' as startsWith and '=$' as endsWith operators.
They both work on String and on any class that exposes startsWith/endsWith methods (duck-type).
                
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JEXL-133) String matching Operator short-hand inspired by CSS3

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JEXL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro updated JEXL-133:
-------------------------------

    Fix Version/s: 3.0
    
> String matching Operator short-hand inspired by CSS3
> ----------------------------------------------------
>
>                 Key: JEXL-133
>                 URL: https://issues.apache.org/jira/browse/JEXL-133
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Alfred Reibenschuh
>            Assignee: Henri Biestro
>            Priority: Trivial
>             Fix For: 3.0
>
>
> like the perl inspired shorthand "=~", css3 also has some nice shorthands 
> http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#attribute-selectors
> for "startsWith" the shorthand could be "expr1 ^= expr2"
> for "endsWith" the shorthand could be "expr1 $= expr2"
> it could be that the "^=" operator already collides with "xor and assign" which i haven't looked at as of now.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira