Functions are not Recognised correctly (FORTH)
Re: Functions are not Recognised correctly (FORTH)
i will try to setup a example File.
Re: Functions are not Recognised correctly (FORTH)
Here is a example file wrapping up all i know about forth in the moment.
I hope it helps a bit.
I hope it helps a bit.
Code: Select all
\ General Information:
\ Every code item has to be separated by a space. Otherwise it is part of a Function- or Variablename.
\ Functions:
: Name Functioncode ;
\ Functions starting with : and trailing space or simply a : because the space would be the delimiter.
: :Name Functioncode ;
\ Would be the same as above but now the second : is part of the Function name.
\ The first word after : and a whitespace is a Function name so a empty Function would be
: Empty-Function ;
\ Every Possible Character could be part of the Funtion name as long as the name is not separated by a space
\ Worst example for a Function name would be:
: /\][~!°?^{ ;
\ But it would be correct because there is no space between the Characters.
: correct?name ; \ not separated the whole word is taken as name despite the question mark
: incorrect name ; \ separated. And the "name" would now be recognised as code of the function "incorrect"
\ Variables:
\ Variables are similar to functions but are indicated by the word Variable.
Variable Name_of_the_Variable \ this Variable is already supported by Zeus
Variable V$name \ I personaly use V$ as name beginning only for readability
\ Same goes for Constants
Constant This-is-a-Constant
Constant C$name
\ Picking up Variables is working fine in Beta 6 as long as there are no special Charakters. So the given V$name and C$name Objects are not read. But for me this would be helpful
\ For comments there are two types used by native Forth wich are ( ) for Block Comment and \ for line comment. As always, to take effect these have to be within Spaces
: (noComment) ( Comment ) \ Comment
\ The comment issue in this case is solved as from Beta6 but the Function name is not tagged due to the special Charakters
\ Here are some Coding examples:
: Hello ." Hello World" . ; \ Already Working.
: !test 10 V$Variable ! ; \ here ! is the expression to store the value 10 into the variable. but it is also used in the function name
: @test V$Variable @ . ; \ in this example @ is on one side part of the function name on the other side with spaces it is a fetch opperator. the Single point with spaces is the print opperator
\ Here is a little Case Function
VARIABLE V$Number
: wich-number? ( n1 - ) \ Function name with Stack info comment
DUP V$Number ! \ Dupplicate the last Stack item and put one stack item in the Variable
CASE \ get the next stack item for the Case decision
0 OF ." it was " V$Number @ . ENDOF \ decide the case, fetch and print the content of the Variable
1 OF ." it was " V$Number @ . ENDOF \ ...
ENDCASE \ end the Case
;
\ Strings:
\ As said earlyer in the thread here are the different String delimiters.
," <string>"
,\" <string>"
,U" <string>"
,U\" <string>"
,Z" <string>"
,Z\" <string>"
C\" <string>"
S\" <string>"
Z" <string>"
Z\" <string>"
." <string>"
Re: Functions are not Recognised correctly (FORTH)
Thanks for the test file.
Could you try this new xtags found in the link below:
http://www.zeusedit.com/z300/xtags.zip
I tested this using a new workspace and your test file.
Let me know if this is any better.
Cheers Jussi
PS: Your test file also highlighted a few Zeus painting issues that I will also look into.
Could you try this new xtags found in the link below:
http://www.zeusedit.com/z300/xtags.zip
I tested this using a new workspace and your test file.
Let me know if this is any better.
Cheers Jussi
PS: Your test file also highlighted a few Zeus painting issues that I will also look into.
Re: Functions are not Recognised correctly (FORTH)
As to the painting issues, the painting went astray with this line of code from the test file:
: /\][~!°?^{ ;
For me, the Zeus FORTH configuration defines { as the start of a is a block comment and hence the reason for the errant painting.
So this is working as designed and is just a limitation of the Zeus parser.
To highlight the string portion just add the " character to the String entry field, in the Keywords section of the Document Type.
Cheers Jussi
: /\][~!°?^{ ;
For me, the Zeus FORTH configuration defines { as the start of a is a block comment and hence the reason for the errant painting.
So this is working as designed and is just a limitation of the Zeus parser.
I think the best Zeus can do is identify the "string" portion, but not the different types of strings.\ As said earlier in the thread here are the different String delimiters.
," <string>"
,\" <string>"
,U" <string>"
,U\" <string>"
,Z" <string>"
,Z\" <string>"
C\" <string>"
S\" <string>"
Z" <string>"
Z\" <string>"
." <string>"
To highlight the string portion just add the " character to the String entry field, in the Keywords section of the Document Type.
Cheers Jussi
Re: Functions are not Recognised correctly (FORTH)
I set up the String Portion as you said. It works fine so far.
Next Step i did was to erase { } as Block comments. Wich went fairly well. Another thing is these type of Block comment is not standard Forth but Swift Forth. ( I Noticed this yesterday by looking into the Swift Forth Documentary )
As for the Tags. It is now working like a charm. Only thing is with the Constants. I missed to say that for a Constant declaration there has to be a Value before Constant.
Like:
It is Quite nice that the Constants are summarized in the Macros tab. Makes it more easy to work with them.
Thank you for your effort in changing the Editor for Forth.
Next Step i did was to erase { } as Block comments. Wich went fairly well. Another thing is these type of Block comment is not standard Forth but Swift Forth. ( I Noticed this yesterday by looking into the Swift Forth Documentary )
As for the Tags. It is now working like a charm. Only thing is with the Constants. I missed to say that for a Constant declaration there has to be a Value before Constant.
Like:
Code: Select all
00101000 CONSTANT C$Binary
Thank you for your effort in changing the Editor for Forth.
Re: Functions are not Recognised correctly (FORTH)
Thanks for that information I will fix this in the Zeus installer.these type of Block comment is not standard Forth but Swift Forth
for a Constant declaration there has to be a Value before Constant.
The new xtags found here should fix this: http://www.zeusedit.com/z300/xtags.zip
This version will see these as constants:
Code: Select all
\ These are Constants
00101000 Constant This-is-a-Constant
00101000 Constant C$name
00101000 CONSTANT C$Binary
Code: Select all
\ These ARE NOT Constants
Constant C$name1
CONSTANT C$Binary1
Constant This-is-a-Constant1
Re: Functions are not Recognised correctly (FORTH)
Works fine. Thank you.