This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 120499 - EL in JavaScript is marked as syntax error
Summary: EL in JavaScript is marked as syntax error
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-30 16:49 UTC by Petr Blaha
Modified: 2009-02-27 14:26 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (225.48 KB, image/png)
2007-10-30 16:50 UTC, Petr Blaha
Details
screenshot (185.41 KB, image/png)
2007-11-02 17:49 UTC, Petr Blaha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2007-10-30 16:49:12 UTC
Product Version: NetBeans IDE Dev (Build 071030)
Java: 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
System: Linux version 2.6.17-12-generic running on i386; UTF-8; en_US (nb)

I have jsp page with JS included. The JS code use value of EL. However, the EL is marked as syntax error. See attachement.
Comment 1 Petr Blaha 2007-10-30 16:50:23 UTC
Created attachment 52023 [details]
screenshot
Comment 2 Marek Fukala 2007-10-30 18:11:48 UTC
reproducible, problem of Schlieman parser because of the separated tokens - more info is written in partially fixed
issue #119554 - Allow lex and parse javascript string divided by JSP or EL tokens.

simplier example to be put into a jsp:

<script>
 if(haha == "${"haha"}") {
 }
</script>
Comment 3 Jan Jancura 2007-11-01 11:51:47 UTC
fixed in trunk:
IDE: [11/1/07 11:51 AM] Committing "LLSyntaxAnalyser.java" started
Checking in LLSyntaxAnalyser.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/parser/LLSyntaxAnalyser.java,v  <--  LLSyntaxAnalyser.java
new revision: 1.53; previous revision: 1.52
done
IDE: [11/1/07 11:51 AM] Committing "LLSyntaxAnalyser.java" finished
Comment 4 Petr Blaha 2007-11-02 17:47:49 UTC
I'm still able to reproduce the issue in the build 071102. See attachement and also try to open logger/StrutsExceptions,
issueDetails.jsp in NetBeans repository.
Comment 5 Petr Blaha 2007-11-02 17:49:17 UTC
Created attachment 52403 [details]
screenshot
Comment 6 Jan Jancura 2007-11-02 21:40:14 UTC
original example works for me.
the new one is fixed:
IDE: [11/2/07 9:39 PM] Committing "LLSyntaxAnalyser.java" started
Checking in LLSyntaxAnalyser.java;
/cvs/languages/engine/src/org/netbeans/modules/languages/parser/LLSyntaxAnalyser.java,v  <--  LLSyntaxAnalyser.java
new revision: 1.58; previous revision: 1.57
done
IDE: [11/2/07 9:39 PM] Committing "LLSyntaxAnalyser.java" finished
Comment 7 Petr Blaha 2007-11-05 10:40:35 UTC
Verified in build 071105
Comment 8 gmichel 2008-09-11 23:30:45 UTC
Using NetBeans IDE 6.5 Beta (Build 200808111757) on Mac 10.4.11, the EL in the Javascript is marked with syntax errors.

For example:
function setPData()
{
p_data = new Array(30);
<c:set var="pcount" value="0"/>
<c:forEach items="${pdata.rows}" var="row">
p_data[${pcount}]=new p(<c:forEach items="${row}" var="col" varStatus="step">
<c:choose>
<c:when test="${step.last}">"${fn:escapeXml(col.value)}"</c:when>
<c:otherwise>"${fn:escapeXml(col.value)}",</c:otherwise>
</c:choose>
</c:forEach>);
</c:forEach>
}
Comment 9 Petr Jiricka 2008-09-16 10:05:16 UTC
Also cc'ing Marek who may be familiar with this problem.
Comment 10 Torbjorn Norbye 2008-09-18 15:03:25 UTC
I think this was fixed as part of the other similar JavaScript embedding fixes recently (-after- beta). It's probably
the same issue.

In particular, if I load a JSP file which contains your code fragment, and I also add in a taglib definition to define
the "c",  then I don't get any syntax errors.

Comment 11 Torbjorn Norbye 2008-09-18 15:31:04 UTC
Reopening, there is still a problem there.
Comment 12 Martin Schovanek 2008-09-29 17:32:52 UTC
Tor: what problem did you mean? I cannot reproduce it with the last example now.
Comment 13 Torbjorn Norbye 2008-09-29 19:16:12 UTC
Hi Martin,
this is tracked by the unit test JsParserTest.test120499 (commented out because it is still not passing). That unit test
basically tracks the JavaScript code which gets generated for the corresponding JSP file. The difficulty here is that
we're seeing multiple generated-tokens in the parameter list without a comma between them. This confuses the parser.
It's great to hear that this doesn't seem to get triggered by the actual JSP file, but it's still a theoretical problem
so I've left the bug open. Perhaps it's a lower priority than P2 though.
Comment 14 Torbjorn Norbye 2008-09-30 00:39:43 UTC
Fixed in changeset dd1a25285b09. The JavaScript parser now handles extra/missing tokens (provided they're the special
embedding tokens) in argument lists, which is what this testcase required. Unit tests reenabled.