|
Error LEFT_ARROW RIGHT_ARROW |
|
|
Written by Shaniur T I M Nabi
|
|
Tuesday, 22 November 2005 |
Error Message:
Error loading <filename.ned>: Error: syntax error, unexpected '.',
expecting LEFT_ARROW or RIGHT_ARROW in line <line number>
Possible Reason of error:
This can happen when you are trying to import a module and it has other
simple modules in there and you are trying to access the gate of a
simple module by calling it like:
moduleName.simpleModuleName.gateName --> anotherModule.gate;
Here is an example of what I'm trying to say:
Lets say, I have a client and base station scenario. My client has 2
connections to the base station. One for voice and the other for data.
So I will have 2 gates from the client. An out gate for voice and
another out gate for data. Lets say my client module is called
subscriber and there is a queue associated with every output gate
(voiceQueue and dataQueue). The queues are simple modules with an 'in'
and 'out' gate respectively. Packets from subscriber goes to the
appropriate queue and from the queue it gets connected to the base
station.
Ideally (I'm taking Java object oriented style) the connection should look like:
subscriber.voiceQueue.out --> baseStation.inGateForSubscriber;
But this will cause the particular error we are dealing here. 'subscriber.voiceQueue.out' is
not acceptable. It is expecting something like 'subscriber.voiceQueue -->' (because it has found a '.' after voiceQueue it is saying syntax error and expecting a right or left arrow, that is --> or <-- ). But as
the gate from the subscriber module (from the packet generator or
handler) is connected to voiceQueue that will not work either. So how do we fix it?
Solution:
You need to create an array of in and out gates (in[] and out[]) for
subscriber and in subscriber.ned file, under 'connections:' have
something like:
voiceQueue.out --> out[0];
(voiceQueue.out --> out++ will also work, so long you can
keep track of the gates). Now in the network.ned file (I'm assuming the
file that defines the network is called network.ned) you'll have to
connect it as:
subscriber.out[0] --> baseStation.VoiceInGateForSubscriber;
OR
subscriber.out++ --> baseStation.VoiceInGateForSubscriber;
Just make sure, if you are using ++, you connect them in proper order, or you are in for a nasty surprise.
I will try and upload a short example code sometime in the future to make this even clearer.
Add as favourites (7) | Quote this article on your site | Views: 992
Powered by AkoComment Tweaked Special Edition v.1.4.6 AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com All right reserved |
|
Last Updated ( Tuesday, 22 November 2005 )
|