mirror of
				https://github.com/flynx/Slang.git
				synced 2025-10-31 19:40:10 +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...
 | ||||
| 	// block...
 | ||||
| 	// syntax: [ ... ]
 | ||||
| 	// NOTE: we can also terminate several blocks with a single ]]
 | ||||
| 	'[': function(context){ | ||||
| 		var block = [] | ||||
| 		var code = context.code | ||||
| 		var cur = code.splice(0, 1)[0] | ||||
| 		while(cur != ']' && code.length > 0){ | ||||
| 		while(cur != ']' && cur != ']]' && code.length > 0){ | ||||
| 			if(cur == '['){ | ||||
| 				cur = this['['](context) | ||||
| 			} | ||||
| 			block.push(cur) | ||||
| 			cur = code.splice(0, 1)[0] | ||||
| 		} | ||||
| 		if(code.length == 0 && cur != ']'){ | ||||
| 		if(code.length == 0 && cur != ']' && cur != ']]'){ | ||||
| 			console.error('Did not find expected "]".') | ||||
| 		}  | ||||
| 		return block | ||||
| 	}, | ||||
| 	']': function(context){ console.error('Unexpected "]".') }, | ||||
| 	']]': function(context){ console.error('Unexpected "]]".') }, | ||||
| 
 | ||||
| 	// XXX macros are not recursive...
 | ||||
| 	'macro:': function(context){ | ||||
| 		var ident = context.code.splice(0, 1) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user