parseDefText function

dynamic parseDefText(
  1. String text, {
  2. String baseFolderPath = '',
  3. String filePath = '',
  4. String readTextFileFunction(
    1. String, [
    2. String
    ])? = null,
  5. String stringProcessingQuote = '\'',
  6. dynamic processQuotedStringFunction(
    1. String,
    2. ParsingContext,
    3. int
    )? = processDefQuotedString,
  7. int levelSpaceCount = 4,
})

Implementation

dynamic parseDefText(
    String text,
    {
        String baseFolderPath = '',
        String filePath = '',
        String Function( String, [String] )? readTextFileFunction = null,
        String stringProcessingQuote = '\'',
        dynamic Function( String, ParsingContext, int )? processQuotedStringFunction = processDefQuotedString,
        int levelSpaceCount = 4
    }
    )
{
    var lineArray =
        text
            .trimRight()
            .replaceAll( '\t', ' ' * levelSpaceCount )
            .replaceAll( '\r', '' )
            .split( '\n' );

    var context =
        ParsingContext(
            baseFolderPath: baseFolderPath,
            filePath: filePath,
            readTextFileFunction: readTextFileFunction,
            stringProcessingQuote: stringProcessingQuote,
            processQuotedStringFunction: processQuotedStringFunction,
            levelSpaceCount: levelSpaceCount,
            text: text,
            lineArray: lineArray
            );

    return parseDefValue( context, 0 );
}