Esempio n. 1
0
 def p_plural_state_description(self, p):
     """plural_state_description : plural_quantifier plural_scope state
                                 | ID plural_scope state
                                 | ID singular_scope state
                                 | ID REFERENCE state"""
     # The singular case is an exception: "1 line broken" is semantically
     # the same as "2 lines broken"
     p[0] = State(p[3], p[2], p[1])
Esempio n. 2
0
 def p_simple_dollar(self, p):
     """simple_dollar_statement : DOLLAR ID newline
                                | DOLLAR state newline
                                | DOLLAR REFERENCE ID newline"""
     # print(p[2])
     p[0] = State(p[2])
Esempio n. 3
0
 def p_singular_state_desc_brief(self, p):
     """brief_state_desc : brief_quantifier state"""
     text = list(p)
     p[0] = State(text[-1], None, text[1])
Esempio n. 4
0
 def p_state_singular_desc(self, p):
     """singular_state_desc : state singular_scope"""
     text = list(p)
     p[0] = State(state=text[1], scope=" ".join(text[2:]))
Esempio n. 5
0
 def p_singular_state_desc(self, p):
     """singular_state_desc : singular_scope state
                            | REFERENCE state
                            | REFERENCE ID state"""
     text = list(p)
     p[0] = State(text[-1], " ".join(text[1:-1]))
Esempio n. 6
0
 def p_plural_state_range_description(self, p):
     """plural_state_description : ID MINUS ID plural_scope state"""
     p[0] = State(p[5], p[4], p[1] + "-" + p[3])
Esempio n. 7
0
 def p_plural_state_description_unquantified_reverse(self, p):
     """plural_state_description : state plural_scope
     """
     # This should probably not be allowed but is happening in the corpus
     # i.e. ""$ blank lines"
     p[0] = State(p[1], p[2])
Esempio n. 8
0
 def p_plural_state_description_unquantified(self, p):
     """plural_state_description : plural_scope state
     """
     # This should probably not be allowed but is happening in the corpus
     # i.e. ""$ columns broken"
     p[0] = State(p[2], p[1])
Esempio n. 9
0
 def p_simple_dollar(self, p):
     """simple_dollar_statement : DOLLAR ID newline
                                | DOLLAR state newline"""
     p[0] = State(p[2])
Esempio n. 10
0
 def p_loose_dollar(self, p):
     "loose_dollar_statement : DOLLAR PARENTHETICALID newline"
     p[0] = State(loose=p[2])