Page 1 of 1

Increasing the number of tokens

Posted: Mon Apr 07, 2008 2:59 pm
by mdemerick@dow.com
This should be an easy one for most of you. Unfortunately, it's not mentioned in the documentation.

I have a pattern with one recognized token. It is a mix of numbers followed by letters. I know I can separate them using (n) and (-c), but I need to get them into their own tokens for further processing. I have tried using [2] to signify a second token, but it doesn't seem to be working.

Here is one such pattern that I am using:

">
COPY [1](n) tempnum
COPY [1](-c) tempalpha
RETYPE [1] ^ tempnum
RETYPE [2] + tempalpha"

I appears that the 'array length', or whatever it is called, is set to a size of one. Is there anything I can do to get the size to equal two?

Re: Increasing the number of tokens

Posted: Mon Apr 07, 2008 6:17 pm
by stuartjvnorton
mdemerick@dow.com wrote:This should be an easy one for most of you. Unfortunately, it's not mentioned in the documentation.

I have a pattern with one recognized token. It is a mix of numbers followed by letters. I know I can separate them using (n) and (-c), but I need to get them into their own tokens for further processing. I have tried using [2] to signify a second token, but it doesn't seem to be working.

Here is one such pattern that I am using:

">
COPY [1](n) tempnum
COPY [1](-c) tempalpha
RETYPE [1] ^ tempnum
RETYPE [2] + tempalpha"

I appears that the 'array length', or whatever it is called, is set to a size of one. Is there anything I can do to get the size to equal two?
I don't think you can split a token and insert the new one back into the current sequence of tokens to potentially fit later patterns (well, not that I've been able to find either). Would be a nice thing to have.

In this case when you only have one input token, you shouldn't need to do anything (what exactly are you wanting to do with the 2 parts?). Forget about the retypes and just process tempalpha and tempnum, creating further dummy patterns if you need to do table lookups, etc.

Posted: Mon Apr 07, 2008 11:33 pm
by jhmckeever
You might find <a href="viewtopic.php?t=104921">this thread</a> on a similar topic useful.

If memory serves, I think the simplest solution suggested was to use a 'pre-processor' PAL script to split the ">" token into separate tokens for digits and alphabetics.

J.