Source

Kiva Editor's Assistant / keatoken.py

Diff from to

File keatoken.py

            (\S*)        # any amount of non-space chars """,
         re.I | re.U | re.VERBOSE)
 
+    @staticmethod
+    def bos_token():
+        """A convenience class-factory method to return an
+        beginning-of-sentence delimiter token."""
+        bos_token = Token('*BOS*')
+        bos_token.bos = True
+        return bos_token
+
+    @staticmethod
+    def eos_token():
+        """A convenience class-factory method to return an
+        end-of-sentence delimiter token."""
+        eos_token = Token('*EOS*')
+        eos_token.eos = True
+        return eos_token
+
     def __init__(self, s, cbegin=None, cend=None):
         """Initialize from text.
 
         self._abbrev_checked = False
         self._abbrev_match = None
         self._abbrev_match_len = 0
-        self.sentence_delim = None
-        self.eof = None
+        self.bos = None  # beginning of sentence
+        self.eos = None  # end of sentence
+        self.eof = None  # end of file
         self._URL_checked = False
         self._is_URL = None
 
         """Return True if any of the attributes are set which indicate a
         non-printing token.
         """
-        return self.sentence_delim or self.eof
+        return self.bos or self.eos or self.eof