Initial check in docu
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
program wp;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
Classes,
|
||||
SysUtils,
|
||||
dpgRTL,
|
||||
|
||||
wpParser in 'wpParser.pas',
|
||||
wpLexer in 'wpLexer.pas';
|
||||
|
||||
var
|
||||
stm: TFileStream;
|
||||
lex: TwpLexer;
|
||||
par: TwpParser;
|
||||
|
||||
begin
|
||||
if ParamCount <> 1 then
|
||||
begin
|
||||
writeln('usage: wp <filename>');
|
||||
exit;
|
||||
end;
|
||||
|
||||
stm := nil;
|
||||
par := nil;
|
||||
|
||||
try
|
||||
stm := TFileStream.Create( ParamStr(1), fmOpenRead);
|
||||
lex := TwpLexer.Create( stm);
|
||||
par := TwpParser.Create(lex);
|
||||
|
||||
par.prog;
|
||||
except
|
||||
on e: EdpgMismatchedChar do writeln('SyntaxError: ' + IntToStr(e.Line));
|
||||
on e: EdpgMismatchedToken do writeln('SyntaxError: ' + IntToStr(e.FoundToken.TokenLine));
|
||||
else writeln('Syntax error');
|
||||
end;
|
||||
|
||||
if stm <> nil then stm.free;
|
||||
if par <> nil then par.free;
|
||||
end.
|
||||
Reference in New Issue
Block a user