Code Monkey home page Code Monkey logo

atto's People

Contributors

adelbertc avatar agjacome avatar bardurarantsson avatar benfradet avatar ceedubs avatar christopherdavenport avatar coltfred avatar cornerman avatar cquiroz avatar davidnadeau avatar dwijnand avatar ekmett avatar felher avatar gitter-badger avatar jkachmar avatar khitiara avatar krever avatar liff avatar marcsaegesser avatar mergify[bot] avatar pepegar avatar pocketberserker avatar scala-steward avatar sethtisue avatar tabdulradi avatar tpolecat avatar vincentdehaan avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atto's Issues

Refined support

I wrote this. Would like it to be part of the library? maybe a separate module?

Edge case in Combinator.choice/1

[info] ! Combinator.choice/1: Falsified after 90 passed tests.
[info] > ARG_0: "枇噻㷻讃"
[info] > ARG_1: ""
[info] > ARG_2: "\u0000"
[info] > ARG_2_ORIGINAL: "얐꽭ḋ廧뀎陏ၢ茁迏ἵ䝨쑥醹黜㱩隢ଧꜾ㹉᥂乬䙗⫑뼂ữ॥鈘䇏蠵ܺ漽탳蜥礵㓹䉔눎只睃绪㚱뽈ి蹈쌁쳪鶙ꝺ愛ꄒ늾ᶰ榉泆⑦캳蔅௯抡⦡喝ᥡ讔ᅄ벎ꎏ誹ᑁ涝寣㒿ɜ烞ə윕"

Tutorial documentation is pre-pandemic

The tutorial documentation has not been published since #191 which I noticed after exploring fpcomplete.com for a while and then going to make a PR tweak. But this is how we learn!

Make it easier to find tut docs

I remembered that there were some useful atto tut docs, but after the microsite transition I found them a little difficult to locate and probably wouldn't have kept looking for them if I didn't know that they were there somewhere.

Currently it looks like the only real way to get to them from the site is to click on "Documentation" in the top right. For some reason I had assumed that this would take me to the API ScalaDocs, which might just be a me thing. However, I think that at a minimum it would be helpful to link to the tut docs in the readme/index body.

`parens`, `squareBrackets`, `braces`, `envelopes`, `bananas` are not actually lazy when parsing an input string

All the derived specializations of bracket aren't actually lazy in their argument when the generated parser is finally applied to some string. This prevents me from writing mutually recursive parsers that make use of any of these specializations of bracket as they will promptly enter an infinite loop when asked to parse any string.

import atto._
import Atto._

def dummyParser: Parser[Char] = {println("activate!"); char('a')}

// Prints activate!
parens(dummyParser).parseOnly("notparentheses")

def myParens[A](p: => Parser[A]): Parser[A] =
  bracket(char('('), p, char(')')) // Notice the absence of named

// Does not print anything
myParens(dummyParser).parseOnly("notparentheses")

Applicative yields SOE where Monad does not

Current import: "org.tpolecat" %% "atto-core" % "0.4.2"

Example code:

lazy val exprBad: Parser[Int] = eParensBad | eLiteralInt
lazy val eParensBad: Parser[Int] = char('(') *> many(whitespace) *> exprBad <* many(whitespace) <* char(')')

lazy val exprGood: Parser[Int] = eParensGood | eLiteralInt
lazy val eParensGood: Parser[Int] = {
  for {
    _ <- char('(')
    _ <- many(whitespace)
    e <- exprGood
    _ <- many(whitespace)
    _ <- char(')')
  } yield (e)
}

lazy val eLiteralInt: Parser[Int] = int

def makeItCrash = exprBad.parse("5").done
def worksFine = exprGood.parse("5").done

scala> worksFine
res0: atto.ParseResult[Int] = Done(,5)
scala> makeItCrash
java.lang.StackOverflowError
  <stacktrace bouncing between exprBad and eParensBad>

ScalaJS support

I am using Atto to parse Uris in Hammock, but since it doesn't compile to ScalaJS, I cannot merge it yet.

It would be really cool that we could use Atto in scala JS projects.

Sources can't be located via sbt-ctags or sbt-sublime

It appears the sources for atto cannot be located by either sbt-ctags or sbt-sublime.

I'm running SBT 0.13.5 and trying to get atto 0.3 on scala 2.11.

Both of these utilities find org.spire-math.spire, but for some reason they can't find the sources for atto.

add tests for streams

there are a lot of corner cases depending on chunking of input, so it would be really nice to have fuzz tests for streams

Numeric.bigInt can fail in scala-js

The numeric parsing methods in the JDK stubs delegate to parseInt, etc., in Javascript which is not as lenient as the parsers on the JVM. In particular c.isDigit doesn't guarantee that Integer.parseInt will work. See gemini-hlsw/gem#201

Problems compiling stringOf in 0.5.x branch

I am using the cats compat lib, and cannot get the stringOf operator to compile. I am getting two errorr:

Error:(7, 21) could not find implicit value for evidence parameter of type atto.compat.NonEmptyListy[F]
    term <- stringOf(letter)
Error:(7, 21) not enough arguments for method stringOf: (implicit evidence$1: atto.compat.NonEmptyListy[F])atto.Parser[String].
Unspecified value parameter evidence$1.
    term <- stringOf(letter)

the error can be reproduced with this code:

import atto._, Atto._, atto.compat.cats._

object mvp extends App {

  val parser = for {
    term <- stringOf(letter)
  } yield term

}

build.sbt:

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  "org.typelevel" %% "cats"  % "0.7.2",
  "org.tpolecat" %% "atto-core"     % "0.5.0-SNAPSHOT",
  "org.tpolecat" %% "atto-compat-cats"     % "0.5.0-SNAPSHOT"
)

resolvers ++= Seq(
  "atto" at "https://oss.sonatype.org/content/repositories/snapshots/"
)

How can I provide this evidence? or should the compat library be handling this?

Calling Atto from java/JRuby adds required mystery 3rd parameter to Combinators

I'm trying to do something a little funky with Atto by using it from JRuby, and I'm running into a strange issue.

Trying to run the readme example of parsing a list of integers separated by whitespace, but when calling

Parser.parse(Atto.sepBy(Atto.int, Atto.spaceChar), "123 45 6"), it tells me I'm missing an argument (2 for 3) in sepBy, whose signature in the scala code appears to only require 2 arguments. When I try providing different kinds of arguments to the third slot, it suggests i get something coercible to atto.compat.NonEmptyListy.
When i try providing NonEmptyList like inputs into the 3rd argument,
Atto.sepBy(Atto.int, Atto.spaceChar, NonEmptyList(1)), it tells me that I'm missing a method 'cons'. It suggests something about overloading to atto.compat.NonEmptyListy, or scala.Function0, but I'm stuck unable to figure out what the 3rd argument should be. When I look in the code for Atto, I notice there is an implicit Functor in ParseResultInstances. Is there some sort of Functor i should be passing as the third argument to let it accumulate on? or some kind of 'empty parser', like the Ok parser?

I understand that this is not the usual use of this library, but I would very much appreciate any help you can give.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.