Skip to main content
Jump to: navigation, search

Difference between revisions of "MoDisco/Components/JSP/Architecture/0.9"

 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=JSP Parser=
+
#REDIRECT [[MoDisco/Moved To Help Center]]
 
+
Modisco JSP Parser has been developed using an ANTLR grammar
+
It can support JSP file, as well as HTML files, TAG files, and JSP/TAG fragment files
+
 
+
==Grammar Architecture==
+
 
+
The ANTLR grammar is composed with rules representing what could be founded in a JSP file :
+
 
+
==Updating the Grammar==
+
 
+
===Non XML Conformity===
+
 
+
The ANTLR Grammar take in consideration the non XML conformity of a JSP file.
+
Knowing that it can contain html or javascript tags, an opened tag is not necessarily closed by one
+
 
+
Example :
+
<code> <img src="./img/myImage.png"> </code>
+
 
+
In order to build the inheritance tree, we had to store all the founded tags, and each time closing one is detected, re build the inheritance tree.
+
 
+
Example :
+
<code>
+
<nowiki>
+
<p>
+
<img src="./img/myImage.png">
+
</p></nowiki>
+
</code>
+
 
+
This fragment of code will add the <img> tag to the children of the <p> on when </p> is detected, and so on.
+
 
+
=== User Code in the generated one ===
+
Because we do not know if a tag will be closed later in the code, we had to manually implement some text concatenation.
+
 
+
Let's say we meet a new opening tag:
+
 
+
<code>
+
<nowiki>
+
<p>
+
This is some HTML content
+
</p></nowiki>
+
</code>
+
 
+
We cannot declared a rule  <nowiki> "'<p>'  'any letter'  '</p>'" because </p> </nowiki> might never appears, or a JSP expression could be there. That is why we concatenate manually the potentially present content after an opening tag, and wait till we found a known token.
+

Latest revision as of 10:49, 2 April 2012

  1. REDIRECT MoDisco/Moved To Help Center

Back to the top