fcl-passrc cannot parse program file with "program xxx;" declaration missing
Original Reporter info from Mantis: Michalis @michaliskambi
-
Reporter name: Michalis Kamburelis
Original Reporter info from Mantis: Michalis @michaliskambi
- Reporter name: Michalis Kamburelis
Description:
The initial declaration "program xxx;" at the beginning of a program file is optional. But fcl-passrc fails to parse such program:
$ fpc program_simple.pas
# compiles Ok
$ fpc test_parser.lpr
$ ./test_parser program_simple.pas
An unhandled exception occurred at $0809673E:
EParserError: Expected "unit" at token "var" in file program_simple.pas at line 2 column 3
Attaching a patch that makes fcl-passrc assume it's a program (with missing "program xxx;" declaration) if it doesn't start with "program" or "unit" keyword. The output is then correct:
$ ./test_parser program_simple.pas
No interface section --- this is not a unit, this is a TPasProgram
Implementation item 0: Foo
Implementation item 1: Bar
The test_parser.lpr example code is also on http://wiki.freepascal.org/fcl-passrc .
Mantis conversion info:
- Mantis ID: 22006
- OS: Debian GNU/Linux
- OS Build: (testing)
- Platform: i386
- Fixed in version: 3.0.0
- Fixed in revision: 21910 (#607b86f5)
- Target version: 2.6.1