components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/js/source-editor/completion-engine.js
/**
             * Handle the query output rate suggestions for the query
             *
             * @private
             * @param {string[]} regexResults Array of groups from the regex execution of the query
             */
Handle the query output rate suggestions for the query
@private
@param {string[]} regexResults Array of groups from the regex execution of the query
Handle the query output rate suggestions for the query @private @param { string [] } regexResults Array of groups from the regex execution of the query
function handleQueryOutputRateSuggestions(regexResults) {
                var outputRateClause = regexResults[16];
                var afterHalfTypedKeywordSuggestionsRegex = new RegExp("^[a-zA-Z]*$", "i");
                var everyKeywordSuggestionsRegex = new RegExp(
                    "^(?:" + regex.query.outputRate.types + "|snapshot)\\s+" +
                    "[a-zA-Z]*$", "i");
                var afterOutputRateClauseSuggestionsRegex = new RegExp("^(?:" +
                    "(?:" + regex.query.outputRate.types + ")?|" +
                    "(?:(?:" + regex.query.outputRate.types + ")?|snapshot)" +
                    ")\\s+every\\s+[0-9]*\\s+" + regex.identifier + "\\s+[a-zA-Z]*$", "i");
                var timeValueSuggestionsRegex = new RegExp(
                    "^(?:(?:" + regex.query.outputRate.types + ")?|snapshot)\\s+" +
                    "every\\s+[0-9]*\\s+[a-zA-Z]*$", "i");
                var eventKeywordSuggestionRegex = new RegExp(
                    "^(?:" + regex.query.outputRate.types + ")?\\s+" + "every\\s+[0-9]*\\s+[a-zA-Z]*$", "i");
                if (outputRateClause == "" || afterHalfTypedKeywordSuggestionsRegex.test(outputRateClause)) {
                    addCompletions(["snapshot every", "all every", "last every", "first every", "every"]
                        .map(function (completion) {
                            return {value: completion + " "};
                        })
                    );
                } else if (everyKeywordSuggestionsRegex.test(outputRateClause)) {
                    addCompletions({value: "every "});
                } else if (afterOutputRateClauseSuggestionsRegex.test(outputRateClause)) {
                    addCompletions(["insert", "delete", "update", "update or insert into"].map(function (completion) {
                        return {value: completion + " "};
                    }));
                } else {
                    if (timeValueSuggestionsRegex.test(outputRateClause)) {
                        addCompletions(suggestions.timeValueTypes);
                    }
                    if (eventKeywordSuggestionRegex.test(outputRateClause)) {
                        addCompletions({value: "events"});
                    }
                }
            }
function handleQueryOutputRateSuggestions ( regexResults ) { var outputRateClause = regexResults [ 16 ] ; var afterHalfTypedKeywordSuggestionsRegex = new RegExp ( "^[a-zA-Z]*$" , "i" ) ; var everyKeywordSuggestionsRegex = new RegExp ( "^(?:" + regex . query . outputRate . types + "|snapshot)\\s+" + "[a-zA-Z]*$" , "i" ) ; var afterOutputRateClauseSuggestionsRegex = new RegExp ( "^(?:" + "(?:" + regex . query . outputRate . types + ")?|" + "(?:(?:" + regex . query . outputRate . types + ")?|snapshot)" + ")\\s+every\\s+[0-9]*\\s+" + regex . identifier + "\\s+[a-zA-Z]*$" , "i" ) ; var timeValueSuggestionsRegex = new RegExp ( "^(?:(?:" + regex . query . outputRate . types + ")?|snapshot)\\s+" + "every\\s+[0-9]*\\s+[a-zA-Z]*$" , "i" ) ; var eventKeywordSuggestionRegex = new RegExp ( "^(?:" + regex . query . outputRate . types + ")?\\s+" + "every\\s+[0-9]*\\s+[a-zA-Z]*$" , "i" ) ; if ( outputRateClause == "" || afterHalfTypedKeywordSuggestionsRegex . test ( outputRateClause ) ) { addCompletions ( [ "snapshot every" , "all every" , "last every" , "first every" , "every" ] . map ( function ( completion ) { return { value : completion + " " } ; } ) ) ; } else if ( everyKeywordSuggestionsRegex . test ( outputRateClause ) ) { addCompletions ( { value : "every " } ) ; } else if ( afterOutputRateClauseSuggestionsRegex . test ( outputRateClause ) ) { addCompletions ( [ "insert" , "delete" , "update" , "update or insert into" ] . map ( function ( completion ) { return { value : completion + " " } ; } ) ) ; } else { if ( timeValueSuggestionsRegex . test ( outputRateClause ) ) { addCompletions ( suggestions . timeValueTypes ) ; } if ( eventKeywordSuggestionRegex . test ( outputRateClause ) ) { addCompletions ( { value : "events" } ) ; } } }
Handle the query output rate suggestions for the query
 @private
 @param {string[]} regexResults Array of groups from the regex execution of the query
Handle the query output rate suggestions for the query @private @param { string [] } regexResults Array of groups from the regex execution of the query
// Regexps used for identifying the suggestions // Testing to find the relevant suggestion // Output rate type suggestions // Add every keyword suggestion after snapshot, all, last, first keywords // Add keywords after the output rate clause // Add time value data type suggestions // Add events keyword after the event count