From 8fc64f119e4c880e740d53c5cab96fd45675f3f5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 18 Aug 2004 02:08:35 +0000 Subject: [PATCH] remove unnecessary parsing words --- TODO.FACTOR.txt | 2 + factor/FactorDocComment.java | 2 +- factor/FactorInterpreter.java | 14 ------- factor/ReadTable.java | 3 +- factor/parser/Dispatch.java | 61 ----------------------------- factor/parser/PassThrough.java | 53 ------------------------- factor/parser/Unreadable.java | 53 ------------------------- library/httpd/file-responder.factor | 2 +- 8 files changed, 5 insertions(+), 185 deletions(-) delete mode 100644 factor/parser/Dispatch.java delete mode 100644 factor/parser/PassThrough.java delete mode 100644 factor/parser/Unreadable.java diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index b657ae4879..6ae1dc57be 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -39,6 +39,8 @@ + listener/plugin: +- lineno/file for native +- jedit for native with socket communication - lineno/file for shuffle defs - balance needs USE: - input style after clicking link diff --git a/factor/FactorDocComment.java b/factor/FactorDocComment.java index db5bd839f4..105a79a968 100644 --- a/factor/FactorDocComment.java +++ b/factor/FactorDocComment.java @@ -49,7 +49,7 @@ public class FactorDocComment implements FactorExternalizable if(stack) return "( " + msg + " )\n"; else - return "#!" + msg + "\n"; + return "#! " + msg + "\n"; } public boolean isStackComment() diff --git a/factor/FactorInterpreter.java b/factor/FactorInterpreter.java index c266ab5cf5..93cd793776 100644 --- a/factor/FactorInterpreter.java +++ b/factor/FactorInterpreter.java @@ -167,8 +167,6 @@ public class FactorInterpreter implements FactorObject, Runnable str.parsing = new StringLiteral(str,true); FactorWord ch = define("builtins","CHAR:"); ch.parsing = new CharLiteral(ch); - FactorWord raw = define("builtins","#\""); - raw.parsing = new StringLiteral(raw,false); /* constants */ FactorWord t = define("builtins","t"); @@ -209,18 +207,6 @@ public class FactorInterpreter implements FactorObject, Runnable FactorWord hex = define("builtins","HEX:"); hex.parsing = new Base(hex,16); - /* specials */ - FactorWord dispatch = define("builtins","#"); - dispatch.parsing = new Dispatch(dispatch); - FactorWord unreadable = define("builtins","#<"); - unreadable.parsing = new Unreadable(unreadable); - - // #: is not handled with a special dispatch. instead, when - // a word starting with #: is passed to intern(), it creates - // a new symbol - FactorWord passthru = define("builtins","#:"); - passthru.parsing = new PassThrough(passthru); - /* vocabulary parsing words */ FactorWord noParsing = define("builtins","POSTPONE:"); noParsing.parsing = new NoParsing(noParsing); diff --git a/factor/ReadTable.java b/factor/ReadTable.java index 92c5f29f6b..4fe180cf2a 100644 --- a/factor/ReadTable.java +++ b/factor/ReadTable.java @@ -52,8 +52,7 @@ public class ReadTable DEFAULT_READTABLE.setCharacterType('!',ReadTable.CONSTITUENT); DEFAULT_READTABLE.setCharacterType('"',ReadTable.DISPATCH); - DEFAULT_READTABLE.setCharacterType('#',ReadTable.DISPATCH); - DEFAULT_READTABLE.setCharacterRange('$','[',ReadTable.CONSTITUENT); + DEFAULT_READTABLE.setCharacterRange('#','[',ReadTable.CONSTITUENT); DEFAULT_READTABLE.setCharacterType('\\',ReadTable.SINGLE_ESCAPE); DEFAULT_READTABLE.setCharacterRange(']','~',ReadTable.CONSTITUENT); diff --git a/factor/parser/Dispatch.java b/factor/parser/Dispatch.java deleted file mode 100644 index 524cf0d349..0000000000 --- a/factor/parser/Dispatch.java +++ /dev/null @@ -1,61 +0,0 @@ -/* :folding=explicit:collapseFolds=1: */ - -/* - * $Id$ - * - * Copyright (C) 2004 Slava Pestov. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package factor.parser; - -import factor.*; -import java.io.IOException; - -public class Dispatch extends FactorParsingDefinition -{ - //{{{ Dispatch constructor - /** - * A new definition. - */ - public Dispatch(FactorWord word) - throws Exception - { - super(word); - } //}}} - - public void eval(FactorInterpreter interp, FactorReader reader) - throws Exception - { - char next = reader.getScanner().readNonEOF(); - String dispatch = word.name + next; - FactorWord dispatchWord = reader.intern(dispatch,false); - if(dispatchWord.parsing != null) - dispatchWord.parsing.eval(interp,reader); - else - { - reader.error("Unknown dispatch: " - + dispatch); - } - } -} diff --git a/factor/parser/PassThrough.java b/factor/parser/PassThrough.java deleted file mode 100644 index c97a4cf567..0000000000 --- a/factor/parser/PassThrough.java +++ /dev/null @@ -1,53 +0,0 @@ -/* :folding=explicit:collapseFolds=1: */ - -/* - * $Id$ - * - * Copyright (C) 2004 Slava Pestov. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package factor.parser; - -import factor.*; -import java.io.IOException; - -public class PassThrough extends FactorParsingDefinition -{ - //{{{ PassThrough constructor - /** - * A new definition. - */ - public PassThrough(FactorWord word) - throws Exception - { - super(word); - } //}}} - - public void eval(FactorInterpreter interp, FactorReader reader) - throws Exception - { - reader.append(reader.intern(word.name - + reader.nextNonEOL(false,false),false)); - } -} diff --git a/factor/parser/Unreadable.java b/factor/parser/Unreadable.java deleted file mode 100644 index 43529c4f7c..0000000000 --- a/factor/parser/Unreadable.java +++ /dev/null @@ -1,53 +0,0 @@ -/* :folding=explicit:collapseFolds=1: */ - -/* - * $Id$ - * - * Copyright (C) 2004 Slava Pestov. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package factor.parser; - -import factor.*; -import java.io.IOException; - -public class Unreadable extends FactorParsingDefinition -{ - //{{{ Unreadable constructor - /** - * A new definition. - */ - public Unreadable(FactorWord word) - throws Exception - { - super(word); - } //}}} - - public void eval(FactorInterpreter interp, FactorReader reader) - throws IOException, FactorParseException - { - reader.getScanner().error("Objects prefixed with " + word.name - + " are unreadable"); - } -} diff --git a/library/httpd/file-responder.factor b/library/httpd/file-responder.factor index 493e429c2b..0b9c8c7333 100644 --- a/library/httpd/file-responder.factor +++ b/library/httpd/file-responder.factor @@ -109,7 +109,7 @@ USE: httpd-responder : parse-object-name ( filename -- argument filename ) dup [ - dup #"(.*?)\?(.*)" groups dup [ nip call ] when swap + dup "(.*?)\\?(.*)" groups dup [ nip call ] when swap ] [ drop f "/" ] ifte ;