mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
If this isn't a problem...
Code:
test { echo -a TEST | $null | echo -a Test }

Why is this a problem?
Code:
test { echo -a TEST |  | echo -a Test }

I get an unknown command |, from the server with the second bit of code.


NaquadaBomb
www.mirc-dll.com
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
There's no reason why it shouldn't give an error, it's bad syntax. If anything the strangeness would be that using $null there doesn't return an error.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 109
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 109
It's all to do with evaluation order.

In the first example, the script engine thingie comes across the $null, and its first 'thought' is that this is something to execute. it's second thought is that this something is a null value, and so does nothing. but at the top-most level, there is something there: the plain-text "$null". (Note this is why extra evaluation in scripting normally requires TWO sets of eval brackets)

In the second example, the engine's first thought is that '|' is something to execute. With this logic, '| echo -a test' is the line to execute, which is why you get the server error, because there is no '|' command, with or without the extra text. If there was more text before the pipe character, it would assume THAT to be a command on its first thought.
| is, just lke $null, a second-evaluation device. | and $null are plain text, but when evaluated (if given the chance), they become a newline, and empty space.

I realise this is a very confusing post. But I believe at least some of it makes sense smile

Note: the idea of 'thought' here is synonymous with that of evaluation. I just like the word better.


<Ingo> I can't uninstall it, there seems to be some kind of "Uninstall Shield"
Joined: Dec 2002
Posts: 39
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Dec 2002
Posts: 39
The mIRC Script parser is highly irregular and fragile. It's ad hoc and it's interpretation can often be hard to predict. Inconsistencies like that one are regular occurences.

This is a pitty, partly because parser construction is a very well researched branch of computer science, i.e. there are very well known and regular techniques for making parsers, it's not much of a craft and very much engineering. And it's easy, dead simple, once you know a good tool (and many good tools are available for free).

Joined: Dec 2002
Posts: 39
V
Ameglian cow
Offline
Ameglian cow
V
Joined: Dec 2002
Posts: 39
(Ofcourse, since mIRC script has evolved with this parser, it's grammar is now sadly non context free and not very ammendable to standard parsing techniques. So, while it could probably be enhanced by using a real tool, such a tool can not fix the underlying difficulty that the language is ambigious. C and Perl suffers from similar problems, they are also hard to parse, although much (much) more regular than mIRC script.)


Link Copied to Clipboard