Ejemplo n.º 1
0
def p_sections(t):
    '''sections : sections section
                | section'''
    if len(t) == 3:
        t[0] = node('[SECTIONS]')
        t[0].add(t[1])
        t[0].add(t[2])
    if len(t) == 2:
        t[0] = node('[SECTIONS]')
        t[0].add(t[1])
Ejemplo n.º 2
0
def p_items(t):
    r'''items : items item
                | item'''
    if len(t) == 3:
        t[0] = node('[ITEMS]')
        t[0].add(t[1])
        t[0].add(t[2])
    elif len(t) == 2:
        t[0] = node('[ITEMS]')
        t[0].add(t[1])
Ejemplo n.º 3
0
def p_subsection(t):
    r'''subsection : SUBSECTION LB TEXT RB TEXT
                    | SUBSECTION LB TEXT RB TEXT itemize TEXT'''
    if len(t) == 6:
        t[0] = node('[SUBSECTION](%s)' % t[3])
        t[0].add(node(t[5]))
    elif len(t) == 8:
        t[0] = node('[SUBSECTION](%s)' % t[3])
        t[0].add(node(t[5]))
        t[0].add(t[6])
        t[0].add(node(t[7]))
Ejemplo n.º 4
0
def p_content(t):
    r'''content :  title abs sections
                    | title author abs sections'''
    if len(t) == 4:
        t[0] = node('[CONTENT]')
        t[0].add(t[1])
        t[0].add(t[2])
        t[0].add(t[3])
    elif len(t) == 5:
        t[0] = node('[CONTENT]')
        t[0].add(t[1])
        t[0].add(t[2])
        t[0].add(t[3])
        t[0].add(t[4])
Ejemplo n.º 5
0
def p_content(t):
    r'content : title abs sections'
    if len(t) == 4:
        t[0] = node('[CONTENT]')
        t[0].add(t[1])
        t[0].add(t[2])
        t[0].add(t[3])
Ejemplo n.º 6
0
def p_abs(t):
    r'abs : BEGIN LB ABS RB TEXT END LB ABS RB'
    if len(t) == 10:
        t[0] = node('[ABSTRACT]')
        t[0].add(node(t[5]))
Ejemplo n.º 7
0
def p_author(t):
    r'author : AUTHOR LB TEXT RB'
    if len(t) == 5:
        t[0] = node('[AUTHOR]')
        t[0].add(node(t[3]))
Ejemplo n.º 8
0
def p_title(t):
    r'title : TITLE LB TEXT RB'
    if len(t) == 5:
        t[0] = node('[TITLE]')
        t[0].add(node(t[3]))
Ejemplo n.º 9
0
def p_item(t):
    r'item : ITEM TEXT'
    if len(t) == 3:
        t[0] = node('[ITEM]')
        t[0].add(node(t[2]))
Ejemplo n.º 10
0
def p_itemsize(t):
    r'itemize : BEGIN LB ITEMIZE RB items END LB ITEMIZE RB'
    if len(t) == 10:
        t[0] = node('[ITEMIZE]')
        t[0].add(t[5])
Ejemplo n.º 11
0
def p_doc(t):
    r'doc : BEGIN LB DOC RB content END LB DOC RB'
    if len(t) == 10:
        t[0] = node('[DOC]')
        t[0].add(t[5])
Ejemplo n.º 12
0
def p_section(t):
    r'section : SECTION LB TEXT RB TEXT'
    if len(t) == 6:
        t[0] = node('[SECTION](%s)' % t[3])
        t[0].add(node(t[5]))