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]
|
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
|
case class Ident(v: String) extends Expr6 with LValue
|
||||||
object Ident extends ParserBridge1[String, Ident]
|
object Ident extends ParserBridge1[String, Ident]
|
||||||
|
|
||||||
case class ArrayElem(name: String, indices: List[Expr])
|
case class ArrayElem(name: Ident, indices: List[Expr])
|
||||||
extends Expr6
|
extends Expr6
|
||||||
with LValue
|
with LValue
|
||||||
object ArrayElem extends ParserBridge2[String, List[Expr], ArrayElem]
|
object ArrayElem extends ParserBridge2[Ident, List[Expr], ArrayElem]
|
||||||
|
|
||||||
// R values
|
// R values
|
||||||
sealed trait RValue
|
sealed trait RValue
|
||||||
@ -55,8 +54,8 @@ object ast {
|
|||||||
case class NewPair(fst: Expr, snd: Expr) extends Expr6 with RValue
|
case class NewPair(fst: Expr, snd: Expr) extends Expr6 with RValue
|
||||||
object NewPair extends ParserBridge2[Expr, Expr, NewPair]
|
object NewPair extends ParserBridge2[Expr, Expr, NewPair]
|
||||||
|
|
||||||
case class Call(name: String, args: List[Expr]) extends Expr6 with RValue
|
case class Call(name: Ident, args: List[Expr]) extends Expr6 with RValue
|
||||||
object Call extends ParserBridge2[String, List[Expr], Call]
|
object Call extends ParserBridge2[Ident, List[Expr], Call]
|
||||||
|
|
||||||
// Unary operators
|
// Unary operators
|
||||||
case class Negate(x: Expr6) extends Expr6
|
case class Negate(x: Expr6) extends Expr6
|
||||||
@ -101,8 +100,8 @@ object ast {
|
|||||||
// Statements
|
// Statements
|
||||||
sealed trait Stmt
|
sealed trait Stmt
|
||||||
case object Skip extends Stmt with ParserBridge0[Skip.type]
|
case object Skip extends Stmt with ParserBridge0[Skip.type]
|
||||||
case class VarDecl(varType: Type, name: String, expr: Expr) extends Stmt
|
case class VarDecl(varType: Type, name: Ident, expr: Expr) extends Stmt
|
||||||
object VarDecl extends ParserBridge3[Type, String, Expr, VarDecl]
|
object VarDecl extends ParserBridge3[Type, Ident, Expr, VarDecl]
|
||||||
case class Assign(lhs: LValue, expr: Expr) extends Stmt
|
case class Assign(lhs: LValue, expr: Expr) extends Stmt
|
||||||
object Assign extends ParserBridge2[LValue, Expr, Assign]
|
object Assign extends ParserBridge2[LValue, Expr, Assign]
|
||||||
case class Read(lhs: LValue) extends Stmt
|
case class Read(lhs: LValue) extends Stmt
|
||||||
@ -135,15 +134,15 @@ object ast {
|
|||||||
// Function Defns
|
// Function Defns
|
||||||
case class FuncDecl(
|
case class FuncDecl(
|
||||||
returnType: Type,
|
returnType: Type,
|
||||||
name: String,
|
name: Ident,
|
||||||
params: List[Param],
|
params: List[Param],
|
||||||
body: Stmt
|
body: Stmt
|
||||||
)
|
)
|
||||||
object FuncDecl
|
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)
|
case class Param(paramType: Type, name: Ident)
|
||||||
object Param extends ParserBridge2[Type, String, Param]
|
object Param extends ParserBridge2[Type, Ident, Param]
|
||||||
|
|
||||||
// waccadoodledo
|
// waccadoodledo
|
||||||
case class Program(funcs: List[FuncDecl], main: Stmt)
|
case class Program(funcs: List[FuncDecl], main: Stmt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user