diff --git a/Slang/slang.js b/Slang/slang.js index 72c7695..70d8df1 100755 --- a/Slang/slang.js +++ b/Slang/slang.js @@ -60,6 +60,7 @@ function run(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 @@ -96,6 +97,20 @@ var PRE_NAMESPACE = { 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(){}, } diff --git a/js-oop.js b/js-oop.js index c51b230..60ccef5 100755 --- a/js-oop.js +++ b/js-oop.js @@ -57,7 +57,8 @@ // The 'new' expression returns the context object after it has been // 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, @@ -68,10 +69,10 @@ // populate the object. i.e. no instance values will be created. // // -// The instance has another type of attribute accessible through it that -// is not stored in it, but rather in it's prototype (o.__proto__), or -// rather the constructor's prototype (o.constructor.prototype). For -// more details see the next section. +// The instance has another type of attribute accessible through it, an +// attribute that's not stored in the object, but rather in it's +// prototype (o.__proto__), or rather the constructor's prototype +// (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 -// 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. // This principle enables us to implement inheritance. //