Python pygments.token.String.Double() Examples

The following are 6 code examples of pygments.token.String.Double(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygments.token.String , or try the search function .
Example #1
Source File: test_basic.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_can_recover_after_unterminated_string(lexer):
    assert_tokens_match(lexer,
                        '"x\nx',
                        ((String.Double, '"'), (String.Double, 'x'),
                         (Error, '\n'), (Name, 'x'))) 
Example #2
Source File: test_lexer.py    From http-prompt with MIT License 5 votes vote down vote up
def test_header_option_value(self):
        self.assertEqual(self.get_tokens('Accept:`echo "application/json"`'), [
            (Name, 'Accept'),
            (Operator, ':'),
            (Text, '`'),
            (Name.Builtin, 'echo'),
            (String.Double, '"application/json"'),
            (Text, '`'),
        ]) 
Example #3
Source File: test_lexer.py    From http-prompt with MIT License 5 votes vote down vote up
def test_httpie_post_pipe(self):
        self.assertEqual(self.get_tokens('httpie post | tee "/tmp/test"'), [
            (Keyword, 'httpie'),
            (Keyword, 'post'),
            (Operator, '|'),
            (Text, 'tee'),
            (String.Double, '"/tmp/test"'),
        ]) 
Example #4
Source File: test_lexer.py    From http-prompt with MIT License 5 votes vote down vote up
def test_post_pipe(self):
        self.assertEqual(self.get_tokens('post | tee "/tmp/test"'), [
            (Keyword, 'post'),
            (Operator, '|'),
            (Text, 'tee'),
            (String.Double, '"/tmp/test"'),
        ]) 
Example #5
Source File: sourcewindow.py    From dcc with Apache License 2.0 4 votes vote down vote up
def actionRename(self):
        cursor = self.textCursor()
        start = cursor.selectionStart()
        end = cursor.selectionEnd()
        selection = cursor.selectedText()
        log.debug("Rename asked for '%s' (%d, %d)" %
                        (selection, start, end))

        if start not in list(self.doc.binding.keys()):
            self.mainwin.showStatus("Rename not available. No info for: '%s'." %
                                    selection)
            return

        # Double check if we support the renaming for the type of
        # object before poping a new window to the user
        t = self.doc.binding[start]
        if t[0] == 'NAME_METHOD_PROTOTYPE':
            class_ = self.current_class
            method_ = t[1]
            if method_ == self.title:
                method_ = 'init'
            log.debug(
                "Found corresponding method: %s -> %s in source file: %s" %
                (class_, method_, self.current_filename))
        elif t[0] == 'NAME_METHOD_INVOKE':
            class_, method_ = t[2].split(' -> ')
            if class_ == 'this':
                class_ = self.current_class
            log.debug(
                "Found corresponding method: %s -> %s in source file: %s" %
                (class_, method_, self.current_filename))
        elif t[0] == 'NAME_PROTOTYPE':
            class_ = t[2] + '.' + t[1]
            log.debug("Found corresponding class: %s in source file: %s" %
                            (class_, self.current_filename))
        elif t[0] == 'NAME_FIELD':
            field_ = t[1]
            log.debug("Found corresponding field: %s in source file: %s" %
                            (field_, self.current_filename))
        else:
            self.mainwin.showStatus(
                "Rename not available. Info ok: '%s' but object not supported."
                % selection)
            return

        rwin = RenameDialog(parent=self,
                            win=self.mainwin,
                            element=selection,
                            info=(start, end))
        rwin.show() 
Example #6
Source File: sourcewindow.py    From MARA_Framework with GNU Lesser General Public License v3.0 4 votes vote down vote up
def actionRename(self):
        cursor = self.textCursor()
        start = cursor.selectionStart()
        end = cursor.selectionEnd()
        selection = cursor.selectedText()
        androconf.debug("Rename asked for '%s' (%d, %d)" %
                        (selection, start, end))

        if start not in self.doc.binding.keys():
            self.mainwin.showStatus("Rename not available. No info for: '%s'." %
                                    selection)
            return

        # Double check if we support the renaming for the type of
        # object before poping a new window to the user
        t = self.doc.binding[start]
        if t[0] == 'NAME_METHOD_PROTOTYPE':
            class_ = self.current_class
            method_ = t[1]
            if method_ == self.title:
                method_ = 'init'
            androconf.debug(
                "Found corresponding method: %s -> %s in source file: %s" %
                (class_, method_, self.current_filename))
        elif t[0] == 'NAME_METHOD_INVOKE':
            class_, method_ = t[2].split(' -> ')
            if class_ == 'this':
                class_ = self.current_class
            androconf.debug(
                "Found corresponding method: %s -> %s in source file: %s" %
                (class_, method_, self.current_filename))
        elif t[0] == 'NAME_PROTOTYPE':
            class_ = t[2] + '.' + t[1]
            androconf.debug("Found corresponding class: %s in source file: %s" %
                            (class_, self.current_filename))
        elif t[0] == 'NAME_FIELD':
            field_ = t[1]
            androconf.debug("Found corresponding field: %s in source file: %s" %
                            (field_, self.current_filename))
        else:
            self.mainwin.showStatus(
                "Rename not available. Info ok: '%s' but object not supported."
                % selection)
            return

        rwin = RenameDialog(parent=self,
                            win=self.mainwin,
                            element=selection,
                            info=(start, end))
        rwin.show()