Threat Name | Megabackup |
Category | Trojan Horse. |
Main Activity | Slithers onto your Mac and may steal information from it. A heuristic detection for most conventional trojan horses. |
Signs of Presence | Slow PC, changed settings, error messages, suspicious PC behavior. Logins from unknown sources on your online accounts. |
Spread | Via malicious e-mail spam and set of infection tools. |
Detection+Removal | Note!For Mac users, please use the following instructions. |
parser-combinators
grows, megaparsec
shrinksparser-combinators
package which provides commonparsing commbinators that work with any instance of Applicative
,Alternative
, Monad
. It’s quite general and depends virtually only onbase
. Recently I included the code to do parsing of permutation phrasesand expressions, so we’re now able to drop Text.Megaparsec.Perm
andText.Megaparsec.Expr
from Megaparsec itself:Text.Megaparsec.Perm
→ Control.Applicative.Permutations
Text.Megaparsec.Expr
→ Control.Monad.Combinators.Expr
Text.Megaparec.Char
andText.Megaparsec.Byte
that are actually not specific to input stream typeand should live in the Text.Megaparsec
module. So they have been moved.And renamed.single
combinator that is a generalization of char
for arbitrary streams. Text.Megaparsec.Char
and Text.Megaparsec.Byte
still contain char
as type-constrained versions of single
.chunk
combinator that is a generalization ofstring
for arbitrary streams. The string
combinator is stillre-exported from Text.Megaparsec.Char
and Text.Megaparsec.Byte
forcompatibility.satisfy
does not depend on type of token, and so it now lives inText.Megaparsec
.anyChar
was renamed to anySingle
and moved to Text.Megaparsec
.notChar
was renamed to anySingleBut
and moved to Text.Megaparsec
.oneOf
and noneOf
were moved to Text.Megaparsec
.ParseError
:parseErrorPretty
, parseErrorPretty'
, and parseErrorPretty_
. The lastwas added because parseErrorPretty'
actually doesn’t allow specifyingtab width which is necessary to know for proper displaying of lines withtabs.ParseError
and Text
to work around this.mmark
can reportseveral ParseError
s at once, and when they are pretty-printed, wedisplay an offending line per error from the original input stream. If wejust use the functions that are provided out-of-the-box, we’ll betraversing the input stream N times, where N is the number ofParseError
s we want to display. Not nice at all!ParseErrorBundle
that functions like parse
will return.errorBundlePretty
.ParseError
s which aresorted. During pretty-printing it should traverse input stream only once.PosState
is defined like so:ParseError
sin one pass. Functions like runParser
or parse
always return only oneParseError
in a bundle, but we can add more ourselves, which is what Ithink mmark
will be doing.PosState
though, and it has to do with theperformance improvements in Megaparsec 7.SourcePos
in State
is expensive, butpretty much a useless thing to do if a parser doesn’t fail.SourcePos
when we want to present ParseErrors
tohumans. For everything else a simple Int
offset as the number ofconsumed tokens so far is perfect.SourcePos
anyway, so keepingstateTokensProcessed
and statePos
at the same time is a waste.SourcePos
from offsets while doingthat.Int
offset instead of SourcePos
position in ParseError
s.SourcePos
when necessary on pretty-printing.Benchmark | Attoparsec 0.13.2.2 | Megaparsec 6.5.0 | Megaparsec 7.0.0 |
---|---|---|---|
CSV (40) | 99.62 μs | 137.2 μs | 82.75 μs |
Log (40) | 429.4 μs | 577.4 μs | 453.8 μs |
JSON (40) | 27.01 μs | 48.81 μs | 33.68 μs |
Benchmark | Attoparsec 0.13.2.2 | Megaparsec 6.5.0 | Megaparsec 7.0.0 |
---|---|---|---|
CSV (40) | 397,952 | 557,312 | 357,208 |
Log (40) | 1,181,120 | 1,485,776 | 1,246,496 |
JSON (40) | 132,488 | 233,328 | 203,824 |
SourcePos
incrementally and on demand. Re-usingPosState
we plug it into parser State
:reachOffset
is a new method of Stream
that replaces all the oldmethods that had to do with keeping track of source position. At the sametime reachOffset
fetches String
representation of the right line ininput to show in parse errors. And it’s tuned to be incremental, so onlynot-previously-traversed part of input will be processed. I have confirmedon projects like mmark
that even if you use getSourcePos
, there is noperformance regressions, performance stays the same in that case (that’s ifyou don’t call getSourcePos
on every token, which is a bad idea).