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

Issue 9994043: Impliment MDV Syntax expressions (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by rafaelw
Modified:
12 years, 8 months ago
Reviewers:
arv
CC:
mdv-reviews_googlegroups.com
Base URL:
https://github.com/Polymer/mdv.git@master
Visibility:
Public.

Description

Impliment MDV Syntax expressions Hey, This patch implements all the expression support we discussed with the exception of function invocation. This includes: Unary +, - Binary +, -, *, /, % Relational <, >, <=, >= Equality ==, !=, ===, !== Logical &&, || Logical ! Conditional (e.g. foo ? bat : bar) Literals (e.g. 1, 'foo', null) Note that this takes a dependency on esprima which is BSD licensed. R=arv BUG= Committed: https://github.com/Polymer/mdv/commit/63e8fad

Patch Set 1 #

Patch Set 2 : inline inclusion of subset of esprima library #

Patch Set 3 : removed support for non-ascii identifier characters #

Patch Set 4 : parsing directly to mdv_syntax, rather than going through AST structure #

Patch Set 5 : support for expressions in class syntax, named scopes and general cleanup #

Patch Set 6 : fix breakage #

Patch Set 7 : moar clenaup #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+1867 lines, -77 lines) Patch
M mdv.js View 1 chunk +1 line, -0 lines 0 comments Download
M src/mdv_syntax.js View 1 2 3 4 5 3 chunks +248 lines, -74 lines 8 comments Download
M tests/mdv_syntax.js View 1 2 3 4 3 chunks +329 lines, -3 lines 2 comments Download
A third_party/esprima/CONTRIBUTING.md View 1 1 chunk +20 lines, -0 lines 0 comments Download
A third_party/esprima/LICENSE.BSD View 1 1 chunk +19 lines, -0 lines 0 comments Download
A third_party/esprima/README.md View 1 2 1 chunk +39 lines, -0 lines 0 comments Download
A third_party/esprima/esprima.js View 1 2 3 4 5 6 1 chunk +1211 lines, -0 lines 0 comments Download

Messages

Total messages: 3
rafaelw
Committed patchset #6 manually as r63e8fad (presubmit successful).
12 years, 8 months ago (2013-06-06 19:18:00 UTC) #1
arv
It is kind of unfortunate to have to support parsing full ES5 when all we ...
12 years, 8 months ago (2013-06-07 16:03:40 UTC) #2
rafaelw
12 years, 8 months ago (2013-06-07 21:07:50 UTC) #3
Message was sent while issue was closed.
https://codereview.appspot.com/9994043/diff/15001/src/mdv_syntax.js
File src/mdv_syntax.js (right):

https://codereview.appspot.com/9994043/diff/15001/src/mdv_syntax.js#newcode140
src/mdv_syntax.js:140: esprima.parse(expressionText, delegate);
Per offline discussion, we can't wrap in parens because we need to support
multiple labelled statements.

On 2013/06/07 16:03:41, arv wrote:
> Does esprima have a more specific parse function? We need to parse this as an
> Expression and not as a Program.
> 
> We should wrap this in parens since we only accept a single expression.

https://codereview.appspot.com/9994043/diff/15001/src/mdv_syntax.js#newcode146
src/mdv_syntax.js:146: throw Error('Expression must be a single statement');
On 2013/06/07 16:03:41, arv wrote:
> This is pretty backwards. An expression is never a statement. What you really
> mean here is that we only accept a single Expression.

Done.

https://codereview.appspot.com/9994043/diff/15001/src/mdv_syntax.js#newcode148
src/mdv_syntax.js:148: var resolveFn = delegate.labeledStatements.length ?
Added comment.

On 2013/06/07 16:03:41, arv wrote:
> It is unclear how you intend to use labeledStatements?

https://codereview.appspot.com/9994043/diff/15001/src/mdv_syntax.js#newcode161
src/mdv_syntax.js:161: for (var i = 0; i < paths.length; i++)
On 2013/06/07 16:03:41, arv wrote:
> {}

Done.

https://codereview.appspot.com/9994043/diff/15001/tests/mdv_syntax.js
File tests/mdv_syntax.js (right):

https://codereview.appspot.com/9994043/diff/15001/tests/mdv_syntax.js#newcode203
tests/mdv_syntax.js:203: '{{ (a.b + c.d)/e - (f * g.h) }}' +
On 2013/06/07 16:03:41, arv wrote:
> maybe remove the second set of parens to ensure specificity is correct

Done.
Sign in to reply to this message.

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