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

Robert Zeigler commented on TAP5-1620:
--------------------------------------

So... if you use a reluctant search, then ${{'key': 'value'}} fails.  If you 
use a greedy search, you can't use expansions in a js function because:

function myfunc() {
  alert("${value}");
}

Will match ${value}");}  and I don't see any way around that uses regular 
expressions. I could limit }, but that's just going to reproduce the reluctant 
behavior.

I see 2 solutions:
  1) Rewrite the expansion parser to implement brace counting so that we 
actually end the expansion at the correct brace.
  2) Rework map support to use a character other than {} to delineate maps.  We 
might be able to override the array syntax so that ['a','b','c'] creates an 
array, and ['a': 'b', 'c': 'd'] creates a map.

I'm leaning toward option #1 at the moment.  Even if I implement #2, it still 
means that someone using a literal } in an expression (contrived example: 
${['a','}']} is going to cause grief; of course, that example will cause grief 
for brace pairing, too...).  I'd rather see smarter processing of templates to 
find the "right" match for the close of an expression.

> Tml parsing expression error
> ----------------------------
>
>                 Key: TAP5-1620
>                 URL: https://issues.apache.org/jira/browse/TAP5-1620
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Denis Stepanov
>            Assignee: Robert Zeigler
>
> <script>
>                               jQuery(function(){      
>                                       registerAutorefresh(${refresh});
>                               });
>                       </script>
> Caused by: java.lang.RuntimeException: Error parsing property expression 
> 'refresh});': Unable to parse input at character position 10.
>       at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.parse(PropertyConduitSourceImpl.java:1441)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.build(PropertyConduitSourceImpl.java:1309)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.create(PropertyConduitSourceImpl.java:1274)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at $PropertyConduitSource_123d98bd5e9eaa20.create(Unknown Source) 
> ~[na:na]
>       at 
> org.apache.tapestry5.internal.bindings.PropBindingFactory.newBinding(PropBindingFactory.java:49)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at $BindingFactory_123d98bd5e9eaa21.newBinding(Unknown Source) ~[na:na]
>       at $BindingFactory_123d98bd5e9eaa18.newBinding(Unknown Source) ~[na:na]
>       at 
> org.apache.tapestry5.internal.services.BindingSourceImpl.newBinding(BindingSourceImpl.java:78)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       ... 94 common frames omitted
> Caused by: java.lang.RuntimeException: Unable to parse input at character 
> position 10
>       at 
> org.apache.tapestry5.internal.antlr.BaseLexer.reportError(BaseLexer.java:50) 
> ~[tapestry-core-5.3-alpha-13.jar:na]
>       at org.antlr.runtime.Lexer.nextToken(Lexer.java:94) ~[antlr.jar:na]
>       at 
> org.antlr.runtime.CommonTokenStream.fillBuffer(CommonTokenStream.java:119) 
> ~[antlr.jar:na]
>       at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:238) 
> ~[antlr.jar:na]
>       at 
> org.apache.tapestry5.internal.antlr.PropertyExpressionParser.start(PropertyExpressionParser.java:98)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.parse(PropertyConduitSourceImpl.java:1437)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       ... 101 common frames omitted
> Caused by: org.antlr.runtime.NoViableAltException: null
>       at org.antlr.runtime.DFA.noViableAlt(DFA.java:158) ~[antlr.jar:na]
>       at org.antlr.runtime.DFA.predict(DFA.java:116) ~[antlr.jar:na]
>       at 
> org.apache.tapestry5.internal.antlr.PropertyExpressionLexer.mTokens(PropertyExpressionLexer.java:1273)
>  ~[tapestry-core-5.3-alpha-13.jar:na]
>       at org.antlr.runtime.Lexer.nextToken(Lexer.java:84) ~[antlr.jar:na]
>       ... 105 common frames omitted

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to