2
* STANDARD ML OF NEW JERSEY COPYRIGHT NOTICE, LICENSE AND DISCLAIMER.
4
* Copyright (c) 1989-1998 by Lucent Technologies
6
* Permission to use, copy, modify, and distribute this software and its
7
* documentation for any purpose and without fee is hereby granted, provided
8
* that the above copyright notice appear in all copies and that both the
9
* copyright notice and this permission notice and warranty disclaimer appear
10
* in supporting documentation, and that the name of Lucent Technologies, Bell
11
* Labs or any Lucent entity not be used in advertising or publicity pertaining
12
* to distribution of the software without specific, written prior permission.
14
* Lucent disclaims all warranties with regard to this software, including all
15
* implied warranties of merchantability and fitness. In no event shall Lucent
16
* be liable for any special, indirect or consequential damages or any damages
17
* whatsoever resulting from loss of use, data or profits, whether in an action
18
* of contract, negligence or other tortious action, arising out of or in
19
* connection with the use or performance of this software.
21
* Taken from this URL:
22
* http://www.smlnj.org/license.html
24
* This license is compatible with the GNU GPL (see section "Standard ML of New
25
* Jersey Copyright License"):
26
* http://www.gnu.org/licenses/license-list.html#StandardMLofNJ
30
* Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
33
package weka.core.parser.java_cup;
35
/** This class represents a transition in an LALR viable prefix recognition
36
* machine. Transitions can be under terminals for non-terminals. They are
37
* internally linked together into singly linked lists containing all the
38
* transitions out of a single state via the _next field.
40
* @see weka.core.parser.java_cup.lalr_state
41
* @version last updated: 11/25/95
42
* @author Scott Hudson
45
public class lalr_transition {
47
/*-----------------------------------------------------------*/
48
/*--- Constructor(s) ----------------------------------------*/
49
/*-----------------------------------------------------------*/
52
* @param on_sym symbol we are transitioning on.
53
* @param to_st state we transition to.
54
* @param nxt next transition in linked list.
56
public lalr_transition(symbol on_sym, lalr_state to_st, lalr_transition nxt)
61
throw new internal_error("Attempt to create transition on null symbol");
63
throw new internal_error("Attempt to create transition to null state");
71
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
73
/** Constructor with null next.
74
* @param on_sym symbol we are transitioning on.
75
* @param to_st state we transition to.
77
public lalr_transition(symbol on_sym, lalr_state to_st) throws internal_error
79
this(on_sym, to_st, null);
82
/*-----------------------------------------------------------*/
83
/*--- (Access to) Instance Variables ------------------------*/
84
/*-----------------------------------------------------------*/
86
/** The symbol we make the transition on. */
87
protected symbol _on_symbol;
89
/** The symbol we make the transition on. */
90
public symbol on_symbol() {return _on_symbol;}
92
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
94
/** The state we transition to. */
95
protected lalr_state _to_state;
97
/** The state we transition to. */
98
public lalr_state to_state() {return _to_state;}
100
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
102
/** Next transition in linked list of transitions out of a state */
103
protected lalr_transition _next;
105
/** Next transition in linked list of transitions out of a state */
106
public lalr_transition next() {return _next;}
108
/*-----------------------------------------------------------*/
109
/*--- General Methods ---------------------------------------*/
110
/*-----------------------------------------------------------*/
112
/** Convert to a string. */
113
public String toString()
117
result = "transition on " + on_symbol().name() + " to state [";
118
result += _to_state.index();
124
/*-----------------------------------------------------------*/