clafer-0.4.5: Compiles Clafer models to other formats: Alloy, JavaScript, JSON, HTML, Dot.

Safe HaskellNone
LanguageHaskell2010

Language.Clafer.Front.LayoutResolver

Description

Resolves indentation into explicit nesting using { }

Synopsis

Documentation

data LayEnv Source #

Constructors

LayEnv 

Fields

Instances

type LastNl = (Int, Int) Source #

ident level of new line, current level or parenthesis

data LEnv Source #

ident level stack, last new line

Constructors

LEnv [Int] (Maybe LastNl) 

incrGlobal Source #

Arguments

:: Monad m 
=> Position

If the token is on the same line as this position, update the column position.

-> Int

Number of characters to add to the position.

-> Token 
-> ClaferT m Token 

Add to the global and column positions of a token. | The column position is only changed if the token is on | the same line as the given position.

position :: Token -> Position Source #

Get the position of a token.

line :: Token -> Int Source #

Get the line number of a token.

column :: Token -> Int Source #

Get the column number of a token.

isTokenIn :: [String] -> Token -> Bool Source #

Check if a token is one of the given symbols.

isLayoutOpen :: Token -> Bool Source #

Check if a token is the layout open token.

isLayoutClose :: Token -> Bool Source #

Check if a token is the layout close token.

tokenLength :: Token -> Int Source #

Get the number of characters in the token.

addToken Source #

Arguments

:: Monad m 
=> Position

Position of the new token.

-> String

Symbol in the new token.

-> [Token]

The rest of the tokens. These will have their positions updated to make room for the new token.

-> ClaferT m [Token] 

Insert a new symbol token at the begninning of a list of tokens.

emit :: MonadState LayEnv m => Char -> m () Source #