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 102794 - HTML Lexer do not parse embeded sections as one token.
Summary: HTML Lexer do not parse embeded sections as one token.
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
: 102182 (view as bug list)
Depends on: 87014
Blocks:
  Show dependency tree
 
Reported: 2007-04-27 15:43 UTC by Jan Jancura
Modified: 2009-05-18 10:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Jancura 2007-04-27 15:44:02 UTC
CSS and JavaScript code embedded in HTML is not parsed by HTML lexer as one token:

<style type="text/css"><!--
pre {
    border: 1px solid black;
    padding: 10px;
    background-color: #FFD;
}
--></style>

CSS parser is not able to parse broken pieces of code.
Comment 1 Jan Jancura 2007-04-27 15:45:29 UTC
*** Issue 102182 has been marked as a duplicate of this issue. ***
Comment 2 Marek Fukala 2007-04-28 16:12:12 UTC
The fix will have a not nice sideeffect - if someone forgets to use </script>
end tag in his file, since the lexer after <script> will make everything a text
until it finds </script>, the rest of the file from the open tag will be gray
without any editing features. In such case I can also replace the dynamic
embedding of the script tags by the static one. The same basically applies for
CSS and others.

Btw, the fix of issue #87014 would also help to resolve the following problems. 
Comment 3 Marek Fukala 2007-06-27 19:53:31 UTC
I wont implement this issue until issue #87014 is resolved. Not critical, lowering priority.
Comment 4 Marek Fukala 2007-07-04 14:02:31 UTC
since it looks like resolution of issue #87014 can take longer time, I did a proposed workaround for <script> tag to
check how it works.

Checking in lexer/src/org/netbeans/lib/html/lexer/HTMLLexer.java;
/cvs/html/lexer/src/org/netbeans/lib/html/lexer/HTMLLexer.java,v  <--  HTMLLexer.java
new revision: 1.16; previous revision: 1.15
done
Checking in lexer/src/org/netbeans/api/html/lexer/HTMLTokenId.java;
/cvs/html/lexer/src/org/netbeans/api/html/lexer/HTMLTokenId.java,v  <--  HTMLTokenId.java
new revision: 1.9; previous revision: 1.8
done
Checking in editor/src/org/netbeans/modules/html/editor/coloring/EmbeddingUpdater.java;
/cvs/html/editor/src/org/netbeans/modules/html/editor/coloring/EmbeddingUpdater.java,v  <--  EmbeddingUpdater.java
new revision: 1.7; previous revision: 1.6
done
Comment 5 Marek Fukala 2007-10-18 22:51:34 UTC
will be fixed in 6.0 FCS, the change is required because of some constraints in lexer. Read more in Issue #118892 -
Allow Schlieman lexer to continuously lex embedded language over  more tokens of its parent language
Comment 6 Marek Fukala 2007-10-20 14:33:51 UTC
fixed

Checking in HTMLSyntaxSupport.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLSyntaxSupport.java,v  <--  HTMLSyntaxSupport.java
new revision: 1.38; previous revision: 1.37
done
Checking in HTMLCompletionQuery.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java,v  <--  HTMLCompletionQuery.java
new revision: 1.41; previous revision: 1.40
done
Comment 7 Marek Fukala 2007-10-20 14:42:06 UTC
oops, wrong files - the fix is:
Checking in api/html/lexer/HTMLTokenId.java;
/cvs/html/lexer/src/org/netbeans/api/html/lexer/HTMLTokenId.java,v  <--  HTMLTokenId.java
new revision: 1.12; previous revision: 1.11
done
Checking in lib/html/lexer/HTMLLexer.java;
/cvs/html/lexer/src/org/netbeans/lib/html/lexer/HTMLLexer.java,v  <--  HTMLLexer.java
new revision: 1.23; previous revision: 1.22
done