55from textworld .textgen .parser import TextGrammarParser
66
77
8- class NewAlternative :
8+ class Alternative :
99 """
1010 A single alternative in a production rule.
1111 """
@@ -36,7 +36,7 @@ def __init__(self, value: str):
3636 self ._value = value
3737
3838
39- class NewLiteralAlternative ( NewAlternative ):
39+ class LiteralAlternative ( Alternative ):
4040 """
4141 An alternative from a literal string and represents it as a chunk of literal and symbol objects.
4242 """
@@ -68,7 +68,7 @@ def split_form(self, include_adj=True) -> Tuple[Optional[str], str]:
6868 return None , self ._node
6969
7070
71- class NewAdjectiveNounAlternative ( NewLiteralAlternative ):
71+ class AdjectiveNounAlternative ( LiteralAlternative ):
7272 """
7373 An alternative that specifies an adjective and a noun as chunk of objects.
7474 """
@@ -89,12 +89,12 @@ def split_form(self, include_adj=True) -> Tuple[Optional[str], str]:
8989 return None , self ._n_node
9090
9191
92- class MatchAlternative (NewAlternative ):
92+ class MatchAlternative (Alternative ):
9393 """
9494 An alternative that specifies matching names for two objects.
9595 """
9696
97- def __init__ (self , lhs : NewAlternative , rhs : NewAlternative ):
97+ def __init__ (self , lhs : Alternative , rhs : Alternative ):
9898 self .lhs = lhs
9999 self .rhs = rhs
100100
@@ -107,7 +107,7 @@ class ProductionRule:
107107 A production rule in a text grammar.
108108 """
109109
110- def __init__ (self , symbol : str , alternatives : Iterable [NewAlternative ]):
110+ def __init__ (self , symbol : str , alternatives : Iterable [Alternative ]):
111111 self .symbol = symbol
112112 self .alternatives = tuple (alternatives )
113113
@@ -123,13 +123,13 @@ def walk_str(self, node):
123123 def walk_Literal (self , node ):
124124 value = self .walk (node .value )
125125 if value :
126- return NewLiteralAlternative (value )
126+ return LiteralAlternative (value )
127127 else :
128128 # Skip empty literals
129129 return None
130130
131131 def walk_AdjectiveNoun (self , node ):
132- return NewAdjectiveNounAlternative (self .walk (node .adjective ), self .walk (node .noun ))
132+ return AdjectiveNounAlternative (self .walk (node .adjective ), self .walk (node .noun ))
133133
134134 def walk_Match (self , node ):
135135 return MatchAlternative (self .walk (node .lhs ), self .walk (node .rhs ))
0 commit comments