[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LPEG: captures
- From: Александр Машин <alex.mashin@...>
- Date: Fri, 29 May 2015 19:53:02 +0700
Mr Parke,
Will the following work for you?
> grammar = [==
> [ wikitext <- {| ( link / separator / text )* |}
> link <- {|
> {:t:''->'link':}
> {'[['}
> !':'
> ''->'Name::'
> { ( !']]' !'|' . )+ }
>{ '|' ( !']]' . )* / }
>{']]'}
> |} separator <- {|
> {:t:''->'separator':}
> { [,;*#] }
> { %s* }
>|}
> text <- {|
> {:t:''->'text':}
> { ( !link !separator . )+ }
>|}
> ]==]
Unfortunately, not. The grammar splits the input line into chunks, which
have to be re-concatenated to get what I wanted as 'full' field. Iwas
able to achieve it in a simpler form but hoped to avoid this second
step. In addition, 'Name::' is not inserted, although with this chunked
input this is not necessary.
Thank you for your help anyway.
Alexander Mashin