* @ngdoc provider * @name $parseProvider * @this * * @description * `$parseProvider` can be used for configuring the default behavior of the ng.$parse $parse * service.
()
| 16688 | * service. |
| 16689 | */ |
| 16690 | function $ParseProvider() { |
| 16691 | var cache = createMap(); |
| 16692 | var literals = { |
| 16693 | 'true': true, |
| 16694 | 'false': false, |
| 16695 | 'null': null, |
| 16696 | 'undefined': undefined |
| 16697 | }; |
| 16698 | var identStart, identContinue; |
| 16699 | |
| 16700 | /** |
| 16701 | * @ngdoc method |
| 16702 | * @name $parseProvider#addLiteral |
| 16703 | * @description |
| 16704 | * |
| 16705 | * Configure $parse service to add literal values that will be present as literal at expressions. |
| 16706 | * |
| 16707 | * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name. |
| 16708 | * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`. |
| 16709 | * |
| 16710 | **/ |
| 16711 | this.addLiteral = function(literalName, literalValue) { |
| 16712 | literals[literalName] = literalValue; |
| 16713 | }; |
| 16714 | |
| 16715 | /** |
| 16716 | * @ngdoc method |
| 16717 | * @name $parseProvider#setIdentifierFns |
| 16718 | * |
| 16719 | * @description |
| 16720 | * |
| 16721 | * Allows defining the set of characters that are allowed in AngularJS expressions. The function |
| 16722 | * `identifierStart` will get called to know if a given character is a valid character to be the |
| 16723 | * first character for an identifier. The function `identifierContinue` will get called to know if |
| 16724 | * a given character is a valid character to be a follow-up identifier character. The functions |
| 16725 | * `identifierStart` and `identifierContinue` will receive as arguments the single character to be |
| 16726 | * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in |
| 16727 | * mind that the `string` parameter can be two characters long depending on the character |
| 16728 | * representation. It is expected for the function to return `true` or `false`, whether that |
| 16729 | * character is allowed or not. |
| 16730 | * |
| 16731 | * Since this function will be called extensively, keep the implementation of these functions fast, |
| 16732 | * as the performance of these functions have a direct impact on the expressions parsing speed. |
| 16733 | * |
| 16734 | * @param {function=} identifierStart The function that will decide whether the given character is |
| 16735 | * a valid identifier start character. |
| 16736 | * @param {function=} identifierContinue The function that will decide whether the given character is |
| 16737 | * a valid identifier continue character. |
| 16738 | */ |
| 16739 | this.setIdentifierFns = function(identifierStart, identifierContinue) { |
| 16740 | identStart = identifierStart; |
| 16741 | identContinue = identifierContinue; |
| 16742 | return this; |
| 16743 | }; |
| 16744 | |
| 16745 | this.$get = ['$filter', function($filter) { |
| 16746 | var noUnsafeEval = csp().noUnsafeEval; |
| 16747 | var $parseOptions = { |
nothing calls this directly
no test coverage detected