Exemplo n.º 1
0
def mergeErrors(p1, p2):
    '''Returns an error, which occurres further down the input.'''
    pos1, pos2 = parseErrorPos(p1), parseErrorPos(p2)

    x = sourceLine(pos1), sourceColumn(pos1)
    y = sourceLine(pos2), sourceColumn(pos2)

    if x > y:
        return p1
    elif y > x:
        return p2
    else:
        return concatErrors(p1, p2)
Exemplo n.º 2
0
def mergeErrors(p1, p2):
    '''Returns an error, which occurres further down the input.'''
    pos1, pos2 = parseErrorPos(p1), parseErrorPos(p2)
    
    x = sourceLine(pos1), sourceColumn(pos1)
    y = sourceLine(pos2), sourceColumn(pos2)

    if x > y:
        return p1
    elif y > x:
        return p2
    else:
        return concatErrors(p1, p2)
Exemplo n.º 3
0
def showPositionInfo(pError):
    pos = parseErrorPos(pError)
    filename, line, col = sourceName(pos), sourceLine(pos), sourceColumn(pos)

    info = '"%s" ' % filename if filename is not None else ''
    info += '(line %d, column %d):' % (line, col)

    return info
Exemplo n.º 4
0
def showPositionInfo(pError):
    pos = parseErrorPos(pError)
    filename, line, col = sourceName(pos), sourceLine(pos), sourceColumn(pos)

    info = '"%s" ' % filename if filename is not None else ''
    info += '(line %d, column %d):' % (line, col)
    
    return info
Exemplo n.º 5
0
def stateLineColumn(state):
    pos =  parseSuccessPos(state) if isParseSuccess(state) else parseErrorPos(state)
    return sourceLine(pos), sourceColumn(pos)