14.227 Cannot parse beyond this point

Prev Up Next Page 698 of 800 Search internet

Origin: lgc. Landing-place: terminal.

The 'Cannot parse beyond this point' error message is probably the most common error message from lgc. It indicates that lgc cannot parse the body of the given lgs source according to the given grammar. As an example, consider a page which references the base page and which defines abs(x) thus:

   eager define abs ( x ) as if x < 0 them - x else x end define

The definition above has a 'them' instead of 'then' so lgc cannot parse it and may give a message like this one:

   Line 8 character 39:
   Syntax error
   Cannot parse beyond this point
   Expected e.g. |n " else " end define
   eager define abs ( x ) as if x < 0 the|
   m - x else x end define

To use this message, first note that the error is in line 8. Use your editor to go to that line of your lgs source file. Chances are that you can spot the error just by looking at that line.

However, you may also go to the last two sections of the error message (line 1 and 3 from bottom in the example above). Those sections give a bit of context before and after the point of error.

The vertical bar at the end of the third last line indicates precisely where lgc thinks the error is. The vertical bar is added so you can see whether or not the line ends with a space character. In the example above, the line does not end with a space character.

The error indicates that lgc was able to get sense out of the source text up to the given point but was unable to make sense of the next character. Thus, the next character must be erroneous or there must be an error before the given point.

In most cases, knowing exactly where lgc thinks the error is is enough to see what is wrong. In case this is not enough, lgc has one more clue to give. When lgc is able to make sense of the source up to the given point, it is also able to suggest how the source could continue. It does so in Line 4 in the example above where it states:

   Expected e.g. |n " else " end define

The text after the vertical bar is the suggestion lgc came up with. In the suggestion, each double quote character represents a subexpression. As can be seen, lgc correctly predicted how the text should continue in the case above except that it was unable to predict that the first subexpression should be - x and the second should be x. As should be expected, lgc occasionally comes up with suggestions which are far out.

Prev Up Next Page 698 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05