source: branches/0.15.x/abcl/src/org/armedbear/lisp/FaslReadtable.java

Last change on this file was 11488, checked in by ehuelsmann, 17 years ago

Add @Override annotations.

Patch by: Douglas Miles

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1/*
2 * FaslReadtable.java
3 *
4 * Copyright (C) 2005 Peter Graves
5 * $Id: FaslReadtable.java 11488 2008-12-27 10:50:33Z ehuelsmann $
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 *
21 * As a special exception, the copyright holders of this library give you
22 * permission to link this library with independent modules to produce an
23 * executable, regardless of the license terms of these independent
24 * modules, and to copy and distribute the resulting executable under
25 * terms of your choice, provided that you also meet, for each linked
26 * independent module, the terms and conditions of the license of that
27 * module.  An independent module is a module which is not derived from
28 * or based on this library.  If you modify this library, you may extend
29 * this exception to your version of the library, but you are not
30 * obligated to do so.  If you do not wish to do so, delete this
31 * exception statement from your version.
32 */
33
34package org.armedbear.lisp;
35
36public final class FaslReadtable extends Readtable
37{
38    public FaslReadtable()
39    {
40        super();
41    }
42
43    @Override
44    protected void initialize()
45    {
46        syntax[9]    = SYNTAX_TYPE_WHITESPACE; // tab
47        syntax[10]   = SYNTAX_TYPE_WHITESPACE; // linefeed
48        syntax[12]   = SYNTAX_TYPE_WHITESPACE; // form feed
49        syntax[13]   = SYNTAX_TYPE_WHITESPACE; // return
50        syntax[' ']  = SYNTAX_TYPE_WHITESPACE;
51
52        syntax['"']  = SYNTAX_TYPE_TERMINATING_MACRO;
53        syntax['\''] = SYNTAX_TYPE_TERMINATING_MACRO;
54        syntax['(']  = SYNTAX_TYPE_TERMINATING_MACRO;
55        syntax[')']  = SYNTAX_TYPE_TERMINATING_MACRO;
56        syntax[',']  = SYNTAX_TYPE_TERMINATING_MACRO;
57        syntax[';']  = SYNTAX_TYPE_TERMINATING_MACRO;
58        syntax['`']  = SYNTAX_TYPE_TERMINATING_MACRO;
59
60        syntax['#']  = SYNTAX_TYPE_NON_TERMINATING_MACRO;
61
62        syntax['\\'] = SYNTAX_TYPE_SINGLE_ESCAPE;
63        syntax['|']  = SYNTAX_TYPE_MULTIPLE_ESCAPE;
64
65        readerMacroFunctions[';']  = FaslReader.FASL_READ_COMMENT;
66        readerMacroFunctions['"']  = FaslReader.FASL_READ_STRING;
67        readerMacroFunctions['(']  = FaslReader.FASL_READ_LIST;
68        readerMacroFunctions[')']  = FaslReader.FASL_READ_RIGHT_PAREN;
69        readerMacroFunctions['\''] = FaslReader.FASL_READ_QUOTE;
70        readerMacroFunctions['#']  = FaslReader.FASL_READ_DISPATCH_CHAR;
71
72        // BACKQUOTE-MACRO and COMMA-MACRO are defined in backquote.lisp.
73        readerMacroFunctions['`']  = Symbol.BACKQUOTE_MACRO;
74        readerMacroFunctions[',']  = Symbol.COMMA_MACRO;
75
76        DispatchTable dt = new DispatchTable();
77        dt.functions['(']  = FaslReader.FASL_SHARP_LEFT_PAREN;
78        dt.functions['*']  = FaslReader.FASL_SHARP_STAR;
79        dt.functions['.']  = FaslReader.FASL_SHARP_DOT;
80        dt.functions[':']  = FaslReader.FASL_SHARP_COLON;
81        dt.functions['A']  = FaslReader.FASL_SHARP_A;
82        dt.functions['B']  = FaslReader.FASL_SHARP_B;
83        dt.functions['C']  = FaslReader.FASL_SHARP_C;
84        dt.functions['O']  = FaslReader.FASL_SHARP_O;
85        dt.functions['P']  = FaslReader.FASL_SHARP_P;
86        dt.functions['R']  = FaslReader.FASL_SHARP_R;
87        dt.functions['S']  = FaslReader.FASL_SHARP_S;
88        dt.functions['X']  = FaslReader.FASL_SHARP_X;
89        dt.functions['\''] = FaslReader.FASL_SHARP_QUOTE;
90        dt.functions['\\'] = FaslReader.FASL_SHARP_BACKSLASH;
91        dt.functions['|']  = FaslReader.FASL_SHARP_VERTICAL_BAR;
92        dt.functions[')']  = FaslReader.FASL_SHARP_ILLEGAL;
93        dt.functions['<']  = FaslReader.FASL_SHARP_ILLEGAL;
94        dt.functions[' ']  = FaslReader.FASL_SHARP_ILLEGAL;
95        dt.functions[8]    = FaslReader.FASL_SHARP_ILLEGAL; // backspace
96        dt.functions[9]    = FaslReader.FASL_SHARP_ILLEGAL; // tab
97        dt.functions[10]   = FaslReader.FASL_SHARP_ILLEGAL; // newline, linefeed
98        dt.functions[12]   = FaslReader.FASL_SHARP_ILLEGAL; // page
99        dt.functions[13]   = FaslReader.FASL_SHARP_ILLEGAL; // return
100        dispatchTables['#'] = dt;
101
102        readtableCase = Keyword.UPCASE;
103    }
104
105    private static final FaslReadtable instance = new FaslReadtable();
106
107    public static final FaslReadtable getInstance()
108    {
109        return instance;
110    }
111}
Note: See TracBrowser for help on using the repository browser.