Initial check in lib
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
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.
|
||||
Reference in New Issue
Block a user