org.nuiton.jrst
Class JRSTLexer

java.lang.Object
  extended by org.nuiton.jrst.JRSTLexer

public class JRSTLexer
extends Object

Le principe est de positionner la mark du AdvancedReader lors du debut d'une methode peek*, puis a la fin de la methode de regarder le nombre de caractere utilisé pour la methode et de faire un reset.

Le nombre de caractere utilisé servira pour le remove lorsque l'utilisateur indiquera qu'il utilise l'element retourné, si l'utilisateur n'appelle pas remove alors il peut relire autant de fois qu'il veut le meme element, ou essayer d'en lire un autre.

Pour mettre en place ce mecanisme le plus simple est d'utiliser les methodes beginPeek() et endPeek() Created: 28 oct. 06 00:44:20

Version:
$Revision: 334 $ Last update: $Date: 2009-05-16 07:33:16 +0200 (sam., 16 mai 2009) $ by : $Author: tchemit $
Author:
poussin, letellier

Field Summary
static String ADMONITION
           
static String ADMONITION_PATTERN
           
static String ATTRIBUTION
           
static String BLANK_LINE
           
static String BLOCK_QUOTE
           
static String BULLET_CHAR
           
static String BULLET_LIST
           
static String CELL
           
static String CELL_BEGIN
           
static String CELL_END
           
static String CELL_INDEX_END
           
static String CELL_INDEX_START
           
static String DECORATION
           
static String DEFINITION_LIST
           
static String DIRECTIVE
           
static String DIRECTIVE_TYPE
           
static String DIRECTIVE_VALUE
           
static String DOCINFO
           
static String DOCINFO_ITEM
           
static String DOCTEST_BLOCK
           
static String ENUMERATED_LIST
           
static String FIELD_LIST
           
static String FOOTER
           
static String FOOTNOTE
           
static String HEADER
           
static String LINE
           
static String LINE_BLOCK
           
static String LITERAL_BLOCK
           
static String OPTION_LIST
           
static String PARAGRAPH
           
static String ROW
           
static String ROW_END_HEADER
           
static String SIDEBAR
           
static String SUBSTITUTION_DEFINITION
           
static String TABLE
           
static String TABLE_HEADER
           
static String TABLE_WIDTH
           
static String TARGET
           
static String TITLE
           
static String TITLE_CHAR
           
static String TOPIC
           
static String TRANSITION
           
 
Constructor Summary
JRSTLexer(Reader reader)
           
 
Method Summary
 boolean eof()
          true if no more element to read
 int getCharNumber()
          return the number of char read
 int getLineNumber()
          return the number of line read
protected  org.dom4j.Element peekAdmonition()
          read admonitions : admonition|attention|caution|danger|error|hint|important|note|tip|warning ..
 org.dom4j.Element peekBlankLine()
          read blank line
 org.dom4j.Element peekBodyElement()
          Return para
 org.dom4j.Element peekBulletList()
          read list - first line - next line
 org.dom4j.Element peekDefinitionList()
          read definition list un autre mot une autre definition le mot : la classe la definition le mot : la classe 1 : la classe 2 la definition
 org.dom4j.Element peekDirectiveOrReference()
          read directive or reference
 org.dom4j.Element peekDocInfo()
          read doc info author, date, version, ... or field list element :author: Benjamin Poussin :address: Quelque part Dans le monde
 org.dom4j.Element peekDocInfoItem()
          read doc info author, date, version, ...
 org.dom4j.Element peekEnumeratedList()
          read enumarted list can be: 1, 2, 3, ...
 org.dom4j.Element peekFieldList()
          read field list :first: text :second: text and other text :last empty:
 org.dom4j.Element peekFooter()
          search if the doc have an header .. footer:: design by **LETELLIER Sylvain**
 org.dom4j.Element peekFootnote()
          ..
 org.dom4j.Element peekHeader()
          search if the doc have an header .. header:: This space for rent. aaaa **aaaa**
 org.dom4j.Element peekLiteralBlock()
          read literal block :: LiteralBlock
 org.dom4j.Element peekOption()
          read options Ex : -a command-line option "a" -1 file, --one=file, --two file Multiple options with arguments.
 org.dom4j.Element peekPara()
          read paragraph with attribut level that represente the space numbers at left side
 org.dom4j.Element peekRemove()
          Remove already read elements
 org.dom4j.Element peekTable()
          read table simple and complexe +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | Cells may span columns
 org.dom4j.Element peekTarget()
           
 LinkedList<org.dom4j.Element> peekTargetAnonymous()
           .. __: http://www.python.org
 org.dom4j.Element peekTitle()
          Parse un titre simple ou double simple: Le titre ======== double: ============ le titre ============
 org.dom4j.Element peekTitleOrBodyElement()
          Return title or para
 org.dom4j.Element peekTransition()
          read transition
 String readNotBlanckLine()
          Lit les premieres ligne non vide et les retourne, rien n'est modifier par rapport aux positions dans le fichier.
 LinkedList<org.dom4j.Element> refTarget()
          ..
 void remove()
          remove one element from list of element already read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BULLET_CHAR

