예제 #1
0
def t_VAR_CURSOR(t):
    r'([a-zA-Z]\|)|(\|[a-zA-Z])'
    varString = t.value
    cursor_idx = varString.index('|')
    varString = varString.replace('|', '')
    t.value = xp.NoOpExpression(varString, True, cursor_idx)
    return t
예제 #2
0
def t_NUM_CURSOR(t):
    r'(\d+\|\d*)|(\d*\|\d+)'
    numString = t.value
    cursor_idx = numString.index('|')
    numString = numString.replace('|', '')
    t.value = xp.NoOpExpression(numString, True, cursor_idx)
    return t
예제 #3
0
파일: ui.py 프로젝트: minw1/Clean-Math
 def __init__(self, midleft):
     self.midleft = midleft
     self.text = ""
     self.index = 0
     self.exp = xp.NoOpExpression("")
     self.surf = xts.smartSurface(self.exp, cursor_show=show_cursor())
     self.rect = pygame.Rect(
         (self.midleft[0], self.midleft[1]),
         (self.surf.get_rect().w, self.surf.get_rect().h))
     self.is_active = False
     uiExpression.allUiExpressions += [self]
예제 #4
0
def get_exp(inputStr):
    if inputStr[1:] == 'loading':
        return xp.Expression(op.Operator('loading...', lambda x: ''),
                             [xp.NoOpExpression("")])
    global error
    error = False
    print('processing', inputStr.replace('\u2986', '$').replace('\u2985', '#'))
    inputStr = preprocess(inputStr)
    print('got', inputStr.replace('\u2986', '$').replace('\u2985', '#'))
    resultingExpression = parser.parse(inputStr)
    if error:
        raise ValueError("Expression could not parse correctly.")
    else:
        return resultingExpression
예제 #5
0
def p_exp3_cempty(p):
    'exp3 : UNF_CURSOR empty'
    p[0] = xp.NoOpExpression("", True, 0)
예제 #6
0
def p_exp3_empty(p):
    'exp3 : empty'
    p[0] = xp.NoOpExpression("")
예제 #7
0
def t_NUMBER(t):
    r'\d+(\.\d+)?'
    t.value = xp.NoOpExpression(str(t.value))
    return t
예제 #8
0
def t_VAR(t):
    r'[a-zA-Z]'
    t.value = xp.NoOpExpression(t.value)
    return t