Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(67)

Issue 98112: Implement the Expression evaluator for JSP EL-like OpenSocial Template language

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 6 months ago by Jacky Wang
Modified:
16 years, 6 months ago
Reviewers:
chabotc, panjie.pan
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

The expression language used in OpenSocial templating system is a JSP EL-like one. We need a EL evaluator which could do the following items correctly: 1) number / boolean operation 2) function calls 3) string handling 4) ternary conditional workflow 5) data context de-reference 6) nested structures This patch implemented a clearly support for its evaluating. Basically, it contains 3 parts: 1) ExpType, it defines types like int / float / string / bool / array / object etc. and handles the type coercing as well. 2) ExpLexer, which tokenizes the input expression string into intermediate tokens which will be handled in the later stage. 3) ExpParser, which evaluates the input token stream under a given data context. Excepts the functionalities like operation computing, function calls etc, the capability of input expression validation is also provided. Unit-tests are included, too. Some highlights of this parser: 1) handles tricky string in the right way, e.g. 'this is \\\'"the tricky string"\'' 2) scientific floating parsing, e.g. .5e-3 3) nested unary operator, e.g. 5+---0.2e-3+1 4) nested ternary, e.g. a?b:c?d:e / a?(b?c:d):e 5) scoped variable: no_prefix, Cur, Top 6) access un-exist attribute should return null (it's different with JSP EL's spec) 7) nested attribute access: a[b].c

Patch Set 1 #

Patch Set 2 : updated one #

Unified diffs Side-by-side diffs Delta from patch set Stats (+494 lines, -147 lines) Patch
php/src/gadgets/templates/ExpLexer.php View 1 13 chunks +72 lines, -57 lines 0 comments Download
php/src/gadgets/templates/ExpParser.php View 1 10 chunks +89 lines, -56 lines 0 comments Download
php/src/gadgets/templates/ExpType.php View 1 6 chunks +43 lines, -33 lines 0 comments Download
php/src/gadgets/templates/ExpressionParser.php View 1 1 chunk +1 line, -0 lines 0 comments Download
php/test/gadgets/ExpTypeTest.php View 1 chunk +112 lines, -0 lines 0 comments Download
php/test/gadgets/ExpressionParserTest.php View 1 chunk +176 lines, -0 lines 0 comments Download
php/test/index.php View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 2
Jacky Wang
16 years, 6 months ago (2009-08-03 09:50:50 UTC) #1
Jacky Wang
16 years, 6 months ago (2009-08-03 10:04:51 UTC) #2
updated one
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b