lib/factory.js
function createTokens(format) {
		var tokens = [],
			pos = 0,
			match;
			
		while ((match = tokenRE.exec(format))) {
			if (match.index > pos) {
				// doesn't match any token, static string
				tokens.push(angular.extend({
					value: format.substring(pos, match.index)
				}, definedTokens.string));
				pos = match.index;
			} 

			if (match.index == pos) {
				if (match[1]) {
					// sss
					tokens.push(angular.extend({
						value: match[1]
					}, definedTokens.string));
					tokens.push(definedTokens.sss);
				} else if (match[2]) {
					// escaped string
					tokens.push(angular.extend({
						value: match[2].replace("''", "'")
					}, definedTokens.string));
				} else if (definedTokens[match[0]].name == "timezone") {
					// static timezone
					var tz = SYS_TIMEZONE;
					if (definedTokens[match[0]].colon) {
						tz = insertColon(tz);
					}
					tokens.push(angular.extend({
						value: tz
					}, definedTokens[match[0]]));
				} else {
					// other tokens
					tokens.push(definedTokens[match[0]]);
				}
				pos = tokenRE.lastIndex;
			}
		}
		
		if (pos < format.length) {
			tokens.push(angular.extend({
				value: format.substring(pos)
			}, definedTokens.string));
		}
		
		return tokens;
	}
function createTokens(format) {
		var tokens = [],
			pos = 0,
			match;
			
		while ((match = tokenRE.exec(format))) {
			if (match.index > pos) {
				// doesn't match any token, static string
				tokens.push(angular.extend({
					value: format.substring(pos, match.index)
				}, definedTokens.string));
				pos = match.index;
			} 

			if (match.index == pos) {
				if (match[1]) {
					// sss
					tokens.push(angular.extend({
						value: match[1]
					}, definedTokens.string));
					tokens.push(definedTokens.sss);
				} else if (match[2]) {
					// escaped string
					tokens.push(angular.extend({
						value: match[2].replace("''", "'")
					}, definedTokens.string));
				} else if (definedTokens[match[0]].name == "timezone") {
					// static timezone
					var tz = SYS_TIMEZONE;
					if (definedTokens[match[0]].colon) {
						tz = insertColon(tz);
					}
					tokens.push(angular.extend({
						value: tz
					}, definedTokens[match[0]]));
				} else {
					// other tokens
					tokens.push(definedTokens[match[0]]);
				}
				pos = tokenRE.lastIndex;
			}
		}
		
		if (pos < format.length) {
			tokens.push(angular.extend({
				value: format.substring(pos)
			}, definedTokens.string));
		}
		
		return tokens;
	}
function createTokens ( format ) { var tokens = [ ] , pos = 0 , match ; while ( ( match = tokenRE . exec ( format ) ) ) { if ( match . index > pos ) { // doesn't match any token, static string tokens . push ( angular . extend ( { value : format . substring ( pos , match . index ) } , definedTokens . string ) ) ; pos = match . index ; } if ( match . index == pos ) { if ( match [ 1 ] ) { // sss tokens . push ( angular . extend ( { value : match [ 1 ] } , definedTokens . string ) ) ; tokens . push ( definedTokens . sss ) ; } else if ( match [ 2 ] ) { // escaped string tokens . push ( angular . extend ( { value : match [ 2 ] . replace ( "''" , "'" ) } , definedTokens . string ) ) ; } else if ( definedTokens [ match [ 0 ] ] . name == "timezone" ) { // static timezone var tz = SYS_TIMEZONE ; if ( definedTokens [ match [ 0 ] ] . colon ) { tz = insertColon ( tz ) ; } tokens . push ( angular . extend ( { value : tz } , definedTokens [ match [ 0 ] ] ) ) ; } else { // other tokens tokens . push ( definedTokens [ match [ 0 ] ] ) ; } pos = tokenRE . lastIndex ; } } if ( pos < format . length ) { tokens . push ( angular . extend ( { value : format . substring ( pos ) } , definedTokens . string ) ) ; } return tokens ; }
Split format into multiple tokens
Split format into multiple tokens