MCPcopy Create free account
hub / github.com/apache/cloudstack / readIdent

Function readIdent

tools/ngui/static/js/lib/angular.js:5918–5986  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5916 fn:function() {return number;}});
5917 }
5918 function readIdent() {
5919 var ident = "",
5920 start = index,
5921 lastDot, peekIndex, methodName, ch;
5922
5923 while (index < text.length) {
5924 ch = text.charAt(index);
5925 if (ch == '.' || isIdent(ch) || isNumber(ch)) {
5926 if (ch == '.') lastDot = index;
5927 ident += ch;
5928 } else {
5929 break;
5930 }
5931 index++;
5932 }
5933
5934 //check if this is not a method invocation and if it is back out to last dot
5935 if (lastDot) {
5936 peekIndex = index;
5937 while(peekIndex < text.length) {
5938 ch = text.charAt(peekIndex);
5939 if (ch == '(') {
5940 methodName = ident.substr(lastDot - start + 1);
5941 ident = ident.substr(0, lastDot - start);
5942 index = peekIndex;
5943 break;
5944 }
5945 if(isWhitespace(ch)) {
5946 peekIndex++;
5947 } else {
5948 break;
5949 }
5950 }
5951 }
5952
5953
5954 var token = {
5955 index:start,
5956 text:ident
5957 };
5958
5959 if (OPERATORS.hasOwnProperty(ident)) {
5960 token.fn = token.json = OPERATORS[ident];
5961 } else {
5962 var getter = getterFn(ident, csp);
5963 token.fn = extend(function(self, locals) {
5964 return (getter(self, locals));
5965 }, {
5966 assign: function(self, value) {
5967 return setter(self, ident, value);
5968 }
5969 });
5970 }
5971
5972 tokens.push(token);
5973
5974 if (methodName) {
5975 tokens.push({

Callers 1

lexFunction · 0.85

Calls 7

isIdentFunction · 0.85
isNumberFunction · 0.85
isWhitespaceFunction · 0.85
getterFnFunction · 0.85
extendFunction · 0.85
getterFunction · 0.85
setterFunction · 0.85

Tested by

no test coverage detected