Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
366cec81
Commit
366cec81
authored
Oct 14, 2014
by
Maxime Perrotin
Browse files
Autocompletion on procedure call
parent
431602c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
ogAST.py
View file @
366cec81
...
...
@@ -689,6 +689,9 @@ class TextArea(object):
'-- Syntax: DCL <variable name> <type name>;
\n\n
'
# DCL variables in the text area {name: (sort, default_value), ...}
self
.
variables
=
{}
# fpar and timers are also listed, useful when using autocompletion
self
.
fpar
=
[]
self
.
timers
=
[]
self
.
line
=
None
self
.
charPositionInLine
=
None
# Set default coordinates and width/height
...
...
ogParser.py
View file @
366cec81
...
...
@@ -2266,11 +2266,13 @@ def text_area_content(root, ta_ast, context):
errors
.
append
(
'Duplicate declaration of FPAR section'
)
else
:
context
.
fpar
=
params
ta_ast
.
fpar
=
params
except
AttributeError
:
errors
.
append
(
'Only procedures can have an FPAR section'
)
elif
child
.
type
==
lexer
.
TIMER
:
context
.
timers
.
extend
(
timer
.
text
.
lower
()
for
timer
in
child
.
children
)
timers
=
[
timer
.
text
.
lower
()
for
timer
in
child
.
children
]
context
.
timers
.
extend
(
timers
)
ta_ast
.
timers
=
timers
else
:
warnings
.
append
(
'Unsupported construct in text area content, type: '
+
...
...
sdlSymbols.py
View file @
366cec81
...
...
@@ -648,6 +648,7 @@ class ProcedureCall(VerticalSymbol):
''' Set auto-completion list '''
return
chain
((
proc
.
inputString
for
proc
in
CONTEXT
.
procedures
),
variables_autocompletion
(
self
),
CONTEXT
.
timers
,
CONTEXT
.
global_timers
,
(
'set_timer'
,
'reset_timer'
,
'write'
,
'writeln'
))
...
...
@@ -659,7 +660,6 @@ class TextSymbol(HorizontalSymbol):
# Define reserved keywords for the syntax highlighter
blackbold
=
SDL_BLACKBOLD
redbold
=
SDL_REDBOLD
#completion_list = set()
def
__init__
(
self
,
ast
=
None
):
''' Create a Text Symbol '''
...
...
@@ -678,11 +678,11 @@ class TextSymbol(HorizontalSymbol):
self
.
parser
=
ogParser
def
update_completion_list
(
self
,
pr_text
):
''' When text was entered, update
TASK completion list
'''
''' When text was entered, update
list of variables/FPAR/Timers
'''
# Get AST for the symbol
ast
,
_
,
_
,
_
,
_
=
self
.
parser
.
parseSingleElement
(
'text_area'
,
pr_text
)
CONTEXT
.
variables
.
update
(
ast
.
variables
)
#Task.completion_list |= {dcl for dcl in ast.variables.keys()}
CONTEXT
.
timers
=
list
(
set
(
CONTEXT
.
timers
+
ast
.
timers
))
try
:
CONTEXT
.
fpar
.
extend
(
ast
.
fpar
)
except
AttributeError
:
...
...
Write
Preview
Supports
Markdown
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