Please test https://www.mediafire.com/file/kowgygcu ... 31.7z/file, check if it fit your need~
FreeBasic IDE-poseidonFB(Update 2024.10.02)
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Aha! It almost works! Though it seems to only assume the first generated type is the "correct" one. The parser appears to stop at the macro name, ignoring the parameters. If possible, just assume the parameters are also a part of the type and it should work. Here's a simple test case to illustrate what I'm doing:Kuan Hsu wrote: ↑Sep 19, 2024 12:58 Please test https://www.mediafire.com/file/kowgygcu ... 31.7z/file, check if it fit your need~
Code: Select all
#macro GEN_TYPE(_NAME)
_NAME##_type
#endmacro
type GEN_TYPE(qwer)
dim x as integer
end type
type GEN_TYPE(asdf)
dim y as string
end type
type GEN_TYPE(zxcv)
dim z as single
end type
dim a as GEN_TYPE(qwer)
dim b as GEN_TYPE(asdf)
dim c as GEN_TYPE(zxcv)
'a. [pops up x]
'b. [pops up x] (should pop up y)
'c. [pops up x] (should pop up z)
'To be clear, I don't care if the following doesn't work:
'dim x as GEN_TYPE( qwer ) 'Note the spaces around the parenthesis
'dim y as gen_type(asdf) 'I assume case insensitive is built in to the IDE, but even if it's not, I don't care if this doesn't work either
'var z = cast(typeof(GEN_TYPE(zxcv), ...) 'I don't care about var assignments even with explicit casting either
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Yes, it should be works, but I need fix a lot of code to do, because in my original design, the type attribute of parsed node is store as TYPE (PARAMETERS_STRING), poseidon need split the attribute to get TYPE and PARAMETERS_STRING by open parentheses, in another word, the TYPE is without any parentheses in design.
In new case, I need change the split-rule or add a new parameter attribute in parsed node class(I prefer this one)
The declare variable parse rule need change:
dim as GEN_TYPE(qwer) a ' tokens is: Tdim Tas TIndentifier TopenParen Tidenifier TcloseParen Tidenifier
Original : A veriable, but after first TIndentifier(type name) should be TIndentifier also not TopenParen(no variable name start at open parenthese), Illegal!
dim as GEN_TYPE(qwer) a ' tokens is: Tdim Tas TIndentifier TopenParen Tidenifier TcloseParen Tidenifier
Fixed Mean: A veriable, type is TIndentifier TopenParen Tidenifier TcloseParen, name is Tidenifier
dim as GEN_TYPE(qwer)tail a(10) ' tokens is: Tdim Tas TIndentifier TopenParen Tidenifier TcloseParen Tidenifier Tidenifier TopenParen Tnumber TcloseParen
Mean: a bit complicated......
I never used Concatenation Macro before( QB hasn't, D hasn't, I don't like C so I use D ), it's a part of preprocessor, maybe I should do the parse the preprocessor and replace the tokens, but I don't want to Implement it in poseidonFB
Let me think if there is a better way or not, for now I'm sure I'll add a special option if i done this work...
-
- Posts: 254
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Is it possible to put a breakpoint in a line from IDE ?
i think that this it was possible in earlier versions but not now...
i think i moved the mouse pointer at the beginning of line and with left click i put a red disc-circle before line number...
do i remember wrong ?
i use Night theme color...
i think that this it was possible in earlier versions but not now...
i think i moved the mouse pointer at the beginning of line and with left click i put a red disc-circle before line number...
do i remember wrong ?
i use Night theme color...
-
- Posts: 254
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
as i see now i can place a Bookmark not a Breakpoint...demosthenesk wrote: ↑Sep 23, 2024 20:27 Is it possible to put a breakpoint in a line from IDE ?
i think that this it was possible in earlier versions but not now...
i think i moved the mouse pointer at the beginning of line and with left click i put a red disc-circle before line number...
do i remember wrong ?
i use Night theme color...
what is a Bookmark ?
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
If I had a D compiler I might attempt to implement this myself (but I don't and don't know D either), but I looked over the parser and the best I can come up with might look like this (in pseudo code):
parserFB.d around line 544 in getVariableType:
Code: Select all
...
case TOK.Tidentifier:
string _type;
//Do some special parsing if the token is a known macro.
//And maybe keep it behind an option you can turn on?
if( TOK is MACRO OR DEFINE ANDALSO parseMacroTypesOption is true) //Does the parser know if it's a macro/define at this point?
{
_type ~= token.identifier; //Start by appending the macro name
while( next().tok == TOK.Tcomma )
{
//Append each argument as-is
//Maybe have to remove whitespace too, but I'm not sure?
_type ~= token.identifier;
parseToken( TOK.Tidentifier );
//Skip over the comma or something
parseToken( TOK.Tcomma);
}
} // Do normal processing
while( next().tok == TOK.Tdot )
{
_type ~= token.identifier;
parseToken( TOK.Tidentifier );
_type ~= token.identifier;
parseToken( TOK.Tdot );
}
if( !_type.length ) _type = token.identifier;else _type ~= token.identifier;
}
return _type;
...
That said, I only spent about 30 minutes looking at the code, so I'm probably completely naive as to other changes needed.
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
As I said before, it need change the parse rule, please try and test:shadow008 wrote: ↑Sep 24, 2024 14:48 My guess (it really is only a guess) is that this will allow the "_type" to turn to something like "GEN_TYPEqwer". Perhaps it may need a unique identifier or something so maybe also add a prefix so it turns into "_macroID123GEN_TYPEqwer" or something.
That said, I only spent about 30 minutes looking at the code, so I'm probably completely naive as to other changes needed.
https://www.mediafire.com/file/45flttsi ... 32.7z/file
Except for var z = cast(typeof(GEN_TYPE(zxcv), ...), the others should be OK.
But var z = cast(GEN_TYPE(zxcv), ...) is worked. ( To use CAST to convert datatype, is necessary used TYPEOF? So I didn't modified the CAST parse rule )
Last edited by Kuan Hsu on Sep 25, 2024 1:45, edited 2 times in total.
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
1st: Run Debug,( the debug dialog will bottom-up )demosthenesk wrote: ↑Sep 23, 2024 20:27 Is it possible to put a breakpoint in a line from IDE ?
i think that this it was possible in earlier versions but not now...
i think i moved the mouse pointer at the beginning of line and with left click i put a red disc-circle before line number...
do i remember wrong ?
i use Night theme color...
2nd: Ctrl+Left click the line margin or Right-click the line margin
The bp mark is a red-rect after line-number
-
- Posts: 254
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
ok you put bp after run debugger.Kuan Hsu wrote: ↑Sep 24, 2024 16:541st: Run Debug,( the debug dialog will bottom-up )demosthenesk wrote: ↑Sep 23, 2024 20:27 Is it possible to put a breakpoint in a line from IDE ?
i think that this it was possible in earlier versions but not now...
i think i moved the mouse pointer at the beginning of line and with left click i put a red disc-circle before line number...
do i remember wrong ?
i use Night theme color...
2nd: Ctrl+Left click the line margin or Right-click the line margin
The bp mark is a red-rect after line-number
i tried to put bp before running debugger
...
now works
thanks
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Marked the bookmarks, quick jump to the bookmark; check the toolbar:
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
Yes! This works, at least on single file source codes. It has some difficulties working with the entirety of my project (60+ files). I'll keep fiddling with it to see if I can get it working everywhere, but for now, this will suffice. Thank you!Kuan Hsu wrote: ↑Sep 24, 2024 16:49 As I said before, it need change the parse rule, please try and test:
https://www.mediafire.com/file/45flttsi ... 32.7z/file
Re: FreeBasic IDE-poseidonFB(Update 2024.09.09)
OK, I still do some adjustments, I expect to commit an update this weekend, if you have any findings, please tell me, thanks~
About multifiles issue, I found where the bug is and will fix it
https://www.mediafire.com/file/cky4antr ... 33.7z/file
About multifiles issue, I found where the bug is and will fix it
https://www.mediafire.com/file/cky4antr ... 33.7z/file