mirror of
				https://github.com/flynx/Course-JavaScript.git
				synced 2025-10-31 20:10:08 +00:00 
			
		
		
		
	added block set terminator ']]'...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f1a16805d4
								
							
						
					
					
						commit
						a34636cdd8
					
				| @ -106,22 +106,26 @@ var PRE_NAMESPACE = { | |||||||
| 	// XXX use the real reader...
 | 	// XXX use the real reader...
 | ||||||
| 	// block...
 | 	// block...
 | ||||||
| 	// syntax: [ ... ]
 | 	// syntax: [ ... ]
 | ||||||
|  | 	// NOTE: we can also terminate several blocks with a single ]]
 | ||||||
| 	'[': function(context){ | 	'[': function(context){ | ||||||
| 		var block = [] | 		var block = [] | ||||||
| 		var code = context.code | 		var code = context.code | ||||||
| 		var cur = code.splice(0, 1)[0] | 		var cur = code.splice(0, 1)[0] | ||||||
| 		while(cur != ']' && code.length > 0){ | 		while(cur != ']' && cur != ']]' && code.length > 0){ | ||||||
| 			if(cur == '['){ | 			if(cur == '['){ | ||||||
| 				cur = this['['](context) | 				cur = this['['](context) | ||||||
| 			} | 			} | ||||||
| 			block.push(cur) | 			block.push(cur) | ||||||
| 			cur = code.splice(0, 1)[0] | 			cur = code.splice(0, 1)[0] | ||||||
| 		} | 		} | ||||||
| 		if(code.length == 0 && cur != ']'){ | 		if(code.length == 0 && cur != ']' && cur != ']]'){ | ||||||
| 			console.error('Did not find expected "]".') | 			console.error('Did not find expected "]".') | ||||||
| 		}  | 		}  | ||||||
| 		return block | 		return block | ||||||
| 	}, | 	}, | ||||||
|  | 	']': function(context){ console.error('Unexpected "]".') }, | ||||||
|  | 	']]': function(context){ console.error('Unexpected "]]".') }, | ||||||
|  | 
 | ||||||
| 	// XXX macros are not recursive...
 | 	// XXX macros are not recursive...
 | ||||||
| 	'macro:': function(context){ | 	'macro:': function(context){ | ||||||
| 		var ident = context.code.splice(0, 1) | 		var ident = context.code.splice(0, 1) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user