Esempio 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)
Esempio 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)
Esempio 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
Esempio 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
Esempio n. 5
0
def stateLineColumn(state):
    pos =  parseSuccessPos(state) if isParseSuccess(state) else parseErrorPos(state)
    return sourceLine(pos), sourceColumn(pos)