translate STORE/RESTORE in XML instead of Python
This commit is contained in:
parent
24d5a33b0e
commit
a90622e8e5
3 changed files with 3 additions and 16 deletions
|
@ -40,15 +40,6 @@ class System:
|
||||||
represented as a couple (member, interpretation)
|
represented as a couple (member, interpretation)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Interpretation of extra symbols added if necessary
|
|
||||||
extra_symbols = ["[", "]"]
|
|
||||||
for _, substitution in substitutions:
|
|
||||||
if any(symbol in substitution for symbol in extra_symbols):
|
|
||||||
self.interpretations.extend(
|
|
||||||
[(extra_symbols[0], "STORE"), (extra_symbols[1], "RESTORE")]
|
|
||||||
)
|
|
||||||
break
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return pformat(object=self.__dict__, compact=True, width=120, sort_dicts=False)
|
return pformat(object=self.__dict__, compact=True, width=120, sort_dicts=False)
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<!-- Membre d'une interprétation -->
|
<!-- Membre d'une interprétation -->
|
||||||
<xs:simpleType>
|
<xs:simpleType>
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="[A-Z|\[|\]]{1}" />
|
<xs:pattern value="[A-Z]{1}" />
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
|
|
@ -72,10 +72,6 @@
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<!-- Si pas de substitution trouvé, alors on renvoie le caractère
|
<!-- Si pas de substitution trouvé, alors on renvoie le caractère
|
||||||
tel qu'il est -->
|
tel qu'il est -->
|
||||||
<!-- TODO: Est-ce la meilleur chose à faire ?
|
|
||||||
On pourrait dire que [ = [ et ] = ] dans le script python
|
|
||||||
et ainsi ça ouvrirais la porte à autoriser des substitution
|
|
||||||
vide -->
|
|
||||||
<xsl:when test="not($sub)">
|
<xsl:when test="not($sub)">
|
||||||
<xsl:value-of select="current()" />
|
<xsl:value-of select="current()" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
@ -126,12 +122,12 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<!-- Store -->
|
<!-- Store -->
|
||||||
<xsl:when test="$action = 'STORE'">
|
<xsl:when test="current() = '['">
|
||||||
<store />
|
<store />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<!-- Restore -->
|
<!-- Restore -->
|
||||||
<xsl:when test="$action = 'RESTORE'">
|
<xsl:when test="current() = ']'">
|
||||||
<restore />
|
<restore />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
|
|
Reference in a new issue