59 lines
2.0 KiB
ObjectPascal
59 lines
2.0 KiB
ObjectPascal
unit dpglib.OneOrMoreBlock;
|
|
|
|
interface
|
|
uses
|
|
dpgrtl.types,
|
|
dpglib.types,
|
|
dpglib.BlockWithImpliedExitPath;
|
|
|
|
type
|
|
// =========================================================================
|
|
// Class TOneOrMoreBlock declaration
|
|
// =========================================================================
|
|
TOneOrMoreBlock = class( TBlockWithImpliedExitPath,
|
|
IOneOrMoreBlock,
|
|
IBlockWithImpliedExitPath,
|
|
IAlternativeBlock,
|
|
IAlternativeElem,
|
|
IGrammarElem)
|
|
|
|
// ----------------------------------------------------------------------
|
|
// IGrammarElem overrides
|
|
// ----------------------------------------------------------------------
|
|
public
|
|
procedure Generate;
|
|
function Look( pK: integer): ILookahead;
|
|
function AsString : AnsiString;
|
|
end;
|
|
|
|
implementation
|
|
// ****************************************************************************
|
|
// IGrammarElem overrides
|
|
// ****************************************************************************
|
|
// ============================================================================
|
|
// Generate
|
|
// ============================================================================
|
|
procedure TOneOrMoreBlock.Generate;
|
|
begin
|
|
fGrammar.Generator.Gen( self);
|
|
end;
|
|
|
|
// ============================================================================
|
|
// Look
|
|
// ============================================================================
|
|
function TOneOrMoreBlock.Look(pK: integer): ILookahead;
|
|
begin
|
|
result := fGrammar.LLkAnalyzer.Look( pK, self);
|
|
end;
|
|
|
|
// ============================================================================
|
|
// ToString
|
|
// ============================================================================
|
|
function TOneOrMoreBlock.AsString: AnsiString;
|
|
begin
|
|
result := inherited AsString + '+';
|
|
end;
|
|
|
|
|
|
end.
|