I'm using ragel with C as the host language.
I can recognise a newline simply with '\n', but I need to recognise the start of the file as an alternative.
In other implementations of regex this could be given by \A
or $
, but $
is reserved for other purposes, '\A'
maps to something else (alarm?) and \A
gives a parser error.
I don't think there's an escape sequence for that. However, you can detect it by checking if Ragel's ts
variable equals 0.