92 lines
2.1 KiB
ObjectPascal
92 lines
2.1 KiB
ObjectPascal
// ============================================================================
|
|
// This file is generated by the Delphi Parser Generator.
|
|
// ----------------------------------------------------------------------------
|
|
// DPG version: 1.0.0.118r
|
|
// Grammar: javaparser.g
|
|
// ============================================================================
|
|
unit javaParser;
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes,
|
|
Contnrs,
|
|
dpgLLkParser,
|
|
dpgToken,
|
|
dpgTypes,
|
|
javaParserTokens,
|
|
SysUtils;
|
|
|
|
type
|
|
// =========================================================================
|
|
// Class TJavaParser declaration
|
|
// =========================================================================
|
|
TJavaParser = class( TdpgLLkParser)
|
|
|
|
public // Public grammar rules
|
|
procedure input ;
|
|
procedure javadoc ;
|
|
|
|
end;
|
|
|
|
implementation
|
|
uses
|
|
dpgException,
|
|
dpgExceptionSemantic,
|
|
dpgExceptionMismatchedToken;
|
|
|
|
// ============================================================================
|
|
// input
|
|
// ============================================================================
|
|
procedure TJavaParser.input;
|
|
var
|
|
_cnt_4: integer;
|
|
|
|
begin
|
|
_cnt_4 := 0;
|
|
|
|
while(true) do
|
|
begin
|
|
if (( LA(1) in [LT_int,TT_JAVADOC_OPEN])) then
|
|
begin
|
|
if (( LA(1) in [TT_JAVADOC_OPEN])) then
|
|
begin
|
|
javadoc;
|
|
end;
|
|
match(LT_int);
|
|
match(TT_ID);
|
|
match(TT_SEMI);
|
|
end
|
|
|
|
else
|
|
begin
|
|
if _cnt_4 >= 1 then
|
|
break
|
|
else
|
|
Raise EdpgMismatchedToken.Create( LT(1), [LT_int,TT_JAVADOC_OPEN], FileName);
|
|
end;
|
|
|
|
INC(_cnt_4);
|
|
end;
|
|
end;
|
|
|
|
// ============================================================================
|
|
// javadoc
|
|
// ============================================================================
|
|
procedure TJavaParser.javadoc;
|
|
begin
|
|
|
|
match(TT_JAVADOC_OPEN);
|
|
if (( LA(1) in [TT_PARAM])) then
|
|
begin
|
|
match(TT_PARAM);
|
|
end;
|
|
if (( LA(1) in [TT_EXCEPTION])) then
|
|
begin
|
|
match(TT_EXCEPTION);
|
|
end;
|
|
match(TT_JAVADOC_CLOSE);
|
|
end;
|
|
|
|
end.
|