Use \r\n, \n, \n\r for newlines

This commit is contained in:
dmitry 2021-03-22 11:48:10 +03:00
parent 82428b1227
commit f3372e5d6b
4 changed files with 70 additions and 5 deletions

View File

@ -28,3 +28,64 @@ input directory should contain files with `aqua` scripts
- Abilities passing
- Print syntax errors better way
- For the offset, find a token
### Wishlist
1)
if aaa == bbb: -- !=
else:
2)
try:
catch err:
3)
$streams
4...)
while x:
backpressure...
5)
use "smth.aqua" as Smth
6)
ability passing:
func x {Ab} -> y
func x {Ab} -> y {Foo}
func x -> y {Foo}
7)
on Ability x:
8)
on browserId via relayId:
9)
compilation targets
- ts
- pure air
- ???????????????????
10)
use blueprint "blueprint id" as ServiceName
11)
kademlia in Aqua
onKadNeighborhood(kad_key, replicationFactor) do:
....
12)
better lambda expressions
13)
@-expression
alias AuthToken: bool
func foo(token: AuthToken @check[from app.auth])
14) FUTURE
generate facade modules from Aqua

View File

@ -6,7 +6,7 @@ data Smth:
oloolo: Akaka
service MySrv:
func: A -> u32
func: A, u32 -> u32
-- We can have comments inside
pure: -> []Cdef
@ -31,3 +31,6 @@ func do_smth2( a: X, b: -> Z ): -- And comments after the line
alias Akaka : u32
alias Akaka : bool
service Json("json"):
getString: string, string -> string

View File

@ -7,12 +7,12 @@ import aqua.parser.lift.LiftParser
import cats.Comonad
import cats.parse.Parser
case class ArrowTypeExpr[F[_]](name: Name[F], `type`: ArrowTypeToken[F]) extends Expr[F] {}
case class ArrowTypeExpr[F[_]](name: Name[F], `type`: ArrowTypeToken[F]) extends Expr[F]
object ArrowTypeExpr extends Expr.Leaf {
override def p[F[_]: LiftParser: Comonad]: Parser[Expr[F]] =
((Name.p[F] <* ` : `) ~ ArrowTypeToken.`arrowdef`[F]).map {
case (name, t) => ArrowTypeExpr(name, t)
((Name.p[F] <* ` : `) ~ ArrowTypeToken.`arrowdef`[F]).map { case (name, t) =>
ArrowTypeExpr(name, t)
}
}

View File

@ -17,6 +17,7 @@ object Token {
private val anum = az ++ AZ ++ f09
private val f_ = Set('_')
private val anum_ = anum ++ f_
private val nl = Set('\n', '\r')
val ` ` : P[String] = P.charsWhile(fSpaces)
val `data`: P[Unit] = P.string("data")
@ -31,7 +32,7 @@ object Token {
val ` : ` : P[Unit] = P.char(':').surroundedBy(` `.?)
val `name`: P[String] = (P.charIn(az) ~ P.charsWhile(anum_).?).map { case (c, s) c.toString ++ s.getOrElse("") }
val `Class`: P[String] = (P.charIn(AZ) ~ P.charsWhile(anum_).?).map { case (c, s) c.toString ++ s.getOrElse("") }
val `\n` : P[Unit] = P.char('\n')
val `\n` : P[Unit] = P.string("\n\r") | P.char('\n') | P.string("\r\n")
val `--` : P[Unit] = ` `.?.with1 *> P.string("--") <* ` `.?
val ` \n` : P[Unit] = (` `.?.void *> (`--` *> P.charsWhile(_ != '\n')).?.void).with1 *> `\n`
val ` \n+` : P[Unit] = P.repAs[Unit, Unit](` \n`.backtrack, 1)(Accumulator0.unitAccumulator0)