public static final String BULLET_CHAR
See Also:
Constant Field Values

TITLE_CHAR

public static final String TITLE_CHAR
See Also:
Constant Field Values

DOCINFO_ITEM

public static final String DOCINFO_ITEM
See Also:
Constant Field Values

ADMONITION_PATTERN

public static final String ADMONITION_PATTERN
See Also:
Constant Field Values

TITLE

public static final String TITLE
See Also:
Constant Field Values

DOCINFO

public static final String DOCINFO
See Also:
Constant Field Values

DECORATION

public static final String DECORATION
See Also:
Constant Field Values

HEADER

public static final String HEADER
See Also:
Constant Field Values

FOOTER

public static final String FOOTER
See Also:
Constant Field Values

TRANSITION

public static final String TRANSITION
See Also:
Constant Field Values

SIDEBAR

public static final String SIDEBAR
See Also:
Constant Field Values

TOPIC

public static final String TOPIC
See Also:
Constant Field Values

LITERAL_BLOCK

public static final String LITERAL_BLOCK
See Also:
Constant Field Values

PARAGRAPH

public static final String PARAGRAPH
See Also:
Constant Field Values

BLANK_LINE

public static final String BLANK_LINE
See Also:
Constant Field Values

SUBSTITUTION_DEFINITION

public static final String SUBSTITUTION_DEFINITION
See Also:
Constant Field Values

BULLET_LIST

public static final String BULLET_LIST
See Also:
Constant Field Values

FIELD_LIST

public static final String FIELD_LIST
See Also:
Constant Field Values

DEFINITION_LIST

public static final String DEFINITION_LIST
See Also:
Constant Field Values

ENUMERATED_LIST

public static final String ENUMERATED_LIST
See Also:
Constant Field Values

OPTION_LIST

public static final String OPTION_LIST
See Also:
Constant Field Values

LINE_BLOCK

public static final String LINE_BLOCK
See Also:
Constant Field Values

LINE

public static final String LINE
See Also:
Constant Field Values

BLOCK_QUOTE

public static final String BLOCK_QUOTE
See Also:
Constant Field Values

ATTRIBUTION

public static final String ATTRIBUTION
See Also:
Constant Field Values

DOCTEST_BLOCK

public static final String DOCTEST_BLOCK
See Also:
Constant Field Values

ADMONITION

public static final String ADMONITION
See Also:
Constant Field Values

TARGET

public static final String TARGET
See Also:
Constant Field Values

FOOTNOTE

public static final String FOOTNOTE
See Also:
Constant Field Values

TABLE

public static final String TABLE
See Also:
Constant Field Values

ROW

public static final String ROW
See Also:
Constant Field Values

CELL

public static final String CELL
See Also:
Constant Field Values

TABLE_HEADER

public static final String TABLE_HEADER
See Also:
Constant Field Values

TABLE_WIDTH

public static final String TABLE_WIDTH
See Also:
Constant Field Values

