mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	Add NaN support
This commit is contained in:
		
							parent
							
								
									7dd4e6ecee
								
							
						
					
					
						commit
						ada6c926dc
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -271,6 +271,20 @@ const elements = [
 | 
			
		|||
		}
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	// nan
 | 
			
		||||
	(code, i, source) => {
 | 
			
		||||
		const prev = source[i - 1];
 | 
			
		||||
		if (prev && /[a-zA-Z]/.test(prev)) return null;
 | 
			
		||||
		if (code.substr(0, 3) == 'NaN') {
 | 
			
		||||
			return {
 | 
			
		||||
				html: `<span class="nan">NaN</span>`,
 | 
			
		||||
				next: 3
 | 
			
		||||
			};
 | 
			
		||||
		} else {
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	// keyword
 | 
			
		||||
	(code, i, source) => {
 | 
			
		||||
		const prev = source[i - 1];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,6 +137,7 @@ pre
 | 
			
		|||
			color #42b983
 | 
			
		||||
 | 
			
		||||
		.number
 | 
			
		||||
		.nan
 | 
			
		||||
			color #ae81ff
 | 
			
		||||
 | 
			
		||||
		.var:not(.keyword)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue