fix: replace String with Ident where applicable
This commit is contained in:
parent
50a07cf5d4
commit
f4d0ef8e70
@ -37,14 +37,13 @@ object ast {
|
||||
|
||||
case object PairLiter extends Expr6 with ParserBridge0[PairLiter.type]
|
||||
|
||||
// TODO: with LValue questionable (see LValue BNF)
|
||||
case class Ident(v: String) extends Expr6 with LValue
|
||||
object Ident extends ParserBridge1[String, Ident]
|
||||
|
||||
case class ArrayElem(name: String, indices: List[Expr])
|
||||
case class ArrayElem(name: Ident, indices: List[Expr])
|
||||
extends Expr6
|
||||
with LValue
|
||||
object ArrayElem extends ParserBridge2[String, List[Expr], ArrayElem]
|
||||
object ArrayElem extends ParserBridge2[Ident, List[Expr], ArrayElem]
|
||||
|
||||
// R values
|
||||
sealed trait RValue
|
||||
@ -55,8 +54,8 @@ object ast {
|
||||
case class NewPair(fst: Expr, snd: Expr) extends Expr6 with RValue
|
||||
object NewPair extends ParserBridge2[Expr, Expr, NewPair]
|
||||
|
||||
case class Call(name: String, args: List[Expr]) extends Expr6 with RValue
|
||||
object Call extends ParserBridge2[String, List[Expr], Call]
|
||||
case class Call(name: Ident, args: List[Expr]) extends Expr6 with RValue
|
||||
object Call extends ParserBridge2[Ident, List[Expr], Call]
|
||||
|
||||
// Unary operators
|
||||
case class Negate(x: Expr6) extends Expr6
|
||||
@ -101,8 +100,8 @@ object ast {
|
||||
// Statements
|
||||
sealed trait Stmt
|
||||
case object Skip extends Stmt with ParserBridge0[Skip.type]
|
||||
case class VarDecl(varType: Type, name: String, expr: Expr) extends Stmt
|
||||
object VarDecl extends ParserBridge3[Type, String, Expr, VarDecl]
|
||||
case class VarDecl(varType: Type, name: Ident, expr: Expr) extends Stmt
|
||||
object VarDecl extends ParserBridge3[Type, Ident, Expr, VarDecl]
|
||||
case class Assign(lhs: LValue, expr: Expr) extends Stmt
|
||||
object Assign extends ParserBridge2[LValue, Expr, Assign]
|
||||
case class Read(lhs: LValue) extends Stmt
|
||||
@ -135,15 +134,15 @@ object ast {
|
||||
// Function Defns
|
||||
case class FuncDecl(
|
||||
returnType: Type,
|
||||
name: String,
|
||||
name: Ident,
|
||||
params: List[Param],
|
||||
body: Stmt
|
||||
)
|
||||
object FuncDecl
|
||||
extends ParserBridge4[Type, String, List[Param], Stmt, FuncDecl]
|
||||
extends ParserBridge4[Type, Ident, List[Param], Stmt, FuncDecl]
|
||||
|
||||
case class Param(paramType: Type, name: String)
|
||||
object Param extends ParserBridge2[Type, String, Param]
|
||||
case class Param(paramType: Type, name: Ident)
|
||||
object Param extends ParserBridge2[Type, Ident, Param]
|
||||
|
||||
// waccadoodledo
|
||||
case class Program(funcs: List[FuncDecl], main: Stmt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user