mirror of
				https://github.com/flynx/Course-JavaScript.git
				synced 2025-11-04 05:50:08 +00:00 
			
		
		
		
	started work on comments as words -- splitter not done yet...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									23f5018592
								
							
						
					
					
						commit
						53b91ecf20
					
				@ -60,6 +60,7 @@ function run(context){
 | 
				
			|||||||
	return context
 | 
						return context
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// XXX make this add '\n' / EOL words to the stream...
 | 
				
			||||||
var SPLITTER = /\s*\([^\)]*\)\s*|\s*--.*[\n$]|\s*"([^"]*)"\s*|\s*'([^']*)'\s*|\s+/m
 | 
					var SPLITTER = /\s*\([^\)]*\)\s*|\s*--.*[\n$]|\s*"([^"]*)"\s*|\s*'([^']*)'\s*|\s+/m
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,6 +97,20 @@ var PRE_NAMESPACE = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		this[ident] = cur[0]
 | 
							this[ident] = cur[0]
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// comment...
 | 
				
			||||||
 | 
						// drop everything until '\n'
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// NOTE: this depends on explicit '\n' words...
 | 
				
			||||||
 | 
						'--': function(context){
 | 
				
			||||||
 | 
							var code = context.code
 | 
				
			||||||
 | 
							var cur = code.splice(0, 1)[0]
 | 
				
			||||||
 | 
							while(cur != '\n' && code.length > 0){
 | 
				
			||||||
 | 
								cur = code.splice(0, 1)[0]
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// a no op...
 | 
				
			||||||
 | 
						'\n': function(){},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								js-oop.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								js-oop.js
									
									
									
									
									
								
							@ -57,7 +57,8 @@
 | 
				
			|||||||
// The 'new' expression returns the context object after it has been
 | 
					// The 'new' expression returns the context object after it has been
 | 
				
			||||||
// populated by the constructor function.
 | 
					// populated by the constructor function.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// NOTE: when using 'new', the function return value is ignored.
 | 
					// NOTE: when using 'new', the function/constructor return value is 
 | 
				
			||||||
 | 
					// 		ignored.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// The values set on 'this' by the constructor are instance attributes,
 | 
					// The values set on 'this' by the constructor are instance attributes,
 | 
				
			||||||
@ -68,10 +69,10 @@
 | 
				
			|||||||
// 		populate the object. i.e. no instance values will be created.
 | 
					// 		populate the object. i.e. no instance values will be created.
 | 
				
			||||||
// 
 | 
					// 
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// The instance has another type of attribute accessible through it that
 | 
					// The instance has another type of attribute accessible through it, an 
 | 
				
			||||||
// is not stored in it, but rather in it's prototype (o.__proto__), or 
 | 
					// attribute that's not stored in the object, but rather in it's 
 | 
				
			||||||
// rather the constructor's prototype (o.constructor.prototype). For 
 | 
					// prototype (o.__proto__), or rather the constructor's prototype 
 | 
				
			||||||
// more details see the next section.
 | 
					// (o.constructor.prototype). For more details see the next section.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@ -98,7 +99,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Since the prototype is a JS object that adheres to the same rules as 
 | 
					// Since the prototype is a JS object that adheres to the same rules as 
 | 
				
			||||||
// any other object, if the attr is not resolved in it directly it will 
 | 
					// any other object, if the attr is not resolved in it directly, it will 
 | 
				
			||||||
// be searched in its prototype, and so on.
 | 
					// be searched in its prototype, and so on.
 | 
				
			||||||
// This principle enables us to implement inheritance.
 | 
					// This principle enables us to implement inheritance.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user