Comment after last command gives error

This forum is to report technical problems with Rel.
Post Reply
Blake
Posts: 9
Joined: Tue Jun 07, 2011 9:08 pm

Comment after last command gives error

Post by Blake »

var a integer ;

// Comments after code cause an error.


---
Executing the above in the DBBrowser results in an error:
ERROR: Encountered "var" at line 1, column 1.

Remove the comment and things are ok.
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: Comment after last command gives error

Post by Dave »

DBrowser, the simple command-line client, uses a crude mechanism to detect whether the user's input is an expression or a statement. If the user's input ends with a semicolon, it's a statement. Otherwise, it's considered an expression. Trivial whitespace is ignored but comments aren't, so DBrowser gets confused.

In short, the comment after the statement makes DBrowser think you've entered an expression, so it tries to evaluate it but 'var' isn't valid in an expression.

I've long meant to fix this, but more important issues have always pushed it down the "to do" list.
Post Reply