ROW_END_HEADER

public static final String ROW_END_HEADER
See Also:
Constant Field Values

CELL_INDEX_START

public static final String CELL_INDEX_START
See Also:
Constant Field Values

CELL_INDEX_END

public static final String CELL_INDEX_END
See Also:
Constant Field Values

CELL_BEGIN

public static final String CELL_BEGIN
See Also:
Constant Field Values

CELL_END

public static final String CELL_END
See Also:
Constant Field Values

DIRECTIVE

public static final String DIRECTIVE
See Also:
Constant Field Values

DIRECTIVE_TYPE

public static final String DIRECTIVE_TYPE
See Also:
Constant Field Values

DIRECTIVE_VALUE

public static final String DIRECTIVE_VALUE
See Also:
Constant Field Values
Constructor Detail

JRSTLexer

public JRSTLexer(Reader reader)
Method Detail

eof

public boolean eof()
            throws IOException
true if no more element to read

Returns:
boolean
Throws:
IOException

remove

public void remove()
            throws IOException
remove one element from list of element already read

Throws:
IOException

peekHeader

public org.dom4j.Element peekHeader()
                             throws IOException
search if the doc have an header
    .. header:: This space for rent. aaaa **aaaa**
 

Returns:
Element
Throws:
IOException

peekFooter

public org.dom4j.Element peekFooter()
                             throws IOException
search if the doc have an header
    .. footer:: design by **LETELLIER Sylvain**
 

Returns:
Element
Throws:
IOException

peekTargetAnonymous

public LinkedList<org.dom4j.Element> peekTargetAnonymous()
                                                  throws IOException
 .. __: http://www.python.org
 

Returns:
Element
Throws:
IOException

peekTitleOrBodyElement

public org.dom4j.Element peekTitleOrBodyElement()
                                         throws IOException
Return title or para

Returns:
Element
Throws:
IOException

peekDocInfo

public org.dom4j.Element peekDocInfo()
                              throws IOException
read doc info author, date, version, ... or field list element
 :author: Benjamin Poussin
 :address:
   Quelque part
   Dans le monde
 

Returns:
Element
Throws:
IOException

peekBodyElement

public org.dom4j.Element peekBodyElement()
                                  throws IOException
Return para

Returns:
Element
Throws:
IOException

peekRemove

public org.dom4j.Element peekRemove()
                             throws IOException
Remove already read elements

Returns:
Element
Throws:
IOException

peekOption

public org.dom4j.Element peekOption()
                             throws IOException
read options
 Ex :     -a            command-line option "a"
          -1 file, --one=file, --two file
                     Multiple options with arguments.
 Schéma :  ________________________________
           v          |                    |
        -{1,2}\w+ ->|','                   |
                    |'='-----|-> \w+ --->|','
                    |' '-----|           |' '---+
                    |"  " -----> \w+ ---> end   |
                      ˆ                         |
                      |_________________________|
 Légende :   
 
          -{1,2} --> 1 or 2 tirets
          \w+ -----> word characters one or more times
 

Returns:
Element
Throws:
IOException

peekAdmonition

protected org.dom4j.Element peekAdmonition()
                                    throws IOException
read admonitions : admonition|attention|caution|danger|error|hint|important|note|tip|warning
 .. Attention:: All your base are belong to us.
 .. admonition:: And, by the way...
 
    You can make up your own admonition too.
 

Returns:
Element
Throws:
IOException

peekBlankLine

public org.dom4j.Element peekBlankLine()
                                throws IOException
read blank line

Returns:
Element
Throws:
IOException

peekDirectiveOrReference

public org.dom4j.Element peekDirectiveOrReference()
                                           throws IOException
read directive or reference

Returns:
Element
Throws:
IOException

peekTransition

public org.dom4j.Element peekTransition()
                                 throws IOException
read transition

Returns:
Element
Throws:
IOException

peekPara

public org.dom4j.Element peekPara()
                           throws IOException
read paragraph with attribut level that represente the space numbers at left side

