Tuesday, February 10, 2004

Reader implementation --- Pick out statement

1) Read first "InputTextBufferLengthMax" characters
InputTextBufferLengthMax = 300 characters

2) Try to find "EndOfStatement".
EndOfStatement: "." (point) with following " " (space) or <CR>.

3) If "EndOfStatement" was found within "InputTextBufferLengthMax" characters then
InputTextBufferCurrentEnd = position of EndOfStatement + 1 (or + 2 if is "." is followed by " ").
InputTextNextStartPosition = InputTextBufferCurrentEnd
Continue parsing on deeper level (ParseStatement).

4) Otherwise (if EndOfStatement wasn't found) then consider ";" (semicolon) with following " " (space) or as EndOfStatement. Repeat EndOfStatement search.

5) If EndOfStatement wasn't found still: consider " -" (space with dash) as EndOfStatement. Repeat EndOfStatement search.

6) If EndOfStatement wasn't found still: consider "," (comma) with following " " (space) or as EndOfStatement. Repeat EndOfStatement search.

7) Consider "[", "]", "(", ")" as EndOfStatement.
8) Consider "." (Comma without following space) as EndOfStatement.

9) Consider " " as EndOfStatement.

10) Consider any special character (not char not digit) as EndOfStatement.

11) Consider any digit as EndOfStatement.
12) Consider any capitalized character as EndOfStatement.

13) Complain about bad quality of text. Consider any character as EndOfStatement.