<?SBNF-www.vishia.de version="1.0" encoding="iso-8859-1" ?>
$xmlns:topics="http://www.vishia.de/2006/Topics".
$xmlns:xhtml="http://www.w3.org/1999/xhtml".
$keywords=return|if|else|while|do|public|private|protected.
Cheader::=
[ #ifndef <$?HeaderEntry>
| #if ! defined ( <$?HeaderEntry> ) ## the test to exclude of double includes is obligate!
]
#define <$>
[/*@PACKAGE <*\ *?package/@name> <*|*/?>*/]
[{ <includeDef?+@> }] ## includes at begin
[<OutsideHeaderBlock>]
[{ ##repetition of blocks
/*@TOPIC <topic>
| <CLASS_CPP>
| <CLASS_C> ##/*@CLASS_C ....
| <DEFINE_C> ##/*@DEFINE_C ....
| <ARRAY> ##/*@ARRAY ....
##| <headerBlock>
}]
#endif
[#endSBNF].
##:NOTE: a HeaderBlock may be also inside a condition Block. A Headerblock is the first one information.
##A conditionBlock is only a auxialary wrapper on HeaderBlocks.
##===========================================================================================================
##Block of definition in header. This is the first one information to evaluate a header but also a inner element.
headerBlock::=<?>
[/**<description?-?>*/]
[/*<implementDescription?-?>*/]
[ <invalidBlock?+@>
| <validBlock?>
| <conditionBlock?+conditionBlock>
| extern <variableDecl?+@>;
|<?constDef> const <variableDecl?+@> = <#?value>; ##:TODO: value more variants!
| typedef
[ <methodPtrTypedef?+@>
| <methodTypedef?+@>
| <structDefinition?+@>
| <unionDefinition?+@>
| <classDefinition?+@>
| <enumDefinition?+@>
]
| <includeDef?+@>
| #define CONST<defineDefinition?+const_initializer>
| #define NULL<defineDefinition?+null_initializer>
| #define <defineDefinition?+@>
| <undefDefinition?+@>
| #error <""?compilerError>
| <classDecl?+@>
| <structDecl?+@>
##| <structDef?+@>;
| <classDef?+@>;
##| <unionDef?+@>;
| <methodDef?+@>;
| <methodDefByType?+@>;
| <defineUse?+@>
].
$keywords::=static_cast|struct.
OutsideHeaderBlock::=<?outside>
{ [?/*@] ##stop repetition if /*@NEWBLOCK is detected
<headerBlock>
}
.
topic::=<?topics:topic> <$?@ident> <*\n?><*|*/?xhtml:body+>*/.
##CLASS_C::= /*@CLASS_C <$?classIdent> <*|*/?>*/
CLASS_C::=<?class> /*@CLASS_C <$?@name> <*|*/?>*/
{ [?/*@] ##stop repetition if /*@NEWBLOCK is detected
<headerBlock>
}
[<?virtual> /*@CLASS_C_VIRTUAL <*|*/?>*/ ##it is the block of the c-like virtual methods
{ [?/*@] ##stop repetition if /*@ is detected, it is the next block or the end
<headerBlock>
}
]
.
##/*@ARRAY ObjectRefvalues_Jc @@@@@@@
##Definition of arrays of types outside the CLASS_C-block:
ARRAY::= /*@ARRAY <$?classIdent> <*|*/?>*/
{ [?/*@]
<headerBlock>
}
.
DEFINE_C::=/*@DEFINE_C [<$?@name>]<*|*/?>*/
[ /*@ <description>*/]
{ [?/*@]
<headerBlock>
}
.
CLASS_CPP::=/*@CLASS_CPP <*|*/?>*/
{ [?/*@]
<headerBlock>
}
.
structDefinition::=struct [<$?@tagname>]
\{ { <structContent?> }
\} <$?@name>[ \[ <#?@arraySize> \] ] ;.
unionDefinition::=union [<$?@tagname>] \{ { <attribute?variante> } \} <$?@name>;.
classDefinition::=class [<$?@tagname>] \{ { [ <classContent> | <structContent> ] } \} <$?@name>;.
enumDefinition::= enum [<$?@tagname>] \{
{ [{#define <defineDefinition>}]
<enumElement>
[{#define <defineDefinition>}]
? ,
}
\} <$?@name>;.
methodPtrTypedef::= <type> ( * <$?name> ) ( [| void |{ <typedParameter> ? ,}] );.
methodTypedef::= <type> <$?name> ( [| void |{ <typedParameter> ? ,}] );.
##block inside a header with conditional compilation via ifdef
conditionBlock::=
[ #ifdef <$?conditionDef>| #ifndef <$?conditionDefNot>| #if {<?OrCondition> {<?AndCondition> [defined(<$?conditionDef>)
| ! defined(<$?conditionDefNot>) ] ? && } ? \|\| } ]
[{ <headerBlock> }]
[<?elseConditionBlock> #else
[{ <headerBlock> }]
]
#endif.
invalidBlock::=
#if 0
[{ <headerBlock> }]
#endif.
validBlock::=
#if 1
[{ <headerBlock> }]
#endif.
includeDef::= #include [<""?file>|\<<*\>?sysfile>\>].
defineDefinition::=<$?@name>[( { <$?parameter/@name> ? , } )]<![ \t]*?>{<*|\n|\\|\r\n?value>? \\[\r]\n}.
## be carefull: no white spaces between defineDefinition because the white spaces have syntax deterministic functions!
## if whitespaces are overred the line may be left.
## by value: either until a backslash followed by end of lineor until and of line,
## repitition if backslash followed by end of line is found.
undefDefinition::= #undef<![ \t]*?><$?@name>[( { <$?parameter/@name> ? , } )].
defineUse::= <$?defineMethod> ( { <$?defineparameter> ? , } ).
classDecl::=class <$?name> ;.
structDecl::=struct <$?name> ;.
type::= [<?@modifier>volatile|const|] [<?@forward>struct|class|] [unsigned<?unsigend>|signed|] <$?@name>
[**<?@pointer2> | *<?@pointer>|const *<?@constPointer>|volatile *<?@volatilePointer>|&<?cppRef>|].
methodDef::= [METHOD_C] <type> <$?@name> [( void ) | ( ) | ({ <typedParameter> ? ,} )].
methodDefByType::= METHOD_C <type> <$?name>.
typedParameter::= <type> [<$?@name> [ = <value>] ].
enumElement::= [/**<description>*/] <$?@name> [ = <enumValue?> ].
classDef::=class [<$?@tagname>] [ : {<superclass> ? ,} ]
\{ { <classVisibilityBlock> | <classContent> | <structContent> }
\}.
superclass::= <AccessRight?visibility> [<?isVirtual>virtual] <$?name>.
##attribute::= [/** <*{ *}|*/?!test_description>*/] <type> <$?name> [<arraysize>];. ## | [ = <value> ] ];.
attribute::= [/**<description>*/] <type> <$?@name> [<arraysize>];. ## | [ = <value> ] ];.
description::= <*{ * }|*/?!test_description>.
implementDescription::= <*{ * }|*/?!test_description>.
##The test_desciption syntax is used to parse the inner structure of a description.
test_description::= <*|\e|\@?text>
[{ @return <*@\e?returnDescription>
| @param <paramDescription>
| @sizeof = <sizeofDescription>
| @ <*@\e?auxDescription>
}].
xxtest_description::=<*|\. |\.\r\n|\.\n|\e|\@?brief> [\.] [<*|\e|\@?rest/xhtml:body+> ]
[{ @return <*@\e?returnDescription/p+>
| @param <paramDescription>
| @sizeof = <sizeofDescription>
| @ <*@\e?auxDescription>
}].
paramDescription::=<$?@name> <*@\e?text>.
xxparamDescription::=<$?@name> <*|\. |\.\r\n|\.\n|\e|\@?brief> [\.] [<*|\e|\@?rest/xhtml:body+> ].
sizeofDescription::=<?sizeof><#?@sizeof> <*@\e?text>.
structContent::=<?>
[/**<description?-?>*/]
[ <invalidBlock?+>
| <validBlock?+>
| typedef
[ <methodPtrTypedef?+@>
| <methodTypedef?+@>
| <structDefinition?+@>
| <unionDefinition?+@>
| <classDefinition?+@>
| <enumDefinition?+@>
]
| <unionDefinition?+attribute>
| <structDefinition?+attribute>
| <attribute?+?>
| #define <defineDefinition?+?>
| <structContentInsideCondition?+?>
].
classContent::=
[ virtual <methodDef?abstractMethod> [const] =0;
| virtual <methodDef?virtualMethod> [const] [;|<statementBlock>]
| static <methodDef?staticMethod> ;
| friend class <$?friendClass> ;
| <Destructor>
| <operatorDef> [;|<statementBlock>]
| <methodDef> [const] [;|<statementBlock>]
| <$?constructor> ( [| void |{ <typedParameter> ? ,}] ) [: {<?initialization><$?ident>( <value> )? ,}][ ;|
<statementBlock>]
| <variableDecl>;
].
Destructor::= [virtual] ~<$?className> ( ) [;|<statementBlock>].
operatorDef::= [<type>] operator [<?type>()|<assignOperator?>|<unaryOperator?>|<binaryOperator?>|<type>] ( [| void |{
<typedParameter> ? ,}] ).
statementBlock::=\{ [{ <statement> }] \}.
statement::=
return <returnAssignment>
| <variabledefinition>
| <simpleMethodCall> ;
| <assignment>
| <if_statement>
| <while_statement>
| <try_statement>
.
variabledefinition::=<$?type> <$?attribute> [ = [<objectAccess>|<value>] ];.
returnAssignment::= [<objectAccess>;|<value>;|<assignment>].
assignment::= [<superAccess>|<externObject>|] <$?variable> <assignOperator> [<objectAccess>;| <value>;|<assignment>].
value::=
[|<unaryOperator>]
[ <""?simpleStringLiteral>
| <''?simpleCharLiteral>
| & <value?referenceAddress>
| <refCasting> <value> ##must be arranged before ( <value> ) because confusion with, example (type)value and
(variable)
| (<value>)
| 0x<#x?number>
| <#f?number>
| <#-?number>
| <simpleMethodCall>
| <variable>
## | <!'.'?simpleChar>
]
[<binaryOperator> <value>]
.
assignOperator::= = | += | \|= | &= | -= | *= | /= .
unaryOperator::= - | ~ | ! | * | & .
binaryOperator::= + | - | * | / | && | \|\| | & | \| | == | \>= | \<= | \> | \< | != | ^ .
simpleMethodCall::= <$?methodname> [()|<actualParameter>].
actualParameter::= ({ <objectAccess>| <value>? ,} ).
classVisibilityBlock::=[ public | protected | private ] : { <classContent> | <structContent> }.
structContentInsideCondition::=[ #ifdef | #ifndef] <$?conditionDef> { <structContent> } #endif.
variableDecl::= <type> <$?name> .
AccessRight::=[<?accessRight/@value> public | private | protected | ].
arraysize::=\[ [<#?@value>| <$?@symbolValue>] \].
## An enum value is a constant. It may be written as term "konst + konst". A konst is a number or a symbolic const.
enumValue::= {<?hexnumber/.>0x<#x?> | <#-?intnumber> | <$?symbol> ? [<?operation/@value> +|-|*] }.
##A description is tested typically after /** until */.
xxxdescription::=<*|\. |*/|@?brief> [\. <*|*/|@?restToFull> ]
[{ @
[return <*|*/|@?return>
|param <*|*/|@param?>
|<*|*/|@?aux>
]
}]
.
xxdescription::=<*|\. |*/|@?brief> [\. <*|*/|@?restToFull> ]
[{ @
[return <*|*/|@?return>
|param <*|*/|@param?>
|<*|*/|@?aux>
]
}]
.
methodCall::=[<superAccess>|<externObject>|]<simpleMethodCall>.
variable::=[<superAccess>|<externObject>|] <$?simpleVariable>.
superAccess::=xxx.
externObject::= { [<simpleMethodCall>|<$?association>] [-\>|\.] }.
if_statement::=if ( <condition> ) [<statementBlock>|<statement>] [ else [<statementBlock>|<statement>] ].
while_statement::=while ( <condition> ) [<statementBlock>|<statement>].
try_statement::=try <statementBlock> { catch ( <$?exceptionType> <$?exceptionObj> ) <statementBlock> }.
##objectAccess::=<nullPointer> | <newObject> .
objectAccess::=xxx.
nullPointer::=null.
refCasting::=
static_cast \< <type> \> ##C++-safety casting
| ( <type> ) ##C-like-casting
.