jlp/doc/grammar.rst
Jonathan Bernard 9eb80e91a6 Support for multi=line comments, detects file type.
* Added support for multi-line comments to the JLPPegParser grammar
  implementation.
* Added a Java sample file.
* Updated test script to add convenience functions for the java test file and
  for using a TracingParseRunner for parse runs.
* Added an option, `--css-file`, to allow the caller to specify their own css
  file.
* Added basic logic to the Processor class to detect source file types and build
  a parser and a generator for that source type. Support currently exists for
  the following languages: C (.c, .h), C++ (.cpp, .c++, .hpp, .h++), Erlang
  (.erl), Groovy (.groovy), Java (.java), JavaScript (.js).
2011-12-25 22:07:48 -06:00

58 lines
1.1 KiB
ReStructuredText

SourceFile ->
(Block / DocBlock / CodeBlock)+
Block ->
DocBlock CodeBlock
DocBlock ->
(SDocBlock / MDocBlock)
SDocBlock ->
(SDirective / SDocText)+
MDocBlock ->
MDOC_START (!MDOC_END / MDirective / MDocText)* MDOC_END
CodeBlock ->
(RemainingCodeLine)+
SDirective ->
SDocLineStart AT (SLongDirective / SShortDirective)
MDirective ->
MDocLineStart? AT (MLongDirective / MShortDirective)
SLongDirective ->
("api" / "example") RemainingSDocLine SDocText?
MLongDirective ->
("api" / "example") RemainingMDocLine MDocText?
SShortDirective ->
("author" / "org" / "copyright") RemainingSDocLine
MShortDirective ->
("author" / "org" / "copyright") RemainingMDocLine
SDocText ->
(SDocLineStart !AT RemainingSDocLine)+
MDocText ->
(MDocLineStart? !AT RemainingMDocLine)+
SDocLineStart ->
SPACE* SDOC_START SPACE?
MDocLineStart ->
SPACE* !MDOC_END MDOC_LINE_START SPACE?
RemainingSDocLine ->
((!EOL)* EOL) / ((!EOL)+ EOI)
RemainingMDocLine ->
((!(EOL / MDOC_END))* EOL) / ((!MDOC_END)+)
RemainingCodeLine ->
((!(EOL / MDOC_START / SDocLineStart))* EOL) /
(!(MDOC_START / SDocLineStart))+