[jboss-cvs] jboss-seam ...

Gavin King gavin.king at jboss.com
Fri Jan 12 03:31:35 EST 2007


  User: gavin   
  Date: 07/01/12 03:31:35

  Modified:    jboss-seam  seam-text.g
  Log:
  major improvements
  
  Revision  Changes    Path
  1.8       +61 -52    jboss-seam/seam-text.g
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: seam-text.g
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/seam-text.g,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- seam-text.g	10 Jan 2007 18:40:54 -0000	1.7
  +++ seam-text.g	12 Jan 2007 08:31:33 -0000	1.8
  @@ -9,7 +9,6 @@
   	k=3;
   }
   {   
  -    private int newLinesSinceWord = 0;
       private StringBuilder builder = new StringBuilder();
       
       public String toString() {
  @@ -28,7 +27,13 @@
   startRule: ( (heading)? text (heading text)* )?
       ;
   
  -text: { append("<p>\n"); } (plain|formatted|preformatted|quoted|para|span|list)+ { append("\n</p>\n"); } 
  +text: ( (paragraph|list|preformatted|quoted|html) (newline)* )+
  +    ;
  +    
  +line: (plain|formatted) (plain|formatted|inlineTag)*
  +    ;
  +    
  +paragraph: { append("<p>\n"); } (line newline)+ { append("</p>\n"); } newlineOrEof
       ;
   
   plain: word|punctuation|escape|space
  @@ -37,14 +42,13 @@
   formatted: bold|underline|italic|monospace|superscript|deleted
       ;
   
  -word: w:WORD { append( w.getText() ); newLinesSinceWord=0; }
  +word: w:WORD { append( w.getText() ); }
       ;
       
  -punctuation: p:PUNCTUATION { append( p.getText() ); newLinesSinceWord=0; }
  +punctuation: p:PUNCTUATION { append( p.getText() ); }
       ;
       
  -escape: ESCAPE { newLinesSinceWord=0; } 
  -        ( q:QUOTE { append( q.getText() ); } | specialChars | htmlSpecialChars )
  +escape: ESCAPE ( q:QUOTE { append( q.getText() ); } | specialChars | htmlSpecialChars )
       ;
       
   specialChars:
  @@ -100,76 +104,79 @@
   preformatted: QUOTE { append("<pre>"); }
                 (word|punctuation|specialChars|htmlSpecialChars|space|newline)*
                 QUOTE { append("</pre>"); }
  +              newlineOrEof
       ;
       
  -quoted: DOUBLEQUOTE { append("<quote><p>"); newLinesSinceWord=0; }
  -        (plain|formatted|preformatted|para|span|list)*
  -        DOUBLEQUOTE { append("</p></quote>"); newLinesSinceWord=0; }
  +quoted: DOUBLEQUOTE { append("<quote><p>"); }
  +        line (newline line)*
  +        DOUBLEQUOTE { append("</p></quote>"); }
  +        newlineOrEof
       ;
   
  -heading: ( h1 | h2 | h3 ) newline
  +heading: ( h1 | h2 | h3 ) newlineOrEof
       ;
       
  -headingText: (plain|formatted)+
  +h1: PLUS { append("<h1>"); } line { append("</h1>"); }
       ;
     
  -h1: PLUS { append("<h1>"); } headingText { append("</h1>"); }
  +h2: PLUS PLUS { append("<h2>"); } line { append("</h2>"); }
       ;
    
  -h2: PLUS PLUS { append("<h2>"); } headingText { append("</h2>"); }
  +h3: PLUS PLUS PLUS { append("<h3>"); } line { append("</h3>"); }
       ;
    
  -h3: PLUS PLUS PLUS { append("<h3>"); } headingText { append("</h3>"); }
  +list: ( olist | ulist ) newlineOrEof
       ;
    
  -list: olist | ulist
  +olist: { append("<ol>\n"); } (olistLine newline)+ { append("</ol>\n"); }
       ;
       
  -listItemText: (plain|bold|underline|italic|monospace|superscript|deleted)*
  +olistLine: HASH { append("<li>"); } line { append("</li>"); }
       ;
       
  -olist: para { append("<ol>\n"); } (olistItem)+ { append("</ol>\n"); }
  +ulist: { append("<ul>\n"); } (ulistLine newline)+ { append("</ul>\n"); }
       ;
       
  -olistItem: HASH { append("<li>"); newLinesSinceWord=0; } listItemText { append("</li>"); } para
  +ulistLine: EQ { append("<li>"); } line { append("</li>"); }
       ;
       
  -ulist: para { append("<ul>\n"); } (ulistItem)+ { append("</ul>\n"); }
  +space: s:SPACE { append( s.getText() ); }
       ;
       
  -ulistItem: EQ { append("<li>"); newLinesSinceWord=0; } listItemText { append("</li>"); } para
  +newline: n:NEWLINE { append( n.getText() ); }
       ;
   
  -space: s:SPACE { append( s.getText() ); }
  +newlineOrEof: newline | EOF
       ;
   
  -newline: n:NEWLINE { append( n.getText() ); }
  +html: openTag (attribute)* ( ( tagContent htmlText closeTagWithContent ) | closeTagWithNoContent ) 
       ;
           
  -para: { if (newLinesSinceWord>0) append("</p>\n"); } 
  -      newline 
  -      { if (newLinesSinceWord>0) append("<p>\n"); newLinesSinceWord++; } 
  +htmlText: (plain|formatted|html|newline)*
       ;
   
  -span: LT tag:WORD { append("<" + tag.getText()); }
  -          (
  -              space att:WORD EQ 
  +inlineTag: openTag (attribute)* ( ( tagContent inlineTagText closeTagWithContent ) | closeTagWithNoContent )
  +    ;
  +    
  +inlineTagText: (plain|formatted)*
  +    ;
  +
  +openTag: LT name:WORD { append("<"); append(name.getText()); }
  +    ;
  +    
  +tagContent: GT { append(">"); }
  +    ;
  +    
  +closeTagWithContent: LT SLASH name:WORD GT { append("</"); append(name.getText()); append(">"); }
  +    ;
  +    
  +closeTagWithNoContent: SLASH GT { append("/>"); } 
  +    ;
  +    
  +attribute: space att:WORD EQ 
                 DOUBLEQUOTE { append(att.getText() + "=\""); } 
                 attributeValue 
                 DOUBLEQUOTE { append("\""); } 
  -          )* 
  -      (
  -          (
  -              GT { append(">"); } 
  -              { newLinesSinceWord=0; } 
  -              (plain|formatted|preformatted|quoted|newline|span|list)* 
  -              { newLinesSinceWord=0; }
  -              LT SLASH WORD GT { append("</" + tag.getText() + ">"); }
  -          )
  -      |   (
  -              SLASH GT { append("/>"); } 
  -          )
  -      )
       ;
       
   attributeValue: ( AMPERSAND { append("&amp;"); } | word | punctuation | space | specialChars )*
  @@ -235,6 +242,8 @@
   SPACE: (' '|'\t')+
       ;
       
  -NEWLINE: '\r' '\n' | '\r' | '\n'
  +NEWLINE: "\r\n" | '\r' | '\n'
       ;
       
  \ No newline at end of file
  +EOF : '\uFFFF'
  +    ;
  
  
  



More information about the jboss-cvs-commits mailing list