Merge branch 'master' into ast

This commit is contained in:
Gleb Koval 2025-02-01 20:37:14 +00:00
commit 1643628c60
Signed by: cyclane
GPG Key ID: 15E168A8B332382C
3 changed files with 8 additions and 17 deletions

View File

@ -1,2 +1,4 @@
version = 3.8.6
runner.dialect = scala3
maxColumn = 100

View File

@ -24,9 +24,7 @@ object ast {
case object PairLiter extends Expr6 with ParserBridge0[PairLiter.type]
case class Ident(v: String) extends Expr6 with LValue
object Ident extends ParserBridge1[String, Ident]
case class ArrayElem(name: Ident, indices: List[Expr])
extends Expr6
with LValue
case class ArrayElem(name: Ident, indices: List[Expr]) extends Expr6 with LValue
object ArrayElem extends ParserBridge2[Ident, List[Expr], ArrayElem]
case class Parens(expr: Expr) extends Expr6
object Parens extends ParserBridge1[Expr, Parens]
@ -78,17 +76,13 @@ object ast {
case object BoolType extends BaseType with ParserBridge0[BoolType.type]
case object CharType extends BaseType with ParserBridge0[CharType.type]
case object StringType extends BaseType with ParserBridge0[StringType.type]
case class ArrayType(elemType: Type, dimensions: Int)
extends Type
with PairElemType
case class ArrayType(elemType: Type, dimensions: Int) extends Type with PairElemType
object ArrayType extends ParserBridge2[Type, Int, ArrayType]
case class PairType(fst: PairElemType, snd: PairElemType) extends Type
object PairType extends ParserBridge2[PairElemType, PairElemType, PairType]
sealed trait PairElemType
case object UntypedPairType
extends PairElemType
with ParserBridge0[UntypedPairType.type]
case object UntypedPairType extends PairElemType with ParserBridge0[UntypedPairType.type]
// waccadoodledo
case class Program(funcs: List[FuncDecl], main: List[Stmt])
@ -101,8 +95,7 @@ object ast {
params: List[Param],
body: List[Stmt]
)
object FuncDecl
extends ParserBridge4[Type, Ident, List[Param], List[Stmt], FuncDecl]
object FuncDecl extends ParserBridge4[Type, Ident, List[Param], List[Stmt], FuncDecl]
case class Param(paramType: Type, name: Ident)
object Param extends ParserBridge2[Type, Ident, Param]
@ -124,8 +117,7 @@ object ast {
object Exit extends ParserBridge1[Expr, Exit]
case class Print(expr: Expr, newline: Boolean) extends Stmt
object Print extends ParserBridge2[Expr, Boolean, Print]
case class If(cond: Expr, thenStmt: List[Stmt], elseStmt: List[Stmt])
extends Stmt
case class If(cond: Expr, thenStmt: List[Stmt], elseStmt: List[Stmt]) extends Stmt
object If extends ParserBridge3[Expr, List[Stmt], List[Stmt], If]
case class While(cond: Expr, body: List[Stmt]) extends Stmt
object While extends ParserBridge2[Expr, List[Stmt], While]

View File

@ -5,10 +5,7 @@ import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.Inspectors.forEvery
import parsley.{Success, Failure}
class ParallelExamplesSpec
extends AnyFlatSpec
with BeforeAndAfterAll
with ParallelTestExecution {
class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll with ParallelTestExecution {
val files =
allWaccFiles("wacc-examples/valid").map { p =>
(p.toString, List(0))