Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to handle syntax error in expression "+ 119 +": premature end of expre

Status
Not open for further replies.

flowerbs

Programmer
May 11, 2010
4
0
0
IN
Hi,

We are using TCL\TK and while trying to write into a file, getting below error message inconsistently for some of the records:

Syntax error in expression "+ 119 +": premature end of expression.


As I am pretty new to TCL\TK, it would be very helpful if I get any information on how to resolve the given error or more information about that.

Thanks!
Suma
 
Specifically, how are you implementing the "write"?

_________________
Bob Rashkin
 
Hi,

Thanks for the quick response.

Error occurs at the execution of below while loop:

while {![eof $fid]} {
$temp::ewin insert end [read $fid 1000] $temp::font
}

where ewin is editor window defined as before:
global temp::ewin


set temp::ewin [ctext $sw2.ed -width 80 -height 20 -wrap none\
-font $temp::font -undo 1 -maxundo 1 -background $temp::bkg_color ]

ctext::addHighlightClassForSpecialChars $temp::ewin brackets $temp::bracket_color {[]{}()}
ctext::addHighlightClassForRegexp $temp::ewin atfapis $temp::api_color {atf_(\w*)}
ctext::addHighlightClassForRegexp $temp::ewin strings $temp::strings_color {\".*\"}
ctext::addHighlightClass $temp::ewin keywords $temp::keywords_color {proc set return if while foreach else}
ctext::addHighlightClassForRegexp $temp::ewin comments $temp::com_color {#[^\n\r]*}


bind $temp::ewin <KeyRelease> {temp::key_pressed %A %K}
# Change line color if mouse clicked on the line
bind $temp::ewin <ButtonRelease> {temp::color_line}


Platform used is Win'XP


PS: Code throws error message inconsistently for few files.


Thanks!
 
I don't know what a ctext is so I assume it's a customized widget whose code you haven't shown us. Never the less, if it's like a Tk text widget, the insert command syntax is:
pathName insert index chars ?tagList chars tagList ...?
So it would appear that in'
$temp::ewin insert end [read $fid 1000] $temp::font
$temp::font is a tagList, but elsewhere it seems to be a font (which is consistent with its name).

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top