Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Encountered end of line while processing a string token

Closed Thread
 
Thread Tools Display Modes
Old 11-14-2006   #1 (permalink)
Marco Shaw
Guest
 
Posts: n/a

Encountered end of line while processing a string token

I don't want to share the entire code because it is from Bruce Payette's
upcoming book.

I'd had a hard time copy and paste the code. Without sharing the whole
code, does this provide any insight as to what is wrong?

PS C:\> .\psa1.ps1
Encountered end of line while processing a string token.
At C:\psa1.ps1:5 char:5
+ @" <<<<
PS C:\> gc psa1.ps1|select-object -first 10
param($port=80)
[void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets")
function html ($content,$title = "Sample Page")
{
@"
<html>
<head>
<title>$title</title>
</head>
<body>

Since it is a function, I guess the error could also be anywhere near where
the function is called?


 
Old 11-15-2006   #2 (permalink)
Marco Shaw
Guest
 
Posts: n/a

Re: Encountered end of line while processing a string token

> PS C:\> .\psa1.ps1
> Encountered end of line while processing a string token.
> At C:\psa1.ps1:5 char:5
> + @" <<<<


non-ASCII probably... Loaded the file with DOS/edit. I'm still having
problems though:
PS C:\> .\psa1.ps1
Incomplete 'here string' token.
At C:\psa1.ps1:5 char:5
+ @" <<<<

What's the trick to really see the content of a file and be able to pick out
non-ASCII? I tried this while 'grasping at straws':
gc psa1.ps1|out-file -encoding ascii psa2.ps1


 
Old 11-15-2006   #3 (permalink)
klumsy@gmail.com
Guest
 
Posts: n/a

Re: Encountered end of line while processing a string token

@" and "@ and really cool in that everything between its treated
totally as literal. regardless of how many " ' ` or any other special
character... but its quite pedantic in that @" and "@ have to EACH BE
ON THEIR OWN LINE WITH NOTHING ELSE, or it will error out.... so with
that being the case

@"
hello
"@

will work, while the following 3 will not work

@"hello"@

@"hello
"@

@"
hello"@

so Marco, what company do you work for?

Karl

 
Old 11-15-2006   #4 (permalink)
Marco Shaw
Guest
 
Posts: n/a

Re: Encountered end of line while processing a string token

<klumsy@gmail.com> wrote in message
news:1163573134.336422.83700@b28g2000cwb.googlegroups.com...
> @" and "@ and really cool in that everything between its treated
> totally as literal. regardless of how many " ' ` or any other special
> character... but its quite pedantic in that @" and "@ have to EACH BE
> ON THEIR OWN LINE WITH NOTHING ELSE, or it will error out.... so with
> that being the case


There still must be some non-ASCII in my code damn it! Maybe if I view the
file in UNIX or something! Even my ouput error seems to have non-ASCII in
it, and I can't strip it!

> so Marco, what company do you work for?


I'm assuming klumsy@gmail isn't valid... I'd prefer not to post this here
unless I was trying to promote something.

You can ask me at marcoDOTshaw@ZZZgmailDOTcom. ;-)


 
Old 11-15-2006   #5 (permalink)
Andrew Watt [MVP]
Guest
 
Posts: n/a

Re: Encountered end of line while processing a string token

On Wed, 15 Nov 2006 01:15:57 -0400, "Marco Shaw" <marco@Znbnet.nb.ca>
wrote:

>I don't want to share the entire code because it is from Bruce Payette's
>upcoming book.
>
>I'd had a hard time copy and paste the code. Without sharing the whole
>code, does this provide any insight as to what is wrong?
>
>PS C:\> .\psa1.ps1
>Encountered end of line while processing a string token.
>At C:\psa1.ps1:5 char:5
>+ @" <<<<
>PS C:\> gc psa1.ps1|select-object -first 10
>param($port=80)
>[void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets")
>function html ($content,$title = "Sample Page")
>{
> @"


Marco,

Try it after deleting all the whitespace characters before @" on line
5.

Andrew Watt MVP
 
Old 11-15-2006   #6 (permalink)
Andrew Watt [MVP]
Guest
 
Posts: n/a

Re: Encountered end of line while processing a string token

Marco,

Given the source of the code, perhaps it would be worth also posting
the question at http://www.manning-sandbox.com/forum.jspa?forumID=248

Andrew Watt MVP

On Wed, 15 Nov 2006 01:15:57 -0400, "Marco Shaw" <marco@Znbnet.nb.ca>
wrote:

>I don't want to share the entire code because it is from Bruce Payette's
>upcoming book.
>
>I'd had a hard time copy and paste the code. Without sharing the whole
>code, does this provide any insight as to what is wrong?
>
>PS C:\> .\psa1.ps1
>Encountered end of line while processing a string token.
>At C:\psa1.ps1:5 char:5
>+ @" <<<<
>PS C:\> gc psa1.ps1|select-object -first 10
>param($port=80)
>[void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets")
>function html ($content,$title = "Sample Page")
>{
> @"
> <html>
> <head>
> <title>$title</title>
> </head>
> <body>
>
>Since it is a function, I guess the error could also be anywhere near where
>the function is called?

 
 
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Get-ChildItems to string for processing. rush PowerShell 3 02-01-2008 08:44 AM
do something for each token in a line separated by comma MaxMad PowerShell 5 01-09-2008 03:00 PM
end of line while processing a string token issue hectoritnt PowerShell 6 09-28-2007 01:22 PM
Search for string in CSV and delete line if string found in line sherlock PowerShell 2 07-02-2007 03:42 PM
are there tutorial on string processing with power-shell? light_wt PowerShell 10 05-22-2007 07:30 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49