Error Messages/40114


Example error texts

 Lexical error at line 2 while checking:
   SampleType: 1;
              ^
 Keyword 'End' expected.

Cause

A lexical error basically means that the low-level lexical parser expected something other than what you wrote to appear next, so it could not parse the expression. It is sort of analogous to English when the next word just doesn't follow, like where a verb is expected next but a noun occurs instead:

 The brown car dog 
               ^
 Lexical error: verb expected

Often there are multiple ways in which an expression might continue, and the "expectation" stated might not be the only possibility. For example, the above error might occur when the following expression is parsed:

 If Test_something() Then Begin
   SampleType: 1;
 End

Your intention may have been to use the := operator as in:

 If Test_something() Then Begin
   SampleType := 1;
 End

But the error doesn't say "Lexical error: := expected". Instead, the expectation of the parser reflects the fact that an alternative such as:

 If Test_something() Then Begin
   SampleType
 End

would have also been legal. So don't get thrown by the stated expectation -- just interpret this as telling you that whatever occurred at the indicated position didn't follow given the stuff that preceded it. Also be alert that the problem may lie with the stuff preceding the indicated position.

See Also

Comments


You are not allowed to post comments.