Returns:
<paragraph level="[int]">[text]</paragraph>
Throws:
IOException

peekLiteralBlock

public org.dom4j.Element peekLiteralBlock()
                                   throws IOException
read literal block
 ::
 
     LiteralBlock
 

Returns:
Element
Throws:
IOException

peekDocInfoItem

public org.dom4j.Element peekDocInfoItem()
                                  throws IOException
read doc info author, date, version, ...
 :author: Benjamin Poussin
 :address:
   Quelque part
   Dans le monde
 

Returns:
Element
Throws:
IOException

peekTable

public org.dom4j.Element peekTable()
                            throws IOException
read table simple and complexe
 +------------------------+------------+----------+----------+
 | Header row, column 1   | Header 2   | Header 3 | Header 4 |
 | (header rows optional) |            |          |          |
 +========================+============+==========+==========+
 | body row 1, column 1   | column 2   | column 3 | column 4 |
 +------------------------+------------+----------+----------+
 | body row 2             | Cells may span columns.          |
 +------------------------+------------+---------------------+
 

Returns:
Element
Throws:
IOException

peekBulletList

public org.dom4j.Element peekBulletList()
                                 throws IOException
read list
 - first line
 - next line
 

Returns:
<bullet_list level="[int]" bullet="char"><[text];</bullet_list>
Throws:
IOException

peekFieldList

public org.dom4j.Element peekFieldList()
                                throws IOException
read field list
 :first: text
 :second: text
   and other text
 :last empty:
 

Returns:
<field_list level="[int]" name="[text]">[text]</field_list>
Throws:
IOException

peekDefinitionList

public org.dom4j.Element peekDefinitionList()
                                     throws IOException
read definition list
 un autre mot
   une autre definition
 le mot : la classe
   la definition
 le mot : la classe 1 : la classe 2
   la definition
 

Returns:
<definition_list level="[int]" term="[text]" classifiers="[text]">[text]</definition_list>
Throws:
IOException

peekEnumeratedList

public org.dom4j.Element peekEnumeratedList()
                                     throws IOException
read enumarted list can be:
  • 1, 2, 3, ...
  • a, b, c, ...
  • A, B, C, ...
  • i, ii, iii, iv, ...
  • I, II, III, IV, ... or # for auto-numbered
     
     1. next line 1) next line (1) first line
     
     

    Returns:
    <enumerated_list level="[int]" start="[number]" prefix="[char]" suffix="[char]" enumtype="[(arabic|loweralpha|upperalpha|lowerroman|upperroman]"> ;[text]</enumerated_list>
    Throws:
    IOException

  • peekTitle

    public org.dom4j.Element peekTitle()
                                throws IOException
    Parse un titre simple ou double simple:
     
     Le titre ========
     
     
    double:
     
     ============ le titre ============
     
     

    Returns:
    <title level="[int]" type="[simple|double]" char="[underline char]">
    Throws:
    IOException

    peekTarget

    public org.dom4j.Element peekTarget()
                                 throws IOException
    Throws:
    IOException

    refTarget

    public LinkedList<org.dom4j.Element> refTarget()
                                            throws IOException
    .. _frungible doodads: http://www.example.org/

    Returns:
    Element
    Throws:
    IOException

    peekFootnote

    public org.dom4j.Element peekFootnote()
                                   throws IOException
    .. _frungible doodads: http://www.example.org/

    Returns:
    Element
    Throws:
    IOException

    readNotBlanckLine

    public String readNotBlanckLine()
                             throws IOException
    Lit les premieres ligne non vide et les retourne, rien n'est modifier par rapport aux positions dans le fichier. Util pour afficher a l'utilisateur les lignes qui ont produit une erreur

    Returns:
    les lignes non vides
    Throws:
    IOException

    getLineNumber

    public int getLineNumber()
    return the number of line read

    Returns:
    int

    getCharNumber

    public int getCharNumber()
    return the number of char read

    Returns:
    int


    Copyright © 2004-2010 CodeLutin. All Rights Reserved.