You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Manish Khettry (JIRA)" <ji...@apache.org> on 2007/04/10 03:16:32 UTC

[jira] Commented: (DERBY-1623) Add ANSI TRIM implementation

    [ https://issues.apache.org/jira/browse/DERBY-1623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487668 ] 

Manish Khettry commented on DERBY-1623:
---------------------------------------

I have spent several days but I cannot seem to express the grammar for trim without warnings from JavaCC. The warning says: 

     [java] Warning: Choice conflict involving two expansions at
     [java]          line 6268, column 5 and line 6279, column 5 respectively.
     [java]          A common prefix is: "leading" "+"
     [java]          Consider using a lookahead of 3 or more for earlier expansion

I've included a skeleton of the production rules that I'm using.  I'm also not sure if additiveExpression is the right production to use in this case.

ValueNode
ansiTrimProduction() throws StandardException :
{
}
{
    <LEADING> additiveExpression(null, 0, false)
    {
        return null;    //TODO obviously return a ValueNode when warnings are fixed.
    }
|    
    LOOKAHEAD ( <LEADING> <FROM>)
    <LEADING> <FROM> additiveExpression(null,0,false)
    {
        return null;
    }    
|    
    <LEADING> additiveExpression(null,0,false) <FROM> additiveExpression(null,0,false)
    {
        return null;
    }
}

>From reading the JavaCC documentation and this tutorial (https://javacc.dev.java.net/doc/lookahead.html) it seems the parser does not which production (the first or the third) to take when it reads a token like (+). Using a fixed lookahead to disambiguate between the two productions is not possible in this case. For now, I'm sort of stuck at this point. Any ponters would be appreciated.


> Add ANSI TRIM implementation
> ----------------------------
>
>                 Key: DERBY-1623
>                 URL: https://issues.apache.org/jira/browse/DERBY-1623
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Emmanuel Bernard
>         Assigned To: Manish Khettry
>
> JPA is requiring databases to support this ANSI feature esp the ability to chose the trimmed character
> TRIM([ [ LEADING | TRAILING | BOTH ] [ chars ] FROM ] str)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.