Exemplo n.º 1
0
def p_indexed_root(p):
    '''indexed_root : ROOT root_index argument '''
    p[0] = MathObject(content='root')
    p[0].append_child(p[2])  #The first child will be the index.
    p[0].append_child(
        p[3][0]
    )  #This is because p[5] is a list, as index returns that, but we want to append the MathObject, not the list.
Exemplo n.º 2
0
def p_fraction(p):
    '''fraction : FRAC argument argument '''
    p[0] = MathObject(content='fraction')
    p[0].append_child(p[2])
    p[0].append_child(
        p[3][0]
    )  #This is because p[3] is a list, as index returns that, but we want to append the MathObject, not the list.
Exemplo n.º 3
0
def p_symbol(p):
    """
    symbol : LIM
            | UNKNOWN
            | MOD
            | "!"
            | NOT
            | LINEBREAK
                        | KNOT
                        | USER
    """
    p[0] = MathObject(content=p[1])
Exemplo n.º 4
0
def p_label(p):
    '''label : LABEL '''
    p[0] = MathObject(content='label')
    p[0].append_child(p[1])
Exemplo n.º 5
0
def p_block(p):
    """
    block : BEGINBLOCK formula ENDBLOCK
    """
    p[0] = MathObject(content='block')
    p[0].append_child(p[2])
Exemplo n.º 6
0
def p_pmod(p):
    ''' pmod : PMOD argument '''
    p[0] = MathObject(content='pmod')
    p[0].append_child(p[2])
Exemplo n.º 7
0
def p_text(p):
    ''' text : TEXT TCHAR
            | TEXT ANYTHING'''
    p[0] = MathObject(content='text')
    p[0].append_child(p[2])
Exemplo n.º 8
0
def p_choose(p):
    ''' choose : formula CHOOSE formula '''
    p[0] = MathObject(content='choose')
    p[0].append_child(p[1])
    p[0].append_child(p[3][0])
Exemplo n.º 9
0
def p_binom(p):
    '''binom : BINOM argument argument '''
    p[0] = MathObject(content='binom')
    p[0].append_child(p[2])
    p[0].append_child(p[3][0])
Exemplo n.º 10
0
def p_sqr_root(p):
    '''sqr_root : ROOT argument '''
    p[0] = MathObject(content='root')
    p[0].append_child(p[2])
Exemplo n.º 11
0
def p_largeOp(p):
    ''' symbol : LARGEOP '''
    p[0] = MathObject(content=p[1], kind='LargeOperators')
Exemplo n.º 12
0
def p_dots(p):
    ''' symbol : DOTS '''
    p[0] = MathObject(content=p[1], kind='Dots')
Exemplo n.º 13
0
def p_ord(p):
    ''' symbol : NUM
                            | CHAR
                            | ORD '''
    p[0] = MathObject(content=p[1], kind='Ordinary'
                      )  #Beware to distinguish if is in the dictionary or not.
Exemplo n.º 14
0
def p_delimiter(p):
    ''' symbol : DELIMITER
                            | kdelimiter '''
    p[0] = MathObject(content=p[1], kind='Delimiters')
Exemplo n.º 15
0
def p_arrow(p):
    ''' symbol : ARROW '''
    p[0] = MathObject(content=p[1], kind='Arrows')
Exemplo n.º 16
0
def p_func(p):
    ''' symbol : FUNC '''
    p[0] = MathObject(content=p[1], kind='MathFunctions')
Exemplo n.º 17
0
def p_binrel(p):
    ''' symbol : KBINREL
                            | BINREL'''
    p[0] = MathObject(content=p[1], kind='BinaryRelations'
                      )  #Beware to distinguish if is in the dictionary or not.
Exemplo n.º 18
0
def p_binop(p):
    ''' symbol : BINOP
                       | KBINOP '''
    p[0] = MathObject(content=p[1], kind='BinaryOperators'
                      )  #Beware to distinguish if is in the dictionary or not.