diff --git a/src/CONST/index.ts b/src/CONST/index.ts index a241fd0182a0f..153bf27af8525 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -7076,6 +7076,7 @@ const CONST = { SORT_ORDER: 'sortOrder', GROUP_BY: 'groupBy', COLUMNS: 'columns', + LIMIT: 'limit', }, SYNTAX_FILTER_KEYS: { TYPE: 'type', @@ -7185,6 +7186,7 @@ const CONST = { IS: 'is', REPORT_FIELD: 'report-field', COLUMNS: 'columns', + LIMIT: 'limit', }, get SEARCH_USER_FRIENDLY_VALUES_MAP() { return { diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 7e5ae41f124a9..05e77b043b874 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -77,6 +77,7 @@ const SCREENS = { ADVANCED_FILTERS_WITHDRAWAL_ID_RHP: 'Search_Advanced_Filters_Withdrawal_ID_RHP', ADVANCED_FILTERS_TAG_RHP: 'Search_Advanced_Filters_Tag_RHP', ADVANCED_FILTERS_HAS_RHP: 'Search_Advanced_Filters_Has_RHP', + ADVANCED_FILTERS_LIMIT_RHP: 'Search_Advanced_Filters_Limit_RHP', ADVANCED_FILTERS_FROM_RHP: 'Search_Advanced_Filters_From_RHP', ADVANCED_FILTERS_TO_RHP: 'Search_Advanced_Filters_To_RHP', ADVANCED_FILTERS_TITLE_RHP: 'Search_Advanced_Filters_Title_RHP', diff --git a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx index bd687e58e5178..73e73b81a97bd 100644 --- a/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx +++ b/src/components/Search/SearchPageHeader/SearchFiltersBar.tsx @@ -307,10 +307,11 @@ function SearchFiltersBar({ updatedFilterFormValues.columns = []; } - // Preserve the current sortBy and sortOrder from queryJSON when updating filters + // Preserve the current sortBy, sortOrder, and limit from queryJSON when updating filters let queryString = buildQueryStringFromFilterFormValues(updatedFilterFormValues, { sortBy: queryJSON.sortBy, sortOrder: queryJSON.sortOrder, + limit: queryJSON.limit, }); if (updatedFilterFormValues.groupBy !== searchAdvancedFiltersForm.groupBy) { @@ -325,7 +326,7 @@ function SearchFiltersBar({ Navigation.setParams({q: queryString, rawQuery: undefined}); }); }, - [searchAdvancedFiltersForm, queryJSON.sortBy, queryJSON.sortOrder], + [searchAdvancedFiltersForm, queryJSON.sortBy, queryJSON.sortOrder, queryJSON.limit], ); const openAdvancedFilters = useCallback(() => { diff --git a/src/components/Search/types.ts b/src/components/Search/types.ts index 74c435cee2b20..1964a1dadf8fa 100644 --- a/src/components/Search/types.ts +++ b/src/components/Search/types.ts @@ -194,6 +194,7 @@ type SearchTextFilterKeys = | typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD | typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.TITLE | typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_ID + | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT | ReportFieldTextKey; type SearchDateFilterKeys = @@ -218,7 +219,8 @@ type SearchFilterKey = | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.TYPE | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY - | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.COLUMNS; + | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.COLUMNS + | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT; type UserFriendlyKey = ValueOf; type UserFriendlyValue = ValueOf; @@ -249,6 +251,7 @@ type SearchQueryAST = { policyID?: string[]; rawFilterList?: RawQueryFilter[]; columns?: SearchCustomColumnIds | SearchCustomColumnIds[]; + limit?: number; }; type SearchQueryJSON = { diff --git a/src/hooks/useAdvancedSearchFilters.ts b/src/hooks/useAdvancedSearchFilters.ts index ac6c3a33c56aa..1072798855a21 100644 --- a/src/hooks/useAdvancedSearchFilters.ts +++ b/src/hooks/useAdvancedSearchFilters.ts @@ -30,6 +30,7 @@ const typeFiltersKeys = { CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY, CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY, CONST.SEARCH.SYNTAX_FILTER_KEYS.HAS, + CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT, ], [ CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPENSE_TYPE, diff --git a/src/languages/de.ts b/src/languages/de.ts index 0d9c18bb60aaa..7594ca64610fa 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -6884,6 +6884,7 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard status: 'Status', keyword: 'Schlüsselwort', keywords: 'Schlüsselwörter', + limit: 'Limit', currency: 'Währung', completed: 'Abgeschlossen', amount: { diff --git a/src/languages/en.ts b/src/languages/en.ts index dd3498afdf513..d473e0b529f6f 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -6770,6 +6770,7 @@ const translations = { status: 'Status', keyword: 'Keyword', keywords: 'Keywords', + limit: 'Limit', currency: 'Currency', completed: 'Completed', amount: { diff --git a/src/languages/es.ts b/src/languages/es.ts index a2bd2defab1b0..3fa9e495bc059 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6520,6 +6520,7 @@ ${amount} para ${merchant} - ${date}`, status: 'Estado', keyword: 'Palabra clave', keywords: 'Palabras clave', + limit: 'Límite', currency: 'Divisa', completed: 'Completadas', card: { diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 98f6c1e94f58c..5401a178a2e23 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -6895,6 +6895,7 @@ Exigez des informations de dépense comme les reçus et les descriptions, défin status: 'Statut', keyword: 'Mot-clé', keywords: 'Mots-clés', + limit: 'Limite', currency: 'Devise', completed: 'Terminé', amount: { diff --git a/src/languages/it.ts b/src/languages/it.ts index 8a2535884392f..e11ee8f9124fe 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -6874,6 +6874,7 @@ Richiedi dettagli di spesa come ricevute e descrizioni, imposta limiti e valori status: 'Stato', keyword: 'Parola chiave', keywords: 'Parole chiave', + limit: 'Limite', currency: 'Valuta', completed: 'Completato', amount: { diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 8b29b24b6fbd2..dd18a00377452 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -6815,6 +6815,7 @@ ${reportName} status: 'ステータス', keyword: 'キーワード', keywords: 'キーワード', + limit: '制限', currency: '通貨', completed: '完了', amount: { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 4dd28f7d8417a..8bb3bbc2b6499 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -6856,6 +6856,7 @@ Vraag verplichte uitgavedetails zoals bonnetjes en beschrijvingen, stel limieten status: 'Status', keyword: 'Trefwoord', keywords: 'Trefwoorden', + limit: 'Limiet', currency: 'Valuta', completed: 'Voltooid', amount: { diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 72ab7ddf5be92..286108bb08809 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -6845,6 +6845,7 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i status: 'Status', keyword: 'Słowo kluczowe', keywords: 'Słowa kluczowe', + limit: 'Limit', currency: 'Waluta', completed: 'Zakończone', amount: { diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index ab7d13a8d9ec3..9230c192fd0aa 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -6847,6 +6847,7 @@ Exija detalhes de despesas como recibos e descrições, defina limites e padrõe status: 'Status', keyword: 'Palavra-chave', keywords: 'Palavras-chave', + limit: 'Limite', currency: 'Moeda', completed: 'Concluído', amount: { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index 88a6015cfe45c..1808bf1ccf08d 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -6696,6 +6696,7 @@ ${reportName} status: '状态', keyword: '关键字', keywords: '关键词', + limit: '限制', currency: '货币', completed: '已完成', amount: { diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 46fb0e77d6715..30850882e9aa9 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -946,6 +946,7 @@ const SearchAdvancedFiltersModalStackNavigator = createModalStackNavigator require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersIsPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_TAG_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersTagPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_HAS_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersHasPage').default, + [SCREENS.SEARCH.ADVANCED_FILTERS_LIMIT_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersLimitPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_FROM_RHP]: () => require('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersFromPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_TO_RHP]: () => require('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersToPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_IN_RHP]: () => require('@pages/Search/SearchAdvancedFiltersPage/SearchFiltersInPage').default, diff --git a/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts b/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts index 9f36d76fd742d..aecf8e5770f68 100644 --- a/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts +++ b/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts @@ -36,6 +36,7 @@ const SEARCH_TO_RHP: Partial['config'] = { [SCREENS.SEARCH.ADVANCED_FILTERS_REIMBURSABLE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.REIMBURSABLE), [SCREENS.SEARCH.ADVANCED_FILTERS_WORKSPACE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.POLICY_ID), [SCREENS.SEARCH.ADVANCED_FILTERS_HAS_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.HAS), + [SCREENS.SEARCH.ADVANCED_FILTERS_LIMIT_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.LIMIT), [SCREENS.SEARCH.ADVANCED_FILTERS_PURCHASE_AMOUNT_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.PURCHASE_AMOUNT), [SCREENS.SEARCH.ADVANCED_FILTERS_PURCHASE_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.PURCHASE_CURRENCY), [SCREENS.SEARCH.ADVANCED_FILTERS_ATTENDEE_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.ATTENDEE), diff --git a/src/libs/SearchAutocompleteUtils.ts b/src/libs/SearchAutocompleteUtils.ts index 11a0b8db52dad..547b56418d032 100644 --- a/src/libs/SearchAutocompleteUtils.ts +++ b/src/libs/SearchAutocompleteUtils.ts @@ -237,6 +237,10 @@ function filterOutRangesWithCorrectValue( return userFriendlyColumnList.has(range.value); case CONST.SEARCH.SYNTAX_FILTER_KEYS.IS: return isList.includes(range.value); + case CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT: { + const num = Number(range.value); + return Number.isInteger(num) && num > 0; + } default: return false; } diff --git a/src/libs/SearchParser/autocompleteParser.js b/src/libs/SearchParser/autocompleteParser.js index 4968f5dd67e56..f6aaabf081115 100644 --- a/src/libs/SearchParser/autocompleteParser.js +++ b/src/libs/SearchParser/autocompleteParser.js @@ -233,49 +233,50 @@ function peg$parse(input, options) { var peg$c47 = "withdrawn"; var peg$c48 = "groupby"; var peg$c49 = "group-by"; - var peg$c50 = "feed"; - var peg$c51 = "title"; - var peg$c52 = "assignee"; - var peg$c53 = "createdby"; - var peg$c54 = "created-by"; - var peg$c55 = "action"; - var peg$c56 = "total"; - var peg$c57 = "has"; - var peg$c58 = "is"; - var peg$c59 = "purchaseamount"; - var peg$c60 = "purchase-amount"; - var peg$c61 = "purchasecurrency"; - var peg$c62 = "purchase-currency"; - var peg$c63 = "columns"; - var peg$c64 = "per-diem"; - var peg$c65 = "drafts"; - var peg$c66 = "draft"; - var peg$c67 = "original-amount"; - var peg$c68 = "tax"; - var peg$c69 = "policy-name"; - var peg$c70 = "bank-account"; - var peg$c71 = "long-report-id"; - var peg$c72 = "exported-to"; - var peg$c73 = "exchange-rate"; - var peg$c74 = "reimbursable-total"; - var peg$c75 = "non-reimbursable-total"; - var peg$c76 = "group-from"; - var peg$c77 = "group-expenses"; - var peg$c78 = "group-total"; - var peg$c79 = "group-card"; - var peg$c80 = "group-feed"; - var peg$c81 = "group-bank-account"; - var peg$c82 = "group-withdrawn"; - var peg$c83 = "group-withdrawal-id"; - var peg$c84 = "group-category"; - var peg$c85 = "!="; - var peg$c86 = ">="; - var peg$c87 = ">"; - var peg$c88 = "<="; - var peg$c89 = "<"; - var peg$c90 = "\u201C"; - var peg$c91 = "\u201D"; - var peg$c92 = "\""; + var peg$c50 = "limit"; + var peg$c51 = "feed"; + var peg$c52 = "title"; + var peg$c53 = "assignee"; + var peg$c54 = "createdby"; + var peg$c55 = "created-by"; + var peg$c56 = "action"; + var peg$c57 = "total"; + var peg$c58 = "has"; + var peg$c59 = "is"; + var peg$c60 = "purchaseamount"; + var peg$c61 = "purchase-amount"; + var peg$c62 = "purchasecurrency"; + var peg$c63 = "purchase-currency"; + var peg$c64 = "columns"; + var peg$c65 = "per-diem"; + var peg$c66 = "drafts"; + var peg$c67 = "draft"; + var peg$c68 = "original-amount"; + var peg$c69 = "tax"; + var peg$c70 = "policy-name"; + var peg$c71 = "bank-account"; + var peg$c72 = "long-report-id"; + var peg$c73 = "exported-to"; + var peg$c74 = "exchange-rate"; + var peg$c75 = "reimbursable-total"; + var peg$c76 = "non-reimbursable-total"; + var peg$c77 = "group-from"; + var peg$c78 = "group-expenses"; + var peg$c79 = "group-total"; + var peg$c80 = "group-card"; + var peg$c81 = "group-feed"; + var peg$c82 = "group-bank-account"; + var peg$c83 = "group-withdrawn"; + var peg$c84 = "group-withdrawal-id"; + var peg$c85 = "group-category"; + var peg$c86 = "!="; + var peg$c87 = ">="; + var peg$c88 = ">"; + var peg$c89 = "<="; + var peg$c90 = "<"; + var peg$c91 = "\u201C"; + var peg$c92 = "\u201D"; + var peg$c93 = "\""; var peg$r0 = /^[ \t\r\n\xA0,:=<>!]/; var peg$r1 = /^[:=]/; @@ -344,65 +345,66 @@ function peg$parse(input, options) { var peg$e50 = peg$literalExpectation("withdrawn", true); var peg$e51 = peg$literalExpectation("groupBy", true); var peg$e52 = peg$literalExpectation("group-by", true); - var peg$e53 = peg$literalExpectation("feed", true); - var peg$e54 = peg$literalExpectation("title", true); - var peg$e55 = peg$literalExpectation("assignee", true); - var peg$e56 = peg$literalExpectation("createdBy", true); - var peg$e57 = peg$literalExpectation("created-by", true); - var peg$e58 = peg$literalExpectation("action", true); - var peg$e59 = peg$literalExpectation("total", true); - var peg$e60 = peg$literalExpectation("has", true); - var peg$e61 = peg$literalExpectation("is", true); - var peg$e62 = peg$literalExpectation("purchaseAmount", true); - var peg$e63 = peg$literalExpectation("purchase-amount", true); - var peg$e64 = peg$literalExpectation("purchaseCurrency", true); - var peg$e65 = peg$literalExpectation("purchase-currency", true); - var peg$e66 = peg$literalExpectation("columns", true); - var peg$e67 = peg$literalExpectation("per-diem", true); - var peg$e68 = peg$literalExpectation("drafts", true); - var peg$e69 = peg$literalExpectation("draft", true); - var peg$e70 = peg$literalExpectation("original-amount", true); - var peg$e71 = peg$literalExpectation("tax", true); - var peg$e72 = peg$literalExpectation("policy-name", true); - var peg$e73 = peg$literalExpectation("bank-account", true); - var peg$e74 = peg$literalExpectation("long-report-id", true); - var peg$e75 = peg$literalExpectation("exported-to", true); - var peg$e76 = peg$literalExpectation("exchange-rate", true); - var peg$e77 = peg$literalExpectation("reimbursable-total", true); - var peg$e78 = peg$literalExpectation("non-reimbursable-total", true); - var peg$e79 = peg$literalExpectation("group-from", true); - var peg$e80 = peg$literalExpectation("group-expenses", true); - var peg$e81 = peg$literalExpectation("group-total", true); - var peg$e82 = peg$literalExpectation("group-card", true); - var peg$e83 = peg$literalExpectation("group-feed", true); - var peg$e84 = peg$literalExpectation("group-bank-account", true); - var peg$e85 = peg$literalExpectation("group-withdrawn", true); - var peg$e86 = peg$literalExpectation("group-withdrawal-id", true); - var peg$e87 = peg$literalExpectation("group-category", true); - var peg$e88 = peg$otherExpectation("operator"); - var peg$e89 = peg$classExpectation([":", "="], false, false); - var peg$e90 = peg$literalExpectation("!=", false); - var peg$e91 = peg$literalExpectation(">=", false); - var peg$e92 = peg$literalExpectation(">", false); - var peg$e93 = peg$literalExpectation("<=", false); - var peg$e94 = peg$literalExpectation("<", false); - var peg$e95 = peg$otherExpectation("word"); - var peg$e96 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e97 = peg$otherExpectation("whitespace"); - var peg$e98 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); - var peg$e99 = peg$otherExpectation("quote"); - var peg$e100 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e101 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); - var peg$e102 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); - var peg$e103 = peg$literalExpectation("\u201C", false); - var peg$e104 = peg$literalExpectation("\u201D", false); - var peg$e105 = peg$literalExpectation("\"", false); - var peg$e106 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e107 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e108 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); - var peg$e109 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); - var peg$e110 = peg$classExpectation([","], false, false); - var peg$e111 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); + var peg$e53 = peg$literalExpectation("limit", true); + var peg$e54 = peg$literalExpectation("feed", true); + var peg$e55 = peg$literalExpectation("title", true); + var peg$e56 = peg$literalExpectation("assignee", true); + var peg$e57 = peg$literalExpectation("createdBy", true); + var peg$e58 = peg$literalExpectation("created-by", true); + var peg$e59 = peg$literalExpectation("action", true); + var peg$e60 = peg$literalExpectation("total", true); + var peg$e61 = peg$literalExpectation("has", true); + var peg$e62 = peg$literalExpectation("is", true); + var peg$e63 = peg$literalExpectation("purchaseAmount", true); + var peg$e64 = peg$literalExpectation("purchase-amount", true); + var peg$e65 = peg$literalExpectation("purchaseCurrency", true); + var peg$e66 = peg$literalExpectation("purchase-currency", true); + var peg$e67 = peg$literalExpectation("columns", true); + var peg$e68 = peg$literalExpectation("per-diem", true); + var peg$e69 = peg$literalExpectation("drafts", true); + var peg$e70 = peg$literalExpectation("draft", true); + var peg$e71 = peg$literalExpectation("original-amount", true); + var peg$e72 = peg$literalExpectation("tax", true); + var peg$e73 = peg$literalExpectation("policy-name", true); + var peg$e74 = peg$literalExpectation("bank-account", true); + var peg$e75 = peg$literalExpectation("long-report-id", true); + var peg$e76 = peg$literalExpectation("exported-to", true); + var peg$e77 = peg$literalExpectation("exchange-rate", true); + var peg$e78 = peg$literalExpectation("reimbursable-total", true); + var peg$e79 = peg$literalExpectation("non-reimbursable-total", true); + var peg$e80 = peg$literalExpectation("group-from", true); + var peg$e81 = peg$literalExpectation("group-expenses", true); + var peg$e82 = peg$literalExpectation("group-total", true); + var peg$e83 = peg$literalExpectation("group-card", true); + var peg$e84 = peg$literalExpectation("group-feed", true); + var peg$e85 = peg$literalExpectation("group-bank-account", true); + var peg$e86 = peg$literalExpectation("group-withdrawn", true); + var peg$e87 = peg$literalExpectation("group-withdrawal-id", true); + var peg$e88 = peg$literalExpectation("group-category", true); + var peg$e89 = peg$otherExpectation("operator"); + var peg$e90 = peg$classExpectation([":", "="], false, false); + var peg$e91 = peg$literalExpectation("!=", false); + var peg$e92 = peg$literalExpectation(">=", false); + var peg$e93 = peg$literalExpectation(">", false); + var peg$e94 = peg$literalExpectation("<=", false); + var peg$e95 = peg$literalExpectation("<", false); + var peg$e96 = peg$otherExpectation("word"); + var peg$e97 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e98 = peg$otherExpectation("whitespace"); + var peg$e99 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$e100 = peg$otherExpectation("quote"); + var peg$e101 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e102 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); + var peg$e103 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); + var peg$e104 = peg$literalExpectation("\u201C", false); + var peg$e105 = peg$literalExpectation("\u201D", false); + var peg$e106 = peg$literalExpectation("\"", false); + var peg$e107 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e108 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e109 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); + var peg$e110 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); + var peg$e111 = peg$classExpectation([","], false, false); + var peg$e112 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); var peg$f0 = function(ranges) { return { autocomplete, ranges }; }; var peg$f1 = function(filters) { return filters.filter(Boolean).flat(); }; @@ -501,70 +503,71 @@ function peg$parse(input, options) { var peg$f39 = function() { return "posted"; }; var peg$f40 = function() { return "withdrawn"; }; var peg$f41 = function() { return "groupBy"; }; - var peg$f42 = function() { return "feed"; }; - var peg$f43 = function() { return "title"; }; - var peg$f44 = function() { return "assignee"; }; - var peg$f45 = function() { return "createdBy"; }; - var peg$f46 = function() { return "action"; }; - var peg$f47 = function() {return "total"; }; - var peg$f48 = function() {return "has"; }; - var peg$f49 = function() {return "is"; }; - var peg$f50 = function() {return "purchaseAmount"}; - var peg$f51 = function() {return "purchaseCurrency"}; - var peg$f52 = function() { + var peg$f42 = function() { return "limit"; }; + var peg$f43 = function() { return "feed"; }; + var peg$f44 = function() { return "title"; }; + var peg$f45 = function() { return "assignee"; }; + var peg$f46 = function() { return "createdBy"; }; + var peg$f47 = function() { return "action"; }; + var peg$f48 = function() {return "total"; }; + var peg$f49 = function() {return "has"; }; + var peg$f50 = function() {return "is"; }; + var peg$f51 = function() {return "purchaseAmount"}; + var peg$f52 = function() {return "purchaseCurrency"}; + var peg$f53 = function() { isColumnsContext = true; return "columns"; }; - var peg$f53 = function() { return isColumnsContext; }; - var peg$f54 = function() { return "perDiem"; }; - var peg$f55 = function() { return "drafts"; }; - var peg$f56 = function() { return "originalamount"; }; - var peg$f57 = function() { return "taxAmount"; }; - var peg$f58 = function() { return "taxrate"; }; - var peg$f59 = function() { return "policyname"; }; - var peg$f60 = function() { return "withdrawalID"; }; - var peg$f61 = function() { return "bankAccount"; }; - var peg$f62 = function() { return "reportID"; }; - var peg$f63 = function() { return "base62ReportID"; }; - var peg$f64 = function() { return "exportedto"; }; - var peg$f65 = function() { return "exchangeRate"; }; - var peg$f66 = function() { return "reimbursableTotal"; }; - var peg$f67 = function() { return "nonReimbursableTotal"; }; - var peg$f68 = function() { return "groupFrom"; }; - var peg$f69 = function() { return "groupExpenses"; }; - var peg$f70 = function() { return "groupTotal"; }; - var peg$f71 = function() { return "groupCard"; }; - var peg$f72 = function() { return "groupFeed"; }; - var peg$f73 = function() { return "groupBankAccount"; }; - var peg$f74 = function() { return "groupWithdrawn"; }; - var peg$f75 = function() { return "groupWithdrawalID"; }; - var peg$f76 = function() { return "groupCategory"; }; - var peg$f77 = function() { return "eq"; }; - var peg$f78 = function() { return "neq"; }; - var peg$f79 = function() { return "gte"; }; - var peg$f80 = function() { return "gt"; }; - var peg$f81 = function() { return "lte"; }; - var peg$f82 = function() { return "lt"; }; - var peg$f83 = function(o) { + var peg$f54 = function() { return isColumnsContext; }; + var peg$f55 = function() { return "perDiem"; }; + var peg$f56 = function() { return "drafts"; }; + var peg$f57 = function() { return "originalamount"; }; + var peg$f58 = function() { return "taxAmount"; }; + var peg$f59 = function() { return "taxrate"; }; + var peg$f60 = function() { return "policyname"; }; + var peg$f61 = function() { return "withdrawalID"; }; + var peg$f62 = function() { return "bankAccount"; }; + var peg$f63 = function() { return "reportID"; }; + var peg$f64 = function() { return "base62ReportID"; }; + var peg$f65 = function() { return "exportedto"; }; + var peg$f66 = function() { return "exchangeRate"; }; + var peg$f67 = function() { return "reimbursableTotal"; }; + var peg$f68 = function() { return "nonReimbursableTotal"; }; + var peg$f69 = function() { return "groupFrom"; }; + var peg$f70 = function() { return "groupExpenses"; }; + var peg$f71 = function() { return "groupTotal"; }; + var peg$f72 = function() { return "groupCard"; }; + var peg$f73 = function() { return "groupFeed"; }; + var peg$f74 = function() { return "groupBankAccount"; }; + var peg$f75 = function() { return "groupWithdrawn"; }; + var peg$f76 = function() { return "groupWithdrawalID"; }; + var peg$f77 = function() { return "groupCategory"; }; + var peg$f78 = function() { return "eq"; }; + var peg$f79 = function() { return "neq"; }; + var peg$f80 = function() { return "gte"; }; + var peg$f81 = function() { return "gt"; }; + var peg$f82 = function() { return "lte"; }; + var peg$f83 = function() { return "lt"; }; + var peg$f84 = function(o) { if (nameOperator) { expectingNestedQuote = (o === "eq"); // Use simple parser if no valid operator is found } isColumnsContext = false; return o; }; - var peg$f84 = function(chars) { return chars.join("").trim(); }; - var peg$f85 = function() { + var peg$f85 = function(chars) { return chars.join("").trim(); }; + var peg$f86 = function() { isColumnsContext = false; return "and"; }; - var peg$f86 = function() { return expectingNestedQuote; }; - var peg$f87 = function(start, inner, end) { //handle no-breaking space + var peg$f87 = function() { return expectingNestedQuote; }; + var peg$f88 = function(start, inner, end) { //handle no-breaking space return [...start, '"', ...inner, '"', ...end].join(""); }; - var peg$f88 = function(start) {return "“"}; - var peg$f89 = function(start) {return "”"}; - var peg$f90 = function(start) {return "\""}; - var peg$f91 = function(start, inner, end) { + var peg$f89 = function(start) {return "“"}; + var peg$f90 = function(start) {return "”"}; + var peg$f91 = function(start) {return "\""}; + var peg$f92 = function(start, inner, end) { return [...start, '"', ...inner, '"'].join(""); }; var peg$currPos = options.peg$currPos | 0; @@ -1064,6 +1067,9 @@ function peg$parse(input, options) { s1 = peg$parsereportFieldDynamic(); if (s1 === peg$FAILED) { s1 = peg$parsecolumns(); + if (s1 === peg$FAILED) { + s1 = peg$parselimit(); + } } } } @@ -1997,13 +2003,13 @@ function peg$parse(input, options) { return s0; } - function peg$parsefeed() { + function peg$parselimit() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 4); + s1 = input.substr(peg$currPos, 5); if (s1.toLowerCase() === peg$c50) { - peg$currPos += 4; + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e53); } @@ -2017,13 +2023,13 @@ function peg$parse(input, options) { return s0; } - function peg$parsetitle() { + function peg$parsefeed() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 5); + s1 = input.substr(peg$currPos, 4); if (s1.toLowerCase() === peg$c51) { - peg$currPos += 5; + peg$currPos += 4; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e54); } @@ -2037,13 +2043,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseassignee() { + function peg$parsetitle() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 8); + s1 = input.substr(peg$currPos, 5); if (s1.toLowerCase() === peg$c52) { - peg$currPos += 8; + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e55); } @@ -2057,28 +2063,48 @@ function peg$parse(input, options) { return s0; } + function peg$parseassignee() { + var s0, s1; + + s0 = peg$currPos; + s1 = input.substr(peg$currPos, 8); + if (s1.toLowerCase() === peg$c53) { + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e56); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f45(); + } + s0 = s1; + + return s0; + } + function peg$parsecreatedBy() { var s0, s1; s0 = input.substr(peg$currPos, 9); - if (s0.toLowerCase() === peg$c53) { + if (s0.toLowerCase() === peg$c54) { peg$currPos += 9; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e56); } + if (peg$silentFails === 0) { peg$fail(peg$e57); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c54) { + if (s1.toLowerCase() === peg$c55) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e57); } + if (peg$silentFails === 0) { peg$fail(peg$e58); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f45(); + s1 = peg$f46(); } s0 = s1; } @@ -2091,15 +2117,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 6); - if (s1.toLowerCase() === peg$c55) { + if (s1.toLowerCase() === peg$c56) { peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e58); } + if (peg$silentFails === 0) { peg$fail(peg$e59); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f46(); + s1 = peg$f47(); } s0 = s1; @@ -2111,15 +2137,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 5); - if (s1.toLowerCase() === peg$c56) { + if (s1.toLowerCase() === peg$c57) { peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e59); } + if (peg$silentFails === 0) { peg$fail(peg$e60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f47(); + s1 = peg$f48(); } s0 = s1; @@ -2131,15 +2157,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 3); - if (s1.toLowerCase() === peg$c57) { + if (s1.toLowerCase() === peg$c58) { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e60); } + if (peg$silentFails === 0) { peg$fail(peg$e61); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f48(); + s1 = peg$f49(); } s0 = s1; @@ -2151,15 +2177,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 2); - if (s1.toLowerCase() === peg$c58) { + if (s1.toLowerCase() === peg$c59) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e61); } + if (peg$silentFails === 0) { peg$fail(peg$e62); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f49(); + s1 = peg$f50(); } s0 = s1; @@ -2170,24 +2196,24 @@ function peg$parse(input, options) { var s0, s1; s0 = input.substr(peg$currPos, 14); - if (s0.toLowerCase() === peg$c59) { + if (s0.toLowerCase() === peg$c60) { peg$currPos += 14; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e62); } + if (peg$silentFails === 0) { peg$fail(peg$e63); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c60) { + if (s1.toLowerCase() === peg$c61) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e63); } + if (peg$silentFails === 0) { peg$fail(peg$e64); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f50(); + s1 = peg$f51(); } s0 = s1; } @@ -2199,24 +2225,24 @@ function peg$parse(input, options) { var s0, s1; s0 = input.substr(peg$currPos, 16); - if (s0.toLowerCase() === peg$c61) { + if (s0.toLowerCase() === peg$c62) { peg$currPos += 16; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e64); } + if (peg$silentFails === 0) { peg$fail(peg$e65); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 17); - if (s1.toLowerCase() === peg$c62) { + if (s1.toLowerCase() === peg$c63) { peg$currPos += 17; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e65); } + if (peg$silentFails === 0) { peg$fail(peg$e66); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f51(); + s1 = peg$f52(); } s0 = s1; } @@ -2229,15 +2255,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 7); - if (s1.toLowerCase() === peg$c63) { + if (s1.toLowerCase() === peg$c64) { peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e66); } + if (peg$silentFails === 0) { peg$fail(peg$e67); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f52(); + s1 = peg$f53(); } s0 = s1; @@ -2249,7 +2275,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f53(); + s1 = peg$f54(); if (s1) { s1 = undefined; } else { @@ -2351,11 +2377,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 8); - if (s1.toLowerCase() === peg$c64) { + if (s1.toLowerCase() === peg$c65) { peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e67); } + if (peg$silentFails === 0) { peg$fail(peg$e68); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2370,7 +2396,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f54(); + s0 = peg$f55(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2388,19 +2414,19 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 6); - if (s1.toLowerCase() === peg$c65) { + if (s1.toLowerCase() === peg$c66) { peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e68); } + if (peg$silentFails === 0) { peg$fail(peg$e69); } } if (s1 === peg$FAILED) { s1 = input.substr(peg$currPos, 5); - if (s1.toLowerCase() === peg$c66) { + if (s1.toLowerCase() === peg$c67) { peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e69); } + if (peg$silentFails === 0) { peg$fail(peg$e70); } } } if (s1 !== peg$FAILED) { @@ -2416,7 +2442,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f55(); + s0 = peg$f56(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2434,11 +2460,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c67) { + if (s1.toLowerCase() === peg$c68) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e70); } + if (peg$silentFails === 0) { peg$fail(peg$e71); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2453,7 +2479,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f56(); + s0 = peg$f57(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2471,11 +2497,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 3); - if (s1.toLowerCase() === peg$c68) { + if (s1.toLowerCase() === peg$c69) { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e71); } + if (peg$silentFails === 0) { peg$fail(peg$e72); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2490,7 +2516,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f57(); + s0 = peg$f58(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2527,7 +2553,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f58(); + s0 = peg$f59(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2545,11 +2571,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c69) { + if (s1.toLowerCase() === peg$c70) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e72); } + if (peg$silentFails === 0) { peg$fail(peg$e73); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2564,7 +2590,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f59(); + s0 = peg$f60(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2601,7 +2627,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f60(); + s0 = peg$f61(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2619,11 +2645,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 12); - if (s1.toLowerCase() === peg$c70) { + if (s1.toLowerCase() === peg$c71) { peg$currPos += 12; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e73); } + if (peg$silentFails === 0) { peg$fail(peg$e74); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2638,7 +2664,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f61(); + s0 = peg$f62(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2656,11 +2682,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c71) { + if (s1.toLowerCase() === peg$c72) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e74); } + if (peg$silentFails === 0) { peg$fail(peg$e75); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2675,7 +2701,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f62(); + s0 = peg$f63(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2712,7 +2738,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f63(); + s0 = peg$f64(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2730,11 +2756,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c72) { + if (s1.toLowerCase() === peg$c73) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e75); } + if (peg$silentFails === 0) { peg$fail(peg$e76); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2749,7 +2775,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f64(); + s0 = peg$f65(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2767,11 +2793,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c73) { + if (s1.toLowerCase() === peg$c74) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e76); } + if (peg$silentFails === 0) { peg$fail(peg$e77); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2786,7 +2812,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f65(); + s0 = peg$f66(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2804,11 +2830,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c74) { + if (s1.toLowerCase() === peg$c75) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e77); } + if (peg$silentFails === 0) { peg$fail(peg$e78); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2823,7 +2849,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(); + s0 = peg$f67(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2841,11 +2867,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 22); - if (s1.toLowerCase() === peg$c75) { + if (s1.toLowerCase() === peg$c76) { peg$currPos += 22; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e78); } + if (peg$silentFails === 0) { peg$fail(peg$e79); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2860,7 +2886,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(); + s0 = peg$f68(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2878,11 +2904,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c76) { + if (s1.toLowerCase() === peg$c77) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2897,7 +2923,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f68(); + s0 = peg$f69(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2915,11 +2941,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c77) { + if (s1.toLowerCase() === peg$c78) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2934,7 +2960,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f69(); + s0 = peg$f70(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2952,11 +2978,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c78) { + if (s1.toLowerCase() === peg$c79) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2971,7 +2997,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f70(); + s0 = peg$f71(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2989,11 +3015,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c79) { + if (s1.toLowerCase() === peg$c80) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3008,7 +3034,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f71(); + s0 = peg$f72(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3026,11 +3052,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c80) { + if (s1.toLowerCase() === peg$c81) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e83); } + if (peg$silentFails === 0) { peg$fail(peg$e84); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3045,7 +3071,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f72(); + s0 = peg$f73(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3063,11 +3089,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c81) { + if (s1.toLowerCase() === peg$c82) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3082,7 +3108,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f73(); + s0 = peg$f74(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3100,11 +3126,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c82) { + if (s1.toLowerCase() === peg$c83) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e85); } + if (peg$silentFails === 0) { peg$fail(peg$e86); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3119,7 +3145,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f74(); + s0 = peg$f75(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3137,11 +3163,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 19); - if (s1.toLowerCase() === peg$c83) { + if (s1.toLowerCase() === peg$c84) { peg$currPos += 19; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e86); } + if (peg$silentFails === 0) { peg$fail(peg$e87); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3156,7 +3182,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f75(); + s0 = peg$f76(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3174,11 +3200,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c84) { + if (s1.toLowerCase() === peg$c85) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3193,7 +3219,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f76(); + s0 = peg$f77(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3216,81 +3242,81 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e89); } + if (peg$silentFails === 0) { peg$fail(peg$e90); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f77(); + s1 = peg$f78(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c85) { - s1 = peg$c85; + if (input.substr(peg$currPos, 2) === peg$c86) { + s1 = peg$c86; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e90); } + if (peg$silentFails === 0) { peg$fail(peg$e91); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f78(); + s1 = peg$f79(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c86) { - s1 = peg$c86; + if (input.substr(peg$currPos, 2) === peg$c87) { + s1 = peg$c87; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e91); } + if (peg$silentFails === 0) { peg$fail(peg$e92); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f79(); + s1 = peg$f80(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c87; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f80(); + s1 = peg$f81(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c88) { - s1 = peg$c88; + if (input.substr(peg$currPos, 2) === peg$c89) { + s1 = peg$c89; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f81(); + s1 = peg$f82(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c89; + s1 = peg$c90; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e94); } + if (peg$silentFails === 0) { peg$fail(peg$e95); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f82(); + s1 = peg$f83(); } s0 = s1; } @@ -3301,7 +3327,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } return s0; @@ -3314,7 +3340,7 @@ function peg$parse(input, options) { s1 = peg$parseoperator(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f83(s1); + s1 = peg$f84(s1); } s0 = s1; @@ -3332,7 +3358,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { @@ -3342,7 +3368,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } } } else { @@ -3350,13 +3376,13 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f84(s1); + s1 = peg$f85(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e95); } + if (peg$silentFails === 0) { peg$fail(peg$e96); } } return s0; @@ -3368,7 +3394,7 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); peg$savedPos = s0; - s1 = peg$f85(); + s1 = peg$f86(); s0 = s1; return s0; @@ -3384,7 +3410,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } while (s1 !== peg$FAILED) { s0.push(s1); @@ -3393,12 +3419,12 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } } peg$silentFails--; s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e97); } + if (peg$silentFails === 0) { peg$fail(peg$e98); } return s0; } @@ -3408,7 +3434,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f86(); + s1 = peg$f87(); if (s1) { s1 = undefined; } else { @@ -3445,7 +3471,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3454,7 +3480,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } } s2 = input.charAt(peg$currPos); @@ -3462,7 +3488,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3471,7 +3497,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -3480,7 +3506,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } } s4 = input.charAt(peg$currPos); @@ -3488,7 +3514,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s4 !== peg$FAILED) { s5 = []; @@ -3497,7 +3523,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } while (s6 !== peg$FAILED) { s5.push(s6); @@ -3506,11 +3532,11 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } } peg$savedPos = s0; - s0 = peg$f87(s1, s3, s5); + s0 = peg$f88(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3522,7 +3548,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e99); } + if (peg$silentFails === 0) { peg$fail(peg$e100); } } return s0; @@ -3539,7 +3565,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3548,7 +3574,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } } s2 = input.charAt(peg$currPos); @@ -3556,7 +3582,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3565,7 +3591,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3581,15 +3607,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c90; + s6 = peg$c91; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f88(s1); + s4 = peg$f89(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3612,15 +3638,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c91; + s6 = peg$c92; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f89(s1); + s4 = peg$f90(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3643,15 +3669,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c92; + s6 = peg$c93; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f90(s1); + s4 = peg$f91(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3670,7 +3696,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3686,15 +3712,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c90; + s6 = peg$c91; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f88(s1); + s4 = peg$f89(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3717,15 +3743,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c91; + s6 = peg$c92; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f89(s1); + s4 = peg$f90(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3748,15 +3774,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c92; + s6 = peg$c93; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f90(s1); + s4 = peg$f91(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3772,7 +3798,7 @@ function peg$parse(input, options) { s4 = peg$parseclosingQuote(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f91(s1, s3, s4); + s0 = peg$f92(s1, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3784,7 +3810,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e99); } + if (peg$silentFails === 0) { peg$fail(peg$e100); } } return s0; @@ -3799,7 +3825,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3837,7 +3863,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3846,7 +3872,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } } s2 = []; @@ -3855,7 +3881,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } while (s3 !== peg$FAILED) { s2.push(s3); @@ -3864,7 +3890,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } } s3 = []; @@ -3873,7 +3899,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -3882,7 +3908,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } } s4 = peg$parseoperator(); @@ -3901,7 +3927,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3910,7 +3936,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } } s2 = peg$currPos; @@ -3957,7 +3983,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } } } @@ -3973,7 +3999,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -4002,7 +4028,7 @@ function peg$parse(input, options) { // List fields where you cannot prefix it with "-" to negate it const nonNegatableKeys = new Set([ - "type", "keyword", "groupCurrency", "groupBy", "columns" + "type", "keyword", "groupCurrency", "groupBy", "columns", "limit" ]); diff --git a/src/libs/SearchParser/autocompleteParser.peggy b/src/libs/SearchParser/autocompleteParser.peggy index cda2b7c8c8882..4a6aee643960d 100644 --- a/src/libs/SearchParser/autocompleteParser.peggy +++ b/src/libs/SearchParser/autocompleteParser.peggy @@ -23,7 +23,7 @@ // List fields where you cannot prefix it with "-" to negate it const nonNegatableKeys = new Set([ - "type", "keyword", "groupCurrency", "groupBy", "columns" + "type", "keyword", "groupCurrency", "groupBy", "columns", "limit" ]); } @@ -119,6 +119,7 @@ autocompleteKey "key" / title / reportFieldDynamic / columns + / limit ) filterKey diff --git a/src/libs/SearchParser/baseRules.peggy b/src/libs/SearchParser/baseRules.peggy index a87eb26ae0912..9a45ae86831f2 100644 --- a/src/libs/SearchParser/baseRules.peggy +++ b/src/libs/SearchParser/baseRules.peggy @@ -69,6 +69,7 @@ exported = "exported"i { return "exported"; } posted = "posted"i { return "posted"; } withdrawn = "withdrawn"i { return "withdrawn"; } groupBy = "groupBy"i / "group-by"i { return "groupBy"; } +limit = "limit"i { return "limit"; } feed = "feed"i { return "feed"; } title = "title"i { return "title"; } assignee = "assignee"i { return "assignee"; } diff --git a/src/libs/SearchParser/searchParser.js b/src/libs/SearchParser/searchParser.js index c479f45c928c3..70ba1be546948 100644 --- a/src/libs/SearchParser/searchParser.js +++ b/src/libs/SearchParser/searchParser.js @@ -234,49 +234,50 @@ function peg$parse(input, options) { var peg$c47 = "withdrawn"; var peg$c48 = "groupby"; var peg$c49 = "group-by"; - var peg$c50 = "feed"; - var peg$c51 = "title"; - var peg$c52 = "assignee"; - var peg$c53 = "createdby"; - var peg$c54 = "created-by"; - var peg$c55 = "action"; - var peg$c56 = "total"; - var peg$c57 = "has"; - var peg$c58 = "is"; - var peg$c59 = "purchaseamount"; - var peg$c60 = "purchase-amount"; - var peg$c61 = "purchasecurrency"; - var peg$c62 = "purchase-currency"; - var peg$c63 = "columns"; - var peg$c64 = "per-diem"; - var peg$c65 = "drafts"; - var peg$c66 = "draft"; - var peg$c67 = "original-amount"; - var peg$c68 = "tax"; - var peg$c69 = "policy-name"; - var peg$c70 = "bank-account"; - var peg$c71 = "long-report-id"; - var peg$c72 = "exported-to"; - var peg$c73 = "exchange-rate"; - var peg$c74 = "reimbursable-total"; - var peg$c75 = "non-reimbursable-total"; - var peg$c76 = "group-from"; - var peg$c77 = "group-expenses"; - var peg$c78 = "group-total"; - var peg$c79 = "group-card"; - var peg$c80 = "group-feed"; - var peg$c81 = "group-bank-account"; - var peg$c82 = "group-withdrawn"; - var peg$c83 = "group-withdrawal-id"; - var peg$c84 = "group-category"; - var peg$c85 = "!="; - var peg$c86 = ">="; - var peg$c87 = ">"; - var peg$c88 = "<="; - var peg$c89 = "<"; - var peg$c90 = "\u201C"; - var peg$c91 = "\u201D"; - var peg$c92 = "\""; + var peg$c50 = "limit"; + var peg$c51 = "feed"; + var peg$c52 = "title"; + var peg$c53 = "assignee"; + var peg$c54 = "createdby"; + var peg$c55 = "created-by"; + var peg$c56 = "action"; + var peg$c57 = "total"; + var peg$c58 = "has"; + var peg$c59 = "is"; + var peg$c60 = "purchaseamount"; + var peg$c61 = "purchase-amount"; + var peg$c62 = "purchasecurrency"; + var peg$c63 = "purchase-currency"; + var peg$c64 = "columns"; + var peg$c65 = "per-diem"; + var peg$c66 = "drafts"; + var peg$c67 = "draft"; + var peg$c68 = "original-amount"; + var peg$c69 = "tax"; + var peg$c70 = "policy-name"; + var peg$c71 = "bank-account"; + var peg$c72 = "long-report-id"; + var peg$c73 = "exported-to"; + var peg$c74 = "exchange-rate"; + var peg$c75 = "reimbursable-total"; + var peg$c76 = "non-reimbursable-total"; + var peg$c77 = "group-from"; + var peg$c78 = "group-expenses"; + var peg$c79 = "group-total"; + var peg$c80 = "group-card"; + var peg$c81 = "group-feed"; + var peg$c82 = "group-bank-account"; + var peg$c83 = "group-withdrawn"; + var peg$c84 = "group-withdrawal-id"; + var peg$c85 = "group-category"; + var peg$c86 = "!="; + var peg$c87 = ">="; + var peg$c88 = ">"; + var peg$c89 = "<="; + var peg$c90 = "<"; + var peg$c91 = "\u201C"; + var peg$c92 = "\u201D"; + var peg$c93 = "\""; var peg$r0 = /^[^ \t\r\n\xA0]/; var peg$r1 = /^[ \t\r\n\xA0,:=<>!]/; @@ -348,65 +349,66 @@ function peg$parse(input, options) { var peg$e52 = peg$literalExpectation("withdrawn", true); var peg$e53 = peg$literalExpectation("groupBy", true); var peg$e54 = peg$literalExpectation("group-by", true); - var peg$e55 = peg$literalExpectation("feed", true); - var peg$e56 = peg$literalExpectation("title", true); - var peg$e57 = peg$literalExpectation("assignee", true); - var peg$e58 = peg$literalExpectation("createdBy", true); - var peg$e59 = peg$literalExpectation("created-by", true); - var peg$e60 = peg$literalExpectation("action", true); - var peg$e61 = peg$literalExpectation("total", true); - var peg$e62 = peg$literalExpectation("has", true); - var peg$e63 = peg$literalExpectation("is", true); - var peg$e64 = peg$literalExpectation("purchaseAmount", true); - var peg$e65 = peg$literalExpectation("purchase-amount", true); - var peg$e66 = peg$literalExpectation("purchaseCurrency", true); - var peg$e67 = peg$literalExpectation("purchase-currency", true); - var peg$e68 = peg$literalExpectation("columns", true); - var peg$e69 = peg$literalExpectation("per-diem", true); - var peg$e70 = peg$literalExpectation("drafts", true); - var peg$e71 = peg$literalExpectation("draft", true); - var peg$e72 = peg$literalExpectation("original-amount", true); - var peg$e73 = peg$literalExpectation("tax", true); - var peg$e74 = peg$literalExpectation("policy-name", true); - var peg$e75 = peg$literalExpectation("bank-account", true); - var peg$e76 = peg$literalExpectation("long-report-id", true); - var peg$e77 = peg$literalExpectation("exported-to", true); - var peg$e78 = peg$literalExpectation("exchange-rate", true); - var peg$e79 = peg$literalExpectation("reimbursable-total", true); - var peg$e80 = peg$literalExpectation("non-reimbursable-total", true); - var peg$e81 = peg$literalExpectation("group-from", true); - var peg$e82 = peg$literalExpectation("group-expenses", true); - var peg$e83 = peg$literalExpectation("group-total", true); - var peg$e84 = peg$literalExpectation("group-card", true); - var peg$e85 = peg$literalExpectation("group-feed", true); - var peg$e86 = peg$literalExpectation("group-bank-account", true); - var peg$e87 = peg$literalExpectation("group-withdrawn", true); - var peg$e88 = peg$literalExpectation("group-withdrawal-id", true); - var peg$e89 = peg$literalExpectation("group-category", true); - var peg$e90 = peg$otherExpectation("operator"); - var peg$e91 = peg$classExpectation([":", "="], false, false); - var peg$e92 = peg$literalExpectation("!=", false); - var peg$e93 = peg$literalExpectation(">=", false); - var peg$e94 = peg$literalExpectation(">", false); - var peg$e95 = peg$literalExpectation("<=", false); - var peg$e96 = peg$literalExpectation("<", false); - var peg$e97 = peg$otherExpectation("word"); - var peg$e98 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e99 = peg$otherExpectation("whitespace"); - var peg$e100 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); - var peg$e101 = peg$otherExpectation("quote"); - var peg$e102 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e103 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); - var peg$e104 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); - var peg$e105 = peg$literalExpectation("\u201C", false); - var peg$e106 = peg$literalExpectation("\u201D", false); - var peg$e107 = peg$literalExpectation("\"", false); - var peg$e108 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e109 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e110 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); - var peg$e111 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); - var peg$e112 = peg$classExpectation([","], false, false); - var peg$e113 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); + var peg$e55 = peg$literalExpectation("limit", true); + var peg$e56 = peg$literalExpectation("feed", true); + var peg$e57 = peg$literalExpectation("title", true); + var peg$e58 = peg$literalExpectation("assignee", true); + var peg$e59 = peg$literalExpectation("createdBy", true); + var peg$e60 = peg$literalExpectation("created-by", true); + var peg$e61 = peg$literalExpectation("action", true); + var peg$e62 = peg$literalExpectation("total", true); + var peg$e63 = peg$literalExpectation("has", true); + var peg$e64 = peg$literalExpectation("is", true); + var peg$e65 = peg$literalExpectation("purchaseAmount", true); + var peg$e66 = peg$literalExpectation("purchase-amount", true); + var peg$e67 = peg$literalExpectation("purchaseCurrency", true); + var peg$e68 = peg$literalExpectation("purchase-currency", true); + var peg$e69 = peg$literalExpectation("columns", true); + var peg$e70 = peg$literalExpectation("per-diem", true); + var peg$e71 = peg$literalExpectation("drafts", true); + var peg$e72 = peg$literalExpectation("draft", true); + var peg$e73 = peg$literalExpectation("original-amount", true); + var peg$e74 = peg$literalExpectation("tax", true); + var peg$e75 = peg$literalExpectation("policy-name", true); + var peg$e76 = peg$literalExpectation("bank-account", true); + var peg$e77 = peg$literalExpectation("long-report-id", true); + var peg$e78 = peg$literalExpectation("exported-to", true); + var peg$e79 = peg$literalExpectation("exchange-rate", true); + var peg$e80 = peg$literalExpectation("reimbursable-total", true); + var peg$e81 = peg$literalExpectation("non-reimbursable-total", true); + var peg$e82 = peg$literalExpectation("group-from", true); + var peg$e83 = peg$literalExpectation("group-expenses", true); + var peg$e84 = peg$literalExpectation("group-total", true); + var peg$e85 = peg$literalExpectation("group-card", true); + var peg$e86 = peg$literalExpectation("group-feed", true); + var peg$e87 = peg$literalExpectation("group-bank-account", true); + var peg$e88 = peg$literalExpectation("group-withdrawn", true); + var peg$e89 = peg$literalExpectation("group-withdrawal-id", true); + var peg$e90 = peg$literalExpectation("group-category", true); + var peg$e91 = peg$otherExpectation("operator"); + var peg$e92 = peg$classExpectation([":", "="], false, false); + var peg$e93 = peg$literalExpectation("!=", false); + var peg$e94 = peg$literalExpectation(">=", false); + var peg$e95 = peg$literalExpectation(">", false); + var peg$e96 = peg$literalExpectation("<=", false); + var peg$e97 = peg$literalExpectation("<", false); + var peg$e98 = peg$otherExpectation("word"); + var peg$e99 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e100 = peg$otherExpectation("whitespace"); + var peg$e101 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$e102 = peg$otherExpectation("quote"); + var peg$e103 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e104 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); + var peg$e105 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); + var peg$e106 = peg$literalExpectation("\u201C", false); + var peg$e107 = peg$literalExpectation("\u201D", false); + var peg$e108 = peg$literalExpectation("\"", false); + var peg$e109 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e110 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e111 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); + var peg$e112 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); + var peg$e113 = peg$classExpectation([","], false, false); + var peg$e114 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); var peg$f0 = function(filters) { return applyDefaults(filters); }; var peg$f1 = function(head, tail) { @@ -528,70 +530,71 @@ function peg$parse(input, options) { var peg$f40 = function() { return "posted"; }; var peg$f41 = function() { return "withdrawn"; }; var peg$f42 = function() { return "groupBy"; }; - var peg$f43 = function() { return "feed"; }; - var peg$f44 = function() { return "title"; }; - var peg$f45 = function() { return "assignee"; }; - var peg$f46 = function() { return "createdBy"; }; - var peg$f47 = function() { return "action"; }; - var peg$f48 = function() {return "total"; }; - var peg$f49 = function() {return "has"; }; - var peg$f50 = function() {return "is"; }; - var peg$f51 = function() {return "purchaseAmount"}; - var peg$f52 = function() {return "purchaseCurrency"}; - var peg$f53 = function() { + var peg$f43 = function() { return "limit"; }; + var peg$f44 = function() { return "feed"; }; + var peg$f45 = function() { return "title"; }; + var peg$f46 = function() { return "assignee"; }; + var peg$f47 = function() { return "createdBy"; }; + var peg$f48 = function() { return "action"; }; + var peg$f49 = function() {return "total"; }; + var peg$f50 = function() {return "has"; }; + var peg$f51 = function() {return "is"; }; + var peg$f52 = function() {return "purchaseAmount"}; + var peg$f53 = function() {return "purchaseCurrency"}; + var peg$f54 = function() { isColumnsContext = true; return "columns"; }; - var peg$f54 = function() { return isColumnsContext; }; - var peg$f55 = function() { return "perDiem"; }; - var peg$f56 = function() { return "drafts"; }; - var peg$f57 = function() { return "originalamount"; }; - var peg$f58 = function() { return "taxAmount"; }; - var peg$f59 = function() { return "taxrate"; }; - var peg$f60 = function() { return "policyname"; }; - var peg$f61 = function() { return "withdrawalID"; }; - var peg$f62 = function() { return "bankAccount"; }; - var peg$f63 = function() { return "reportID"; }; - var peg$f64 = function() { return "base62ReportID"; }; - var peg$f65 = function() { return "exportedto"; }; - var peg$f66 = function() { return "exchangeRate"; }; - var peg$f67 = function() { return "reimbursableTotal"; }; - var peg$f68 = function() { return "nonReimbursableTotal"; }; - var peg$f69 = function() { return "groupFrom"; }; - var peg$f70 = function() { return "groupExpenses"; }; - var peg$f71 = function() { return "groupTotal"; }; - var peg$f72 = function() { return "groupCard"; }; - var peg$f73 = function() { return "groupFeed"; }; - var peg$f74 = function() { return "groupBankAccount"; }; - var peg$f75 = function() { return "groupWithdrawn"; }; - var peg$f76 = function() { return "groupWithdrawalID"; }; - var peg$f77 = function() { return "groupCategory"; }; - var peg$f78 = function() { return "eq"; }; - var peg$f79 = function() { return "neq"; }; - var peg$f80 = function() { return "gte"; }; - var peg$f81 = function() { return "gt"; }; - var peg$f82 = function() { return "lte"; }; - var peg$f83 = function() { return "lt"; }; - var peg$f84 = function(o) { + var peg$f55 = function() { return isColumnsContext; }; + var peg$f56 = function() { return "perDiem"; }; + var peg$f57 = function() { return "drafts"; }; + var peg$f58 = function() { return "originalamount"; }; + var peg$f59 = function() { return "taxAmount"; }; + var peg$f60 = function() { return "taxrate"; }; + var peg$f61 = function() { return "policyname"; }; + var peg$f62 = function() { return "withdrawalID"; }; + var peg$f63 = function() { return "bankAccount"; }; + var peg$f64 = function() { return "reportID"; }; + var peg$f65 = function() { return "base62ReportID"; }; + var peg$f66 = function() { return "exportedto"; }; + var peg$f67 = function() { return "exchangeRate"; }; + var peg$f68 = function() { return "reimbursableTotal"; }; + var peg$f69 = function() { return "nonReimbursableTotal"; }; + var peg$f70 = function() { return "groupFrom"; }; + var peg$f71 = function() { return "groupExpenses"; }; + var peg$f72 = function() { return "groupTotal"; }; + var peg$f73 = function() { return "groupCard"; }; + var peg$f74 = function() { return "groupFeed"; }; + var peg$f75 = function() { return "groupBankAccount"; }; + var peg$f76 = function() { return "groupWithdrawn"; }; + var peg$f77 = function() { return "groupWithdrawalID"; }; + var peg$f78 = function() { return "groupCategory"; }; + var peg$f79 = function() { return "eq"; }; + var peg$f80 = function() { return "neq"; }; + var peg$f81 = function() { return "gte"; }; + var peg$f82 = function() { return "gt"; }; + var peg$f83 = function() { return "lte"; }; + var peg$f84 = function() { return "lt"; }; + var peg$f85 = function(o) { if (nameOperator) { expectingNestedQuote = (o === "eq"); // Use simple parser if no valid operator is found } isColumnsContext = false; return o; }; - var peg$f85 = function(chars) { return chars.join("").trim(); }; - var peg$f86 = function() { + var peg$f86 = function(chars) { return chars.join("").trim(); }; + var peg$f87 = function() { isColumnsContext = false; return "and"; }; - var peg$f87 = function() { return expectingNestedQuote; }; - var peg$f88 = function(start, inner, end) { //handle no-breaking space + var peg$f88 = function() { return expectingNestedQuote; }; + var peg$f89 = function(start, inner, end) { //handle no-breaking space return [...start, '"', ...inner, '"', ...end].join(""); }; - var peg$f89 = function(start) {return "“"}; - var peg$f90 = function(start) {return "”"}; - var peg$f91 = function(start) {return "\""}; - var peg$f92 = function(start, inner, end) { + var peg$f90 = function(start) {return "“"}; + var peg$f91 = function(start) {return "”"}; + var peg$f92 = function(start) {return "\""}; + var peg$f93 = function(start, inner, end) { return [...start, '"', ...inner, '"'].join(""); }; var peg$currPos = options.peg$currPos | 0; @@ -1238,6 +1241,9 @@ function peg$parse(input, options) { s1 = peg$parsegroupBy(); if (s1 === peg$FAILED) { s1 = peg$parsecolumns(); + if (s1 === peg$FAILED) { + s1 = peg$parselimit(); + } } } } @@ -2181,13 +2187,13 @@ function peg$parse(input, options) { return s0; } - function peg$parsefeed() { + function peg$parselimit() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 4); + s1 = input.substr(peg$currPos, 5); if (s1.toLowerCase() === peg$c50) { - peg$currPos += 4; + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e55); } @@ -2201,13 +2207,13 @@ function peg$parse(input, options) { return s0; } - function peg$parsetitle() { + function peg$parsefeed() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 5); + s1 = input.substr(peg$currPos, 4); if (s1.toLowerCase() === peg$c51) { - peg$currPos += 5; + peg$currPos += 4; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e56); } @@ -2221,13 +2227,13 @@ function peg$parse(input, options) { return s0; } - function peg$parseassignee() { + function peg$parsetitle() { var s0, s1; s0 = peg$currPos; - s1 = input.substr(peg$currPos, 8); + s1 = input.substr(peg$currPos, 5); if (s1.toLowerCase() === peg$c52) { - peg$currPos += 8; + peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e57); } @@ -2241,28 +2247,48 @@ function peg$parse(input, options) { return s0; } + function peg$parseassignee() { + var s0, s1; + + s0 = peg$currPos; + s1 = input.substr(peg$currPos, 8); + if (s1.toLowerCase() === peg$c53) { + peg$currPos += 8; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e58); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$f46(); + } + s0 = s1; + + return s0; + } + function peg$parsecreatedBy() { var s0, s1; s0 = input.substr(peg$currPos, 9); - if (s0.toLowerCase() === peg$c53) { + if (s0.toLowerCase() === peg$c54) { peg$currPos += 9; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e58); } + if (peg$silentFails === 0) { peg$fail(peg$e59); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c54) { + if (s1.toLowerCase() === peg$c55) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e59); } + if (peg$silentFails === 0) { peg$fail(peg$e60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f46(); + s1 = peg$f47(); } s0 = s1; } @@ -2275,15 +2301,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 6); - if (s1.toLowerCase() === peg$c55) { + if (s1.toLowerCase() === peg$c56) { peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e60); } + if (peg$silentFails === 0) { peg$fail(peg$e61); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f47(); + s1 = peg$f48(); } s0 = s1; @@ -2295,15 +2321,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 5); - if (s1.toLowerCase() === peg$c56) { + if (s1.toLowerCase() === peg$c57) { peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e61); } + if (peg$silentFails === 0) { peg$fail(peg$e62); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f48(); + s1 = peg$f49(); } s0 = s1; @@ -2315,15 +2341,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 3); - if (s1.toLowerCase() === peg$c57) { + if (s1.toLowerCase() === peg$c58) { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e62); } + if (peg$silentFails === 0) { peg$fail(peg$e63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f49(); + s1 = peg$f50(); } s0 = s1; @@ -2335,15 +2361,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 2); - if (s1.toLowerCase() === peg$c58) { + if (s1.toLowerCase() === peg$c59) { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e63); } + if (peg$silentFails === 0) { peg$fail(peg$e64); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f50(); + s1 = peg$f51(); } s0 = s1; @@ -2354,24 +2380,24 @@ function peg$parse(input, options) { var s0, s1; s0 = input.substr(peg$currPos, 14); - if (s0.toLowerCase() === peg$c59) { + if (s0.toLowerCase() === peg$c60) { peg$currPos += 14; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e64); } + if (peg$silentFails === 0) { peg$fail(peg$e65); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c60) { + if (s1.toLowerCase() === peg$c61) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e65); } + if (peg$silentFails === 0) { peg$fail(peg$e66); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f51(); + s1 = peg$f52(); } s0 = s1; } @@ -2383,24 +2409,24 @@ function peg$parse(input, options) { var s0, s1; s0 = input.substr(peg$currPos, 16); - if (s0.toLowerCase() === peg$c61) { + if (s0.toLowerCase() === peg$c62) { peg$currPos += 16; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e66); } + if (peg$silentFails === 0) { peg$fail(peg$e67); } } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 17); - if (s1.toLowerCase() === peg$c62) { + if (s1.toLowerCase() === peg$c63) { peg$currPos += 17; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e67); } + if (peg$silentFails === 0) { peg$fail(peg$e68); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f52(); + s1 = peg$f53(); } s0 = s1; } @@ -2413,15 +2439,15 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 7); - if (s1.toLowerCase() === peg$c63) { + if (s1.toLowerCase() === peg$c64) { peg$currPos += 7; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e68); } + if (peg$silentFails === 0) { peg$fail(peg$e69); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f53(); + s1 = peg$f54(); } s0 = s1; @@ -2433,7 +2459,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f54(); + s1 = peg$f55(); if (s1) { s1 = undefined; } else { @@ -2535,11 +2561,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 8); - if (s1.toLowerCase() === peg$c64) { + if (s1.toLowerCase() === peg$c65) { peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e69); } + if (peg$silentFails === 0) { peg$fail(peg$e70); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2554,7 +2580,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f55(); + s0 = peg$f56(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2572,19 +2598,19 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 6); - if (s1.toLowerCase() === peg$c65) { + if (s1.toLowerCase() === peg$c66) { peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e70); } + if (peg$silentFails === 0) { peg$fail(peg$e71); } } if (s1 === peg$FAILED) { s1 = input.substr(peg$currPos, 5); - if (s1.toLowerCase() === peg$c66) { + if (s1.toLowerCase() === peg$c67) { peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e71); } + if (peg$silentFails === 0) { peg$fail(peg$e72); } } } if (s1 !== peg$FAILED) { @@ -2600,7 +2626,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f56(); + s0 = peg$f57(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2618,11 +2644,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c67) { + if (s1.toLowerCase() === peg$c68) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e72); } + if (peg$silentFails === 0) { peg$fail(peg$e73); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2637,7 +2663,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f57(); + s0 = peg$f58(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2655,11 +2681,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 3); - if (s1.toLowerCase() === peg$c68) { + if (s1.toLowerCase() === peg$c69) { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e73); } + if (peg$silentFails === 0) { peg$fail(peg$e74); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2674,7 +2700,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f58(); + s0 = peg$f59(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2711,7 +2737,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f59(); + s0 = peg$f60(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2729,11 +2755,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c69) { + if (s1.toLowerCase() === peg$c70) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e74); } + if (peg$silentFails === 0) { peg$fail(peg$e75); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2748,7 +2774,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f60(); + s0 = peg$f61(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2785,7 +2811,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f61(); + s0 = peg$f62(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2803,11 +2829,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 12); - if (s1.toLowerCase() === peg$c70) { + if (s1.toLowerCase() === peg$c71) { peg$currPos += 12; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e75); } + if (peg$silentFails === 0) { peg$fail(peg$e76); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2822,7 +2848,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f62(); + s0 = peg$f63(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2840,11 +2866,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c71) { + if (s1.toLowerCase() === peg$c72) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e76); } + if (peg$silentFails === 0) { peg$fail(peg$e77); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2859,7 +2885,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f63(); + s0 = peg$f64(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2896,7 +2922,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f64(); + s0 = peg$f65(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2914,11 +2940,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c72) { + if (s1.toLowerCase() === peg$c73) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e77); } + if (peg$silentFails === 0) { peg$fail(peg$e78); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2933,7 +2959,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f65(); + s0 = peg$f66(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2951,11 +2977,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c73) { + if (s1.toLowerCase() === peg$c74) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e78); } + if (peg$silentFails === 0) { peg$fail(peg$e79); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2970,7 +2996,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(); + s0 = peg$f67(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2988,11 +3014,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c74) { + if (s1.toLowerCase() === peg$c75) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3007,7 +3033,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(); + s0 = peg$f68(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3025,11 +3051,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 22); - if (s1.toLowerCase() === peg$c75) { + if (s1.toLowerCase() === peg$c76) { peg$currPos += 22; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3044,7 +3070,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f68(); + s0 = peg$f69(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3062,11 +3088,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c76) { + if (s1.toLowerCase() === peg$c77) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3081,7 +3107,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f69(); + s0 = peg$f70(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3099,11 +3125,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c77) { + if (s1.toLowerCase() === peg$c78) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3118,7 +3144,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f70(); + s0 = peg$f71(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3136,11 +3162,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c78) { + if (s1.toLowerCase() === peg$c79) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e83); } + if (peg$silentFails === 0) { peg$fail(peg$e84); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3155,7 +3181,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f71(); + s0 = peg$f72(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3173,11 +3199,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c79) { + if (s1.toLowerCase() === peg$c80) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3192,7 +3218,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f72(); + s0 = peg$f73(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3210,11 +3236,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c80) { + if (s1.toLowerCase() === peg$c81) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e85); } + if (peg$silentFails === 0) { peg$fail(peg$e86); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3229,7 +3255,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f73(); + s0 = peg$f74(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3247,11 +3273,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c81) { + if (s1.toLowerCase() === peg$c82) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e86); } + if (peg$silentFails === 0) { peg$fail(peg$e87); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3266,7 +3292,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f74(); + s0 = peg$f75(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3284,11 +3310,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c82) { + if (s1.toLowerCase() === peg$c83) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3303,7 +3329,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f75(); + s0 = peg$f76(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3321,11 +3347,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 19); - if (s1.toLowerCase() === peg$c83) { + if (s1.toLowerCase() === peg$c84) { peg$currPos += 19; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3340,7 +3366,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f76(); + s0 = peg$f77(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3358,11 +3384,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c84) { + if (s1.toLowerCase() === peg$c85) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e89); } + if (peg$silentFails === 0) { peg$fail(peg$e90); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3377,7 +3403,7 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f77(); + s0 = peg$f78(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3400,81 +3426,81 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e91); } + if (peg$silentFails === 0) { peg$fail(peg$e92); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f78(); + s1 = peg$f79(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c85) { - s1 = peg$c85; + if (input.substr(peg$currPos, 2) === peg$c86) { + s1 = peg$c86; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f79(); + s1 = peg$f80(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c86) { - s1 = peg$c86; + if (input.substr(peg$currPos, 2) === peg$c87) { + s1 = peg$c87; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f80(); + s1 = peg$f81(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c87; + s1 = peg$c88; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e94); } + if (peg$silentFails === 0) { peg$fail(peg$e95); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f81(); + s1 = peg$f82(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c88) { - s1 = peg$c88; + if (input.substr(peg$currPos, 2) === peg$c89) { + s1 = peg$c89; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e95); } + if (peg$silentFails === 0) { peg$fail(peg$e96); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f82(); + s1 = peg$f83(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c89; + s1 = peg$c90; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f83(); + s1 = peg$f84(); } s0 = s1; } @@ -3485,7 +3511,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e90); } + if (peg$silentFails === 0) { peg$fail(peg$e91); } } return s0; @@ -3498,7 +3524,7 @@ function peg$parse(input, options) { s1 = peg$parseoperator(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f84(s1); + s1 = peg$f85(s1); } s0 = s1; @@ -3516,7 +3542,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { @@ -3526,7 +3552,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } } } else { @@ -3534,13 +3560,13 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$f85(s1); + s1 = peg$f86(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e97); } + if (peg$silentFails === 0) { peg$fail(peg$e98); } } return s0; @@ -3552,7 +3578,7 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); peg$savedPos = s0; - s1 = peg$f86(); + s1 = peg$f87(); s0 = s1; return s0; @@ -3568,7 +3594,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } while (s1 !== peg$FAILED) { s0.push(s1); @@ -3577,12 +3603,12 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } } peg$silentFails--; s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e99); } + if (peg$silentFails === 0) { peg$fail(peg$e100); } return s0; } @@ -3592,7 +3618,7 @@ function peg$parse(input, options) { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$f87(); + s1 = peg$f88(); if (s1) { s1 = undefined; } else { @@ -3629,7 +3655,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3638,7 +3664,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } } s2 = input.charAt(peg$currPos); @@ -3646,7 +3672,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3655,7 +3681,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -3664,7 +3690,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } } s4 = input.charAt(peg$currPos); @@ -3672,7 +3698,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s4 !== peg$FAILED) { s5 = []; @@ -3681,7 +3707,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } while (s6 !== peg$FAILED) { s5.push(s6); @@ -3690,11 +3716,11 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } } peg$savedPos = s0; - s0 = peg$f88(s1, s3, s5); + s0 = peg$f89(s1, s3, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3706,7 +3732,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } return s0; @@ -3723,7 +3749,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3732,7 +3758,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } } s2 = input.charAt(peg$currPos); @@ -3740,7 +3766,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3749,7 +3775,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3765,15 +3791,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c90; + s6 = peg$c91; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f89(s1); + s4 = peg$f90(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3796,15 +3822,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c91; + s6 = peg$c92; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f90(s1); + s4 = peg$f91(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3827,15 +3853,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c92; + s6 = peg$c93; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f91(s1); + s4 = peg$f92(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3854,7 +3880,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3870,15 +3896,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c90; + s6 = peg$c91; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f89(s1); + s4 = peg$f90(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3901,15 +3927,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c91; + s6 = peg$c92; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f90(s1); + s4 = peg$f91(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3932,15 +3958,15 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c92; + s6 = peg$c93; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; - s4 = peg$f91(s1); + s4 = peg$f92(s1); } else { peg$currPos = s4; s4 = peg$FAILED; @@ -3956,7 +3982,7 @@ function peg$parse(input, options) { s4 = peg$parseclosingQuote(); if (s4 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f92(s1, s3, s4); + s0 = peg$f93(s1, s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3968,7 +3994,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } return s0; @@ -3983,7 +4009,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -4021,7 +4047,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4030,7 +4056,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } } s2 = []; @@ -4039,7 +4065,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } while (s3 !== peg$FAILED) { s2.push(s3); @@ -4048,7 +4074,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } } s3 = []; @@ -4057,7 +4083,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -4066,7 +4092,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } } s4 = peg$parseoperator(); @@ -4085,7 +4111,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4094,7 +4120,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } } s2 = peg$currPos; @@ -4141,7 +4167,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } } } @@ -4157,7 +4183,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e113); } + if (peg$silentFails === 0) { peg$fail(peg$e114); } } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -4209,7 +4235,7 @@ function peg$parse(input, options) { // List fields where you cannot prefix it with "-" to negate it const nonNegatableKeys = new Set([ - "type", "keyword", "groupCurrency", "groupBy", "columns" + "type", "keyword", "groupCurrency", "groupBy", "columns", "limit" ]); function isDefaultSortValue(sortBy) { diff --git a/src/libs/SearchParser/searchParser.peggy b/src/libs/SearchParser/searchParser.peggy index 565593759f7f5..8b680cc865e69 100644 --- a/src/libs/SearchParser/searchParser.peggy +++ b/src/libs/SearchParser/searchParser.peggy @@ -55,7 +55,7 @@ // List fields where you cannot prefix it with "-" to negate it const nonNegatableKeys = new Set([ - "type", "keyword", "groupCurrency", "groupBy", "columns" + "type", "keyword", "groupCurrency", "groupBy", "columns", "limit" ]); function isDefaultSortValue(sortBy) { @@ -262,7 +262,7 @@ filterKey return k; } -defaultKey "default key" = @(type / status / sortBy / sortOrder / policyID / groupBy / columns) +defaultKey "default key" = @(type / status / sortBy / sortOrder / policyID / groupBy / columns / limit) identifier = (","+)? parts:(values / quotedString / alphanumeric)|1.., ","+| empty:(","+)? { diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 423ac9c35bfa3..6c030db4568a6 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -95,7 +95,9 @@ const keyToUserFriendlyMap = createKeyToUserFriendlyMap(); * @example * getUserFriendlyKey("taxRate") // returns "tax-rate" */ -function getUserFriendlyKey(keyName: SearchFilterKey | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_BY | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_ORDER): UserFriendlyKey { +function getUserFriendlyKey( + keyName: SearchFilterKey | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_BY | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_ORDER | typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT, +): UserFriendlyKey { const isReportField = keyName.startsWith(CONST.SEARCH.REPORT_FIELD.GLOBAL_PREFIX); if (isReportField) { @@ -382,6 +384,9 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.SORT_ORDER}:${query.sortOrder}`; orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.COLUMNS}:${Array.isArray(query.columns) ? query.columns.join(',') : query.columns}`; + if (query.limit !== undefined) { + orderedQuery += ` ${CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT}:${query.limit}`; + } const primaryHash = hashText(orderedQuery, 2 ** 32); return {primaryHash, recentSearchHash, similarSearchHash}; @@ -430,6 +435,18 @@ function buildSearchQueryJSON(query: SearchQueryString, rawQuery?: SearchQuerySt // Add the full input and hash to the results result.inputQuery = query; result.flatFilters = flatFilters; + + if (result.policyID && typeof result.policyID === 'string') { + // Ensure policyID is always an array for consistency + result.policyID = [result.policyID]; + } + + // Normalize limit before computing hashes to ensure invalid values don't affect hash + if (result.limit !== undefined) { + const num = Number(result.limit); + result.limit = Number.isInteger(num) && num > 0 ? num : undefined; + } + const {primaryHash, recentSearchHash, similarSearchHash} = getQueryHashes(result); result.hash = primaryHash; result.recentSearchHash = recentSearchHash; @@ -440,11 +457,6 @@ function buildSearchQueryJSON(query: SearchQueryString, rawQuery?: SearchQuerySt result.rawFilterList = getRawFilterListFromQuery(rawQuery); } - if (result.policyID && typeof result.policyID === 'string') { - // Ensure policyID is always an array for consistency - result.policyID = [result.policyID]; - } - return result; } catch (e) { console.error(`Error when parsing SearchQuery: "${query}"`, e); @@ -548,6 +560,7 @@ function getSanitizedRawFilters(queryJSON: SearchQueryJSON): RawQueryFilter[] | type BuildQueryStringOptions = { sortBy?: string; sortOrder?: string; + limit?: number; }; /** @@ -571,7 +584,7 @@ function buildQueryStringFromFilterFormValues(filterValues: Partial 0) { const segments: string[] = []; @@ -1285,6 +1310,10 @@ function buildUserReadableQueryString( title += buildFilterValuesString(getUserFriendlyKey(key), displayQueryFilters); } + if (limit !== undefined) { + title += ` limit:${limit}`; + } + if (autoCompleteWithSpace && !title.endsWith(' ')) { title += ' '; } diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 10548f81f2eb8..4aac0949d66fa 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -410,13 +410,15 @@ function search({ } const {optimisticData, finallyData, failureData} = getOnyxLoadingData(queryJSON.hash, queryJSON, offset, isOffline, true); - const {flatFilters, ...queryJSONWithoutFlatFilters} = queryJSON; + const {flatFilters, limit, ...queryJSONWithoutFlatFilters} = queryJSON; const query = { ...queryJSONWithoutFlatFilters, searchKey, offset, filters: queryJSONWithoutFlatFilters.filters ?? null, shouldCalculateTotals, + // Backend expects 'maximumResults' instead of 'limit' + ...(limit !== undefined && {maximumResults: limit}), }; const jsonQuery = JSON.stringify(query); saveLastSearchParams({ diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index 696cd36c0aa68..9873883e84d62 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -29,7 +29,15 @@ import Navigation from '@libs/Navigation/Navigation'; import {createDisplayName} from '@libs/PersonalDetailsUtils'; import {getAllTaxRates, getCleanedTagName} from '@libs/PolicyUtils'; import {computeReportName} from '@libs/ReportNameUtils'; -import {buildCannedSearchQuery, buildQueryStringFromFilterFormValues, buildSearchQueryJSON, isCannedSearchQuery, isSearchDatePreset, sortOptionsWithEmptyValue} from '@libs/SearchQueryUtils'; +import { + buildCannedSearchQuery, + buildQueryStringFromFilterFormValues, + buildSearchQueryJSON, + getCurrentSearchQueryJSON, + isCannedSearchQuery, + isSearchDatePreset, + sortOptionsWithEmptyValue, +} from '@libs/SearchQueryUtils'; import {getStatusOptions} from '@libs/SearchUIUtils'; import {getExpenseTypeTranslationKey} from '@libs/TransactionUtils'; import CONST from '@src/CONST'; @@ -183,6 +191,11 @@ const baseFilterConfig = { description: 'search.has' as const, route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.HAS), }, + limit: { + getTitle: getFilterDisplayTitle, + description: 'search.filters.limit' as const, + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_ROOT_KEYS.LIMIT), + }, is: { getTitle: getFilterDisplayTitle, description: 'search.filters.is' as const, @@ -563,7 +576,14 @@ function AdvancedSearchFilters() { const {currentType, typeFiltersKeys} = useAdvancedSearchFilters(); - const queryString = useMemo(() => buildQueryStringFromFilterFormValues(searchAdvancedFilters), [searchAdvancedFilters]); + const queryString = useMemo(() => { + const currentQueryJSON = getCurrentSearchQueryJSON(); + return buildQueryStringFromFilterFormValues(searchAdvancedFilters, { + sortBy: currentQueryJSON?.sortBy, + sortOrder: currentQueryJSON?.sortOrder, + limit: currentQueryJSON?.limit, + }); + }, [searchAdvancedFilters]); const queryJSON = useMemo(() => buildSearchQueryJSON(queryString || buildCannedSearchQuery()), [queryString]); const applyFiltersAndNavigate = () => { diff --git a/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersLimitPage.tsx b/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersLimitPage.tsx new file mode 100644 index 0000000000000..3358d0a0cbc44 --- /dev/null +++ b/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersLimitPage.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import SearchFiltersTextBase from '@components/Search/SearchFiltersTextBase'; +import CONST from '@src/CONST'; + +function SearchFiltersLimitPage() { + return ( + + ); +} + +export default SearchFiltersLimitPage; diff --git a/src/pages/Search/SearchColumnsPage.tsx b/src/pages/Search/SearchColumnsPage.tsx index 08294897c973e..b1ba25d719089 100644 --- a/src/pages/Search/SearchColumnsPage.tsx +++ b/src/pages/Search/SearchColumnsPage.tsx @@ -17,7 +17,7 @@ import useOnyx from '@hooks/useOnyx'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; -import {buildQueryStringFromFilterFormValues} from '@libs/SearchQueryUtils'; +import {buildQueryStringFromFilterFormValues, getCurrentSearchQueryJSON} from '@libs/SearchQueryUtils'; import {getCustomColumnDefault, getCustomColumns, getSearchColumnTranslationKey} from '@libs/SearchUIUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -184,7 +184,12 @@ function SearchColumnsPage() { columns: selectedColumnIds, }; - const queryString = buildQueryStringFromFilterFormValues(updatedAdvancedFilters); + const currentQueryJSON = getCurrentSearchQueryJSON(); + const queryString = buildQueryStringFromFilterFormValues(updatedAdvancedFilters, { + sortBy: currentQueryJSON?.sortBy, + sortOrder: currentQueryJSON?.sortOrder, + limit: currentQueryJSON?.limit, + }); Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: queryString}), {forceReplace: true}); }; diff --git a/src/types/form/SearchAdvancedFiltersForm.ts b/src/types/form/SearchAdvancedFiltersForm.ts index b87cc82af5633..09489573ea3dc 100644 --- a/src/types/form/SearchAdvancedFiltersForm.ts +++ b/src/types/form/SearchAdvancedFiltersForm.ts @@ -167,6 +167,7 @@ const FILTER_KEYS = { REPORT_FIELD: 'reportField', COLUMNS: 'columns', + LIMIT: 'limit', } as const; const ALLOWED_TYPE_FILTERS = { @@ -265,6 +266,7 @@ const ALLOWED_TYPE_FILTERS = { FILTER_KEYS.REPORT_FIELD, FILTER_KEYS.ATTENDEE_NOT, FILTER_KEYS.COLUMNS, + FILTER_KEYS.LIMIT, ], [CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT]: [ FILTER_KEYS.TYPE, @@ -674,6 +676,7 @@ type SearchAdvancedFiltersForm = Form< [FILTER_KEYS.IS]: string[]; [FILTER_KEYS.HAS]: string[]; [FILTER_KEYS.REPORT_FIELD]: string; + [FILTER_KEYS.LIMIT]: string; } & Record & Record & Record diff --git a/tests/unit/Search/SearchQueryUtilsTest.ts b/tests/unit/Search/SearchQueryUtilsTest.ts index 2e3b935d15f63..9156a32ddfede 100644 --- a/tests/unit/Search/SearchQueryUtilsTest.ts +++ b/tests/unit/Search/SearchQueryUtilsTest.ts @@ -268,6 +268,39 @@ describe('SearchQueryUtils', () => { expect(result).toEqual('sortBy:date sortOrder:desc type:expense withdrawn:last-month'); }); + + describe('limit option', () => { + test('includes limit in query string when provided', () => { + const filterValues: Partial = { + type: 'expense', + }; + + const result = buildQueryStringFromFilterFormValues(filterValues, {limit: 10}); + + expect(result).toEqual('sortBy:date sortOrder:desc type:expense limit:10'); + }); + + test('combines limit with sort options', () => { + const filterValues: Partial = { + type: 'expense', + merchant: 'Amazon', + }; + + const result = buildQueryStringFromFilterFormValues(filterValues, {sortBy: 'amount', sortOrder: 'asc', limit: 25}); + + expect(result).toEqual('sortBy:amount sortOrder:asc type:expense merchant:Amazon limit:25'); + }); + + test('omits limit when not provided', () => { + const filterValues: Partial = { + type: 'expense', + }; + + const result = buildQueryStringFromFilterFormValues(filterValues); + + expect(result).not.toContain('limit:'); + }); + }); }); describe('buildUserReadableQueryString', () => { @@ -354,6 +387,43 @@ describe('SearchQueryUtils', () => { expect(merchantFilter?.value).toBe('Lyft'); }); + + test('includes limit in readable query string when present', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:25'); + + if (!queryJSON) { + throw new Error('Failed to parse query string'); + } + + const result = buildUserReadableQueryString(queryJSON, undefined, emptyReports, emptyTaxRates, emptyCardList, emptyCardFeeds, emptyPolicies, currentUserAccountID); + + expect(result).toContain('limit:25'); + }); + + test('does not include limit in readable query string when not specified', () => { + const queryJSON = buildSearchQueryJSON('type:expense merchant:Test'); + + if (!queryJSON) { + throw new Error('Failed to parse query string'); + } + + const result = buildUserReadableQueryString(queryJSON, undefined, emptyReports, emptyTaxRates, emptyCardList, emptyCardFeeds, emptyPolicies, currentUserAccountID); + + expect(result).not.toContain('limit:'); + }); + + test('includes limit with other root parameters in readable query string', () => { + const queryJSON = buildSearchQueryJSON('type:expense groupBy:category limit:50'); + + if (!queryJSON) { + throw new Error('Failed to parse query string'); + } + + const result = buildUserReadableQueryString(queryJSON, undefined, emptyReports, emptyTaxRates, emptyCardList, emptyCardFeeds, emptyPolicies, currentUserAccountID); + + expect(result).toContain('limit:50'); + expect(result).toContain('group-by:category'); + }); }); describe('buildFilterFormValuesFromQuery', () => { @@ -559,6 +629,142 @@ describe('SearchQueryUtils', () => { expect(queryJSONa?.similarSearchHash).not.toEqual(queryJSONb?.similarSearchHash); }); + + describe('limit filter hashing', () => { + it('should return same similarSearchHash for queries with different limit values', () => { + const queryJSONa = buildSearchQueryJSON('type:expense limit:10'); + const queryJSONb = buildSearchQueryJSON('type:expense limit:50'); + + expect(queryJSONa?.similarSearchHash).toEqual(queryJSONb?.similarSearchHash); + }); + + it('should return different primaryHash for queries with different limit values', () => { + const queryJSONa = buildSearchQueryJSON('type:expense limit:10'); + const queryJSONb = buildSearchQueryJSON('type:expense limit:50'); + + expect(queryJSONa?.hash).not.toEqual(queryJSONb?.hash); + }); + + it('should return same primaryHash for queries without limit (hash stability)', () => { + const queryJSONa = buildSearchQueryJSON('type:expense'); + const queryJSONb = buildSearchQueryJSON('type:expense'); + + expect(queryJSONa?.hash).toEqual(queryJSONb?.hash); + }); + + it('should return different primaryHash for query with valid limit vs without limit', () => { + const withoutLimit = buildSearchQueryJSON('type:expense'); + const withLimit = buildSearchQueryJSON('type:expense limit:10'); + + expect(withoutLimit?.hash).not.toEqual(withLimit?.hash); + }); + + it('should return same primaryHash for same limit value queried twice', () => { + const queryJSONa = buildSearchQueryJSON('type:expense limit:25'); + const queryJSONb = buildSearchQueryJSON('type:expense limit:25'); + + expect(queryJSONa?.hash).toEqual(queryJSONb?.hash); + }); + + it('should not include limit in hash when limit is not in query string', () => { + const queryJSON = buildSearchQueryJSON('type:expense merchant:test'); + + expect(queryJSON?.limit).toBeUndefined(); + expect(queryJSON?.hash).toBeDefined(); + }); + + it('should return same primaryHash for invalid limit as no limit (normalization before hashing)', () => { + const withoutLimit = buildSearchQueryJSON('type:expense'); + const withZeroLimit = buildSearchQueryJSON('type:expense limit:0'); + const withNegativeLimit = buildSearchQueryJSON('type:expense limit:-5'); + const withDecimalLimit = buildSearchQueryJSON('type:expense limit:10.5'); + + // All invalid limits should normalize to undefined and produce same hash as no limit + expect(withZeroLimit?.hash).toEqual(withoutLimit?.hash); + expect(withNegativeLimit?.hash).toEqual(withoutLimit?.hash); + expect(withDecimalLimit?.hash).toEqual(withoutLimit?.hash); + }); + }); + }); + + describe('limit filter parsing', () => { + it('parses limit value as a number', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:25'); + + expect(queryJSON?.limit).toBe(25); + expect(typeof queryJSON?.limit).toBe('number'); + }); + + it('preserves limit when combined with other filters', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:100 merchant:Amazon'); + + expect(queryJSON?.limit).toBe(100); + expect(queryJSON?.type).toBe('expense'); + }); + + it('returns undefined limit when not specified in query', () => { + const queryJSON = buildSearchQueryJSON('type:expense merchant:Amazon'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('handles large limit values', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:9999'); + + expect(queryJSON?.limit).toBe(9999); + }); + + it('converts limit:0 to undefined', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:0'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('converts negative limit to undefined', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:-10'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('converts decimal limit to undefined', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:10.5'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('converts non-numeric limit to undefined', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:abc'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('converts comma-separated limit to undefined', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:10,20'); + + expect(queryJSON?.limit).toBeUndefined(); + }); + + it('uses last limit value when multiple limits specified', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:10 limit:20'); + + expect(queryJSON?.limit).toBe(20); + }); + + it('treats empty limit as keyword, not limit filter', () => { + const queryJSON = buildSearchQueryJSON('type:expense limit:'); + + expect(queryJSON?.limit).toBeUndefined(); + const keywordFilter = queryJSON?.flatFilters.find((filter) => filter.key === 'keyword'); + expect(keywordFilter?.filters.some((f) => f.value === 'limit:')).toBe(true); + }); + + it('treats negated limit as keyword since limit is non-negatable', () => { + const queryJSON = buildSearchQueryJSON('type:expense -limit:10'); + + expect(queryJSON?.limit).toBeUndefined(); + const keywordFilter = queryJSON?.flatFilters.find((filter) => filter.key === 'keyword'); + expect(keywordFilter?.filters.some((f) => f.value === '-limit:10')).toBe(true); + }); }); describe('getFilterDisplayValue', () => { diff --git a/tests/unit/SearchAutocompleteParserTest.ts b/tests/unit/SearchAutocompleteParserTest.ts index 256cf6ed89212..be6e703e08c96 100644 --- a/tests/unit/SearchAutocompleteParserTest.ts +++ b/tests/unit/SearchAutocompleteParserTest.ts @@ -299,6 +299,45 @@ const tests = [ }, ]; +const limitAutocompleteTests = [ + { + description: 'basic limit filter autocomplete', + query: 'limit:10', + expected: { + autocomplete: {key: 'limit', value: '10', negated: false, start: 6, length: 2}, + ranges: [{key: 'limit', value: '10', negated: false, start: 6, length: 2}], + }, + }, + { + description: 'empty limit value shows autocomplete suggestion', + query: 'limit:', + expected: { + autocomplete: {key: 'limit', value: '', start: 6, length: 0, negated: false}, + ranges: [], + }, + }, + { + description: 'limit filter in complex query', + query: 'type:expense limit:100 merchant:test', + expected: { + autocomplete: {key: 'merchant', value: 'test', negated: false, start: 32, length: 4}, + ranges: [ + {key: 'type', value: 'expense', negated: false, start: 5, length: 7}, + {key: 'limit', value: '100', negated: false, start: 19, length: 3}, + {key: 'merchant', value: 'test', negated: false, start: 32, length: 4}, + ], + }, + }, + { + description: 'limit filter is case-insensitive', + query: 'LIMIT:50', + expected: { + autocomplete: {key: 'limit', value: '50', negated: false, start: 6, length: 2}, + ranges: [{key: 'limit', value: '50', negated: false, start: 6, length: 2}], + }, + }, +]; + const nameFieldContinuationTests = [ { query: 'to:John Smi', @@ -705,3 +744,11 @@ describe('autocomplete parser - name field continuation detection', () => { expect(result).toEqual(expected); }); }); + +describe('autocomplete parser - limit filter', () => { + test.each(limitAutocompleteTests)('$description: $query', ({query, expected}) => { + const result = parse(query) as SearchQueryJSON; + + expect(result).toEqual(expected); + }); +}); diff --git a/tests/unit/SearchAutocompleteUtilsTest.ts b/tests/unit/SearchAutocompleteUtilsTest.ts index e26c17fc371c5..7b92ad879ee24 100644 --- a/tests/unit/SearchAutocompleteUtilsTest.ts +++ b/tests/unit/SearchAutocompleteUtilsTest.ts @@ -208,6 +208,60 @@ describe('SearchAutocompleteUtils', () => { expect(result).toEqual([]); }); + describe('limit filter highlighting', () => { + it('highlights valid positive integer', () => { + const input = 'limit:10'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([{start: 6, type: 'mention-user', length: 2}]); + }); + + it('does not highlight zero value', () => { + const input = 'limit:0'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([]); + }); + + it('does not highlight non-integer value', () => { + const input = 'limit:10.5'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([]); + }); + + it('does not highlight negative value', () => { + const input = 'limit:-5'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([]); + }); + + it('highlights limit in complex query with other filters', () => { + const input = 'type:expense limit:50 currency:USD'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([ + {start: 5, type: 'mention-user', length: 7}, // type:expense + {start: 19, type: 'mention-user', length: 2}, // limit:50 + {start: 31, type: 'mention-user', length: 3}, // currency:USD + ]); + }); + + it('does not highlight empty limit value', () => { + const input = 'limit:'; + + const result = parseForLiveMarkdown(input, currentUserName, mockSubstitutionMap, mockUserLogins, mockCurrencyList, mockCategoryList, mockTagList); + + expect(result).toEqual([]); + }); + }); + it('should handle valid AMOUNT filters but not invalid TOTAL amounts', () => { const input = 'amount:-50.25'; diff --git a/tests/unit/SearchParserTest.ts b/tests/unit/SearchParserTest.ts index 32d7b6d79c694..8683737ad4ce9 100644 --- a/tests/unit/SearchParserTest.ts +++ b/tests/unit/SearchParserTest.ts @@ -832,6 +832,65 @@ const keywordTests = [ }, ]; +const limitTests = [ + { + description: 'basic limit filter', + query: 'type:expense limit:10', + expected: { + type: 'expense', + status: CONST.SEARCH.STATUS.EXPENSE.ALL, + sortBy: 'date', + sortOrder: 'desc', + limit: '10', + filters: null, + }, + }, + { + description: 'limit filter combined with other filters', + query: 'type:expense limit:50 merchant:Amazon', + expected: { + type: 'expense', + status: CONST.SEARCH.STATUS.EXPENSE.ALL, + sortBy: 'date', + sortOrder: 'desc', + limit: '50', + filters: { + operator: 'eq', + left: 'merchant', + right: 'Amazon', + }, + }, + }, + { + description: 'limit filter is case-insensitive', + query: 'type:expense LIMIT:25', + expected: { + type: 'expense', + status: CONST.SEARCH.STATUS.EXPENSE.ALL, + sortBy: 'date', + sortOrder: 'desc', + limit: '25', + filters: null, + }, + }, + { + description: 'limit filter at the beginning of query', + query: 'limit:100 category:travel,hotel', + expected: { + type: 'expense', + status: CONST.SEARCH.STATUS.EXPENSE.ALL, + sortBy: 'date', + sortOrder: 'desc', + limit: '100', + filters: { + operator: 'eq', + left: 'category', + right: ['travel', 'hotel'], + }, + }, + }, +]; + describe('search parser', () => { test.each(tests)(`parsing: $query`, ({query, expected}) => { const {rawFilterList, ...resultWithoutRawFilters} = parse(query) as SearchQueryJSON; @@ -845,3 +904,10 @@ describe('Testing search parser with special characters and wrapped in quotes.', expect(resultWithoutRawFilters).toEqual(expected); }); }); + +describe('search parser - limit filter', () => { + test.each(limitTests)('$description: $query', ({query, expected}) => { + const {rawFilterList, ...resultWithoutRawFilters} = parse(query) as SearchQueryJSON; + expect(resultWithoutRawFilters).toEqual(expected); + }); +});