[ruby-talk:00809] Re: Summary of discussion about RD (Re: Docum entation about RD?)
From:
Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
Date:
1999-09-17 04:30:23 UTC
List:
ruby-talk #809
Hi,
> |I suppose to write list like that is valid idea.
> |I want to write so.
> |But how do we tell list from verbatim?
>
> If the first indented line appears to be list header, you can consider
> it as a list, I assume.
> matz.
I see.
Well.... Now structure of Block changes so much. So I decide to support
new structure of Block for later version than 0.2.3 of RDtool.
I wrote following for summary.
=begin
= RD Block structure and grammar
Block is units of document structure in RD. TextBlock(Paragraph), Verbatim,
tree kinds of List and Headline are Block. RD document is constructed of
Blocks. And Block can include InlineElement.
Block has its Baseline(Basecolumn?). Baseline is standard depth of indents.
Each Block has its Baseline and, the type of Block is determined with
indent and first char of its lines. For Example,
* Lines of TextBlock is as deep as Baseline of parent Block, and its
first char is not *, (num), :, = or +.
* Lines of Verbatim is deeper than Baseline of parent Block, and first
char of its first line is not *, (num), :.
* Lines of List is as deep as or deeper than Baseline of parent Block,
and item starts with *, (num), :.
* Lines of Headline is as deep as Top level Baseline, and first char
of Headline is = or +.
Baseline of Block defined by indent of first line of Block.
In List, Block structure can be hierarchical. Each item of
List is as deep as others (Baseline of List), and in List
item, First TextBlock defines Baseline of List item.
Following is definition of grammar of Block structure (BNF like,
but also using Regexp like "+").
document := textblock | verbatim | list | headline
textblock := (STRING)+
verbatim := INDENT verbatimcontent DEDENT
verbatimcontent := (STRING)+
| (STRING)+ verbatimcontent
| INDENT verbatimcontent DEDENT
| WHITELINE verbatimcontent
list := INDENT (listitem)+ DEDENT
| (listitem)+
listitem := LISTMARK INDENT listcontent DEDENT
# this "INDENT" means whitespaces after LISTMARK here.
listcontent := textblock others
others := verbatim others
| list others
| textblock others
| verbatim
| list
| textblock
| WHITELINE
headline := HEADLINE
# STRING means line of text.
# INDENT means that the line is deeper than prev one.
# DEDENT means that the line is sharrower than prev one.
# For example,
# prev line
# this line
# next line
# is lex analized as STRING INDENT STRING DEDENT STRING ...
# WHITELINE means line of only whitespaces.
# LISTMARK means "*", "(num)".
# desclist differ from other lists, so it isn't in this figure.
# HEADLINE means line of Headline.
This figure of grammar is not so precise. For example, textblock and
verbatim is more complicated, because we have to think about line whose
first char is LISTMARK.
=end
Please point out my misunderstandings when you find one.
---
Tosh