Integrated Code can be used in Curry in the form
AccentGraves Langtag Whitespaces Code SingleQuotes
where AccentGraves is a number of
greater than 2
SingleQuotes is the same number of '
Langtag is an arbitrary sequence of characters without
whitespaces, tabs and newlines,
Whitespaces is a combination of spaces, tabs and newlines,
and Code is code in the language Langtag.
Is is allowed to use
and ' in the code, as long as they amount of
sequential ` or ' is smaller than their number in AccentGraves.
If there is a corresponding parser to the langtag, the expression can be translated into type-safe Curry code.
Currently available Langtags: format - see the FormatParser and Format library regex - see the RegexParser and Regex library html - see the MLParser and HTML library xml - see the MLParser and XML library sql - see the SQLConverter and CDBI-library
Author: Jasper Sikorra (with changes by Michael Hanus)
Version: January 2018
ciparser
:: String -> String -> IO (PM [StandardToken])
|
parsers
:: Maybe String -> Either String ParserInfo -> Pos -> String -> IO (PM String)
|
addRealFname
:: String -> (Pos,String) -> (Pos,String)
|
formatErrors
:: [PError] -> IO a
|
formatWarnings
:: [(Pos,String)] -> String
|
translateIntCode
:: Int -> String -> String -> String -> IO String
Translates a string containing a Curry program with Integrated Code into a string with pure Curry code. |
tryReadParserInfoFile
:: Int -> String -> String -> IO (Either String ParserInfo)
Try to read parser info file for the SQL preprocessor. |
findParserInfoFile
:: [String] -> IO (Either String String)
|
concatAllIOPM
:: IO (PM [StandardToken]) -> IO (PM String)
Handles the IO and PM monads around the StandardTokens for the concatenation, so they will not disturb in the real concat function concatAll |
concatAll
:: [StandardToken] -> String
Concatenates the result of the translation process, inserting newlines and offsets if necessary |
genLines
:: Int -> String
The function genLines generates lines |
splitByLine
:: String -> (String,String)
The function splitByLine splits a string at the first newline |
applyLangParsers
:: Either String ParserInfo -> IO (PM [StandardToken]) -> IO (PM [StandardToken])
Applies the corresponding translators of the DSL to Curry on the StandardTokens |
applyLangParser
:: Either String ParserInfo -> StandardToken -> IO (PM StandardToken)
Select the right translator and apply it to a single StandardToken |
|
|
|
|
|
Translates a string containing a Curry program with Integrated Code into a string with pure Curry code. The second argument is, if non-empty, the name of an info file containing information about the data model in case of integrated SQL code.
|
Try to read parser info file for the SQL preprocessor. |
|
Handles the IO and PM monads around the StandardTokens for the concatenation, so they will not disturb in the real concat function concatAll
|
Concatenates the result of the translation process, inserting newlines and offsets if necessary
|
The function genLines generates lines
|
The function splitByLine splits a string at the first newline
|
Applies the corresponding translators of the DSL to Curry on the StandardTokens
|
Select the right translator and apply it to a single StandardToken
|