PDA

View Full Version : How do I fix an "EOF expected" error?



wordsmith
11-25-2008, 01:30 PM
When testing the built-in extensions, about as often as not I wind up with an error message that ends with "EOF expected." I can't find a DekiScript definition of what constitutes and "EOF" (end of file?), so I have no idea how to fix these errors. A search for "EOF expected" didn't turn up anything in the forums or the Developer Wiki that helps. Where should I be looking for an answer, please?:confused:

lktest
11-25-2008, 03:12 PM
You'll often get that error in DekiScript if you're missing a semicolon ";" at the end of a line. For example:



{{
var x = user.name
web.text("Hello "..x);
}}


This code would produce an EOF error because it is missing a semicolon after user.name to signify that the line/argument is over. This is similar to how PHP and other languages work.

Do you want to add this to the FAQ?

wordsmith
11-25-2008, 03:31 PM
Thanks, but I still don't know how to fix it. I tried putting the semicolon in at various points and it doesn't fix the problem. Here's the actual code I'm using.
Use this page to search only the Help pages:
{{ dhtml.inputbox{value: __request.args.q, button: "Search 'Help'", field: "q", publish: page.uri} }}

{{ if(__request.args.q) {wiki.search(__request.args.q, nil, nil, "Wikipath:ZzHelp/*")} }}

I get the search box, but the results page won't display--that's where I'm getting the EOF error.

Also, I'm skeptical that a semicolon is always the missing EOF--the part of my code that works has no semicolons in it...

lktest
11-25-2008, 06:41 PM
In your code above, try changing "Wikipath:ZzHelp/*" to simply "path:ZzHelp/*".

What might be borking is that you're using an incorrect search modifier, so instead interpreting the colon to be part of a search phrase, Deki is making its best guess that the colon is part of a DekiScript argument string (which would require a semicolon at the end to close it).

If you haven't seen already, there's a FAQ (http://wiki.developer.mindtouch.com/MindTouch_Deki/FAQ/Page_Management/How_do_I...Do_advanced_content_searches%3f) on which search modifiers are safe to use.

SteveB
11-25-2008, 06:45 PM
I just tried the second line and it worked fine. What version are you running?

wordsmith
11-25-2008, 08:03 PM
I'm running 8.08.1a. It's probably obvious that I found the code somewhere on the Deki site and copied it--I don't speak code of any kind, so I really don't know an "argument string" from a "search modifier." What's happening is that I'm getting a search box, but the results won't display, plus I'm getting "/p[2]/span, line 1, column 1: EOF expected".

Entire code (which is actually giving me three consecutive EOF errors) is as follows.
Use this page to search only the Help pages:
{{ dhtml.inputbox{value: __request.args.q, button: "Search 'Help'", field: "q", publish: page.uri} }}

{{ if(__request.args.q) {wiki.search(__request.args.q, nil, nil, "wikipath:ZzHelp/*");} }}


{{<?php echo "<a href='javascript: void(0)' onclick=""window.open(pop.<wbr/>php?pid='$<wbr/>pop', 'Special:Search', 'width=200, height=77, left=500, top=200'); return false;"">Click here </a>"; ?>{}}}}



{{<a target="_blank" href="Special:Search">search results</a>{}}}

crb
11-25-2008, 09:18 PM
Where did you get this example from? This example (http://wiki.developer.mindtouch.com/index.php?title=DekiScript/FAQ/How_do_I..._Create_a_custom_search_form%3F)seems much cleaner..

I think the bottom two lines aren't meant to be there.


{{ dhtml.inputbox{value: __request.args.q, button: "Search 'Tree'", field: "q", publish: page.uri} }}

{{ if(__request.args.q) { wiki.search(__request.args.q, nil, nil, "path:Tree/*"); } }}

This example will search subpages of the "Tree" page for the text you enter into the box. I don't know if you have a page called Zzhelp, but if you don't, you won't get interesting results!

wordsmith
11-25-2008, 10:11 PM
One of the fun things about the Deki site is that, if I find something interesting and fail to bookmark it, I can never find it again, so I really can't tell you where I found that sample. I do have a page named "zzHelp" (wanted it to show up always at the bottom of the TOC). I'll try the cleaner search. However, I still don't have an answer for what an "EOF" is. I get a lot of those--not just this instance. Does that always mean I'm missing a semi-colon somewhere?

crb
11-25-2008, 10:57 PM
EOF means something wasn't closed - could be mismatched { } s also.

wordsmith
11-26-2008, 01:23 PM
Thanks. I guess that helps, although I've tried adding curly brackets and that doesn't seem to fix them either. The extensions apparently really aren't meant for use by admins who don't know DekiScript.

wordsmith
11-26-2008, 01:29 PM
{{ dhtml.inputbox{value: __request.args.q, button: "Search 'Tree'", field: "q", publish: page.uri} }}

{{ if(__request.args.q) { wiki.search(__request.args.q, nil, nil, "path:Tree/*"); } }}

This example will search subpages of the "Tree" page for the text you enter into the box. I don't know if you have a page called Zzhelp, but if you don't, you won't get interesting results![/QUOTE]

So the way to use this sample is to substitute the name of a parent page for "Tree" everywhere "Tree" appears in the code? Sorry to be so dense...

crb
11-26-2008, 02:20 PM
Correct. The first instance is just displaying the term "Search 'Tree'", that could say anything. The bit that actually matters is the path:Tree/* constraint to the wiki.search function (http://wiki.developer.mindtouch.com/DekiScript/Reference/Wiki_Functions_and_Variables/Wiki.Search).