|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
postscript style for source-hightlightHi
I recently discovered source-highlight, it appears to be a very useful program. However, when using the postscript.lang as a source language, it doesn't handle % within strings (%) correctly. eg, the following is treated as a comment and print is highlighted as such, where instead because % is inside ( ) it should be treated as part of a string. (%) print I first tried adding "string = '\(.*\)'" to postscript.lang, this suceeded in highlighting strings correctly, but % inside ( ) was still making the rest of the line a comment. I tried changing comment start "%" to comment start "(\(.*\))*(?=)%" but this appears to be wrong, as source-highlight prints the following: source-highlight: /usr/include/boost/shared_ptr.hpp:253: T* boost::shared_ptr<T>::operator->() const [with T = RegExpFormatter]: Assertion `px != 0' failed. Aborted Are there any gurus able to assist? Original message: Lorenzo Bettini wrote: Dirk Jagdmann wrote: Hello highlighters, I have hacked together a style file for postscript files. It is attached to this email. Use it along with the following lines in lang.map: ps = postscript.lang eps = postscript.lang Thanks a lot Dirk! :-) I'll add this file to the source-highlight distribution! cheers Lorenzo -- _______________________________________________ Help-source-highlight mailing list Help-source-highlight@... http://lists.gnu.org/mailman/listinfo/help-source-highlight |
|
|
Re: postscript style for source-hightlightjeffz@... wrote:
> Hi > Hi Jeff and welcome to the list > I recently discovered source-highlight, it appears to be a very useful > program. > > However, when using the postscript.lang as a source language, it doesn't > handle % within strings (%) correctly. > so (%) is to be considered as a string? in particular everything between ( and ) should be considered as a string? > eg, the following is treated as a comment and print is highlighted as > such, where instead because % is inside ( ) it should be treated as part > of a string. (%) print > > I first tried adding "string = '\(.*\)'" to postscript.lang, this > suceeded in highlighting strings correctly, but % inside ( ) was still > making the rest of the line a comment. mhh... probably because your definition comes after the definition of % comment? > > I tried changing comment start "%" to comment start "(\(.*\))*(?=)%" but > this appears to be wrong, as source-highlight prints the following: > > source-highlight: /usr/include/boost/shared_ptr.hpp:253: T* > boost::shared_ptr<T>::operator->() const [with T = RegExpFormatter]: > Assertion `px != 0' failed. > Aborted yes probably this generates a regular expression that's wrong... > > Are there any gurus able to assist? > Although I don't know postscript I can try to fix this problem. I'd need an input test file (in postscript) with % used in several context, i.e., when it should be treated as a comment and some examples of valid postscript strings (for instance, can ( ) strings be nested? can ( or ) be escaped?) hope to hear from you soon cheers Lorenzo P.S. yesterday I released 2.6 of source-highlight -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net _______________________________________________ Help-source-highlight mailing list Help-source-highlight@... http://lists.gnu.org/mailman/listinfo/help-source-highlight |
|
|
Re: postscript style for source-hightlightOn Sat, Mar 24, 2007 at 11:20:24AM +0100, Lorenzo Bettini wrote:
> jeffz@... wrote: > >Hi > > > > Hi Jeff and welcome to the list > Thanks > >I recently discovered source-highlight, it appears to be a very useful > >program. > > > >However, when using the postscript.lang as a source language, it doesn't > >handle % within strings (%) correctly. > > > > so (%) is to be considered as a string? > in particular everything between ( and ) should be considered as a string? Yes > >eg, the following is treated as a comment and print is highlighted as > >such, where instead because % is inside ( ) it should be treated as part > >of a string. (%) print > > > >I first tried adding "string = '\(.*\)'" to postscript.lang, this > >suceeded in highlighting strings correctly, but % inside ( ) was still > >making the rest of the line a comment. > > mhh... probably because your definition comes after the definition of % > comment? I put my string definition before the regular comment definition. > > > >I tried changing comment start "%" to comment start "(\(.*\))*(?=)%" but > >this appears to be wrong, as source-highlight prints the following: > > > >source-highlight: /usr/include/boost/shared_ptr.hpp:253: T* > >boost::shared_ptr<T>::operator->() const [with T = RegExpFormatter]: > >Assertion `px != 0' failed. > >Aborted > > yes probably this generates a regular expression that's wrong... > > > > >Are there any gurus able to assist? > > > > Although I don't know postscript I can try to fix this problem. > > I'd need an input test file (in postscript) with % used in several > context, i.e., when it should be treated as a comment and some examples > of valid postscript strings (for instance, can ( ) strings be nested? > can ( or ) be escaped?) > According to the PostScript Language Reference manual, a comment is defined as: "Any occurrence of the character % outside a string introduces a comment. The comment consists of all characters between the % and the next newline or form feed, including regular, delimiter, space, and tab characters." again, referring to the red book on strings: "Literal Text Strings A literal text string consists of an arbitrary number of characters enclosed in ( and ). Any characters may appear in the string other than (, ), and \, which must be treated specially. Balanced pairs of parentheses in the string require no special treatment. The following lines show several valid strings: (This is a string) (Strings may contain newlines and such.) (Strings may contain special characters *!&}^% and balanced parentheses ( ) (and so on).) (The following is an empty string.) () (It has 0 (zero) length.) Within a text string, the \ (backslash) character is treated as an “escape” for various purposes, such as including newline characters, unbalanced parentheses, and the \ character itself in the string." In summary, an example of input would be. % This is a comment (This is a % (percent) inside a string) > hope to hear from you soon > cheers > Lorenzo Thanks for your quick reply Jeff > P.S. yesterday I released 2.6 of source-highlight > > -- > Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze > ICQ# lbetto, 16080134 (GNU/Linux User # 158233) > HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com > BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com > http://www.gnu.org/software/src-highlite > http://www.gnu.org/software/gengetopt > http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net > _______________________________________________ Help-source-highlight mailing list Help-source-highlight@... http://lists.gnu.org/mailman/listinfo/help-source-highlight |
|
|
Re: postscript style for source-hightlightHi
this is my attempt, I attach the new postscript.lang definition The only modification is this one: environment string delim "(" ")" multiline nested begin specialchar = '\\.' end and an example of output (by the way, emacs does not highlight it correctly ;-) hope to hear from you soon cheers Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net # by Dirk Jagdmann, http://cubic.org/~doj vardef ID = '[[:word:]]+' variable = '/' + $ID keyword = "abs|add|aload|anchorsearch|and|arc|arcn|arct|arcto|array|ashow|astore|atan|awidthshow", "begin|bind|bitshift|bytesavailable", "cachestatus|ceiling|charpath|clear|cleartomark|cleardictstack|clip|clippath|closefile|closepath|colorimage|concat|concatmatrix|condition|configurationerror|copy|copypage|cos|count|countdictstack|countexecstack|counttomark|cshow|currentblackgeneration|currentcacheparams|currentcmykcolor|currentcolor|currentcolorrendering|currentcolorscreen|currentcolorspace|currentcolortransfer|currentcontext|currentdash|currentdevparams|currentdict|currentfile|currentflat|currentfont|currentglobal|currentgray|currentgstate|currenthalftone|currenthalftonephase|currenthsbcolor|currentlinecap|currentlinejoin|currentlinewidth|currentmatrix|currentmiterlimit|currentobjectformat|currentpacking|currentpagedevice|currentpoint|currentrgbcolor|currentscreen|currentshared|currentstrokeadjust|currentsystemparams|currenttransfer|currentundercolorremoval|currentuserparams|curveto|cvi|cvlit|cvn|cvr|cvrs|cvs|cvx", "def|defaultmatrix|definefont|defineresource|defineusername|defineuserobject|deletefile|detach|deviceinfo|dict|dictfull|dictstack|dictstackoverflow|dictstackunderflow|div|dtransform|dup", "echo|eexec|end|eoclip|eofill|eoviewclip|eq|erasepage|errordict|exch|exec|execform|execstack|execstackoverflow|execuserobject|executeonly|executive|exit|exp", "false|file|filenameforall|fileposition|fill|filter|findencoding|findfont|findresource|flattenpath|floor|flush|flushfile|FontDirectory|for|forall|fork", "ge|get|getinterval|globaldict|GlobalFontDirectory|glyphshow|grestore|grestoreall|gsave|gstate|gt", "handleerror", "identmatrix|idiv|idtransform|if|ifelse|image|imagemask|index|ineofill|infill|initclip|initgraphics|initmatrix|initviewclip|instroke|internaldict|interrupt|inueofill|inufill|inustroke|invalidaccess|invalidcontext|invalidexit|invalidfileaccess|invalidfont|invalidid|invalidrestore|invertmatrix|ioerror|ISOLatin1Encoding|itransform", "join", "kshow|known", "languagelevel|le|length|limitcheck|lineto|ln|load|lock|log|loop|lt", "makefont|makepattern|mark|matrix|maxlength|mod|monitor|moveto|mul", "ne|neg|newpath|noaccess|nocurrentpoint|not|notify|null|nulldevice", "or", "packedarray|pathbbox|pathforall|pop|print|printobject|product|prompt|pstack|put|putinterval", "quit", "rand|rangecheck|rcurveto|read|readhexstring|readline|readonly|readstring|realtime|rectclip|rectfill|rectstroke|rectviewclip|renamefile|repeat|resetfile|resourceforall|resourcestatus|restore|reversepath|revision|rlineto|rmoveto|roll|rootfont|rotate|round|rrand|run", "save|scale|scalefont|scheck|search|selectfont|serialnumber|setbbox|setblackgeneration|setcachedevice|setcachedevice2|setcachelimit|setcacheparams|setcharwidth|setcmykcolor|setcolor|setcolorrendering|setcolorscreen|setcolorspace|setcolortransfer|setdash|setdevparams|setfileposition|setflat|setfont|setglobal|setgray|setgstate|sethalftone|sethalftonephase|sethsbcolor|setlinecap|setlinejoin|setlinewidth|setmatrix|setmiterlimit|setobjectformat|setoverprint|setpacking|setpagedevice|setpattern|setrgbcolor|setscreen|setshared|setstrokeadjust|setsystemparams|settransfer|setucacheparams|setundercolorremoval|setuserparams|setvmthreshold|shareddict|show|showpage|sin|sqrt|srand|stack|stackoverflow|stackunderflow|StandardEncoding|start|startjob|status|statusdict|stop|stopped|store|string|stringwidth|stroke|strokepath|sub|syntaxerror|systemdict", "timeout|transform|translate|true|truncate|type|typecheck|token", "uappend|ucache|ucachestatus|ueofill|ufill|undef|undefined|undefinedfilename|undefineresource|undefinedresult|undefinefont|undefineresource|undefinedresource|undefineuserobject|unmatchedmark|unregistered|upath|userdict|UserObjects|usertime|ustroke|ustrokepath", "version|viewclip|viewclippath|VMerror|vmreclaim|vmstatus", "wait|wcheck|where|widthshow|write|writehexstring|writeobject|writestring|wtranslation", "xcheck|xor|xshow|xyshow", "yield|yshow" variable = $ID environment string delim "(" ")" multiline nested begin specialchar = '\\.' end comment start "%" include "number.lang" symbol = "[","]","=","==","{","}","<<",">>" %!
% a test for highlighting postscript files
% proc dotest => .
/dotest
{
dup
mark
exch
stopped not % False if error, true if no error.
{ (Allowed access: ) print cleartomark == }
if
clear
}
def
0 0 moveto % So the show commands don't bomb because of nocurrentpoint.
{ [1 2] executeonly aload } dotest
{ (string) executeonly (seek) anchorsearch } dotest
{ (string) (seek) executeonly anchorsearch } dotest
(This is % a string)
{ [1 2] executeonly aload }
(This is a string with \( some escapes \( )
{ [1 2] executeonly aload }
(Strings may contain newlines
and such.)
{ [1 2] executeonly aload }
(Strings may contain special characters *!&}^% and
balanced parentheses ( ) (and so on).)
{ [1 2] executeonly aload }
(The following is an empty string.)
{ [1 2] executeonly aload }
()
{ [1 2] executeonly aload }
(It has 0 (zero) length.)
{ [1 2] executeonly aload }
_______________________________________________ Help-source-highlight mailing list Help-source-highlight@... http://lists.gnu.org/mailman/listinfo/help-source-highlight |
|
|
Re: postscript style for source-hightlightThis appears to work perfectly, thank you :)
On Sun, Mar 25, 2007 at 10:29:01AM +0000, Lorenzo Bettini wrote: > Hi > > this is my attempt, I attach the new postscript.lang definition > > The only modification is this one: > > environment string delim "(" ")" multiline nested begin > specialchar = '\\.' > end > > and an example of output (by the way, emacs does not highlight it > correctly ;-) I submitted a bug report, though, I think I forgot to mention that the issue was how it was highlighted in font-lock-mode. I cc'd you on that anyway. Thanks again Jeff > > hope to hear from you soon > cheers > Lorenzo > > -- > Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze > ICQ# lbetto, 16080134 (GNU/Linux User # 158233) > HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com > BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com > http://www.gnu.org/software/src-highlite > http://www.gnu.org/software/gengetopt > http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net _______________________________________________ Help-source-highlight mailing list Help-source-highlight@... http://lists.gnu.org/mailman/listinfo/help-source-highlight |
| Free embeddable forum powered by Nabble | Forum Help |