|
|
@@ -1,184 +1,97 @@
|
|
|
-"use strict"
|
|
|
-
|
|
|
-
|
|
|
+"use strict";
|
|
|
|
|
|
// Autogenerated by cport.py on 2013-09-17 14:37
|
|
|
-var ListOfMatchExpression = module.exports = function (){
|
|
|
-
|
|
|
+var ListOfMatchExpression = module.exports = function (/*type*/){
|
|
|
+ this._expressions = [];
|
|
|
}, klass = ListOfMatchExpression, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
-
|
|
|
// File: expression_tree.h lines: 56-56
|
|
|
-// std::vector< MatchExpression* > _expressions;
|
|
|
-
|
|
|
proto._expressions = undefined;
|
|
|
|
|
|
-
|
|
|
-// File: expression_tree.h lines: 56-56
|
|
|
-// std::vector< MatchExpression* > _expressions;
|
|
|
-
|
|
|
-proto._expressions = undefined;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
- * @method ListOfMatchExpression
|
|
|
- * @param
|
|
|
*
|
|
|
- */
|
|
|
-proto.ListOfMatchExpression = function ListOfMatchExpression( /* MatchType type */ ){
|
|
|
-// File: expression_tree.h lines: 33-32
|
|
|
-// ListOfMatchExpression( MatchType type ) : MatchExpression( type ){}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
+ * Print the debug info from each expression in the list
|
|
|
* @method _debugList
|
|
|
- * @param
|
|
|
+ * @param level
|
|
|
*
|
|
|
*/
|
|
|
-proto._debugList = function _debugList( /* StringBuilder& debug, int level */ ){
|
|
|
-
|
|
|
-// File: expression_tree.cpp lines: 40-42
|
|
|
-// void ListOfMatchExpression::_debugList( StringBuilder& debug, int level ) const {
|
|
|
-// for ( unsigned i = 0; i < _expressions.size(); i++ )
|
|
|
-// _expressions[i]->debugString( debug, level + 1 );
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
+proto._debugList = function _debugList(level){
|
|
|
+ // File: expression_tree.cpp lines: 40-42
|
|
|
+ for (var i = 0; i < this._expressions.length; i++ )
|
|
|
+ this._expressions[i].debugString(level + 1); // debug only takes level now
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
+ *
|
|
|
+ * Append a new expression to our list
|
|
|
* @method add
|
|
|
- * @param
|
|
|
+ * @param Expression
|
|
|
*
|
|
|
*/
|
|
|
-proto.add = function add( /* MatchExpression* e */ ){
|
|
|
-
|
|
|
-// File: expression_tree.cpp lines: 34-36
|
|
|
-// void ListOfMatchExpression::add( MatchExpression* e ) {
|
|
|
-// verify( e );
|
|
|
-// _expressions.push_back( e );
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
+proto.add = function add(Expression){
|
|
|
+ // File: expression_tree.cpp lines: 34-36
|
|
|
+ // verify(expression)
|
|
|
+ if(!Expression)
|
|
|
+ throw new Error(Expression + " failed verify on ListOfMatchExpression:34");
|
|
|
+ this._expressions.push(Expression);
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
+ *
|
|
|
+ * Empty us out
|
|
|
* @method clearAndRelease
|
|
|
- * @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.clearAndRelease = function clearAndRelease( /* */ ){
|
|
|
-// File: expression_tree.h lines: 45-44
|
|
|
-// void clearAndRelease() { _expressions.clear(); }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
+proto.clearAndRelease = function clearAndRelease(){
|
|
|
+ // File: expression_tree.h lines: 45-44
|
|
|
+ this._expressions = []; // empty the expressions
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
+ *
|
|
|
+ * Check if the input list is considered the same as this one
|
|
|
* @method equivalent
|
|
|
- * @param
|
|
|
+ * @param other
|
|
|
*
|
|
|
*/
|
|
|
-proto.equivalent = function equivalent( /* const MatchExpression* other */ ){
|
|
|
+proto.equivalent = function equivalent(other){
|
|
|
+ // File: expression_tree.cpp lines: 45-59
|
|
|
+ if (matchType() != other.matchType())
|
|
|
+ return false;
|
|
|
|
|
|
-// File: expression_tree.cpp lines: 45-59
|
|
|
-// bool ListOfMatchExpression::equivalent( const MatchExpression* other ) const {
|
|
|
-// if ( matchType() != other->matchType() )
|
|
|
-// return false;
|
|
|
-//
|
|
|
-// const ListOfMatchExpression* realOther = static_cast<const ListOfMatchExpression*>( other );
|
|
|
-//
|
|
|
-// if ( _expressions.size() != realOther->_expressions.size() )
|
|
|
-// return false;
|
|
|
-//
|
|
|
-// // TOOD: order doesn't matter
|
|
|
-// for ( unsigned i = 0; i < _expressions.size(); i++ )
|
|
|
-// if ( !_expressions[i]->equivalent( realOther->_expressions[i] ) )
|
|
|
-// return false;
|
|
|
-//
|
|
|
-// return true;
|
|
|
-// }
|
|
|
+ var realOther = new ListOfMatchExpression(other);
|
|
|
|
|
|
+ if (this._expressions.length != realOther._expressions.length)
|
|
|
+ return false;
|
|
|
|
|
|
+ // TODO: order doesn't matter
|
|
|
+ for (var i = 0; i < this._expressions.length; i++ )
|
|
|
+ if (!this._expressions[i].equivalent(realOther._expressions[i]))
|
|
|
+ return false;
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
+ return true;
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
+ *
|
|
|
+ * Get an item from the expressions
|
|
|
* @method getChild
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.getChild = function getChild( /* size_t i */ ){
|
|
|
-// File: expression_tree.h lines: 48-47
|
|
|
-// virtual const MatchExpression* getChild( size_t i ) const { return _expressions[i]; }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
+proto.getChild = function getChild(i){
|
|
|
+ // File: expression_tree.h lines: 48-47
|
|
|
+ return this._expressions[i];
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
- * @method numChildren
|
|
|
- * @param
|
|
|
*
|
|
|
- */
|
|
|
-proto.numChildren = function numChildren( /* */ ){
|
|
|
-// File: expression_tree.h lines: 47-46
|
|
|
-// virtual size_t numChildren() const { return _expressions.size(); }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * This documentation was automatically generated. Please update when you touch this function.
|
|
|
- * @method ~ListOfMatchExpression
|
|
|
+ * Get the length of the list
|
|
|
+ * @method numChildren
|
|
|
* @param
|
|
|
*
|
|
|
*/
|
|
|
-proto.~ListOfMatchExpression = function ~ListOfMatchExpression( /* */ ){
|
|
|
-
|
|
|
-// File: expression_tree.cpp lines: 28-31
|
|
|
-// ListOfMatchExpression::~ListOfMatchExpression() {
|
|
|
-// for ( unsigned i = 0; i < _expressions.size(); i++ )
|
|
|
-// delete _expressions[i];
|
|
|
-// _expressions.clear();
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+proto.numChildren = function numChildren(){
|
|
|
+ // File: expression_tree.h lines: 47-46
|
|
|
+ return this._expressions.length;
|
|
|
+};
|