newlispdoc trouble

Started by Dmi, May 14, 2007, 01:00:51 AM

Previous topic - Next topic

Dmi

;; @syntax (test <t1> (<t2> <t3>) (<t4> <t5>) ...)
;; test

generates
Quotet4

syntax: (test t1 (t2 t3) (t4 t5) ...)

test

should be:
Quotetest

syntax: (test t1 (t2 t3) (t4 t5) ...)

test


Also it would be cool to have a trick for a short one line description to pruduce similar:
Quotetest - a test function

syntax: (test t1 (t2 t3) (t4 t5) ...)

test
WBR, Dmi

Lutz

#1
Yes, parenthesized expressins in syntax patterns cannot be recognized correctly. If you have a patch for this I can incorporate it.



While we are at regular expressions. You asked in another thread how to maintain token-seperator and other information when using 'parse'.



Here is a solution with 'replace' using the replacement function to do the work and report the token seperators:



With 'parse' when can do somthing too, but I have to think about it. Meanwhile you could use 'replace' with a parse grammatik in the search pattern and use a userdefined function in the replacement expression to supply information. Here is a simple example:


> (set 'prog "x=y+z")

(define (foo) (println "token:" $1) (println "separator:" $2) $0)

(replace "([a-z]+)([=+])" prog (foo) 0)
token:x
separator:=
token:y
separator:+
"x=y+z"


Lutz



ps: this does not report handling the character position though. You would have to build a solution with 'regex' which also reports the position.

Dmi

#2
Lutz,



In the function format-syntax adding "^ *" (link regexp to start of the string and eat leading spaces) in the front of the regexp seems to be a trick for newlispdoc.
(replace {^ *((.*?) (.*?))} text (string "(<font color=#CC0000>" $1 "</font> " $2) 0)
(replace {^ *(([^ ]*?))} text (string "(<font color=#CC0000>" $1 "</font>)") 0)


And thanks for tricks about parsing.
WBR, Dmi