Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Embedding pod in other languages

by John M. Dlugosz (Monsignor)
on May 19, 2011 at 16:28 UTC ( [id://905744]=note: print w/replies, xml ) Need Help??


in reply to Embedding pod in other languages

Verbatim lines need some sort of special identification (currently =v followed by whitespace) to allow processed lines to begin in some column other than 0.
I don't like that. It will be a bear to use, unless your editor handles that for you.

'^.*#\s*ifdef\s+pod\b'
That will find a #ifdef pod anywhere on the line, even with other stuff on it. In C, the # has to be the first non-whitespace character on a line, and it won't tolerate stuff after the expression other than whitespace and comments. In fact /^.*/ seems kind of silly, since the two cancel out. If it's not anchored to the front, you don't need to skip stuff! I think you wanted /^\s*# .../.

I like the idea of embedding extraction details for known languages, to encourage standardization, but still allow it to be customized.

Replies are listed 'Best First'.
Re^2: Embedding pod in other languages
by jpl (Monk) on May 19, 2011 at 17:25 UTC

    Good catch on the ^.* typo!

    I'm not thrilled with the =v tag for verbatim lines, but I couldn't think of a better alternative. I considered a mechanism for starting and ending a "verbatim block", but controlling the amount of indent on each line fights with the desire to allow extra content up front. Assuming you start with a block of "verbatim text", most editors I know make it easy to paste a =v at the start of each line, after which you can adjust what comes before to suit the language and style.

      Is there some flaw in my suggestion of matching the indent level of the =code line that initiates it?

        There is no perfect solution. "Matching the indent level" of a mixture of blanks and tabs relies on knowing where the tab-stops are. We could add a bunch more options to support the notion of tab-stops, as perltidy does, but that doesn't protect you from an inadvertent (or deliberate) leading space that turns a line into a verbatim line when that wasn't the intent. For what I have been trying to do, verbatim lines are relatively uncommon, so I don't mind going a little out of my way to make other stuff foolproof, if that makes verbatim lines a bit clumsier.

        Given the response to this thread that could most charitably be described as "tepid", I have what I need, and I'm pleased that I'm not reinventing some existing wheel. If you have a preference for an alternative that works better for you, go for it. I'm not eager to push the idea much further.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://905744]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found