| Server IP : 103.243.232.44 / Your IP : 216.73.216.237 Web Server : LiteSpeed System : Linux server17213-10344.hostycare.online 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64 User : iamakash ( 1400) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib64/gedit/plugins/externaltools/__pycache__/ |
Upload File : |
a
A�T`� � @ sd d dl Z G dd� d�ZG dd� d�ZG dd� de�ZG dd � d e�Zd
ZdZdZd
Z dZ
dZdZdS )� Nc @ s e Zd ZdZdd� Zdd� ZdS )�Linka
This class represents a file link from within a string given by the
output of some software tool. A link contains a reference to a file, the
line number within the file and the boundaries within the given output
string that should be marked as a link.
c C s* || _ t|�| _t|�| _|| _|| _dS )a6
path -- the path of the file (that could be extracted)
line_nr -- the line nr of the specified file
col_nr -- the col nr of the specific file
start -- the index within the string that the link starts at
end -- the index within the string where the link ends at
N)�path�int�line_nr�col_nr�start�end)�selfr r r r r � r
�5/usr/lib64/gedit/plugins/externaltools/linkparsing.py�__init__ s
z
Link.__init__c C s d| j | j| j| j| jf S )Nz%s[%s][%s](%s:%s))r r r r r �r r
r
r �__repr__, s �z
Link.__repr__N)�__name__�
__module__�__qualname__�__doc__r r r
r
r
r r s r c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�
LinkParseraL
Parses a text using different parsing providers with the goal of finding one
or more file links within the text. A typical example could be the output
from a compiler that specifies an error in a specific file. The path of the
file, the line nr and some more info is then returned so that it can be used
to be able to navigate from the error output in to the specific file.
The actual work of parsing the text is done by instances of classes that
inherits from AbstractLinkParser or by regular expressions. To add a new
parser just create a class that inherits from AbstractLinkParser and then
register in this class cunstructor using the method add_parser. If you want
to add a regular expression then just call add_regexp in this class
constructor and provide your regexp string as argument.
c C sP g | _ | �t� | �t� | �t� | �t� | �t� | �t� | �t� d S �N) �
_providers�
add_regexp�REGEXP_STANDARD�
REGEXP_PYTHON�REGEXP_VALAC�REGEXP_BASH�REGEXP_RUBY�REGEXP_PERL�
REGEXP_MCSr
r
r
r r A s
zLinkParser.__init__c C s | j �|� d S r )r �append)r �parserr
r
r �
add_parserK s zLinkParser.add_parserc C s | � t|�� dS )a�
Adds a regular expression string that should match a link using
re.MULTILINE and re.VERBOSE regexp. The area marked as a link should
be captured by a group named lnk. The path of the link should be
captured by a group named pth. The line number should be captured by
a group named ln. To read more about this look at the documentation
for the RegexpLinkParser constructor.
N)r �RegexpLinkParser)r Zregexpr
r
r r N s zLinkParser.add_regexpc C s4 |du rt d��g }| jD ]}|�|�|�� q|S )a[
Parses the given text and returns a list of links that are parsed from
the text. This method delegates to parser providers that can parse
output from different kinds of formats. If no links are found then an
empty list is returned.
text -- the text to scan for file links. 'text' can not be None.
Nztext can not be None)�
ValueErrorr �extend�parse)r �text�linksZproviderr
r
r r$ Y s
zLinkParser.parseN)r r r r r r r r$ r
r
r
r r 1 s
r c @ s e Zd ZdZdd� ZdS )�AbstractLinkParserz)The "abstract" base class for link parsesc C s t d��dS )a�
This method should be implemented by subclasses. It takes a text as
argument (never None) and then returns a list of Link objects. If no
links are found then an empty list is expected. The Link class is
defined in this module. If you do not override this method then a
NotImplementedError will be thrown.
text -- the text to parse. This argument is never None.
z need to implement a parse methodN)�NotImplementedError)r r% r
r
r r$ p s
zAbstractLinkParser.parseN)r r r r r$ r
r
r
r r'