remove unnecessary parsing words
parent
f7b77cbba7
commit
8fc64f119e
|
@ -39,6 +39,8 @@
|
||||||
|
|
||||||
+ listener/plugin:
|
+ listener/plugin:
|
||||||
|
|
||||||
|
- lineno/file for native
|
||||||
|
- jedit for native with socket communication
|
||||||
- lineno/file for shuffle defs
|
- lineno/file for shuffle defs
|
||||||
- balance needs USE:
|
- balance needs USE:
|
||||||
- input style after clicking link
|
- input style after clicking link
|
||||||
|
|
|
@ -167,8 +167,6 @@ public class FactorInterpreter implements FactorObject, Runnable
|
||||||
str.parsing = new StringLiteral(str,true);
|
str.parsing = new StringLiteral(str,true);
|
||||||
FactorWord ch = define("builtins","CHAR:");
|
FactorWord ch = define("builtins","CHAR:");
|
||||||
ch.parsing = new CharLiteral(ch);
|
ch.parsing = new CharLiteral(ch);
|
||||||
FactorWord raw = define("builtins","#\"");
|
|
||||||
raw.parsing = new StringLiteral(raw,false);
|
|
||||||
|
|
||||||
/* constants */
|
/* constants */
|
||||||
FactorWord t = define("builtins","t");
|
FactorWord t = define("builtins","t");
|
||||||
|
@ -209,18 +207,6 @@ public class FactorInterpreter implements FactorObject, Runnable
|
||||||
FactorWord hex = define("builtins","HEX:");
|
FactorWord hex = define("builtins","HEX:");
|
||||||
hex.parsing = new Base(hex,16);
|
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 */
|
/* vocabulary parsing words */
|
||||||
FactorWord noParsing = define("builtins","POSTPONE:");
|
FactorWord noParsing = define("builtins","POSTPONE:");
|
||||||
noParsing.parsing = new NoParsing(noParsing);
|
noParsing.parsing = new NoParsing(noParsing);
|
||||||
|
|
|
@ -52,8 +52,7 @@ public class ReadTable
|
||||||
|
|
||||||
DEFAULT_READTABLE.setCharacterType('!',ReadTable.CONSTITUENT);
|
DEFAULT_READTABLE.setCharacterType('!',ReadTable.CONSTITUENT);
|
||||||
DEFAULT_READTABLE.setCharacterType('"',ReadTable.DISPATCH);
|
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.setCharacterType('\\',ReadTable.SINGLE_ESCAPE);
|
||||||
DEFAULT_READTABLE.setCharacterRange(']','~',ReadTable.CONSTITUENT);
|
DEFAULT_READTABLE.setCharacterRange(']','~',ReadTable.CONSTITUENT);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -109,7 +109,7 @@ USE: httpd-responder
|
||||||
|
|
||||||
: parse-object-name ( filename -- argument filename )
|
: parse-object-name ( filename -- argument filename )
|
||||||
dup [
|
dup [
|
||||||
dup #"(.*?)\?(.*)" groups dup [ nip call ] when swap
|
dup "(.*?)\\?(.*)" groups dup [ nip call ] when swap
|
||||||
] [
|
] [
|
||||||
drop f "/"
|
drop f "/"
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
Loading…
Reference in New Issue