End of input

瀏覽次數:25 次
跳到第一則未讀訊息

Rob Nichols

未讀,
2017年2月14日 下午5:15:052017/2/14
收件者:Treetop Development
How do I detect that an element is the last one?

For example, if I parse the text "one two three" how can I create a rule which pulls out "three" because it is the last in the list. I've tried using "\n" for end of line, but that fails I think because there is not carriage return in "one two three".

Clifford Heath

未讀,
2017年2月14日 下午5:37:232017/2/14
收件者:treet...@googlegroups.com
On 15 Feb 2017, at 12:53 AM, Rob Nichols <r...@nicholshayes.co.uk> wrote:
> How do I detect that an element is the last one?

Using a trick: You need to say, effectively "not anything":

rule end_of_input
! .
end

> For example, if I parse the text "one two three" how can I create a rule which pulls out "three" because it is the last in the list. I've tried using "\n" for end of line, but that fails I think because there is not carriage return in "one two three".
>
> --
> You received this message because you are subscribed to the Google Groups "Treetop Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to treetop-dev...@googlegroups.com.
> To post to this group, send email to treet...@googlegroups.com.
> Visit this group at https://groups.google.com/group/treetop-dev.
> For more options, visit https://groups.google.com/d/optout.

Rob Nichols

未讀,
2017年2月24日 清晨5:57:272017/2/24
收件者:Treetop Development
Thank you Clifford. That's what I needed!
回覆所有人
回覆作者
轉寄
0 則新訊息