Inclusions / comments
|Top Previous Next|
Introduction > Inclusions / comments
Comments in programming languages are a typical example of what is meant here by an inclusion. The concept "inclusion" was chosen here to describe the general structure of this example.
Comments or other inclusions can be slid into texts in arbitrary places. The syntactic structure of the texts isn't destroyed by inclusions, even if keyword of the grammar (programming language) are used in them.
The use of c++ comments is possible in the scripts of the TextTransformer:
Into the variable declaration:
int iCount, iEnd;
comments can be included without making the variable declaration syntactical invalid
int iCount /* int variable as counterr */, iEnd /* maximum */;
C++ comments are sections of text, which are included between the two tokens"/*"and"*/". Comments can contain arbitrary text, and therefore the keyword "int" may occur there. However, it isn't interpreted here as a variable type.
Comments were treated exclusively as a part of the ignored characters and recognized by complex regular expressions as whole in older versions of the TextTransformer.
However, it is also possible that the texts of an inclusion aren't arbitrary but that they obey a grammar of their own. E.g. there are conventions, by which C++comments are enriched by instructions which can be extracted as a documentation of the program code.
So besides the parser for the real program code a second parser is needed for the documentation.
It is possible in the TextTransformer to insert productions in a project for this second parser and to let them execute immediately in the change with the main parser. It is even possibly to nest arbitrarily many different parsers in each other. These parsers can operate on sets of tokens of their own respectively so that e.g. the token "int" only is recognized by the code parser, but not by the comment parser.
This page belongs to the TextTransformer Documentation
|Home Content German|