_get_included_files() {
        let files = {};
        let paths = {};

        // Splits content into chunks based on "include(" prefix to detect possible calls
        let include_tag = this.#tags.inline_include;
        let chunks = this.#content.split(include_tag + '(');

        // Iterate through all potential chunks to find nested files
        let line_offset = 0;
        for (let i = 0; i < chunks.length; i++) {
            let current = chunks[i];
            let left = chunks[i - 1];
            let lines_count = ((left || '').match(/\n/g) || []).length + 1;
            let line_position = line_offset + lines_count;

            // Ensure a valid include call with a closure exists
            if (left && current.indexOf(')') > -1) {
                // Derive last character before call initiation to ensure no alphanumeric character preceeds it
                let last_left_char = left[left.length - 1];
                let valid_last_char = this._valid_func_char(last_left_char);

                // Derive potential file path of the include call
                let file_path = this._parse_file_path(current);
                if (!valid_last_char && file_path.length > 0) {
                    let left_content = this._from_newline(left, true);

                    // Determine if include call is commented in code
                    let single_commment = left_content.indexOf('//') > -1;
                    let multi_left = left_content.indexOf('/*') > -1;
                    let multi_right = left_content.indexOf('*/') == -1;
                    let multi_comment = multi_left && multi_right;

                    // Proceed if the call is not commented in code
                    if (!single_commment && !multi_comment) {
                        // Determine absolute system path for FileSystem APIs
                        let absolute_path = absolute_file_path(
                            file_path,
                            this.#directory_path
                        );

                        // Ensure the absolute path is not forbidden to prevent infinite nesting
                        if (!this.#forbidden.includes(absolute_path)) {
                            let spacing = left_content.length;

                            // Store references by line position to representing pointers
                            paths[absolute_path] = true;
                            files[line_position] = {
                                path: absolute_path,
                                spacing: spacing,
                            };
                        } else {
                            // Report infinite inclusion loops through error handler when absolute path matches a forbidden path
                            this.#handlers.error(
                                this.#path,
                                new Error(
                                    `Potential infinite inclusion loop detected at ${absolute_path}:${line_position}`
                                )
                            );
                        }
                    }
                }
            }

            if (left) line_offset += lines_count - 1;
        }

        return {
            files: files,
            paths: paths,
        };
    }
/**
     * Retrieves nested files from include calls in file content.
     *
     * @returns {Object} Object
     */
Retrieves nested files from include calls in file content.
@returns {Object} Object
Retrieves nested files from include calls in file content . @returns { Object } Object
_get_included_files() {
        let files = {};
        let paths = {};
        let include_tag = this.#tags.inline_include;
        let chunks = this.#content.split(include_tag + '(');
        let line_offset = 0;
        for (let i = 0; i < chunks.length; i++) {
            let current = chunks[i];
            let left = chunks[i - 1];
            let lines_count = ((left || '').match(/\n/g) || []).length + 1;
            let line_position = line_offset + lines_count;
            if (left && current.indexOf(')') > -1) {
                let last_left_char = left[left.length - 1];
                let valid_last_char = this._valid_func_char(last_left_char);
                let file_path = this._parse_file_path(current);
                if (!valid_last_char && file_path.length > 0) {
                    let left_content = this._from_newline(left, true);
                    let single_commment = left_content.indexOf('//') > -1;
                    let multi_left = left_content.indexOf('/*') > -1;
                    let multi_right = left_content.indexOf('*/') == -1;
                    let multi_comment = multi_left && multi_right;
                    if (!single_commment && !multi_comment) {
                        let absolute_path = absolute_file_path(
                            file_path,
                            this.#directory_path
                        );
                        if (!this.#forbidden.includes(absolute_path)) {
                            let spacing = left_content.length;
                            paths[absolute_path] = true;
                            files[line_position] = {
                                path: absolute_path,
                                spacing: spacing,
                            };
                        } else {
                            this.#handlers.error(
                                this.#path,
                                new Error(
                                    `Potential infinite inclusion loop detected at ${absolute_path}:${line_position}`
                                )
                            );
                        }
                    }
                }
            }
            if (left) line_offset += lines_count - 1;
        }
        return {
            files: files,
            paths: paths,
        };
    }
_get_included_files ( ) { let files = { } ; let paths = { } ; let include_tag = this . #tags . inline_include ; let chunks = this . #content . split ( include_tag + '(' ) ; let line_offset = 0 ; for ( let i = 0 ; i < chunks . length ; i ++ ) { let current = chunks [ i ] ; let left = chunks [ i - 1 ] ; let lines_count = ( ( left || '' ) . match ( / \n / g ) || [ ] ) . length + 1 ; let line_position = line_offset + lines_count ; if ( left && current . indexOf ( ')' ) > - 1 ) { let last_left_char = left [ left . length - 1 ] ; let valid_last_char = this . _valid_func_char ( last_left_char ) ; let file_path = this . _parse_file_path ( current ) ; if ( ! valid_last_char && file_path . length > 0 ) { let left_content = this . _from_newline ( left , true ) ; let single_commment = left_content . indexOf ( '//' ) > - 1 ; let multi_left = left_content . indexOf ( '/*' ) > - 1 ; let multi_right = left_content . indexOf ( '*/' ) == - 1 ; let multi_comment = multi_left && multi_right ; if ( ! single_commment && ! multi_comment ) { let absolute_path = absolute_file_path ( file_path , this . #directory_path ) ; if ( ! this . #forbidden . includes ( absolute_path ) ) { let spacing = left_content . length ; paths [ absolute_path ] = true ; files [ line_position ] = { path : absolute_path , spacing : spacing , } ; } else { this . #handlers . error ( this . #path , new Error ( ` ${ absolute_path } ${ line_position } ` ) ) ; } } } } if ( left ) line_offset += lines_count - 1 ; } return { files : files , paths : paths , } ; }
Retrieves nested files from include calls in file content.
Retrieves nested files from include calls in file content .
// Splits content into chunks based on "include(" prefix to detect possible calls // Iterate through all potential chunks to find nested files // Ensure a valid include call with a closure exists // Derive last character before call initiation to ensure no alphanumeric character preceeds it // Derive potential file path of the include call // Determine if include call is commented in code // Proceed if the call is not commented in code // Determine absolute system path for FileSystem APIs // Ensure the absolute path is not forbidden to prevent infinite nesting // Store references by line position to representing pointers // Report infinite inclusion loops through error handler when absolute path matches a forbidden path