fromFinishSource static method
Implementation
static Safety<RootCitrusSyntax> fromFinishSource(String source) {
final log = Log(classLocation: RootCitrusSyntax, functionLocation: 'fromFinishSource');
// 1.
final scanner = StringScanner<DerivationCitrusSyntax>.fromString(source);
final stringScannerCompileResult = scanner.compile(LeafCitrusSyntax.result);
log.add(stringScannerCompileResult);
// 1. より LeafCitrusSyntaxExceptionA は起こりえないので throw out.
if (stringScannerCompileResult is! Success<SyntaxScanner<DerivationCitrusSyntax, DerivationCitrusSyntax>, LeafCitrusSyntaxExceptionA>) Result.panic(CitrusSyntaxErrorA(), log);
final compileUnits = [
CompileUnit([
ListSyntaxVerify(ListOfIdentifierable.fromIterable),
ListSyntaxVerify(ListOfOperatable.fromIterable),
ListSyntaxVerify(SpaceCollection.fromIterable),
]),
CompileUnit([
OneLengthSyntaxVerify(Identifier.result),
OneLengthSyntaxVerify(Operator.result),
IndentVerify(),
]),
CompileUnit([
TwoLengthSyntaxVerify(BlockType.new),
ListSyntaxVerify(AccesserableCollection.fromIterable),
FiveLengthSyntaxVerify(RepeatBlock.new),
]),
CompileUnit([
ThreeLengthSyntaxVerify(CurlyBind.new),
ThreeLengthSyntaxVerify(EndBlock.new),
OperatorExpressionVerify(),
FiveLengthSyntaxVerify(InExpression.new),
]),
CompileUnit([
FiveLengthSyntaxVerify(InJoinExpression.new),
]),
CompileUnit([
FiveLengthSyntaxVerify(StartBlock.new),
]),
CompileUnit([
TrunkSyntaxVerify(BlockSandwich.fromIterable),
]),
];
final syntaxCompileResult = stringScannerCompileResult.wrapped.compile(compileUnits);
log.add(syntaxCompileResult);
final derivationSyntaxListResult = CitrusSyntaxList(syntaxCompileResult.wrapped);
final result = RootCitrusSyntax(derivationSyntaxListResult);
return Safety(result, log);
}