Hey everybody. I do quite a bit in of work in text formatting languages like groff and nroff, and there are some simple organizational tasks that I think should be fairly easy to automate (i.e. - complex page headers/footers, table of contents, etc.), and so for the past month or so I've been toying with the idea of writing a front end for groff in perl. Until about a year ago my primary platform was Pascal, and having written a few lexical scanners in that language I am very familiar (and incidentally quite dependent on) the use of the pos() function. This function returns the index of a character in a string, and is useful for determining the location of whitespace and tokens. Although I have considered doing this in lex or yacc, I think it would be a shot in the arm for my perl skills to sit down and write a good 'ol lexical scanner in this language. I'm about 90% sure that it's just some library function I'm missing, but it would be helpful if someone could point me in the right direction. Thanks.

In reply to Character Index by wyvern

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.