Copyright | Copyright 2011-2017 Neil Mitchell |
---|---|
License | BSD3 |
Maintainer | opensource@awakesecurity.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Lexing is a slow point, the code below is optimised.
Since: 0.1.0
- lexFileIO :: Path -> IO [Lexeme Ann]
- lexTextIO :: Text -> IO [Lexeme Ann]
- lexBSIO :: ByteString -> IO [Lexeme Ann]
- lexFile :: (MonadError ParseError m, MonadReadFile m) => Path -> m [Lexeme Ann]
- lexText :: MonadError ParseError m => Text -> m [Lexeme Ann]
- lexBS :: MonadError ParseError m => ByteString -> m [Lexeme Ann]
- lexTextWithPath :: MonadError ParseError m => Maybe Path -> Text -> m [Lexeme Ann]
- lexBSWithPath :: MonadError ParseError m => Maybe Path -> ByteString -> m [Lexeme Ann]
- lexemesP :: Parser m [Lexeme Ann]
- type Parser m a = ParsecT Dec Text m a
- type Ann = Spans
- data Lexeme ann
- data LName ann = MkLName {
- _lnameAnn :: !ann
- _lnameBS :: !ByteString
- newtype LFile ann = MkLFile {
- _lfileExpr :: Expr ann
- data LBind ann = MkLBind {
- _lbindAnn :: !ann
- _lbindName :: !(LName ann)
- _lbindValue :: !(Expr ann)
- data LBuild ann = MkLBuild {
- _lbuildAnn :: !ann
- _lbuildOuts :: ![Expr ann]
- _lbuildRule :: !(LName ann)
- _lbuildDeps :: ![Expr ann]
- makeLBuild :: forall ann. ann -> [Expr ann] -> LName ann -> [Expr ann] -> LBuild ann
- class Monad m => PositionParsing m where
lex*IO
lexFileIO :: Path -> IO [Lexeme Ann] Source #
Lex the file at the given path. This function may throw an exception if parsing fails.
Since: 0.1.0
lexTextIO :: Text -> IO [Lexeme Ann] Source #
Lex the given Text
.
This function may throw an exception if parsing fails.
Since: 0.1.0
lexBSIO :: ByteString -> IO [Lexeme Ann] Source #
Lex the given ByteString
.
This function may throw an exception if parsing fails.
Since: 0.1.0
lex*
lexFile :: (MonadError ParseError m, MonadReadFile m) => Path -> m [Lexeme Ann] Source #
Lex the given file.
Since: 0.1.0
lexText :: MonadError ParseError m => Text -> m [Lexeme Ann] Source #
Lex the given Text
.
Since: 0.1.0
lexBS :: MonadError ParseError m => ByteString -> m [Lexeme Ann] Source #
Lex the given ByteString
.
Since: 0.1.0
lex*WithPath
lexTextWithPath :: MonadError ParseError m => Maybe Path -> Text -> m [Lexeme Ann] Source #
lexBSWithPath :: MonadError ParseError m => Maybe Path -> ByteString -> m [Lexeme Ann] Source #
Lex the given ByteString
that comes from the given Path
, if it is
provided. The Path
is only used for error messages.
Since: 0.1.0
Other ways of running the lexer
Type aliases
Lexeme
and friends
Lex each line separately, rather than each lexeme.
Since: 0.1.0
LexDefine !ann !(LBind ann) | foo = bar Since: 0.1.0 |
LexBind !ann !(LBind ann) | [indent]foo = bar Since: 0.1.0 |
LexInclude !ann !(LFile ann) | include file Since: 0.1.0 |
LexSubninja !ann !(LFile ann) | subninja file Since: 0.1.0 |
LexBuild !ann !(LBuild ann) | build foo: bar | baz || qux Since: 0.1.0 |
LexRule !ann !(LName ann) | rule name Since: 0.1.0 |
LexPool !ann !(LName ann) | pool name Since: 0.1.0 |
LexDefault !ann ![Expr ann] | default foo bar Since: 0.1.0 |
Functor Lexeme Source # | |
Foldable Lexeme Source # | |
Traversable Lexeme Source # | |
Annotated Lexeme Source # | The usual definition for Since: 0.1.0 |
(Monad m, LexemeConstraint (Serial m) ann) => Serial m (Lexeme ann) Source # | Default Since: 0.1.0 |
(Monad m, LexemeConstraint (CoSerial m) ann) => CoSerial m (Lexeme ann) Source # | Default Since: 0.1.0 |
Eq ann => Eq (Lexeme ann) Source # | |
Show ann => Show (Lexeme ann) Source # | |
Generic (Lexeme ann) Source # | |
Hashable ann => Hashable (Lexeme ann) Source # | Default Since: 0.1.0 |
ToJSON ann => ToJSON (Lexeme ann) Source # | Converts to Since: 0.1.0 |
FromJSON ann => FromJSON (Lexeme ann) Source # | Inverse of the Since: 0.1.0 |
NFData ann => NFData (Lexeme ann) Source # | Default Since: 0.1.0 |
type Rep (Lexeme ann) Source # | |
The name of a Ninja rule or pool.
Since: 0.1.0
MkLName | |
|
Functor LName Source # | |
Foldable LName Source # | |
Traversable LName Source # | |
Annotated LName Source # | The usual definition for Since: 0.1.0 |
(Monad m, LNameConstraint (Serial m) ann) => Serial m (LName ann) Source # | Uses the underlying Since: 0.1.0 |
(Monad m, LNameConstraint (CoSerial m) ann) => CoSerial m (LName ann) Source # | Default Since: 0.1.0 |
Eq ann => Eq (LName ann) Source # | |
Show ann => Show (LName ann) Source # | |
Generic (LName ann) Source # | |
Hashable ann => Hashable (LName ann) Source # | Default Since: 0.1.0 |
ToJSON ann => ToJSON (LName ann) Source # | Converts to Since: 0.1.0 |
FromJSON ann => FromJSON (LName ann) Source # | Inverse of the Since: 0.1.0 |
NFData ann => NFData (LName ann) Source # | Default Since: 0.1.0 |
type Rep (LName ann) Source # | |
A reference to a file in an include
or subninja
declaration.
Since: 0.1.0
MkLFile | |
|
Functor LFile Source # | |
Foldable LFile Source # | |
Traversable LFile Source # | |
(Monad m, LFileConstraint (Serial m) ann) => Serial m (LFile ann) Source # | Default Since: 0.1.0 |
(Monad m, LFileConstraint (CoSerial m) ann) => CoSerial m (LFile ann) Source # | Default Since: 0.1.0 |
Eq ann => Eq (LFile ann) Source # | |
Show ann => Show (LFile ann) Source # | |
Generic (LFile ann) Source # | |
Hashable ann => Hashable (LFile ann) Source # | Default Since: 0.1.0 |
ToJSON ann => ToJSON (LFile ann) Source # | Converts to Since: 0.1.0 |
FromJSON ann => FromJSON (LFile ann) Source # | Inverse of the Since: 0.1.0 |
NFData ann => NFData (LFile ann) Source # | Default Since: 0.1.0 |
type Rep (LFile ann) Source # | |
A Ninja variable binding, top-level or otherwise.
Since: 0.1.0
MkLBind | |
|
Functor LBind Source # | |
Foldable LBind Source # | |
Traversable LBind Source # | |
(Monad m, LBindConstraint (Serial m) ann) => Serial m (LBind ann) Source # | Default Since: 0.1.0 |
(Monad m, LBindConstraint (CoSerial m) ann) => CoSerial m (LBind ann) Source # | Default Since: 0.1.0 |
Eq ann => Eq (LBind ann) Source # | |
Show ann => Show (LBind ann) Source # | |
Generic (LBind ann) Source # | |
Hashable ann => Hashable (LBind ann) Source # | Default Since: 0.1.0 |
ToJSON ann => ToJSON (LBind ann) Source # | Converts to Since: 0.1.0 |
FromJSON ann => FromJSON (LBind ann) Source # | Inverse of the Since: 0.1.0 |
NFData ann => NFData (LBind ann) Source # | Default Since: 0.1.0 |
type Rep (LBind ann) Source # | |
The data contained within a Ninja build
declaration.
Since: 0.1.0
MkLBuild | |
|
Functor LBuild Source # | |
Foldable LBuild Source # | |
Traversable LBuild Source # | |
Annotated LBuild Source # | The usual definition for Since: 0.1.0 |
(Monad m, LBuildConstraint (Serial m) ann) => Serial m (LBuild ann) Source # | Uses the underlying Since: 0.1.0 |
(Monad m, LBuildConstraint (CoSerial m) ann) => CoSerial m (LBuild ann) Source # | Default Since: 0.1.0 |
Eq ann => Eq (LBuild ann) Source # | |
Show ann => Show (LBuild ann) Source # | |
Generic (LBuild ann) Source # | |
Hashable ann => Hashable (LBuild ann) Source # | Default Since: 0.1.0 |
ToJSON ann => ToJSON (LBuild ann) Source # | Converts to Since: 0.1.0 |
FromJSON ann => FromJSON (LBuild ann) Source # | Inverse of the Since: 0.1.0 |
NFData ann => NFData (LBuild ann) Source # | Default Since: 0.1.0 |
type Rep (LBuild ann) Source # | |
:: ann | The build annotation |
-> [Expr ann] | The build outputs |
-> LName ann | The rule name |
-> [Expr ann] | The build dependencies |
-> LBuild ann |
Constructor for an LBuild
.
Since: 0.1.0
Classes
class Monad m => PositionParsing m where Source #
This class is kind of like DeltaParsing
from trifecta
.
Since: 0.1.0
getPosition :: m Position Source #