Posted 21 years ago by shareeef
Avatar
Team,

Is there sample SyntaxEditor grammar to parse the Windows INI files. Is it easy to do something like the following?

[Section1]
Key1=Value1
Key2=Value2


[Section2]
Key1=Value1
Key3=Value3

Thanks a lot.

Comments (7)

Posted 21 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We don't have one defined right now but that would be very simple to create. I can add it to our TODO list. But if you make one first, send it over and maybe we can include it as a sample with our product.


Actipro Software Support

Posted 21 years ago by Steven Liu
Avatar
I happen to work with this type of format a lot. The trick is to look ahead to the next keyword. Here's a simple scope definition that may be a good starting point:

<Scope>
    <RegexPatternGroup Type="StartScope" Token="SectionStartToken" Style="SectionWordStyle" PatternValue="\[SECTION\d*\]" LookAhead="{NonWordMacro}" CaseSensitivity="Insensitive" />
    <RegexPatternGroup Type="EndScope" Token="SectionEndToken" Style="DefaultStyle" PatternValue="\n" LookAhead="[ \t\n]*\[SECTION\d*\]" CaseSensitivity="Insensitive" IsContentDivider="True" />
</Scope>
Hope it helps.

Also tech support answered quite a few question I asked recently regarding scopes without closing keywords. Browse thru the postings and you may find some useful info.

Steven Liu
Posted 21 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The next release now has an INI file definition.


Actipro Software Support

Posted 21 years ago by shareeef
Avatar
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Actipro Software Support:
The next release now has an INI file definition.<HR>


Thanks for the quick response...BTW when is the next release? Thanks :-)
Posted 21 years ago by shareeef
Avatar
Thanks Steven for your help...
Posted 21 years ago by shareeef
Avatar
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Actipro Software Support:
The next release now has an INI file definition.<HR>


The Better BNF for INI file is as follows:
file := [ \t\n]*, section+
section := '[',identifier,']', ts,'\n', body
body := statement*
statement := (ts,';',comment,'\n')/equality/nullline
nullline := ts,'\n'comment := -'\n'*
equality := ts, identifier,ts,'=',ts,identified,ts,'\n'
identifier := [a-zA-Z], [a-zA-Z0-9_]*
identified := ('"',string,'"')/number/identifier
ts := [ \t]*
char := -[\134"]+
number := [0-9eE+.-]+
string := (char/escapedchar)*
escapedchar := '\134"' / '\134\134'
Posted 21 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ours is pretty close to that. We plan on a release probably this week.


Actipro Software Support

The latest build of this product (v25.1.0) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.