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:
Alex A. Naanou 2014-02-08 19:28:31 +04:00
parent 23f5018592
commit 53b91ecf20
2 changed files with 22 additions and 6 deletions

View File

@ -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(){},
} }

View File

@ -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.
// //