regLine method

int regLine(
  1. ClipLineData line
)

Implementation

int regLine( ClipLineData line ){
	int code;
	dynamic token;
	int ret;

	ParamVoid tmp = ParamVoid( _curLoop._newLine() );
	ParamBoolean beforeFlag = ParamBoolean( false );

	line.token()!.beginGetToken();
	if( line.token()!.getToken() ){
		code  = ClipToken.curCode();
		token = ClipToken.curToken();

		if( code == ClipGlobal.codeStatement ){
			switch( token ){
			case ClipGlobal.statIf:
				_curLoop._endType[_curLoop._endCnt] = endTypeIf;
				_curLoop._endCnt++;
				break;
			case ClipGlobal.statEndIf:
				if( _curLoop._endCnt > 0 ){
					_curLoop._endCnt--;
				}
				break;
			case ClipGlobal.statSwitch:
				_curLoop._endType[_curLoop._endCnt] = endTypeSwitch;
				_curLoop._endCnt++;
				break;
			case ClipGlobal.statEndSwi:
				if( _curLoop._endCnt > 0 ){
					_curLoop._endCnt--;
				}
				break;
			}
		}

		if( (code == ClipGlobal.codeStatement) && (token < ClipGlobal.statLoopEnd) ){
			if( (ret = _loopSub[token]( this, tmp, beforeFlag )) != ClipGlobal.noErr ){
				return ret;
			}
		}
	}

	_ClipLoop _obj = tmp.obj() as _ClipLoop;
	_obj._line = ClipLineData();
	_obj._line.setToken( ClipToken() );
	line.token()!.dup( _obj._line.token() );
	_obj._line.setNum( line.num() );
	if( line.comment() != null ){
		_obj._line.setComment( line.comment() );
	}
	_obj._line.setNext( line.next() );
	_obj._subFlag = false;

	if( beforeFlag.val() ){
		_curLoop._getFlag = false;
		_curLoop = _curLoop._beforeLoop!;
		if( _curLoop._loopType == typeBase ){
			return ClipGlobal.procEnd;
		}
	}

	return ClipGlobal.loopCont;
}