Skip to content

Commit bddcc10

Browse files
committed
Added NodeInfo
1 parent 8c5effd commit bddcc10

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ stamp-h1
1414
*.lo
1515
*.bak
1616
*.tar.gz
17+
*.pyc
1718
autom4te.cache
1819
buildutils
1920
m4/libtool.m4

pyext/NodeInfo.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2011-2013, Take Vos
2+
# All rights reserved.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are met:
6+
#
7+
# - Redistributions of source code must retain the above copyright notice,
8+
# this list of conditions and the following disclaimer.
9+
# - Redistributions in binary form must reproduce the above copyright notice,
10+
# this list of conditions and the following disclaimer in the documentation
11+
# and/or other materials provided with the distribution.
12+
#
13+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23+
24+
class NodeInfo (object):
25+
def __init__(self, node_type=None, node_name=None, node_size=None, line_nr=None, column_nr=None, file_nr=None):
26+
self.node_type = node_type
27+
self.node_name = node_name
28+
self.node_size = node_size
29+
self.line_nr = line_nr
30+
self.column_nr = column_nr
31+
self.file_nr = file_nr
32+
33+
def location(self):
34+
return "%i:%i" % (self.line_nr, self.column_nr)
35+

0 commit comments

Comments
 (0)