Example #1
0
 def test2(self):
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "b"), False)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "c"), False)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "B"), False)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "abcdefgh"),
                      False)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "a"), True)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "abc"), True)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "aBc"), True)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "ABC"), True)
     self.assertEqual(tu.startswith_ignore_case("ABCdefg", "abcdefg"), True)
Example #2
0
 def get_block_comment_type(self, token):
     tokens = token.tokens
     if len(tokens) >= 3:
         comment = tokens[1].value
         if comment.strip() == "_SQL_ID_" or comment.strip(
         ) == "_SQL_IDENTIFIER_":
             return EngineComment.sql_identifier  # _SQL_IDENTIFIER_
         if tu.startswith_ignore_case(
                 comment, ("IF", "ELIF", "ELSE", "END", "BEGIN")):
             return EngineComment.syntax
         if comment.strip() == comment and (
                 not comment.startswith("*")) and (
                     not comment.startswith("+")):
             return EngineComment.param  # param
     return EngineComment.none
Example #3
0
 def get_block_comment_type(self, token):
     tokens = token.tokens
     if len(tokens) >= 3:
         comment = tokens[1].value
         first_char = comment[0]
         if first_char == " " or \
             re.compile("[a-z]", re.IGNORECASE).match(first_char) or \
             first_char == "^" or \
             first_char == "$" or \
             first_char == "#" or \
             first_char == "@" or \
             first_char == '"' or \
             first_char == "'":
             return EngineComment.param
         if first_char == "%":
             if tu.startswith_ignore_case(comment[1:], "expand"):
                 return EngineComment.param
             return EngineComment.syntax
     return EngineComment.none
Example #4
0
 def get_line_comment_type(self, token):
     cmm = token.token_next_by_type(0, T.Comment)
     comment = cmm.value[2:]
     if tu.startswith_ignore_case(comment.strip(), "ELSE"):
         return EngineComment.syntax
     return EngineComment.none