Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
edf80cc7
Commit
edf80cc7
authored
Aug 06, 2014
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed python3 resources symlinks
parent
5fc0e5c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
306 additions
and
4 deletions
+306
-4
share/kumir2/python3language/analizer_instance.py
share/kumir2/python3language/analizer_instance.py
+100
-1
share/kumir2/python3language/analizer_instance.py
share/kumir2/python3language/analizer_instance.py
+100
-1
share/kumir2/python3language/kumir_constants.py
share/kumir2/python3language/kumir_constants.py
+53
-1
share/kumir2/python3language/kumir_constants.py
share/kumir2/python3language/kumir_constants.py
+53
-1
No files found.
share/kumir2/python3language/analizer_instance.py
deleted
120000 → 0
View file @
5fc0e5c2
/
home
/
victor
/
Projects
/
NIISI
/
kumir
/
python3_static_analyzer
/
analizer_instance
.
py
\ No newline at end of file
share/kumir2/python3language/analizer_instance.py
0 → 100644
View file @
edf80cc7
"""
Analizer instance module
NOTE: Each analizer instance runs in it's own interpreter
"""
from
kumir_constants
import
*
SOURCE_DIR_NAME
=
""
SOURCE_TEXT
=
""
ERRORS
=
[]
LINE_PROPERTIES
=
[]
LINE_RANKS
=
[]
class
Error
:
""" One error message """
def
__init__
(
self
,
line_no
,
start_pos
,
length
,
message
):
"""
line_no -- line number (int)
start_pos -- start position from 0 (int)
length -- error block length (int)
message -- a string (ASCII symbols only) identificating error message
"""
assert
isinstance
(
line_no
,
int
)
assert
isinstance
(
start_pos
,
int
)
assert
isinstance
(
length
,
int
)
assert
isinstance
(
message
,
str
)
self
.
line_no
=
line_no
self
.
start_pos
=
start_pos
self
.
length
=
length
self
.
message
=
message
def
set_source_dir_name
(
path
):
"""
Set the source file location (directory name) to help searching imported modules
path -- directory path in platform dependent format (str)
"""
assert
isinstance
(
path
,
str
)
global
SOURCE_DIR_NAME
SOURCE_DIR_NAME
=
path
def
set_source_text
(
text
):
"""
Set the source text and require complete analisis
text -- complete python program source; line delimiter is '
\n
' (str)
"""
assert
isinstance
(
text
,
str
)
global
SOURCE_TEXT
SOURCE_TEXT
=
text
def
get_errors
():
"""
Get a list of errors generated while 'set_source_text'
returns a list of Error class instances
"""
global
ERRORS
return
ERRORS
def
get_line_properties
():
"""
Get a list of line highlight properties generated while 'set_source_text'
returns a list:
- each item corresponds one text line
- each item is a list:
- each item corresponds one character in line
- each item is an integer number, see 'kumir_constants.py'
"""
global
LINE_PROPERTIES
return
LINE_PROPERTIES
def
get_line_ranks
():
"""
Get a list of line indentation ranks generated while 'set_source_text'
returns a list:
- each item corresponds one text line
- each item is a tuple (start, end), where:
- start is a line start indentation rank
- end is a terminal indentation rank
"""
global
LINE_RANKS
return
LINE_RANKS
def
get_line_property
(
line_no
,
line_text
):
"""
Get line property of one text line, currently editing and possible not complete
line_no -- editable line number (from 0)
line_text -- one text line while in edit progress
returns a list:
- each item corresponds one character in line
- each item is an integer number, see 'kumir_constants.py'
"""
assert
isinstance
(
line_no
,
int
)
assert
isinstance
(
line_text
,
str
)
return
[]
\ No newline at end of file
share/kumir2/python3language/kumir_constants.py
deleted
120000 → 0
View file @
5fc0e5c2
/
home
/
victor
/
Projects
/
NIISI
/
kumir
/
python3_static_analyzer
/
kumir_constants
.
py
\ No newline at end of file
share/kumir2/python3language/kumir_constants.py
0 → 100644
View file @
edf80cc7
"""
Kumir constants defining code highlighting
LxTypeEmpty -- typically used for spaces and other non-significant stuff
LxTypeComment -- comments starts with #
LxTypeName -- a 'generic' name lexem in case if there is not possible to
get name meaning
LxTypeSecondaryKwd -- 'secondary' keyword, which do not define statement type
Examples: in, as, is, and, or
LxTypePrimaryKwd -- 'primary' keyword, which defines statement type
Examples: def, for, import, from, with, global
LxTypeConstant -- a 'generic' constant in case if there is not possible to
get constant type
LxTypeOperator -- operator lexem
LxTypeError -- error lexem; it is optional flag
LxNameClass -- type or class name
LxNameVar -- local or global variable name
LxNameAlg -- function or method name
LxNameModule -- module name
LxConstInteger -- integer constant
LxConstReal -- floating-point constant
LxConstBoolTrue -- boolean True constant
LxConstBoolFalse -- boolean False constant
LxConstLiteral -- literal (char of string) constant
"""
LxTypeEmpty
=
0x00000000
# empty mask
LxTypeComment
=
0x00000001
# bit 0
LxTypeName
=
0x0000001C
# bits [2..4]
LxTypeSecondaryKwd
=
0x000001E0
# bits [5..8]
LxTypePrimaryKwd
=
0x0000F800
# bits [11..15]
LxTypeConstant
=
0x001E0000
# bits [17..20]
LxTypeOperator
=
0x01F00000
# bits [21..25]
LxTypeError
=
0x80000000
# bit 31
# LxTypeName values
LxNameClass
=
0x4
LxNameVar
=
0x8
LxNameAlg
=
0xc
LxNameModule
=
0x10
# LxTypeConstant values
LxConstInteger
=
0x20000
LxConstReal
=
0x40000
LxConstBoolTrue
=
0x60000
LxConstBoolFalse
=
0x80000
LxConstLiteral
=
0xa0000
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment