Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

MoritzKn
Copy link
Contributor

@MoritzKn MoritzKn commented Sep 8, 2016

This is my attempt to implement #64.
Because other technologies (like JSF) use EL as well, the EL grammar is added as its own language file.

There are a few things I am unsure about:

  • Is source.java.el a good scopeName?
    The problem I see is that snippets, autocomplete providers and alike which are intended to work with Java will also apply to EL.
  • Should I add test and if so, how?

Some JSP code I used for testing:

${foo}
${fooBar}
${42}
${foo42}
${42foo}
${fooeq}
${foodiv}
${foomod}
${notfoo}
${footrue}
${42+4}
${42==4}
${'bar \' \\ sdaff " dsaf'}
${"dsa f ' 'dsaf sdf \\ \" asd fds af"}
${"foo"eq"foo"}
${foo eq bar}
${foo == bar}
${foo==bar}
${foo ne bar}
${foo !=bar}
${0 lt 5}
${0 < 5}
${8 gt 5}
${8 > 5}
${80 le 5}
${80 <= 5}
${42 ge 0}
${42 >= 0}
${42 + 0}
${42 - 0}
${42 * 0}
${42 div 0}
${42 / 0}
${42 mod 0}
${42 % 0}
${not bar}
${!bar}
${"foo" eq 'foo'}
${"\"'" eq '"\''}
${true}
${false}
${fn:contains('foo', 'bar')}
${foo ? 'foo' : 'bar'}
${foo['bar']}
${foo[42]}
${(42 lt 5) and (45 ne 8)}
${fn:indexOf('fooo', 'o')}
${not empty bar and fn:contains(bar, 'foo')}

<c:if test="${not empty bar and fn:contains(bar, 'foo')}">
    ${bar}
    ${setFoo(true)}
</c:if>

@MoritzKn
Copy link
Contributor Author

MoritzKn commented Sep 13, 2016

Here are a few EL examples from the oracle page: http://docs.oracle.com/javaee/6/tutorial/doc/bnaim.html#bnain

@MoritzKn MoritzKn changed the title Add Unified Expression Language (EL) and include in JSP Add Unified Expression Language (EL) and include it in JSP Sep 24, 2016
@@ -0,0 +1,94 @@
'scopeName': 'source.java.el'
'name': 'Unified Expression Language (EL)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a grammar that someone will ever want to explicitly choose in the Grammar Selector? If not, this line should be removed.

@@ -0,0 +1,94 @@
'scopeName': 'source.java.el'
'name': 'Unified Expression Language (EL)'
'fileTypes': []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

'fileTypes': []
'patterns': [
{
'include': '#el'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just include all the patterns here directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The primary new feature of JSP 2.1 is the unified expression language (unified EL), which represents a union of the expression language offered by JSP 2.0 and the expression language created for JavaServer Faces technology

-- https://docs.oracle.com/javaee/5/tutorial/doc/bnahq.html

Meaning the unified el grammar could also be useful outside of JSP in a JavaServer Faces (JSF) context. Therefore I thought a separate grammar would make sense although no JSF language package exists yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does #el only contain the expression language up to JSP 2.0? And that perhaps in the future someone may add support for JSP 2.1 in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, I mistaken the code snippet for something else and comply misunderstood you. 🙈
Ignore my first comment. You are right, it makes no sense to include everything like this. I probably just copied this from some other grammar without understanding what exactly it meant.

@winstliu
Copy link
Contributor

Also yes, specs will be required for this PR. I think some basic tests for each pattern should suffice.

This implements atom#64. Since Version 2.1 JSP includes the Unified Expression
Language (or short EL). Because other technologies (like JSF) use EL as well,
the EL grammar is added as its own language file.
@MoritzKn
Copy link
Contributor Author

@50Wliu rebases against master, fixed your remarks and added specs.

@winstliu winstliu merged commit f20f198 into atom:master Jan 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants