Giter VIP home page Giter VIP logo

cuda_tree_pascal's People

Contributors

artem3213212 avatar alexey-t avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

cudatext-addons

cuda_tree_pascal's Issues

class?

Ощущение что нужен класс и доступ к полям по
if self.nnn == ...
вместо "глобал нн"

Workaround for parser issue with Ifdef's

regexpr.pas - парсер показыват вложенные TRegexpr.NNN внутри ф-ции ParseAtom

идея - при доходе парсера до "funcion N.N" закрывать всю вложенность и парсить этот узел для N.N как будто он найден в корне.

need support for "interface"

tests/jsonreader.pp

line
IJSONConsumer = Interface ['{60F9D640-2A69-4AAB-8EE1-0DB6DC614D27}']

можно на этап 2.

my fixing (not 100% ok) for broken tree

@Artem3213212
to fix
Alexey-T/CudaText#3209
I made a change.

def std_block_parse(var_at_begin=False,LowStop=False):
    if var_at_begin:
        vars = var_block_parse()
    else:
        vars = []
    TO_SKIP = ['class','interface']
    z=[]
    funcreg=[]
    while not ended:
        s = get().lower()
        begin_pos = line
        if s in TO_SKIP:
            continue
        if s == '[':
            while not ended and get()!=']':
                pass
        elif s.lower() == 'implementation':
            z+=std_block_parse()
        elif s.lower() == 'uses':
....

tree is better now - missed class is here.
but parasitic "var" block appered.

Screenshot from 2021-03-03 00-45-20

Oper +=

Нашёл два места где можно юзать этот оп, по регулярке можеш найти ещё

bug-3

ATFlatControls - atstatusbar.pas
wrong "const-var" nodes: ARect, AValue

screenshot from 2018-08-05 15-45-19

Inline

Regexpr.pas

Показывает глоб вар «inline”

need const

константы называют обычно КАПСОМ.
Нужна еше одна-
FUNCS = ['function', 'procedure', 'constructor', 'destructor']

const in wrong level

const залезла в класс (не должна).
screenshot from 2018-08-06 21-50-56

at__jsonscanner.pp from ATSynEdit_Ex

optim

 self.queue.put(tuple(['',(0,0),(0,0),True]))

короче писать как

 self.queue.put( ('',(0,0),(0,0),True) )

wrong nodes TName.Method

jsonconf.pp

узлы видны
TJsonConfig.NNNNN
надо же чтобы они были не отдельные узлы а чтобы клик по старым NNNN внутри TJsonConfig клал каретку на тело ф-ции.

Тоже самое в atsynedit_form_complete_synwrite.pas
видно TAcp.DoLoadNnnn

Go to implement

Лучше кликом в дереве по методу класса переходить на _реализацию ф-ций а не на class def
e.g. tests/dumpclass.pp

Improve ranges

Заметил что клики в Пас файлах не меняют положение в дереве. смотрю что дает хелпер. он дает такие узкие ranges, что Куд не может их найти по позиции каретки

пример файла

unit formkey;
....

function DoCommandDialog(AEdit: TATSynEdit): integer;
begin
  Result:= 0;
  with TfmCmd.Create(nil) do
  try
    edit:= AEdit;
    if ShowModal=mrOk then
      if List.Selected<>nil then
        Result:= StrToIntDef(List.Selected.SubItems[2], 0);
  finally
    Free
  end;
end;
...
procedure TfmCmd.ListDblClick(Sender: TObject);
begin
  //ModalResult:= mrOk;
end;

end.

ranges

[((2, 7, 9, 7), 1, 'uses', 0), ((2, 7, 9, 7), 2, 'Classes', 4), ((11, 7, 19, 7), 2, 'SysUtils', 4), ((21, 7, 29, 7), 2, 'FileUtil', 4), ((31, 7, 36, 7), 2, 'Forms', 4), ((38, 7, 46, 7), 2, 'Controls', 4), ((48, 7, 56, 7), 2, 'Graphics', 4), ((58, 7, 65, 7), 2, 'Dialogs', 4), ((67, 7, 75, 7), 2, 'comctrls', 4), ((2, 8, 13, 8), 2, 'ButtonPanel', 4), ((15, 8, 24, 8), 2, 'ATSynedit', 4), ((2, 33, 7, 33), 2, 'Menus', 4), ((9, 33, 16, 33), 2, 'LCLProc', 4), ((2, 26, 7, 26), 1, 'var/const', 2), ((2, 26, 7, 26), 2, 'fmCmd', 7), ((2, 13, 8, 13), 1, 'TfmCmd', 1), ((4, 14, 16, 14), 2, 'var/const', 2), ((4, 14, 16, 14), 3, 'ButtonPanel1', 7), ((4, 15, 8, 15), 3, 'List', 7), ((4, 22, 8, 22), 3, 'edit', 7), ((0, 53, 9, 53), 2, 'FormShow', 5), ((2, 55, 3, 55), 3, 'var/const', 2), ((2, 55, 3, 55), 4, 'i', 7), ((0, 71, 9, 71), 2, 'ListDblClick', 5), ((0, 37, 8, 37), 1, 'DoCommandDialog', 5)]

видим что для ListDblClick - range это слово procedure И ВСЕ!
для DoCommandsDialog - слово function И ВСЕ.
можно дать БОЛЬШИЕ ranges?

make consts for icon indexes

надо сделать консты для индексов иконок-
ICON_USES = тут уже можно менять число
ICON_CLASS =
ICON_PROPERTY =
ICON_INTERFACE =
ICON_VAR =
ICON_FUNC =

чтобы твикатть числа потом.

shorter cmp

if len(uses)!=0:

в Пи есть неявное приведение к Бул. можно писать

if uses:

это как проверка на None, '', 0, []

crash..

ATSynedit/ .. / atsynedit_form_complete_synwrite.pas

Startup: total: 1010ms, including plugins: 16ms
Python 3.6.5
TreeHelpers: Markdown, PHP, Pascal
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 100, in on_open
    self.check_and_update(ed_self)
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 94, in check_and_update
    self.update_tree(lexer)
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 62, in update_tree
    heads = list(getter(filename, lines))
  File "/home/user/.cudatext/py/cuda_tree_pascal/__init__.py", line 282, in get_headers
    main_data=std_block_parse()
  File "/home/user/.cudatext/py/cuda_tree_pascal/__init__.py", line 50, in std_block_parse
    zz+=[(z[0][0],z[0][1],5,z[1:]+begin_block_parse())]
IndexError: list index out of range
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 97, in on_change_slow
    self.check_and_update(ed_self)
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 94, in check_and_update
    self.update_tree(lexer)
  File "/home/user/.cudatext/py/cuda_tree/__init__.py", line 62, in update_tree
    heads = list(getter(filename, lines))
  File "/home/user/.cudatext/py/cuda_tree_pascal/__init__.py", line 282, in get_headers
    main_data=std_block_parse()
  File "/home/user/.cudatext/py/cuda_tree_pascal/__init__.py", line 50, in std_block_parse
    zz+=[(z[0][0],z[0][1],5,z[1:]+begin_block_parse())]
IndexError: list index out of range

wrong node for 'const'

FPC's unit regexpr.pas
tree shows: TRegExpr / var-const /

  • AReplaceStr
  • AUseSubstitution
    but they are func params of Replace(). not const of class.
    function Replace (Const AInputStr : RegExprString;
      const AReplaceStr : RegExprString;
      AUseSubstitution : boolean{$IFDEF DefParam}= False{$ENDIF}) //###0.946
     : RegExprString; {$IFDEF OverMeth} overload;
    function Replace (Const AInputStr : RegExprString;
      AReplaceFunc : TRegExprReplaceFunction)
     : RegExprString; overload;

codetree sync bug

FPC's regexpr.pas
кажется неверные диапазоны кое где.

  • кликкаю на строку в коде function ExecRegExpr - дерево переходит ее ноде - ОК
  • кликаю на слово RegExprInvertCaseFunction в коде
const
  RegExprInvertCaseFunction : TRegExprInvertCaseFunction = {$IFDEF FPC} nil {$ELSE} TRegExpr.InvertCaseFunction{$ENDIF};
  // defaul for InvertCase property

дерево переходит куда-то не туда. а на ноду класса ERegExpr.

refactor get_next_work

     if s[i0][i1] in ['(',')','[',']','/','|','\\','@','#','=','>','<',':',';',',','.','$','+','-','*']:

список надо глобальную константу, напр. SYMBOLS.

s[i0] встреается 10+ раз- надо переменную

wrong on file jsonreader.pp

file in tests/ dir.

  • not shown class TBaseJsonReader
  • and TJsonEventReader
  • and TJSONConsumerReader
  • words "constructor", "overload" in var-const.

wrong in tests/regexpr

  • в конце дерева anon method TRegexpr.GetCompilerErPos ??
  • в конце еще ReturnAdddr хотя оно должно быто вложено в TRegexpr.Error

tree sync bug-2

FPC's regexpr.pp
кликаю на код
function Dump : RegExprString;

дерево не переходит никуда. кажется Dump в дереве нету

wrong global const

const n must be inside func.
screenshot from 2018-08-06 22-06-49

ATSynEdit/.../atsynedit_form_complete_synwrite.pas

Cud hangs with threads

завис Куды при открытии ( ui_reopen_session ) сессии с pas file.
так и думал что виснет Хелпер.
вот видно- у cuda_tree дергается евент, и потом Питон тред у тебя делает "лок"

#0 futex_abstimed_wait_cancelable(0, 0x0, 0, 0x11eda10) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1 do_futex_wait(0x11eda10, 0x11eda10) at sem_waitcommon.c:111
#2 __new_sem_wait_slow(0x11eda10) at sem_waitcommon.c:181
#3 PyThread_acquire_lock_timed at :0
#4 ?? at :0
#5 _PyCFunction_FastCallDict at :0
#6 ?? at :0
#7 _PyEval_EvalFrameDefault at :0
#8 _PyFunction_FastCallDict at :0
#9 _PyObject_FastCallDict at :0
#10 _PyObject_Call_Prepend at :0
#11 _PyObject_FastCallDict at :0
#12 PyObject_CallFunctionObjArgs at :0
#13 _PyEval_EvalFrameDefault at :0
#14 ?? at :0
#15 ?? at :0
#16 _PyEval_EvalFrameDefault at :0
#17 ?? at :0
#18 _PyEval_EvalFrameDefault at :0
#19 ?? at :0
#20 _PyEval_EvalFrameDefault at :0
#21 ?? at :0
#22 _PyEval_EvalFrameDefault at :0
#23 ?? at :0
#24 _PyEval_EvalFrameDefault at :0
#25 ?? at :0
#26 ?? at :0
#27 ?? at :0
#28 ?? at :0
#29 _PyObject_FastCallDict at :0
#30 ?? at :0
#31 _PyEval_EvalFrameDefault at :0
#32 ?? at :0
#33 ?? at :0
#34 _PyEval_EvalFrameDefault at :0
#35 ?? at :0
#36 _PyEval_EvalFrameDefault at :0
#37 ?? at :0
#38 _PyEval_EvalFrameDefault at :0
#39 ?? at :0
#40 PyEval_EvalCodeEx at :0
#41 PyEval_EvalCode at :0
#42 PyRun_StringFlags at :0
#43 RUN_COMMANDASOBJECTWITHDICT(0x7ffff7f8d210, 0x7fffe6065778 '_cudacmd_cuda_tree.on_cha'..., 258, 0x0, 0x0) at Sources/Core/PythonEngine.pas:5257
#44 RUN_COMMANDASOBJECT(0x7ffff7f8d210, 0x7fffe6065778 '_cudacmd_cuda_tree.on_cha'..., 258) at Sources/Core/PythonEngine.pas:5225
#45 RUN_COMMANDASSTRING(0x7ffff7f8d210, 0x7fffe6065778 '_cudacmd_cuda_tree.on_cha'..., 258) at Sources/Core/PythonEngine.pas:5218
#46 EVALSTRINGASSTR(0x7ffff7f8d210, 0x7fffe6065778 '_cudacmd_cuda_tree.on_cha'...) at Sources/Core/PythonEngine.pas:5200
#47 PY_EVALSTRINGASSTRING(0x7fffe6065778 '_cudacmd_cuda_tree.on_cha'...) at proc_py.pas:97
#48 PY_RUNPLUGIN_EVENT(0x7fffe637a398 'cuda_tree', 0x962958 'on_change_slow', 0x7fffe6570c50, 0x7fffffffe000, -1, false) at proc_py.pas:132
#49 DOPYEVENT(0x7ffff7fa1030, 0x7fffe6570c50, CEVENTONCHANGESLOW, 0x7fffffffe000, -1) at formmain_py_helpers.inc:109
#50 DOPYEVENT(0x7fffe65669d0, 0x7fffe6570c50, CEVENTONCHANGESLOW, 0x7fffffffe000, -1) at formframe.pas:2285
#51 TIMERCHANGETIMER(0x7fffe65669d0, 0x7fffe64c0a80) at formframe.pas:485
#52 DOONTIMER(0x7fffe64c0a80) at customtimer.pas:175
#53 TIMER(0x7fffe64c0a80) at customtimer.pas:150
#54 GTKTIMERCB(0x7fffe6512680) at gtk2/gtk2callback.inc:2703
#55 ?? at :0
#56 g_main_context_dispatch at :0
#57 ?? at :0
#58 g_main_context_iteration at :0
#59 APPWAITMESSAGE(0x7ffff7f64f30) at gtk2/gtk2widgetset.inc:2431
#60 IDLE(0x7ffff7f648f0, true) at include/application.inc:414
#61 HANDLEMESSAGE(0x7ffff7f648f0) at include/application.inc:1283
#62 RUNLOOP(0x7ffff7f648f0) at include/application.inc:1419
#63 APPRUN(0x7ffff7f64f30, {Proc = {procedure (POINTER)} 0x7fffffffe390, Self = 0x7ffff7f648f0}) at include/interfacebase.inc:54
#64 RUN(0x7ffff7f648f0) at include/application.inc:1407
#65 main at cudatext.lpr:35

enum types not shown

tests/jsonscanner.pp

now shown: TJsonToken = (...,...,...)
может енумам иконку другую дать.

too many s.lower()

you get "s" in lowercase, so next checks
if s.lower() == ... are not needeing .lower().
it's slowdown w/o need.

    while not ended:
        s = get().lower()
        begin_pos = line
        if s in TO_SKIP:
            continue
        if s == '[':
            while not ended and get()!=']':
                pass
        elif s.lower() == 'implementation':
            z+=std_block_parse()
        elif s.lower() == 'uses':
            uses_block_parse()
        elif s.lower() == 'type':
            z+=type_block_parse()
        elif s.lower() in ['const','resourcestring']:
            vars+=const_block_parse()
        elif s.lower() in ['var']+ACCESS_CONTROL:
            vars+=var_block_parse()
        elif s.lower() in FUNCS:
            vars.append(False)
            z+=function_parse(begin_pos,funcreg)
        elif s.lower() == 'property':
            z+=property_parse()
        elif s.lower() == 'begin':

CudaTree API change

кажется надо поменять апи.
сейчас АПИ дает тоьько "номер строки". и тогда CudaTree не поймет где кончается тело ф-ции.
давай я поменяю? вместо line_num можно туда давать

  • int (compatible)
  • tuple (x1, y1, x2, y2) (new)
    и ты заюзаешь новый формат. дашь туда диапазон для тела ф-ций

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.