diff --git a/Slang/slang.html b/Slang/slang.html
index d4bc5de..082b57a 100755
--- a/Slang/slang.html
+++ b/Slang/slang.html
@@ -143,6 +143,8 @@ function runCommand(){
next.setAttribute('contenteditable', true)
console.appendChild(next)
next.focus()
+
+ window.scrollTo(0,document.body.scrollHeight)
}
NAMESPACE.print = function(context){
diff --git a/Slang/slang.js b/Slang/slang.js
index 70d8df1..9414062 100755
--- a/Slang/slang.js
+++ b/Slang/slang.js
@@ -61,11 +61,48 @@ function run(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
+var SPLITTER = RegExp([
+ // terms to keep in the stream...
+ /*'('+[
+ '\\n',
+ '--',
+ ].join('|')+')',*/
+
+ // comments...
+ '\\s*\\([^\\)]*\\)\\s*',
+ '\\s*--.*[\\n$]',
+
+ // quoted strings...
+ '\\s*"([^"]*)"\\s*',
+ "\\s*'([^']*)'\\s*",
+
+ // whitespace...
+ '\\s+',
+ ].join('|'),
+ 'm')
// pre-processor namespace...
var PRE_NAMESPACE = {
+ // comment...
+ // syntax: -- ... \n
+ //
+ // drop everything until '\n'
+ //
+ // NOTE: this depends on explicit '\n' words...
+ '--': function(context){
+ var res = ['--']
+ var code = context.code
+ var cur = code.splice(0, 1)[0]
+ res.push(cur)
+ while(cur != '\n' && code.length > 0){
+ cur = code.splice(0, 1)[0]
+ res.push(cur)
+ }
+ console.log(res.join(' '))
+ },
+
// XXX use the real reader...
// block...
// syntax: [ ... ]
@@ -98,19 +135,10 @@ 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(){},
+ '\n': function(){
+ console.log('NL')
+ },
}