Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
5527fa42
Vérifiée
Valider
5527fa42
rédigé
3 years ago
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
WIP: Define the IrExpression classes family API
parent
a96219ef
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!25
Draft: New Vivy module spec
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/Lib/Script/Ast/IrExpression.cc
+22
-0
22 ajouts, 0 suppression
src/Lib/Script/Ast/IrExpression.cc
src/Lib/Script/Ast/IrExpression.hh
+58
-6
58 ajouts, 6 suppressions
src/Lib/Script/Ast/IrExpression.hh
avec
80 ajouts
et
6 suppressions
src/Lib/Script/Ast/IrExpression.cc
+
22
−
0
Voir le fichier @
5527fa42
...
@@ -5,6 +5,10 @@
...
@@ -5,6 +5,10 @@
#include
<cassert>
#include
<cassert>
/*
** IrExpression
*/
namespace
Vivy
::
Script
namespace
Vivy
::
Script
{
{
IrExpression
::
IrExpression
(
IrElement
*
p
,
Type
type
)
noexcept
IrExpression
::
IrExpression
(
IrElement
*
p
,
Type
type
)
noexcept
...
@@ -63,6 +67,10 @@ IrExpression::innerType() const noexcept
...
@@ -63,6 +67,10 @@ IrExpression::innerType() const noexcept
}
}
}
}
/*
** IrEVariableRef
*/
namespace
Vivy
::
Script
namespace
Vivy
::
Script
{
{
std
::
string
std
::
string
...
@@ -168,6 +176,10 @@ IrEConstExpr::parse(std::vector<Token> *)
...
@@ -168,6 +176,10 @@ IrEConstExpr::parse(std::vector<Token> *)
}
}
}
}
/*
** IrECall
*/
namespace
Vivy
::
Script
namespace
Vivy
::
Script
{
{
std
::
string
std
::
string
...
@@ -181,6 +193,16 @@ IrECall::parse(std::vector<Token> *)
...
@@ -181,6 +193,16 @@ IrECall::parse(std::vector<Token> *)
{
{
throw
std
::
logic_error
(
"Not implemented"
);
throw
std
::
logic_error
(
"Not implemented"
);
}
}
const
IrFunction
*
IrECall
::
call
()
const
noexcept
{
return
callPtr
;
}
const
std
::
vector
<
IrExpression
*>&
IrECall
::
args
()
const
noexcept
{
return
inArgs
;
}
}
}
namespace
Vivy
::
Script
namespace
Vivy
::
Script
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Script/Ast/IrExpression.hh
+
58
−
6
Voir le fichier @
5527fa42
...
@@ -46,7 +46,6 @@ class IrEConstExpr : public IrExpression {
...
@@ -46,7 +46,6 @@ class IrEConstExpr : public IrExpression {
public
:
public
:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
virtual
IrTPrimitive
*
innerType
()
const
noexcept
override
;
virtual
IrTPrimitive
*
innerType
()
const
noexcept
override
;
bool
getInnerBoolean
()
const
;
bool
getInnerBoolean
()
const
;
...
@@ -59,40 +58,93 @@ public:
...
@@ -59,40 +58,93 @@ public:
class
IrECall
:
public
IrExpression
{
class
IrECall
:
public
IrExpression
{
VIVY_IR_ELEMENT
(
IrECall
)
VIVY_IR_ELEMENT
(
IrECall
)
IrFunction
*
callPtr
=
nullptr
;
std
::
vector
<
IrExpression
*>
inArgs
;
public:
public:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
const
IrFunction
*
call
()
const
noexcept
;
const
std
::
vector
<
IrExpression
*>&
args
()
const
noexcept
;
};
};
class
IrECompOp
:
public
IrExpression
{
class
IrECompOp
:
public
IrExpression
{
VIVY_IR_ELEMENT
(
IrECompOp
)
VIVY_IR_ELEMENT
(
IrECompOp
)
public:
enum
class
OpType
{
LT
,
GT
,
LE
,
GE
,
EQ
,
NEQ
};
private
:
const
OpType
selfOpType
;
IrExpression
*
left
;
IrExpression
*
right
;
IrECompOp
(
OpType
,
IrExpression
*&&
left
,
IrExpression
*&&
right
)
noexcept
;
public
:
public
:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
OpType
opType
()
const
noexcept
;
};
};
class
IrEArithmeticOp
:
public
IrExpression
{
class
IrEArithmeticOp
:
public
IrExpression
{
VIVY_IR_ELEMENT
(
IrEArithmeticOp
)
VIVY_IR_ELEMENT
(
IrEArithmeticOp
)
public:
enum
class
OpType
{
Add
,
Sub
,
Mul
,
Div
,
Mod
};
private
:
const
OpType
selfOpType
;
IrExpression
*
left
;
IrExpression
*
right
;
IrEArithmeticOp
(
OpType
,
IrExpression
*&&
left
,
IrExpression
*&&
right
)
noexcept
;
public
:
public
:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
OpType
opType
()
const
noexcept
;
};
};
class
IrELogicOp
:
public
IrExpression
{
class
IrELogicOp
:
public
IrExpression
{
VIVY_IR_ELEMENT
(
IrELogicOp
)
VIVY_IR_ELEMENT
(
IrELogicOp
)
public:
enum
class
OpType
{
And
,
Or
,
Xor
};
private
:
const
OpType
selfOpType
;
IrExpression
*
left
;
IrExpression
*
right
;
IrELogicOp
(
OpType
,
IrExpression
*&&
left
,
IrExpression
*&&
right
)
noexcept
;
public
:
public
:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
OpType
opType
()
const
noexcept
;
};
};
class
IrEVariableRef
:
public
IrExpression
{
class
IrEVariableRef
:
public
IrExpression
{
VIVY_IR_ELEMENT
(
IrEVariableRef
)
VIVY_IR_ELEMENT
(
IrEVariableRef
)
IrVariable
*
const
referencedVariable
;
IrEVariableRef
(
IrVariable
*
)
noexcept
;
IrEVariableRef
(
IrVariable
*
,
std
::
vector
<
IrExpression
*>&&
);
template
<
typename
...
Args
>
IrEVariableRef
(
IrVariable
*
var
,
Args
...
&&
indicies
)
:
IrEVariableRef
(
var
,
std
::
vector
<
IrExpression
*>
{
indicies
...})
{
}
public
:
public
:
std
::
string
toString
()
const
noexcept
override
;
std
::
string
toString
()
const
noexcept
override
;
void
parse
(
std
::
vector
<
Token
>
*
)
override
;
};
};
std
::
string
toString
(
IrELogicOp
::
OpType
)
noexcept
;
std
::
string
toString
(
IrEArithmeticOp
::
OpType
)
noexcept
;
std
::
string
toString
(
IrECompOp
::
OpType
)
noexcept
;
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter