aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 14:24:28 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 14:24:28 +0200
commitd7686611a91db048f43c0be3b4ffec295de6c623 (patch)
treecae6aafd195aacd55fddd50d01d7dee2521a7eca
parent453e6fcdd3bab20a8b93ffac624ddacef55c90d8 (diff)
downloadPraspel-d7686611a91db048f43c0be3b4ffec295de6c623.zip
Praspel-d7686611a91db048f43c0be3b4ffec295de6c623.tar.gz
Praspel-d7686611a91db048f43c0be3b4ffec295de6c623.tar.bz2
Rename @forexample to @description.
The @forexample has already a semantics defined in JML. Our @forexample clause has a complete different semantics. In order to avoid confusion, we rename it.
-rw-r--r--Grammar.pp8
-rw-r--r--Model/Behavior.php7
-rw-r--r--Model/Description.php (renamed from Model/Forexample.php)12
-rw-r--r--Model/Specification.php9
-rw-r--r--Visitor/Compiler.php6
-rw-r--r--Visitor/Interpreter.php4
6 files changed, 23 insertions, 23 deletions
diff --git a/Grammar.pp b/Grammar.pp
index 58a6265..18b2d06 100644
--- a/Grammar.pp
+++ b/Grammar.pp
@@ -52,7 +52,7 @@
%token at_throwable @throwable
%token at_invariant @invariant
%token at_behavior @behavior
-%token at_forexample @forexample
+%token at_description @description
// Constructions.
%token old \\old
@@ -126,7 +126,7 @@ method:
| invariant()
)
::semicolon::+
- | ( behavior() | forexample() ) ::semicolon::*
+ | ( behavior() | description() ) ::semicolon::*
#is:
::at_is:: <pure>
@@ -161,8 +161,8 @@ behavior_content:
)+
::_brace:: #behavior
-#forexample:
- ::at_forexample:: string()
+#description:
+ ::at_description:: string()
expression:
( declaration() | constraint() | domainof() | predicate() )
diff --git a/Model/Behavior.php b/Model/Behavior.php
index 3ce3604..c31da7f 100644
--- a/Model/Behavior.php
+++ b/Model/Behavior.php
@@ -66,12 +66,7 @@ from('Hoa')
/**
* \Hoa\Praspel\Model\Invariant
*/
--> import('Praspel.Model.Invariant')
-
-/**
- * \Hoa\Praspel\Model\Forexample
- */
--> import('Praspel.Model.Forexample');
+-> import('Praspel.Model.Invariant');
}
diff --git a/Model/Forexample.php b/Model/Description.php
index 20cf58a..dee99bf 100644
--- a/Model/Forexample.php
+++ b/Model/Description.php
@@ -48,16 +48,16 @@ from('Hoa')
namespace Hoa\Praspel\Model {
/**
- * Class \Hoa\Praspel\Model\Forexample.
+ * Class \Hoa\Praspel\Model\Description.
*
- * Represent the @forexample clause.
+ * Represent the @description clause.
*
* @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
* @copyright Copyright © 2007-2013 Ivan Enderlin.
* @license New BSD License
*/
-class Forexample
+class Description
extends Clause
implements \ArrayAccess,
\IteratorAggregate,
@@ -68,12 +68,12 @@ class Forexample
*
* @const string
*/
- const NAME = 'forexample';
+ const NAME = 'description';
/**
* Examples.
*
- * @var \Hoa\Praspel\Model\Forexample array
+ * @var \Hoa\Praspel\Model\Description array
*/
protected $_examples = array();
@@ -112,7 +112,7 @@ class Forexample
* @access public
* @param int $offset Offset.
* @param string $value Example value.
- * @return \Hoa\Praspel\Model\Forexample
+ * @return \Hoa\Praspel\Model\Description
*/
public function offsetSet ( $offset, $value ) {
diff --git a/Model/Specification.php b/Model/Specification.php
index 240e97b..351d3e1 100644
--- a/Model/Specification.php
+++ b/Model/Specification.php
@@ -49,6 +49,11 @@ from('Hoa')
-> import('Praspel.Model.Is')
/**
+ * \Hoa\Praspel\Model\Description
+ */
+-> import('Praspel.Model.Description')
+
+/**
* \Hoa\Realdom\Disjunction
*/
-> import('Realdom.Disjunction', true);
@@ -130,8 +135,8 @@ class Specification extends Behavior {
$handle = new Behavior($this);
break;
- case 'forexample':
- $handle = new Forexample($this);
+ case 'description':
+ $handle = new Description($this);
break;
default:
diff --git a/Visitor/Compiler.php b/Visitor/Compiler.php
index e8234cf..2d606d8 100644
--- a/Visitor/Compiler.php
+++ b/Visitor/Compiler.php
@@ -84,7 +84,7 @@ class Compiler implements \Hoa\Visitor\Visit {
'ensures',
'behavior',
'throwable',
- 'forexample'
+ 'description'
);
foreach($clauses as $clause)
@@ -182,13 +182,13 @@ class Compiler implements \Hoa\Visitor\Visit {
$eldnah
);
}
- elseif($element instanceof \Hoa\Praspel\Model\Forexample) {
+ elseif($element instanceof \Hoa\Praspel\Model\Description) {
$parent = '$' . $element->getParent()->getId();
$variable = '$' . $element->getId();
$out = "\n" .
$variable . ' = ' . $parent .
- '->getClause(\'forexample\');' . "\n";
+ '->getClause(\'description\');' . "\n";
foreach($element as $example)
$out .= $variable . '[] = \'' .
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index 22e66ac..8357c5f 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -162,8 +162,8 @@ class Interpreter implements \Hoa\Visitor\Visit {
$this->_current = $previous;
break;
- case '#forexample':
- $this->_clause = $this->_root->getClause('forexample');
+ case '#description':
+ $this->_clause = $this->_root->getClause('description');
$this->_clause[] = $element->getChild(0)->accept(
$this,
$handle,