Visual dbase

All questions regarding lexer highlighting schemes are discussed here...
senendds
Posts: 11
Joined: 06.03.2015 11:14

Post by senendds »

Here you have the exported lexer and a dummy source example.

In your lexer you are using ENDCLASS to detect the end of a procedure, but that doesn't always work, because procedures can be outside classes.

I've tried something similar that I thought could work, that is: using the 'EndClass' rule in my lexer as the "Range end condition" for the 'Procedure' rule. That doesn't work either.

The tree view with your lexer is 'weird' because

Code: Select all

class::Init()
is in fact a procedure call, not a class definition.

The lexer I've post, almost always work, the only problem is that I cannot collapse Procedures. And I afraid I don't get what 'Self closing range' really means.
Attachments
TESTLEXR.zip
Source example
(851 Bytes) Downloaded 48 times
lexer.Visual_dBase.zip
Exported lexer
(2.33 KiB) Downloaded 54 times
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

added folded Procedure/Define. OK now??
added comment "* and text"
What to fix? example file.
http://sourceforge.net/projects/synwrit ... p/download
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

My file. I solved folding by usin "Close block at file end", even for procedure out of class this closes procedure at end
senendds
Posts: 11
Joined: 06.03.2015 11:14

Post by senendds »

I've updated the lexer with your suggestions. Thank you for them. I've seen that instead of reusing the EndClass rule to close the Procedures (as I had tried first) you have defined a new EndClass-2 rule to do that. I've renamed that rule to EndProcedure, to better reflect its role.

Beside that, I've added rules for the "do case" blocks:

Code: Select all

do case some-expression
   case 1 ...
   case 2 ...
   otherwise...
endcase
and "do.. until" blocks:

Code: Select all

do
....
until some-condition
I've added support for the "else" "elseif" constructs, with proper collapsing behavior.

I've added a rule for "DEFINE" statements (which had nothing to do with Procedures, a define statement is the old way of constructing objects,that the visual editor of forms uses).

I've added a 'Properties' rule as an special case of 'Keywords' that list properties in classes predefined in the language.

And finally, I've added some token types and parsers to better deal with some cases (for instance, to distinguish between the "do case" and the "case" expressions in the example above).
Attachments
lexer.Visual_dBase.3.senen.zip
(2.98 KiB) Downloaded 47 times
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

note: (next update). Add name to NOTES tab of lexr. Not to lexer name (dbase.3.senen)
>>>Author: senen (email@)
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

\:[a-z]+\:
Name cannot have 1..9?

[a-z_0-9]+
same as \w+

close?\s+proc.*
better at end "\w*" , not .* (. is any)

appe(nd?)?\x20+blank
better at end "\b" so "blankname" is not ok
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

"define"-No end rule; u can put "define" to "proc" rule (proc rule finds procedure and define);
or can set "Initial closed" for it
senendds
Posts: 11
Joined: 06.03.2015 11:14

Post by senendds »

Alexey wrote:note: (next update). Add name to NOTES tab of lexr. Not to lexer name (dbase.3.senen)
>>>Author: senen (email@)
That was only to distinguish your lexer from mine while doing my tests. I didn't intend to distribute that...
senendds
Posts: 11
Joined: 06.03.2015 11:14

Post by senendds »

Alexey wrote:\:[a-z]+\:
Name cannot have 1..9?
If you mean in 'Database' parser, maybe it can. I haven't found any information regarding which characters are allowed there so we are using only alpha.
Alexey wrote: [a-z_0-9]+
same as \w+
Ok.
Alexey wrote: close?\s+proc.*
better at end "\w*" , not .* (. is any)
It can be any character, except new line.
Alexey wrote: appe(nd?)?\x20+blank
better at end "\b" so "blankname" is not ok
I've removed the parser and the rule. There is not real use for it.
Attachments
lexer.Visual_dBase.zip
(2.98 KiB) Downloaded 49 times
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Now at AddonManager- tks
Locked