Discussion forum for David Beazley

Parsing AWS Cloudformation

I am trying to parse AWS cloudformation template. I am in the initial stages and trying to parse the Type for resources
The pattern is ::::

I have two issues
1> the expression r’[a-zA-Z0-9:]+[a-zA-Z0-9]$’ parses some of the types not all types
2> when quoted it does not parse at all

I have " as a separate token and I have a resource_type list where I lookup to find out the tokens

Any help will be appreciated.
I have worked with the unix lexx and yacc; I am however, new to ply

One question, do you have some text to do some testing?

Thank you for responding
I am trying to parse the ARN of any AWS resource



The above are 2 examples I have

Uhmm, now I am doubting how to do it best.
One way that you could do it is to declare \b[0-9a-zA-Z]+\b
to use it as word delimiter and then you should ignore colon.
put in your lexer

DATA = r"\b\w+\b"