|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Need help with simple grammarHello.
I want to color following syntax: block start: ^(#if) (.*)$ block end: ^(#fi).*$ I want: - #if and #fi to be paired (it's trivial, just set region01 and region11) -between start and end is top level scheme (so such blocks can be nested, no problems here) - (.*) must be colored according to it's own scheme (and here is the problem: i can't write scheme which wont jump over '\n') Current hrc is like this: scheme top: block: start: ^#if end: ^#fi.*$ scheme: q scheme q: //additional scheme to apply some scheme to (.*) block: start: ^. end: ^\M#fi scheme: top block: start: .?#1 end: $ scheme: w scheme w: //of course real scheme will be more complex match: . region0: red priority: low But scheme w just eats everything, how can i deny it eating a newline? ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ colorer-talks mailing list colorer-talks@... https://lists.sourceforge.net/lists/listinfo/colorer-talks |
|
|
Re: Need help with simple grammarDmitry,
It's quite difficult to find out the syntax you want to describe. Could you please provide some samples on what you want to parse? Its not clear from the above why you want to handle "w" scheme separately from "q". -- Igor On 2/25/07, Dmitry Ivankov <divanorama@...> wrote: > Hello. > I want to color following syntax: > block start: ^(#if) (.*)$ > block end: ^(#fi).*$ > I want: > - #if and #fi to be paired (it's trivial, just set region01 and region11) > -between start and end is top level scheme (so such blocks can be nested, no > problems here) > - (.*) must be colored according to it's own scheme (and here is the > problem: i can't write scheme which wont jump over '\n') > > Current hrc is like this: > scheme top: > block: > start: ^#if > end: ^#fi.*$ > scheme: q > > scheme q: //additional scheme to apply some scheme to (.*) > block: > start: ^. > end: ^\M#fi > scheme: top > block: > start: .?#1 > end: $ > scheme: w > > scheme w: //of course real scheme will be more complex > match: . > region0: red > priority: low > > But scheme w just eats everything, how can i deny it eating a newline? > -- Igor ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ colorer-talks mailing list colorer-talks@... https://lists.sourceforge.net/lists/listinfo/colorer-talks |
|
|
Re: Need help with simple grammarOk, it's c++ like preprocessor with separate syntax for conditions (more limited than in non preprocessor text)
Full structure: ... #if (a == b) && c ... #elseif !(a) ... #elseif !b || !c ... #else ... #endif ... "#else", and "#elseif" lines are optional Looks like i've found a solution: add block (".?!", "\M#endif") to scheme of E (syntax for conditions), and add auxiliary scheme F scheme T: keywords, braces, etc..., block("#if", "#endif", E) //main scheme scheme E: other keywords, braces, block(".?!", "\M#endif", F) //preprocessor conditions scheme F: inherits T, block("#elseif", "\M#endif", E), block("#else", "\M#endif", T) //auxiliary scheme Can it be done in more elegantly? I don't like those "\M#endif" ends ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ colorer-talks mailing list colorer-talks@... https://lists.sourceforge.net/lists/listinfo/colorer-talks |
|
|
Re: Need help with simple grammarOk, think your implementation will work, however you should check it
agains recursive constructions. I don't think you'll be able to remove these \M, since your construction is quite irregular and definitely requires such a hacks. On 2/25/07, Dmitry Ivankov <divanorama@...> wrote: > Ok, it's c++ like preprocessor with separate syntax for conditions (more > limited than in non preprocessor text) > > Full structure: > ... > #if (a == b) && c > ... > #elseif !(a) > ... > #elseif !b || !c > ... > #else > ... > #endif > ... > > "#else", and "#elseif" lines are optional > Looks like i've found a solution: add block (".?!", "\M#endif") to scheme of > E (syntax for conditions), and add auxiliary scheme F > > scheme T: keywords, braces, etc..., block("#if", "#endif", > E) //main scheme > scheme E: other keywords, braces, block(".?!", "\M#endif", F) > //preprocessor conditions > scheme F: inherits T, block("#elseif", "\M#endif", E), block("#else", > "\M#endif", T) //auxiliary scheme > > Can it be done in more elegantly? I don't like those > "\M#endif" ends > -- Igor ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ colorer-talks mailing list colorer-talks@... https://lists.sourceforge.net/lists/listinfo/colorer-talks |
| Free Forum Powered by Nabble | Forum Help |