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.
The follwoing code produces a syntax error within rhtml files <li style="margin-left: <%=indent -%>" >
Marek, this is the issue I wrote about yesterday. (There are several duplicates. I'm making a pass over the unevaluated bugs today so I'll add several here. Note again that this isn't specific to one language; the scenario I mentioned yesterday had a parsing error in HTML - the below appears to be within CSS. I believe the root problem is the GLF parser not handling the embedded language regions correctly.)
*** Issue 116545 has been marked as a duplicate of this issue. ***
*** Issue 114698 has been marked as a duplicate of this issue. ***
*** Issue 117404 has been marked as a duplicate of this issue. ***
I do not know how to fix it on my side. css-inlined grammar fires Syntax error, because "margin-left:" is not valid.
Hi Hanz, I don't see how I can do anything about this from the Ruby side since it's -Schliemann- which is generating the Syntax Error. Apologies for changing the bug categories back and forth but I think this needs to be addressed in languages/engine; if what I need to do (suppress errors) is already possible, please tell me how. I believe the error here is that Schliemann generates an error message when it should not. When Schliemann sees that the source it's trying to parse has an embedded region within it, with a language it does not recognize, it should not try to parse it - or at least it should not report errors on it! <li style="margin-left: <%=indent -%>" > is valid source - it's just an embedding scenario that's not handled by a Schliemann grammar. As I wrote to the scripting alias, I need at least a way to turn off parsing of CSS and HTML for RHTML documents, but it would be much better if this wasn't done globally but only for places where you detect embedding scenarios you can't handle. I think the simplest way to fix this would be to go to the error handler and when you've generated a SyntaxError, suppress it if you discover that it's near an embedded language that you're not handling. (As I also mentioned in my scripting mail, I think it would be very beneficial to include the name of the language next to "Syntax Error." such that there's no ambiguity as to which language parser is unhappy - CSS, HTML, Ruby, ...? Would you like a separate issue filed on that?)
I am sorry guys, but it looks like this is my fault - I think I am incorrectly creating the css embedding also on the closing quotation mark in the style tag value. The same usecase mentioned by Tor doesn't work in JSP, but works as content of <style> tag. I'll double check and potentially fix in the morning. Sorry for that :-|
Hi Marek, There are some other scenarios too (see the duplicates). Here's an embedded JavaScript scenario (from duplicate 114698) which has nothing to do with CSS: <input type="submit" name="save" value="Save" onClick="document.route = '<%= url_for :action=>@action, :page_id=>@page.name %>';" /> There are some other CSS scenarios to check after you fix the first scenario: (1) (this is from my mail to the scripting alias yesterday) <style type="text/css"> <!-- @import "<% stylesheet_path "faen" %>"; --> </style> (2) (From duplicate 117404) <div style="width: 100%; margin:0;padding:0; background: #dedede; overflow: auto; width: 100%; height: <%= "#{@list_height}px;" %>" >
*** Issue 120434 has been marked as a duplicate of this issue. ***
I am sorry, my previous evaluation was incorrect, I was too tired in the night :-(. The css embedding is created correctly (not encompassing the quotation mark). It looks like the problem is if the GAP (something from higher level language) is at the end of the section. In such case the hack with joining token from LLSyntaxAnalyzer doesn't work. We agreed with Hanz he will extend the hack it the way that the GAP is always added at the end of the section. There might be some situations at the end of the sections stating to be correct althought they aren't, but it looks like its better than the false alarms. Thanks Hanzi.
Hi Tor and Marek. First, sorry that I am not reacting on some emails - I am really busy - fixing... Feel free to file bug if you need some change. Detection of embedded piece of code is not trivial, on my side. Thats because handcoded rhtml lexer (the same is true for JSP) use different hierarchy of tokens that I am expecting (top level language <> bottom level language). Preprocessor language (JSP, Ruby) should be on the bottom level of tokens hierarchy, I think. I am not able correctly detect embeddings in current hierarchy. So, I am forced to do some hacks on my side. We are working on it with Marek. Switching parser off on some parts of source file is not a good solution, I think. User will have problem to recognize whats going on - why some parts of his source has no representation in Navigator, why code completion does not work in some parts of text... I will help Marek to find some workarround for this issue. Anyway, this issue is reproducible on rhtml files, so it should be assigned to ruby/rhtml. But I am leaving it here.
First usecase "<li style="margin-left: <%=indent -%>" >" fixed on my side. But it looks like there is still some issue in HTML lexer. IDE:------------------------------------------------- IDE: [11/1/07 9:44 AM] Committing "SLexer.java" started Checking in SLexer.java; /cvs/languages/engine/src/org/netbeans/modules/languages/lexer/SLexer.java,v <-- SLexer.java new revision: 1.29; previous revision: 1.28 done IDE: [11/1/07 9:44 AM] Committing "SLexer.java" finished
second example "<input type="submit" name="save" value="Save" onClick="document.route = '<%= url_for :action=>@action, :page_id=>@page.name %>';" />" looks like the error is caused by HTML lexer too.
Looks like all examples mentioned in this issue fails because of HTML lexer. Can you look at it, Marek?
I am affraid the fix introduced a regression: Put <div style="a:<%="x" %>" > into an empty JSP, you will get IOOBE from parser: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.join(LLSyntaxAnalyser.java:522) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.skipEmbedding(LLSyntaxAnalyser.java:499) ...
I'll look at the html lexer problem tomorrow.
regression is fixed now: IDE: [11/2/07 12:05 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.55; previous revision: 1.54 done IDE: [11/2/07 12:05 AM] Committing "LLSyntaxAnalyser.java" finished
after the partiall fix of #121033 the status is following: <input type="submit" name="save" value="Save" onClick="document.route = '<%= url_for :action=>@action, :page_id=>@page.name %>';" /> ... is ok now <style type="text/css"> <!-- @import "<% stylesheet_path "faen" %>"; --> </style> The same hack as for javadcript string joining needs to be done also for css, I tried to do that, but it didn't work. I belive the fix is a 5minutes task for you. Thanks. <div style="width: 100%; margin:0;padding:0; background: #dedede; overflow: auto; width: 100%; height: <%= "#{@list_height}px;" %>" > ... this always worked for me. The line is marked as unfinished tag, which is correct. I belive if you fix the style string joining, we can close this issue. I cannot say it cases are fixed for sure since java.lang.IndexOutOfBoundsException: Index: 0 at java.util.Collections$EmptyList.get(Collections.java:2970) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.join(LLSyntaxAnalyser.java:522) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.skipEmbedding(LLSyntaxAnalyser.java:499) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.readEmbeddings(LLSyntaxAnalyser.java:417) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.read2(LLSyntaxAnalyser.java:336) at org.netbeans.modules.languages.parser.LLSyntaxAnalyser.read(LLSyntaxAnalyser.java:153) at org.netbeans.modules.languages.ParserManagerImpl.parse(ParserManagerImpl.java:359) at org.netbeans.modules.languages.ParserManagerImpl.parseAST(ParserManagerImpl.java:309) at org.netbeans.modules.languages.ParserManagerImpl.access$100(ParserManagerImpl.java:84) at org.netbeans.modules.languages.ParserManagerImpl$1.run(ParserManagerImpl.java:181) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) is still thrown. But at least the embeddings are created properly now (taking into account #121046)
java.lang.IndexOutOfBoundsException fixed <style type="text/css"> <!-- @import "<% stylesheet_path "faen" %>"; --> </style> Has already been fixed. Marek, you do not have up to date sources, probably. <div style="width: 100%; margin:0;padding:0; background: #dedede; overflow: auto; width: 100%; height: <%= "#{@list_height}px;" %>" > Works for me too. So, looks like issue is fixed.
you are right, the css strings joining works fine. The issue is fixed.