Module ParsePos

Handling parse positions

Author: Jasper Sikorra - jsi@informatik.uni-kiel.de

Version: January 2014

Summary of exported operations:

tw :: Int   
unknown_fname :: String   
setPos :: String -> Int -> Int -> Int -> Pos   
Construct a new position
initPos :: String -> Pos   
Construct the initial position
getFilename :: Pos -> String   
setFilename :: Pos -> String -> Pos   
getAbs :: Pos -> Int   
setAbs :: Pos -> Int -> Pos   
moveAbs :: Pos -> Int -> Pos   
getLn :: Pos -> Int   
setLn :: Pos -> Int -> Pos   
moveLn :: Pos -> Int -> Pos   
getCol :: Pos -> Int   
setCol :: Pos -> Int -> Pos   
moveCol :: Pos -> Int -> Pos   
lnDifference :: Pos -> Pos -> Int   
The difference in lines between two positions
colDifference :: Pos -> Pos -> Int   
The difference in columns between two positions
absDifference :: Pos -> Pos -> Int   
The absolute difference between two positions
fullDifference :: Pos -> Pos -> (Int,Int)   
The line and column difference between two positions
movePosByChar :: Pos -> Char -> Pos   
Move the position one character
movePosByString :: Pos -> String -> Pos   
Move the position multiple characters
toSimplePos :: Pos -> (Int,Int)   
Convert to SimplePos
fromSimplePos :: (Int,Int) -> Pos   
Convert from SimplePos
fromSimplePosWithFname :: (Int,Int) -> String -> Pos   
Convert from SimplePos with Filename

Exported datatypes:


Filename

Type synonym: Filename = String


Absolute

Type synonym: Absolute = Int


Line

Type synonym: Line = Int


Column

Type synonym: Column = Int


SimplePos

Type synonym: SimplePos = (Int,Int)


Pos

The Pos data type contains the name of the file, the absolute, where every character is counted as 1 (newlines, tabs too) (starting with 0), the line (starting with 1) and the column (starting with 1) of the character's position.

Constructors:


Exported operations:

tw :: Int   

Further infos:
  • solution complete, i.e., able to compute all solutions

unknown_fname :: String   

Further infos:
  • solution complete, i.e., able to compute all solutions

setPos :: String -> Int -> Int -> Int -> Pos   

Construct a new position

Further infos:
  • solution complete, i.e., able to compute all solutions

initPos :: String -> Pos   

Construct the initial position

Further infos:
  • solution complete, i.e., able to compute all solutions

getFilename :: Pos -> String   

Further infos:
  • solution complete, i.e., able to compute all solutions

setFilename :: Pos -> String -> Pos   

Further infos:
  • solution complete, i.e., able to compute all solutions

getAbs :: Pos -> Int   

Further infos:
  • solution complete, i.e., able to compute all solutions

setAbs :: Pos -> Int -> Pos   

Further infos:
  • solution complete, i.e., able to compute all solutions

moveAbs :: Pos -> Int -> Pos   

getLn :: Pos -> Int   

Further infos:
  • solution complete, i.e., able to compute all solutions

setLn :: Pos -> Int -> Pos   

Further infos:
  • solution complete, i.e., able to compute all solutions

moveLn :: Pos -> Int -> Pos   

getCol :: Pos -> Int   

Further infos:
  • solution complete, i.e., able to compute all solutions

setCol :: Pos -> Int -> Pos   

Further infos:
  • solution complete, i.e., able to compute all solutions

moveCol :: Pos -> Int -> Pos   

lnDifference :: Pos -> Pos -> Int   

The difference in lines between two positions

colDifference :: Pos -> Pos -> Int   

The difference in columns between two positions

absDifference :: Pos -> Pos -> Int   

The absolute difference between two positions

fullDifference :: Pos -> Pos -> (Int,Int)   

The line and column difference between two positions

movePosByChar :: Pos -> Char -> Pos   

Move the position one character

movePosByString :: Pos -> String -> Pos   

Move the position multiple characters

toSimplePos :: Pos -> (Int,Int)   

Convert to SimplePos

Further infos:
  • solution complete, i.e., able to compute all solutions

fromSimplePos :: (Int,Int) -> Pos   

Convert from SimplePos

fromSimplePosWithFname :: (Int,Int) -> String -> Pos   

Convert from SimplePos with Filename