[ 
https://issues.apache.org/jira/browse/VELOCITY-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624383#comment-16624383
 ] 

Nate Chadwick commented on VELOCITY-542:
----------------------------------------

Here is an example that is close to solving the $variable-1 issue that 
[~spbolton] has been hacking on:

{code}
     <#ALPHA_CHAR: ["a"-"z", "A"-"Z", "_" ] >
|    <#ALPHA_NUM_CHAR: [ "a"-"z", "A"-"Z", "_" "0"-"9" ] >
|    <#IDENTIFIER_CHAR: [ "a"-"z", "A"-"Z", "0"-"9", "_" ] >
|    <#IDENTIFIER_DASH: [ "-" ] >
|   <#IDENTIFIER_CHAR: [ "a"-"z", "A"-"Z", "0"-"9", "-", "_" ] >
|   <IDENTIFIER:  ( <ALPHA_CHAR> ) ((<IDENTIFIER_DASH>  <ALPHA_CHAR>) | 
(<ALPHA_NUM_CHAR>))*) >``
{code}

One of the problems with this approach that still needs addressed is handling 
something like:

{code}
$velo-Var--897
{code}

Which may be handleable by making -- an Operator that equates to + (had to 
remember 5th grade math for that!).  

Would really appreciate a re-open so that we can solve this in a way that you 
have 1 parser and don't need to eliminate - as a valid character in language 
identifiers.  I don't have permissions to reopen a closed bug.

The correct fix just needs more work and testing. 



> minus sign in #set requires spaces to surround it
> -------------------------------------------------
>
>                 Key: VELOCITY-542
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-542
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.5
>            Reporter: Will Glass-Husain
>            Assignee: Claude Brisson
>            Priority: Minor
>             Fix For: 2.0
>
>
> The following example:
> #set($thisCampNumber = 10)
> #set($nextCampNumber = $thisCampNumber+1)
> #set($previousCampNumber = $thisCampNumber-1)
> #set($previousCampNumberB = $thisCampNumber - 1)
> 1: $thisCampNumber<br>
> 2: $nextCampNumber<br>
> 3: $previousCampNumber<br>
> 4: $previousCampNumberB<br>
> produces this result
> 1: 10
> 2: 11
> 3: $previousCampNumber
> 4: 9
> Note that using a minus sign in a #set statement does not work if there are 
> no spaces around it.  (however, the same is not true for +).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to